Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/si.c @ 29091:b0fb53868142
jabber: Handle the case where the server success-with-data is sent as a challenge/response pair.
This should also make it easier to feed C/R pairs via the tester.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 11 Nov 2009 20:32:09 +0000 |
parents | fa7f3426ed13 |
children | 08a52bdd9619 7b4ade7c6d8a e77894113a14 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple - Jabber Protocol Plugin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
28398
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28224
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28224
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28224
diff
changeset
|
6 * source distribution. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19675
diff
changeset
|
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
17770
diff
changeset
|
25 #include "internal.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
17770
diff
changeset
|
27 #include "blist.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "ft.h" |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
30 #include "request.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "network.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "disco.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "jabber.h" |
25247
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
37 #include "ibb.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "si.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
41 #define STREAMHOST_CONNECT_TIMEOUT 15 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 typedef struct _JabberSIXfer { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 |
15823 | 46 PurpleProxyConnectData *connect_data; |
47 PurpleNetworkListenData *listen_data; | |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
48 guint connect_timeout; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 gboolean accepted; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 char *stream_id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 char *iq_id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 enum { |
27634
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
56 STREAM_METHOD_UNKNOWN = 0, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 STREAM_METHOD_BYTESTREAMS = 2 << 1, |
27634
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
58 STREAM_METHOD_IBB = 2 << 2, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 STREAM_METHOD_UNSUPPORTED = 2 << 31 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 } stream_method; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 GList *streamhosts; |
15823 | 63 PurpleProxyInfo *gpi; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 char *rxqueue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 size_t rxlen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 gsize rxmaxlen; |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
68 int local_streamhost_fd; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
69 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
70 JabberIBBSession *ibb_session; |
25243
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
71 guint ibb_timeout_handle; |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
72 PurpleCircBuffer *ibb_buffer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 } JabberSIXfer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
75 /* some forward declarations */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
76 static void jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
77 |
15823 | 78 static PurpleXfer* |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 jabber_si_xfer_find(JabberStream *js, const char *sid, const char *from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 GList *xfers; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 if(!sid || !from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 for(xfers = js->file_transfers; xfers; xfers = xfers->next) { |
15823 | 87 PurpleXfer *xfer = xfers->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 JabberSIXfer *jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 if(jsx->stream_id && xfer->who && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 !strcmp(jsx->stream_id, sid) && !strcmp(xfer->who, from)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 return xfer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
22912
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
97 static void |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
98 jabber_si_free_streamhost(gpointer data, gpointer user_data) |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
99 { |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
100 JabberBytestreamsStreamhost *sh = data; |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
101 |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
102 if(!data) |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
103 return; |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
104 |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
105 g_free(sh->jid); |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
106 g_free(sh->host); |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
107 g_free(sh->zeroconf); |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
108 g_free(sh); |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
109 } |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
110 |
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
111 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
15823 | 113 static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 { |
15823 | 118 PurpleXfer *xfer = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 JabberSIXfer *jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 xmlnode *query, *su; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
122 JabberBytestreamsStreamhost *streamhost = jsx->streamhosts->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
15823 | 124 purple_proxy_info_destroy(jsx->gpi); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
125 jsx->gpi = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 jsx->connect_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
128 if (jsx->connect_timeout > 0) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
129 purple_timeout_remove(jsx->connect_timeout); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
130 jsx->connect_timeout = 0; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
131 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 if(source < 0) { |
17770
efb5d0fe4895
Better error message for when a Jabber connection fails
Mark Doliner <mark@kingant.net>
parents:
17441
diff
changeset
|
133 purple_debug_warning("jabber", |
efb5d0fe4895
Better error message for when a Jabber connection fails
Mark Doliner <mark@kingant.net>
parents:
17441
diff
changeset
|
134 "si connection failed, jid was %s, host was %s, error was %s\n", |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
135 streamhost->jid, streamhost->host, |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
136 error_message ? error_message : "(null)"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); |
22912
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
138 jabber_si_free_streamhost(streamhost, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 jabber_si_bytestreams_attempt_connect(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
143 /* unknown file transfer type is assumed to be RECEIVE */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
144 if(xfer->type == PURPLE_XFER_SEND) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
145 { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
146 xmlnode *activate; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
147 iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, "http://jabber.org/protocol/bytestreams"); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
148 xmlnode_set_attrib(iq->node, "to", streamhost->jid); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
149 query = xmlnode_get_child(iq->node, "query"); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
150 xmlnode_set_attrib(query, "sid", jsx->stream_id); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
151 activate = xmlnode_new_child(query, "activate"); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
152 xmlnode_insert_data(activate, xfer->who, -1); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
153 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
154 /* TODO: We need to wait for an activation result before starting */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
155 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
156 else |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
157 { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
158 iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, "http://jabber.org/protocol/bytestreams"); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
159 xmlnode_set_attrib(iq->node, "to", xfer->who); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
160 jabber_iq_set_id(iq, jsx->iq_id); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
161 query = xmlnode_get_child(iq->node, "query"); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
162 su = xmlnode_new_child(query, "streamhost-used"); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
163 xmlnode_set_attrib(su, "jid", streamhost->jid); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
164 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
15823 | 168 purple_xfer_start(xfer, source, NULL, -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
171 static gboolean |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
172 connect_timeout_cb(gpointer data) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
173 { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
174 PurpleXfer *xfer = data; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
175 JabberSIXfer *jsx = xfer->data; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
176 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
177 purple_debug_info("jabber", "Streamhost connection timeout of %d seconds exceeded.\n", STREAMHOST_CONNECT_TIMEOUT); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
178 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
179 jsx->connect_timeout = 0; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
180 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
181 if (jsx->connect_data != NULL) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
182 purple_proxy_connect_cancel(jsx->connect_data); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
183 jsx->connect_data = NULL; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
184 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
185 /* Trigger the connect error manually */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
186 jabber_si_bytestreams_connect_cb(xfer, -1, "Timeout Exceeded."); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
187 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
188 return FALSE; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
189 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
190 |
25243
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
191 static void |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
192 jabber_si_bytestreams_ibb_timeout_remove(JabberSIXfer *jsx) |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
193 { |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
194 if (jsx->ibb_timeout_handle) { |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
195 purple_timeout_remove(jsx->ibb_timeout_handle); |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
196 jsx->ibb_timeout_handle = 0; |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
197 } |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
198 } |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
199 |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
200 static gboolean |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
201 jabber_si_bytestreams_ibb_timeout_cb(gpointer data) |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
202 { |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
203 PurpleXfer *xfer = (PurpleXfer *) data; |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
204 JabberSIXfer *jsx = xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
205 |
25243
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
206 if (jsx && !jsx->ibb_session) { |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
207 purple_debug_info("jabber", |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
208 "jabber_si_bytestreams_ibb_timeout called and IBB session not set " |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
209 " up yet, cancel transfer"); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
210 jabber_si_bytestreams_ibb_timeout_remove(jsx); |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
211 purple_xfer_cancel_local(xfer); |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
212 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
213 |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
214 return FALSE; |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
215 } |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
216 |
15823 | 217 static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 JabberSIXfer *jsx = xfer->data; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
220 JabberBytestreamsStreamhost *streamhost; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 JabberID *dstjid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 if(!jsx->streamhosts) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 JabberIq *iq = jabber_iq_new(jsx->js, JABBER_IQ_ERROR); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 xmlnode *error, *inf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 if(jsx->iq_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 jabber_iq_set_id(iq, jsx->iq_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 xmlnode_set_attrib(iq->node, "to", xfer->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 error = xmlnode_new_child(iq->node, "error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 xmlnode_set_attrib(error, "code", "404"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 xmlnode_set_attrib(error, "type", "cancel"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 inf = xmlnode_new_child(error, "item-not-found"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
239 /* if IBB is available, revert to that before giving up... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
240 if (jsx->stream_method & STREAM_METHOD_IBB) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
241 /* if we are the initializer, init IBB */ |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
242 purple_debug_info("jabber", |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
243 "jabber_si_bytestreams_attempt_connect: " |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
244 "no streamhosts found, trying IBB\n"); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
245 /* if we are the sender, open an IBB session, but not if we already |
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
246 did it, since we could have received the error <iq/> from the |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
247 receiver already... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
248 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
249 && !jsx->ibb_session) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
250 jabber_si_xfer_ibb_send_init(jsx->js, xfer); |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
251 } else { |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
252 /* setup a timeout to cancel waiting for IBB open */ |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
253 jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
254 jabber_si_bytestreams_ibb_timeout_cb, xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
255 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
256 /* if we are the receiver, just wait for IBB open, callback is |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
257 already set up... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
258 } else { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
259 purple_xfer_cancel_local(xfer); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
260 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
261 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 streamhost = jsx->streamhosts->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
267 jsx->connect_data = NULL; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
268 if (jsx->gpi != NULL) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
269 purple_proxy_info_destroy(jsx->gpi); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
270 jsx->gpi = NULL; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
271 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 dstjid = jabber_id_new(xfer->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
274 /* TODO: Deal with zeroconf */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
275 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
276 if(dstjid != NULL && streamhost->host && streamhost->port > 0) { |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
277 char *dstaddr, *hash; |
15823 | 278 jsx->gpi = purple_proxy_info_new(); |
279 purple_proxy_info_set_type(jsx->gpi, PURPLE_PROXY_SOCKS5); | |
280 purple_proxy_info_set_host(jsx->gpi, streamhost->host); | |
281 purple_proxy_info_set_port(jsx->gpi, streamhost->port); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
283 /* unknown file transfer type is assumed to be RECEIVE */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
284 if(xfer->type == PURPLE_XFER_SEND) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
285 dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
286 jsx->js->user->resource, dstjid->node, dstjid->domain, dstjid->resource); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
287 else |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
288 dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, dstjid->node, dstjid->domain, dstjid->resource, |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
289 jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
291 /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ |
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
292 hash = jabber_calculate_data_sha1sum(dstaddr, strlen(dstaddr)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
15823 | 294 jsx->connect_data = purple_proxy_connect_socks5(NULL, jsx->gpi, |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
295 hash, 0, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 jabber_si_bytestreams_connect_cb, xfer); |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
297 g_free(hash); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 g_free(dstaddr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
300 /* When selecting a streamhost, timeout after STREAMHOST_CONNECT_TIMEOUT seconds, otherwise it takes forever */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
301 if (xfer->type != PURPLE_XFER_SEND && jsx->connect_data != NULL) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
302 jsx->connect_timeout = purple_timeout_add_seconds( |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
303 STREAMHOST_CONNECT_TIMEOUT, connect_timeout_cb, xfer); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
304 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 jabber_id_free(dstjid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 if (jsx->connect_data == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); |
22912
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
311 jabber_si_free_streamhost(streamhost, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 jabber_si_bytestreams_attempt_connect(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
316 void jabber_bytestreams_parse(JabberStream *js, const char *from, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
317 JabberIqType type, const char *id, xmlnode *query) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 { |
15823 | 319 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 JabberSIXfer *jsx; |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
321 xmlnode *streamhost; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
322 const char *sid; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
324 if(type != JABBER_IQ_SET) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
327 if(!from) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 if(!(sid = xmlnode_get_attrib(query, "sid"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 if(!(xfer = jabber_si_xfer_find(js, sid, from))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 if(!jsx->accepted) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 if(jsx->iq_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 g_free(jsx->iq_id); |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
343 jsx->iq_id = g_strdup(id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 for(streamhost = xmlnode_get_child(query, "streamhost"); streamhost; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 streamhost = xmlnode_get_next_twin(streamhost)) { |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
347 const char *jid, *host = NULL, *port, *zeroconf; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
348 int portnum = 0; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 if((jid = xmlnode_get_attrib(streamhost, "jid")) && |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
351 ((zeroconf = xmlnode_get_attrib(streamhost, "zeroconf")) || |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
352 ((host = xmlnode_get_attrib(streamhost, "host")) && |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 (port = xmlnode_get_attrib(streamhost, "port")) && |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
354 (portnum = atoi(port))))) { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
355 JabberBytestreamsStreamhost *sh = g_new0(JabberBytestreamsStreamhost, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 sh->jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 sh->host = g_strdup(host); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 sh->port = portnum; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
359 sh->zeroconf = g_strdup(zeroconf); |
22912
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
360 /* If there were a lot of these, it'd be worthwhile to prepend and reverse. */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 jsx->streamhosts = g_list_append(jsx->streamhosts, sh); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 jabber_si_bytestreams_attempt_connect(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, |
15823 | 371 PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 { |
15823 | 373 PurpleXfer *xfer = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 JabberSIXfer *jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 if (len < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 else if (len < 0) { |
15823 | 381 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 g_free(jsx->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 jsx->rxqueue = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 close(source); |
15823 | 386 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 jsx->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 if (jsx->rxlen < jsx->rxmaxlen) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 |
15823 | 394 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 g_free(jsx->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 jsx->rxqueue = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
399 /* Before actually starting sending the file, we need to wait until the |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
400 * recipient sends the IQ result with <streamhost-used/> |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
401 */ |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
402 purple_debug_info("jabber", "SOCKS5 connection negotiation completed. " |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
403 "Waiting for IQ result to start file transfer.\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, |
15823 | 408 PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 { |
15823 | 410 PurpleXfer *xfer = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 JabberSIXfer *jsx = xfer->data; |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
412 char buffer[42]; /* 40 for DST.ADDR + 2 bytes for port number*/ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 int len; |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
414 char *dstaddr, *hash; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 const char *host; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 |
15823 | 417 purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_again_cb\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 if(jsx->rxlen < 5) { |
15823 | 420 purple_debug_info("jabber", "reading the first 5 bytes\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 len = read(source, buffer, 5 - jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 if(len < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 else if(len <= 0) { |
15823 | 425 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 close(source); |
15823 | 428 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 jsx->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 } else if(jsx->rxqueue[0] != 0x05 || jsx->rxqueue[1] != 0x01 || |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
436 jsx->rxqueue[3] != 0x03 || jsx->rxqueue[4] != 40) { |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
437 purple_debug_info("jabber", "Invalid socks5 conn req. header[0x%x,0x%x,0x%x,0x%x,0x%x]\n", |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
438 jsx->rxqueue[0], jsx->rxqueue[1], jsx->rxqueue[2], |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
439 jsx->rxqueue[3], jsx->rxqueue[4]); |
15823 | 440 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 close(source); |
15823 | 443 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 } else if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) { |
26997
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
446 /* Upper-bound of 257 (jsx->rxlen = 5, jsx->rxqueue[4] = 0xFF) */ |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
447 unsigned short to_read = jsx->rxqueue[4] + 2 - (jsx->rxlen - 5); |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
448 purple_debug_info("jabber", "reading %u bytes for DST.ADDR + port num (trying to read %hu now)\n", |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
449 jsx->rxqueue[4] + 2, to_read); |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
450 len = read(source, buffer, to_read); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 if(len < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 else if(len <= 0) { |
15823 | 454 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 close(source); |
15823 | 457 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 jsx->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
465 /* Have we not read all of DST.ADDR and the following 2-byte port number? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 |
15823 | 469 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 dstaddr = g_strdup_printf("%s%s@%s/%s%s", jsx->stream_id, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 jsx->js->user->node, jsx->js->user->domain, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 jsx->js->user->resource, xfer->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
476 /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ |
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
477 hash = jabber_calculate_data_sha1sum(dstaddr, strlen(dstaddr)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
479 if(strncmp(hash, jsx->rxqueue + 5, 40) || |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 jsx->rxqueue[45] != 0x00 || jsx->rxqueue[46] != 0x00) { |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
481 if (jsx->rxqueue[45] != 0x00 || jsx->rxqueue[46] != 0x00) |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
482 purple_debug_error("jabber", "Got SOCKS5 BS conn with the wrong DST.PORT" |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
483 " (must be 0 - got[0x%x,0x%x]).\n", |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
484 jsx->rxqueue[45], jsx->rxqueue[46]); |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
485 else |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
486 purple_debug_error("jabber", "Got SOCKS5 BS conn with the wrong DST.ADDR" |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
487 " (expected '%s' - got '%.40s').\n", |
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
488 hash, jsx->rxqueue + 5); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 close(source); |
15823 | 490 purple_xfer_cancel_remote(xfer); |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
491 g_free(hash); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
492 g_free(dstaddr); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24497
diff
changeset
|
496 g_free(hash); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
497 g_free(dstaddr); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
498 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 g_free(jsx->rxqueue); |
15823 | 500 host = purple_network_get_my_ip(jsx->js->fd); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 jsx->rxmaxlen = 5 + strlen(host) + 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 jsx->rxqueue = g_malloc(jsx->rxmaxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 jsx->rxlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 jsx->rxqueue[0] = 0x05; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 jsx->rxqueue[1] = 0x00; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 jsx->rxqueue[2] = 0x00; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 jsx->rxqueue[3] = 0x03; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 jsx->rxqueue[4] = strlen(host); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 memcpy(jsx->rxqueue + 5, host, strlen(host)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 jsx->rxqueue[5+strlen(host)] = 0x00; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 jsx->rxqueue[6+strlen(host)] = 0x00; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
15823 | 515 xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 jabber_si_xfer_bytestreams_send_read_again_resp_cb(xfer, source, |
15823 | 518 PURPLE_INPUT_WRITE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, |
15823 | 523 PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 { |
15823 | 525 PurpleXfer *xfer = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 JabberSIXfer *jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 if (len < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 else if (len < 0) { |
15823 | 533 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 g_free(jsx->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 jsx->rxqueue = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 close(source); |
15823 | 538 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 jsx->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 if (jsx->rxlen < jsx->rxmaxlen) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 |
15823 | 546 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
549 /* If we sent a "Success", wait for a response, otherwise give up and cancel */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 if (jsx->rxqueue[1] == 0x00) { |
15823 | 551 xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 jabber_si_xfer_bytestreams_send_read_again_cb, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 g_free(jsx->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 jsx->rxqueue = NULL; |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
555 jsx->rxlen = 0; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 close(source); |
15823 | 558 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, |
15823 | 564 PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 { |
15823 | 566 PurpleXfer *xfer = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 JabberSIXfer *jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 char buffer[256]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 |
15823 | 572 purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_cb\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 xfer->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
576 /** Try to read the SOCKS5 header */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 if(jsx->rxlen < 2) { |
15823 | 578 purple_debug_info("jabber", "reading those first two bytes\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 len = read(source, buffer, 2 - jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 if(len < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 else if(len <= 0) { |
15823 | 583 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 close(source); |
15823 | 586 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 jsx->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 return; |
26997
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
593 } else if(jsx->rxlen - 2 < jsx->rxqueue[1]) { |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
594 /* Has a maximum value of 255 (jsx->rxlen = 2, jsx->rxqueue[1] = 0xFF) */ |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
595 unsigned short to_read = jsx->rxqueue[1] - (jsx->rxlen - 2); |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
596 purple_debug_info("jabber", "reading %u bytes for auth methods (trying to read %hu now)\n", |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
597 jsx->rxqueue[1], to_read); |
90e7220cf773
Fix two sizeof(size_t) != sizeof(unsigned int) warnings which could never
Paul Aurich <paul@darkrain42.org>
parents:
26959
diff
changeset
|
598 len = read(source, buffer, to_read); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 if(len < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 else if(len <= 0) { |
15823 | 602 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 close(source); |
15823 | 605 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 jsx->rxlen += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 |
25841
0d7f02640e2b
Make sure that the buffer is large enough to fit DST.ADDR + DST.PORT. This was found in the analysis that Veracode performed on the pidgin codebase.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24641
diff
changeset
|
613 /* Have we not read all the auth. method bytes? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 if(jsx->rxlen -2 < jsx->rxqueue[1]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 |
15823 | 617 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 xfer->watcher = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 |
15823 | 620 purple_debug_info("jabber", "checking to make sure we're socks FIVE\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 if(jsx->rxqueue[0] != 0x05) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 close(source); |
15823 | 624 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 |
15823 | 628 purple_debug_info("jabber", "going to test %hhu different methods\n", jsx->rxqueue[1]); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 for(i=0; i<jsx->rxqueue[1]; i++) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 |
15823 | 632 purple_debug_info("jabber", "testing %hhu\n", jsx->rxqueue[i+2]); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 if(jsx->rxqueue[i+2] == 0x00) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 g_free(jsx->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 jsx->rxlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 jsx->rxmaxlen = 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 jsx->rxqueue = g_malloc(jsx->rxmaxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 jsx->rxqueue[0] = 0x05; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 jsx->rxqueue[1] = 0x00; |
15823 | 640 xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 jabber_si_xfer_bytestreams_send_read_response_cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 jabber_si_xfer_bytestreams_send_read_response_cb(xfer, |
15823 | 644 source, PURPLE_INPUT_WRITE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 jsx->rxqueue = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 jsx->rxlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 g_free(jsx->rxqueue); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 jsx->rxlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 jsx->rxmaxlen = 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 jsx->rxqueue = g_malloc(jsx->rxmaxlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 jsx->rxqueue[0] = 0x05; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 jsx->rxqueue[1] = 0xFF; |
15823 | 657 xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 jabber_si_xfer_bytestreams_send_read_response_cb, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 jabber_si_xfer_bytestreams_send_read_response_cb(xfer, |
15823 | 660 source, PURPLE_INPUT_WRITE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
663 static gint |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
664 jabber_si_compare_jid(gconstpointer a, gconstpointer b) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
665 { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
666 const JabberBytestreamsStreamhost *sh = a; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
667 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
668 if(!a) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
669 return -1; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
670 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
671 return strcmp(sh->jid, (char *)b); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
672 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
673 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, |
15823 | 676 PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 { |
15823 | 678 PurpleXfer *xfer = data; |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
679 JabberSIXfer *jsx = xfer->data; |
23769
e21c79681c96
Use non-blocking io for direct xmpp file transfers
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23645
diff
changeset
|
680 int acceptfd, flags; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 |
15823 | 682 purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_connected_cb\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 acceptfd = accept(source, NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 else if(acceptfd == -1) { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
19680
diff
changeset
|
688 purple_debug_warning("jabber", "accept: %s\n", g_strerror(errno)); |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
689 /* Don't cancel the ft - allow it to fall to the next streamhost.*/ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 |
15823 | 693 purple_input_remove(xfer->watcher); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 close(source); |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
695 jsx->local_streamhost_fd = -1; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 |
23769
e21c79681c96
Use non-blocking io for direct xmpp file transfers
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23645
diff
changeset
|
697 flags = fcntl(acceptfd, F_GETFL); |
e21c79681c96
Use non-blocking io for direct xmpp file transfers
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23645
diff
changeset
|
698 fcntl(acceptfd, F_SETFL, flags | O_NONBLOCK); |
e21c79681c96
Use non-blocking io for direct xmpp file transfers
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23645
diff
changeset
|
699 #ifndef _WIN32 |
e21c79681c96
Use non-blocking io for direct xmpp file transfers
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23645
diff
changeset
|
700 fcntl(acceptfd, F_SETFD, FD_CLOEXEC); |
e21c79681c96
Use non-blocking io for direct xmpp file transfers
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23645
diff
changeset
|
701 #endif |
e21c79681c96
Use non-blocking io for direct xmpp file transfers
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23645
diff
changeset
|
702 |
15823 | 703 xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
704 jabber_si_xfer_bytestreams_send_read_cb, xfer); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
705 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
706 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
707 static void |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
708 jabber_si_connect_proxy_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
709 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
710 xmlnode *packet, gpointer data) |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
711 { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
712 PurpleXfer *xfer = data; |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
713 JabberSIXfer *jsx; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
714 xmlnode *query, *streamhost_used; |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
715 const char *jid; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
716 GList *matched; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
717 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
718 /* TODO: This need to send errors if we don't see what we're looking for */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
719 |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
720 /* Make sure that the xfer is actually still valid and we're not just receiving an old iq response */ |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
721 if (!g_list_find(js->file_transfers, xfer)) { |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
722 purple_debug_error("jabber", "Got bytestreams response for no longer existing xfer (%p)\n", xfer); |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
723 return; |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
724 } |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
725 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
726 /* In the case of a direct file transfer, this is expected to return */ |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
727 if(!xfer->data) |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
728 return; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
729 |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
730 jsx = xfer->data; |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
731 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
732 if(type != JABBER_IQ_RESULT) { |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
733 purple_debug_info("jabber", |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
734 "jabber_si_xfer_connect_proxy_cb: type = error\n"); |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
735 /* if IBB is available, open IBB session */ |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
736 purple_debug_info("jabber", |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
737 "jabber_si_xfer_connect_proxy_cb: got error, method: %d\n", |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
738 jsx->stream_method); |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
739 if (jsx->stream_method & STREAM_METHOD_IBB) { |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
740 purple_debug_info("jabber", "IBB is possible, try it\n"); |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
741 /* if we are the sender and haven't already opened an IBB |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
742 session, do so now (we might already have failed to open |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
743 the bytestream proxy ourselves when receiving this <iq/> */ |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
744 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
745 && !jsx->ibb_session) { |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
746 jabber_si_xfer_ibb_send_init(js, xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
747 } else { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
748 jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
749 jabber_si_bytestreams_ibb_timeout_cb, xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
750 } |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
751 /* if we are receiver, just wait for IBB open stanza, callback |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
752 is already set up */ |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
753 } else { |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
754 purple_xfer_cancel_remote(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
755 } |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
756 return; |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
757 } |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
758 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
759 if (!from) |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
760 return; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
761 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
762 if(!(query = xmlnode_get_child(packet, "query"))) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
763 return; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
764 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
765 if(!(streamhost_used = xmlnode_get_child(query, "streamhost-used"))) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
766 return; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
767 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
768 if(!(jid = xmlnode_get_attrib(streamhost_used, "jid"))) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
769 return; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
770 |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
771 purple_debug_info("jabber", "jabber_si_connect_proxy_cb() will be looking at jsx %p: jsx->streamhosts is %p and jid is %s\n", |
22656
919074aa02ca
I've seen intermittent crashes on xmpp file transfers in this code, but I
Evan Schoenberg <evan.s@dreskin.net>
parents:
22206
diff
changeset
|
772 jsx, jsx->streamhosts, jid); |
919074aa02ca
I've seen intermittent crashes on xmpp file transfers in this code, but I
Evan Schoenberg <evan.s@dreskin.net>
parents:
22206
diff
changeset
|
773 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
774 if(!(matched = g_list_find_custom(jsx->streamhosts, jid, jabber_si_compare_jid))) |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
775 { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
776 gchar *my_jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
777 jsx->js->user->domain, jsx->js->user->resource); |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
778 if (!strcmp(jid, my_jid)) { |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
779 purple_debug_info("jabber", "Got local SOCKS5 streamhost-used.\n"); |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
780 purple_xfer_start(xfer, xfer->fd, NULL, -1); |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
781 } else { |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
782 /* if available, try to revert to IBB... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
783 if (jsx->stream_method & STREAM_METHOD_IBB) { |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
784 purple_debug_info("jabber", |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
785 "jabber_si_connect_proxy_cb: trying to revert to IBB\n"); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
786 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
787 jabber_si_xfer_ibb_send_init(jsx->js, xfer); |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
788 } else { |
25243
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
789 jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
790 jabber_si_bytestreams_ibb_timeout_cb, xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
791 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
792 /* if we are the receiver, we are already set up...*/ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
793 } else { |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
794 purple_debug_info("jabber", |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
795 "streamhost-used does not match any proxy that was offered to target\n"); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
796 purple_xfer_cancel_local(xfer); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
797 } |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
798 } |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
799 g_free(my_jid); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
800 return; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
801 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
802 |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
803 /* Clean up the local streamhost - it isn't going to be used.*/ |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
804 if (xfer->watcher > 0) { |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
805 purple_input_remove(xfer->watcher); |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
806 xfer->watcher = 0; |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
807 } |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
808 if (jsx->local_streamhost_fd >= 0) { |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
809 close(jsx->local_streamhost_fd); |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
810 jsx->local_streamhost_fd = -1; |
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
811 } |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
812 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
813 jsx->streamhosts = g_list_remove_link(jsx->streamhosts, matched); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
814 g_list_foreach(jsx->streamhosts, jabber_si_free_streamhost, NULL); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
815 g_list_free(jsx->streamhosts); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
816 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
817 jsx->streamhosts = matched; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
818 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
819 jabber_si_bytestreams_attempt_connect(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 { |
15823 | 825 PurpleXfer *xfer = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 JabberSIXfer *jsx; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 xmlnode *query, *streamhost; |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
829 char port[6]; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
830 GList *tmp; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
831 JabberBytestreamsStreamhost *sh, *sh2; |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
832 int streamhost_count = 0; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 jsx->listen_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
837 /* I'm not sure under which conditions this can happen |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
838 * (it seems like it shouldn't be possible */ |
15823 | 839 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) { |
840 purple_xfer_unref(xfer); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 |
15823 | 844 purple_xfer_unref(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 "http://jabber.org/protocol/bytestreams"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 xmlnode_set_attrib(iq->node, "to", xfer->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 xmlnode_set_attrib(query, "sid", jsx->stream_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
853 /* If we successfully started listening locally */ |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
854 if (sock >= 0) { |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
855 gchar *jid; |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
856 const char *local_ip, *public_ip; |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
857 |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
858 jsx->local_streamhost_fd = sock; |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
859 |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
860 jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 jsx->js->user->domain, jsx->js->user->resource); |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
862 xfer->local_port = purple_network_get_port_from_fd(sock); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
863 g_snprintf(port, sizeof(port), "%hu", xfer->local_port); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
864 |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
865 /* Include the localhost's IP (for in-network transfers) */ |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
866 local_ip = purple_network_get_local_system_ip(jsx->js->fd); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
867 if (strcmp(local_ip, "0.0.0.0") != 0) { |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
868 streamhost_count++; |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
869 streamhost = xmlnode_new_child(query, "streamhost"); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
870 xmlnode_set_attrib(streamhost, "jid", jid); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
871 xmlnode_set_attrib(streamhost, "host", local_ip); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
872 xmlnode_set_attrib(streamhost, "port", port); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
873 } |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
874 |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
875 /* Include the public IP (assuming that there is a port mapped somehow) */ |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
876 public_ip = purple_network_get_my_ip(jsx->js->fd); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
877 if (strcmp(public_ip, local_ip) != 0 && strcmp(public_ip, "0.0.0.0") != 0) { |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
878 streamhost_count++; |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
879 streamhost = xmlnode_new_child(query, "streamhost"); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
880 xmlnode_set_attrib(streamhost, "jid", jid); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
881 xmlnode_set_attrib(streamhost, "host", public_ip); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
882 xmlnode_set_attrib(streamhost, "port", port); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
883 } |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
884 |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
885 g_free(jid); |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
886 |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
887 /* The listener for the local proxy */ |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
888 xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
889 jabber_si_xfer_bytestreams_send_connected_cb, xfer); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
890 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
891 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
892 for (tmp = jsx->js->bs_proxies; tmp; tmp = tmp->next) { |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
893 sh = tmp->data; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
894 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
895 /* TODO: deal with zeroconf proxies */ |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
896 |
21637
844225b0c905
Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
897 if (!(sh->jid && sh->host && sh->port > 0)) |
844225b0c905
Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
898 continue; |
844225b0c905
Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
899 |
24423
88955b918197
Add missing newline in debug message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23769
diff
changeset
|
900 purple_debug_info("jabber", "jabber_si_xfer_bytestreams_listen_cb() will be looking at jsx %p: jsx->streamhosts %p and sh->jid %p\n", |
22656
919074aa02ca
I've seen intermittent crashes on xmpp file transfers in this code, but I
Evan Schoenberg <evan.s@dreskin.net>
parents:
22206
diff
changeset
|
901 jsx, jsx->streamhosts, sh->jid); |
21637
844225b0c905
Now that the release has been tagged and strings are unfrozen, enable the new ft proxy account setting for xmpp accounts. Also, prevent duplicate entries in the streamhost lists. I don't know if the default account proxy is acceptable, perhaps there shouldn't be a default value.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
902 if(g_list_find_custom(jsx->streamhosts, sh->jid, jabber_si_compare_jid) != NULL) |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
903 continue; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
904 |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
905 streamhost_count++; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
906 streamhost = xmlnode_new_child(query, "streamhost"); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
907 xmlnode_set_attrib(streamhost, "jid", sh->jid); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
908 xmlnode_set_attrib(streamhost, "host", sh->host); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
909 g_snprintf(port, sizeof(port), "%hu", sh->port); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
910 xmlnode_set_attrib(streamhost, "port", port); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
911 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
912 sh2 = g_new0(JabberBytestreamsStreamhost, 1); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
913 sh2->jid = g_strdup(sh->jid); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
914 sh2->host = g_strdup(sh->host); |
22912
9004da91edd3
Reuse cleanup function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22656
diff
changeset
|
915 /*sh2->zeroconf = g_strdup(sh->zeroconf);*/ |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
916 sh2->port = sh->port; |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
917 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
918 jsx->streamhosts = g_list_prepend(jsx->streamhosts, sh2); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
919 } |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
920 |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
921 /* We have no way of transferring, cancel the transfer */ |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
922 if (streamhost_count == 0) { |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
923 jabber_iq_free(iq); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
924 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
925 /* if available, revert to IBB */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
926 if (jsx->stream_method & STREAM_METHOD_IBB) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
927 purple_debug_info("jabber", |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
928 "jabber_si_xfer_bytestreams_listen_cb: trying to revert to IBB\n"); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
929 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
930 /* if we are the sender, init the IBB session... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
931 jabber_si_xfer_ibb_send_init(jsx->js, xfer); |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
932 } else { |
25243
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
933 jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
934 jabber_si_bytestreams_ibb_timeout_cb, xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
935 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
936 /* if we are the receiver, we should just wait... the IBB open |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
937 handler has already been set up... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
938 } else { |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
939 /* We should probably notify the target, |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
940 but this really shouldn't ever happen */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
941 purple_xfer_cancel_local(xfer); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
942 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
943 |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
944 return; |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
945 } |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
946 |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
947 jabber_iq_set_callback(iq, jabber_si_connect_proxy_cb, xfer); |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
948 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 static void |
15823 | 954 jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 JabberSIXfer *jsx; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 |
15823 | 958 purple_xfer_ref(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 jsx = xfer->data; |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
961 |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
962 /* TODO: Should there be an option to not use the local host as a ft proxy? |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
963 * (to prevent revealing IP address, etc.) */ |
15823 | 964 jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 jabber_si_xfer_bytestreams_listen_cb, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 if (jsx->listen_data == NULL) { |
23366
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
967 /* We couldn't open a local port. Perhaps we can use a proxy. */ |
05802d915c13
Improve error handling for xmpp file transfers.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23365
diff
changeset
|
968 jabber_si_xfer_bytestreams_listen_cb(-1, xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
973 static void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
974 jabber_si_xfer_ibb_error_cb(JabberIBBSession *sess) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
975 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
976 PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
977 JabberStream *js = jabber_ibb_session_get_js(sess); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
978 PurpleConnection *gc = js->gc; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
979 PurpleAccount *account = purple_connection_get_account(gc); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
980 |
27366
73c8e1964eef
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27190
diff
changeset
|
981 purple_debug_error("jabber", "an error occurred during IBB file transfer\n"); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
982 purple_xfer_error(purple_xfer_get_type(xfer), account, |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
983 jabber_ibb_session_get_who(sess), |
27366
73c8e1964eef
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27190
diff
changeset
|
984 _("An error occurred on the in-band bytestream transfer\n")); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
985 purple_xfer_cancel_remote(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
986 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
987 |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
988 static void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
989 jabber_si_xfer_ibb_closed_cb(JabberIBBSession *sess) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
990 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
991 PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
992 JabberStream *js = jabber_ibb_session_get_js(sess); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
993 PurpleConnection *gc = js->gc; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
994 PurpleAccount *account = purple_connection_get_account(gc); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
995 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
996 purple_debug_info("jabber", "the remote user closed the transfer\n"); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
997 if (purple_xfer_get_bytes_remaining(xfer) > 0) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
998 purple_xfer_error(purple_xfer_get_type(xfer), account, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
999 jabber_ibb_session_get_who(sess), _("Transfer was closed.")); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1000 purple_xfer_cancel_remote(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1001 } else { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1002 purple_xfer_set_completed(xfer, TRUE); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1003 purple_xfer_end(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1004 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1005 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1006 |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1007 static void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1008 jabber_si_xfer_ibb_recv_data_cb(JabberIBBSession *sess, gpointer data, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1009 gsize size) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1010 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1011 PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1012 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1013 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1014 if (size <= purple_xfer_get_bytes_remaining(xfer)) { |
25247
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
1015 purple_debug_info("jabber", "about to write %" G_GSIZE_FORMAT " bytes from IBB stream\n", |
25216
daaabfcf5c2b
Revert to using g_fopen (since we have a compatability define for old glibs)
Marcus Lundblad <ml@update.uu.se>
parents:
25213
diff
changeset
|
1016 size); |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1017 purple_circ_buffer_append(jsx->ibb_buffer, data, size); |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1018 purple_xfer_prpl_ready(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1019 } else { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1020 /* trying to write past size of file transfers negotiated size, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1021 reject transfer to protect against malicious behaviour */ |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1022 purple_debug_error("jabber", |
25247
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
1023 "IBB file transfer send more data than expected\n"); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1024 purple_xfer_cancel_remote(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1025 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1026 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1027 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1028 |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1029 static gssize |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1030 jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer) |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1031 { |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1032 JabberSIXfer *jsx = xfer->data; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1033 guchar *buffer; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1034 gsize size; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1035 gsize tmp; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1036 |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1037 size = jsx->ibb_buffer->bufused; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1038 *out_buffer = buffer = g_malloc(size); |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1039 while ((tmp = purple_circ_buffer_get_max_read(jsx->ibb_buffer))) { |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1040 memcpy(buffer, jsx->ibb_buffer->outptr, tmp); |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1041 buffer += tmp; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1042 purple_circ_buffer_mark_read(jsx->ibb_buffer, tmp); |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1043 } |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1044 |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1045 return size; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1046 } |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1047 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1048 static gboolean |
26555
50ff0162fe26
Convert IBB parser (and everything that then stems from that) to new iq-handler
Paul Aurich <paul@darkrain42.org>
parents:
26551
diff
changeset
|
1049 jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, |
50ff0162fe26
Convert IBB parser (and everything that then stems from that) to new iq-handler
Paul Aurich <paul@darkrain42.org>
parents:
26551
diff
changeset
|
1050 xmlnode *open) |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1051 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1052 const gchar *sid = xmlnode_get_attrib(open, "sid"); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1053 PurpleXfer *xfer = jabber_si_xfer_find(js, sid, who); |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1054 if (xfer) { |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1055 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1056 JabberIBBSession *sess = |
26555
50ff0162fe26
Convert IBB parser (and everything that then stems from that) to new iq-handler
Paul Aurich <paul@darkrain42.org>
parents:
26551
diff
changeset
|
1057 jabber_ibb_session_create_from_xmlnode(js, who, id, open, xfer); |
25247
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
1058 |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1059 jabber_si_bytestreams_ibb_timeout_remove(jsx); |
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1060 |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1061 if (sess) { |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1062 /* setup callbacks here...*/ |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1063 jabber_ibb_session_set_data_received_callback(sess, |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1064 jabber_si_xfer_ibb_recv_data_cb); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1065 jabber_ibb_session_set_closed_callback(sess, |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1066 jabber_si_xfer_ibb_closed_cb); |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1067 jabber_ibb_session_set_error_callback(sess, |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1068 jabber_si_xfer_ibb_error_cb); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1069 |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1070 jsx->ibb_session = sess; |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1071 jsx->ibb_buffer = |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1072 purple_circ_buffer_new(jabber_ibb_session_get_block_size(sess)); |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1073 |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1074 /* set up read function */ |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1075 purple_xfer_set_read_fnc(xfer, jabber_si_xfer_ibb_read); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1076 |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1077 /* start the transfer */ |
28218
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
28138
diff
changeset
|
1078 purple_xfer_start(xfer, -1, NULL, 0); |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1079 return TRUE; |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1080 } else { |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1081 /* failed to create IBB session */ |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1082 purple_debug_error("jabber", "failed to create IBB session\n"); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1083 purple_xfer_cancel_remote(xfer); |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1084 return FALSE; |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1085 } |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1086 } else { |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1087 /* we got an IBB <open/> for an unknown file transfer, pass along... */ |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1088 purple_debug_info("jabber", |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1089 "IBB open did not match any SI file transfer\n"); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1090 return FALSE; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1091 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1092 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1093 |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1094 static gssize |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1095 jabber_si_xfer_ibb_write(const guchar *buffer, size_t len, PurpleXfer *xfer) |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1096 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1097 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1098 JabberIBBSession *sess = jsx->ibb_session; |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1099 gsize packet_size = len < jabber_ibb_session_get_block_size(sess) ? |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1100 len : jabber_ibb_session_get_block_size(sess); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1101 |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1102 jabber_ibb_session_send_data(sess, buffer, packet_size); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1103 |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1104 return packet_size; |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1105 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1106 |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1107 static void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1108 jabber_si_xfer_ibb_sent_cb(JabberIBBSession *sess) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1109 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1110 PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1111 gsize remaining = purple_xfer_get_bytes_remaining(xfer); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1112 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1113 if (remaining == 0) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1114 /* close the session */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1115 jabber_ibb_session_close(sess); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1116 purple_xfer_set_completed(xfer, TRUE); |
25222
d6351b105e42
Call purple_xfer_end when ending an IBB session.
Marcus Lundblad <ml@update.uu.se>
parents:
25221
diff
changeset
|
1117 purple_xfer_end(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1118 } else { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1119 /* send more... */ |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1120 purple_xfer_prpl_ready(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1121 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1122 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1123 |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1124 static void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1125 jabber_si_xfer_ibb_opened_cb(JabberIBBSession *sess) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1126 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1127 PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); |
25247
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
1128 JabberStream *js = jabber_ibb_session_get_js(sess); |
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
1129 PurpleConnection *gc = js->gc; |
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
1130 PurpleAccount *account = purple_connection_get_account(gc); |
151b4054ce40
Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents:
25243
diff
changeset
|
1131 |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1132 if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_OPENED) { |
28218
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
28138
diff
changeset
|
1133 purple_xfer_start(xfer, -1, NULL, 0); |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1134 purple_xfer_prpl_ready(xfer); |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1135 } else { |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1136 /* error */ |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1137 purple_xfer_error(purple_xfer_get_type(xfer), account, |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1138 jabber_ibb_session_get_who(sess), |
25224
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1139 _("Failed to open in-band bytestream")); |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1140 purple_xfer_end(xfer); |
51cbb9be484e
Set state error on IBBSession if the receiver gives an error.
Marcus Lundblad <ml@update.uu.se>
parents:
25222
diff
changeset
|
1141 } |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1142 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1143 |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1144 static void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1145 jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1146 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1147 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1148 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1149 jsx->ibb_session = jabber_ibb_session_create(js, jsx->stream_id, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1150 purple_xfer_get_remote_user(xfer), xfer); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1151 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1152 if (jsx->ibb_session) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1153 /* should set callbacks here... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1154 jabber_ibb_session_set_opened_callback(jsx->ibb_session, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1155 jabber_si_xfer_ibb_opened_cb); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1156 jabber_ibb_session_set_data_sent_callback(jsx->ibb_session, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1157 jabber_si_xfer_ibb_sent_cb); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1158 jabber_ibb_session_set_closed_callback(jsx->ibb_session, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1159 jabber_si_xfer_ibb_closed_cb); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1160 jabber_ibb_session_set_error_callback(jsx->ibb_session, |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1161 jabber_si_xfer_ibb_error_cb); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1162 |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1163 purple_xfer_set_write_fnc(xfer, jabber_si_xfer_ibb_write); |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1164 |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1165 jsx->ibb_buffer = |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1166 purple_circ_buffer_new(jabber_ibb_session_get_block_size(jsx->ibb_session)); |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1167 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1168 /* open the IBB session */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1169 jabber_ibb_session_open(jsx->ibb_session); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1170 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1171 } else { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1172 /* failed to create IBB session */ |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1173 purple_debug_error("jabber", |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1174 "failed to initiate IBB session for file transfer\n"); |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1175 purple_xfer_cancel_local(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1176 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1177 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1178 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1179 static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1180 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1181 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 { |
15823 | 1183 PurpleXfer *xfer = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 xmlnode *si, *feature, *x, *field, *value; |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1185 gboolean found_method = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 if(!(si = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { |
15823 | 1188 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1190 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 if(!(feature = xmlnode_get_child_with_namespace(si, "feature", "http://jabber.org/protocol/feature-neg"))) { |
15823 | 1193 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) { |
15823 | 1198 purple_xfer_cancel_remote(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 const char *var = xmlnode_get_attrib(field, "var"); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1204 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1205 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 if(var && !strcmp(var, "stream-method")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 if((value = xmlnode_get_child(field, "value"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1208 char *val = xmlnode_get_data(value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1209 if(val && !strcmp(val, "http://jabber.org/protocol/bytestreams")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 jabber_si_xfer_bytestreams_send_init(xfer); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1211 jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1212 found_method = TRUE; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1213 } else if (val && !strcmp(val, XEP_0047_NAMESPACE)) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1214 jsx->stream_method |= STREAM_METHOD_IBB; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1215 if (!found_method) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1216 /* we haven't tried to init a bytestream session, yet |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1217 start IBB right away... */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1218 jabber_si_xfer_ibb_send_init(js, xfer); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1219 found_method = TRUE; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1220 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 g_free(val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1226 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1227 if (!found_method) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1228 purple_xfer_cancel_remote(xfer); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1229 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1230 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 |
15823 | 1233 static void jabber_si_xfer_send_request(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1234 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 JabberSIXfer *jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 xmlnode *si, *file, *feature, *x, *field, *option, *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 char buf[32]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 xfer->filename = g_path_get_basename(xfer->local_filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 iq = jabber_iq_new(jsx->js, JABBER_IQ_SET); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 xmlnode_set_attrib(iq->node, "to", xfer->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 si = xmlnode_new_child(iq->node, "si"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 jsx->stream_id = jabber_get_next_id(jsx->js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 xmlnode_set_attrib(si, "id", jsx->stream_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 xmlnode_set_attrib(si, "profile", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 "http://jabber.org/protocol/si/profile/file-transfer"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 file = xmlnode_new_child(si, "file"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 xmlnode_set_namespace(file, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 "http://jabber.org/protocol/si/profile/file-transfer"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 xmlnode_set_attrib(file, "name", xfer->filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 xmlnode_set_attrib(file, "size", buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 /* maybe later we'll do hash and date attribs */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 feature = xmlnode_new_child(si, "feature"); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
1260 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 x = xmlnode_new_child(feature, "x"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1262 xmlnode_set_namespace(x, "jabber:x:data"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 xmlnode_set_attrib(x, "type", "form"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1264 field = xmlnode_new_child(x, "field"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 xmlnode_set_attrib(field, "var", "stream-method"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 xmlnode_set_attrib(field, "type", "list-single"); |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
1267 /* maybe we should add an option to always skip bytestreams for people |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
1268 behind troublesome firewalls */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 option = xmlnode_new_child(field, "option"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1270 value = xmlnode_new_child(option, "value"); |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
1271 xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1272 option = xmlnode_new_child(field, "option"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 value = xmlnode_new_child(option, "value"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1274 xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1275 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 jabber_iq_set_callback(iq, jabber_si_xfer_send_method_cb, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 |
19675
a48681403103
Unregister the iq callback listener when the transfer is freed. Fixes #1804. It doesn't seem correct to me that nothing is sent to the recipient when the sender cancels the ft request, but that is a different issue.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18210
diff
changeset
|
1278 /* Store the IQ id so that we can cancel the callback */ |
a48681403103
Unregister the iq callback listener when the transfer is freed. Fixes #1804. It doesn't seem correct to me that nothing is sent to the recipient when the sender cancels the ft request, but that is a different issue.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18210
diff
changeset
|
1279 g_free(jsx->iq_id); |
a48681403103
Unregister the iq callback listener when the transfer is freed. Fixes #1804. It doesn't seem correct to me that nothing is sent to the recipient when the sender cancels the ft request, but that is a different issue.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18210
diff
changeset
|
1280 jsx->iq_id = g_strdup(iq->id); |
a48681403103
Unregister the iq callback listener when the transfer is freed. Fixes #1804. It doesn't seem correct to me that nothing is sent to the recipient when the sender cancels the ft request, but that is a different issue.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18210
diff
changeset
|
1281 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1282 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1284 |
15823 | 1285 static void jabber_si_xfer_free(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1286 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1287 JabberSIXfer *jsx = xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1288 |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1289 if (jsx) { |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1290 JabberStream *js = jsx->js; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1291 |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1292 js->file_transfers = g_list_remove(js->file_transfers, xfer); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1293 |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1294 if (jsx->connect_data != NULL) |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1295 purple_proxy_connect_cancel(jsx->connect_data); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1296 if (jsx->listen_data != NULL) |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1297 purple_network_listen_cancel(jsx->listen_data); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1298 if (jsx->iq_id != NULL) |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1299 jabber_iq_remove_callback_by_id(js, jsx->iq_id); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1300 if (jsx->local_streamhost_fd >= 0) |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1301 close(jsx->local_streamhost_fd); |
27190
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
27014
diff
changeset
|
1302 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
27014
diff
changeset
|
1303 xfer->fd >= 0) { |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
27014
diff
changeset
|
1304 purple_debug_info("jabber", "remove port mapping\n"); |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
27014
diff
changeset
|
1305 purple_network_remove_port_mapping(xfer->fd); |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
27014
diff
changeset
|
1306 } |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1307 if (jsx->connect_timeout > 0) |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1308 purple_timeout_remove(jsx->connect_timeout); |
25243
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
1309 if (jsx->ibb_timeout_handle > 0) |
2faa374df334
Remove timeout for IBB when receiving an IBB session open from the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
25242
diff
changeset
|
1310 purple_timeout_remove(jsx->ibb_timeout_handle); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1311 |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1312 if (jsx->streamhosts) { |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1313 g_list_foreach(jsx->streamhosts, jabber_si_free_streamhost, NULL); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1314 g_list_free(jsx->streamhosts); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1315 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1316 |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1317 if (jsx->ibb_session) { |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1318 purple_debug_info("jabber", |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1319 "jabber_si_xfer_free: destroying IBB session\n"); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1320 jabber_ibb_session_destroy(jsx->ibb_session); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1321 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1322 |
28224
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1323 if (jsx->ibb_buffer) { |
b2dd32ce7353
jabber: Migrate IBB to the new code added in the previous commit.
Paul Aurich <paul@darkrain42.org>
parents:
28218
diff
changeset
|
1324 purple_circ_buffer_destroy(jsx->ibb_buffer); |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1325 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1326 |
28138
deecc1d663c4
Don't use pointers (even opaquely) once they're freed. Closes #9822.
Paul Aurich <paul@darkrain42.org>
parents:
27635
diff
changeset
|
1327 purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p\n", jsx); |
deecc1d663c4
Don't use pointers (even opaquely) once they're freed. Closes #9822.
Paul Aurich <paul@darkrain42.org>
parents:
27635
diff
changeset
|
1328 |
25221
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1329 g_free(jsx->stream_id); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1330 g_free(jsx->iq_id); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1331 /* XXX: free other stuff */ |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1332 g_free(jsx->rxqueue); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1333 g_free(jsx); |
6e0f1532eb3d
Check don't try to free the JabberSIXfer if it's already been freed.
Marcus Lundblad <ml@update.uu.se>
parents:
25220
diff
changeset
|
1334 xfer->data = NULL; |
21603
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21561
diff
changeset
|
1335 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1337 |
25248
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1338 /* |
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1339 * These four functions should only be called from the PurpleXfer functions |
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1340 * (typically purple_xfer_cancel_(remote|local), purple_xfer_end, or |
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1341 * purple_xfer_request_denied. |
4b51394fd834
Standardize all the IBB stream cleanup
Paul Aurich <paul@darkrain42.org>
parents:
25247
diff
changeset
|
1342 */ |
15823 | 1343 static void jabber_si_xfer_cancel_send(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 { |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1345 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1346 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1347 /* if there is an IBB session active, send close on that */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1348 if (jsx->ibb_session) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1349 jabber_ibb_session_close(jsx->ibb_session); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1350 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1351 jabber_si_xfer_free(xfer); |
28889
fa7f3426ed13
jabber: Convert to purple_debug_* convenience functions.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
1352 purple_debug_info("jabber", "in jabber_si_xfer_cancel_send\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1353 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1355 |
15823 | 1356 static void jabber_si_xfer_request_denied(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 { |
27635
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1358 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1359 JabberStream *js = jsx->js; |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1360 |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1361 /* |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1362 * TODO: It's probably an error if jsx->iq_id == NULL. g_return_if_fail |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1363 * might be warranted. |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1364 */ |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1365 if (jsx->iq_id && !jsx->accepted) { |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1366 JabberIq *iq; |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1367 xmlnode *error, *child; |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1368 iq = jabber_iq_new(js, JABBER_IQ_ERROR); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1369 xmlnode_set_attrib(iq->node, "to", xfer->who); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1370 jabber_iq_set_id(iq, jsx->iq_id); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1371 |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1372 error = xmlnode_new_child(iq->node, "error"); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1373 xmlnode_set_attrib(error, "type", "cancel"); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1374 child = xmlnode_new_child(error, "forbidden"); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1375 xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1376 child = xmlnode_new_child(error, "text"); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1377 xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1378 xmlnode_insert_data(child, "Offer Declined", -1); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1379 |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1380 jabber_iq_send(iq); |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1381 } |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1382 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1383 jabber_si_xfer_free(xfer); |
28889
fa7f3426ed13
jabber: Convert to purple_debug_* convenience functions.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
1384 purple_debug_info("jabber", "in jabber_si_xfer_request_denied\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1385 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1387 |
15823 | 1388 static void jabber_si_xfer_cancel_recv(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1389 { |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1390 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1391 /* if there is an IBB session active, send close */ |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1392 if (jsx->ibb_session) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1393 jabber_ibb_session_close(jsx->ibb_session); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1394 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1395 jabber_si_xfer_free(xfer); |
28889
fa7f3426ed13
jabber: Convert to purple_debug_* convenience functions.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
1396 purple_debug_info("jabber", "in jabber_si_xfer_cancel_recv\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1398 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1399 |
15823 | 1400 static void jabber_si_xfer_end(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1401 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1402 jabber_si_xfer_free(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1403 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1404 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1405 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1406 static void jabber_si_xfer_send_disco_cb(JabberStream *js, const char *who, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1407 JabberCapabilities capabilities, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1408 { |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1409 PurpleXfer *xfer = (PurpleXfer *) data; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1410 JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1411 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1412 if (capabilities & JABBER_CAP_IBB) { |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1413 purple_debug_info("jabber", |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1414 "jabber_si_xfer_send_disco_cb: remote JID supports IBB\n"); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1415 jsx->stream_method |= STREAM_METHOD_IBB; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1416 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1417 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1418 if (capabilities & JABBER_CAP_SI_FILE_XFER) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 jabber_si_xfer_send_request(xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1420 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 char *msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who); |
15823 | 1422 purple_notify_error(js->gc, _("File Send Failed"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1423 _("File Send Failed"), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1424 g_free(msg); |
27634
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1425 purple_xfer_cancel_local(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1426 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1427 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1429 static void resource_select_cancel_cb(PurpleXfer *xfer, PurpleRequestFields *fields) |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1430 { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1431 purple_xfer_cancel_local(xfer); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1432 } |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1433 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1434 static void do_transfer_send(PurpleXfer *xfer, const char *resource) |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1435 { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1436 JabberSIXfer *jsx = xfer->data; |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1437 char **who_v = g_strsplit(xfer->who, "/", 2); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1438 char *who; |
27634
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1439 JabberBuddy *jb; |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1440 JabberBuddyResource *jbr = NULL; |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1441 |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1442 jb = jabber_buddy_find(jsx->js, who_v[0], FALSE); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1443 if (jb) { |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1444 jbr = jabber_buddy_find_resource(jb, resource); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1445 } |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1446 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1447 who = g_strdup_printf("%s/%s", who_v[0], resource); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1448 g_strfreev(who_v); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1449 g_free(xfer->who); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1450 xfer->who = who; |
27634
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1451 |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1452 if (jbr) { |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1453 char *msg; |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1454 |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1455 if (jabber_resource_has_capability(jbr, XEP_0047_NAMESPACE)) |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1456 jsx->stream_method |= STREAM_METHOD_IBB; |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1457 if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/si/profile/file-transfer")) { |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1458 jabber_si_xfer_send_request(xfer); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1459 return; |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1460 } |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1461 |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1462 msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1463 purple_notify_error(jsx->js->gc, _("File Send Failed"), |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1464 _("File Send Failed"), msg); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1465 g_free(msg); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1466 purple_xfer_cancel_local(xfer); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1467 } else { |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1468 jabber_disco_info_do(jsx->js, who, |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1469 jabber_si_xfer_send_disco_cb, xfer); |
636c3b6c9cc7
Use Entity Caps for determining file transfer abilities, if possible.
Paul Aurich <paul@darkrain42.org>
parents:
27366
diff
changeset
|
1470 } |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1471 } |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1472 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1473 static void resource_select_ok_cb(PurpleXfer *xfer, PurpleRequestFields *fields) |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1474 { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1475 PurpleRequestField *field = purple_request_fields_get_field(fields, "resource"); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1476 int selected_id = purple_request_field_choice_get_value(field); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1477 GList *labels = purple_request_field_choice_get_labels(field); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1478 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1479 const char *selected_label = g_list_nth_data(labels, selected_id); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1480 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1481 do_transfer_send(xfer, selected_label); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1482 } |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1483 |
15823 | 1484 static void jabber_si_xfer_init(PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1486 JabberSIXfer *jsx = xfer->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1487 JabberIq *iq; |
15823 | 1488 if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1489 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1490 JabberBuddyResource *jbr = NULL; |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1491 char *resource; |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1492 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1493 if(NULL != (resource = jabber_get_resource(xfer->who))) { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1494 /* they've specified a resource, no need to ask or |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1495 * default or anything, just do it */ |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1496 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1497 do_transfer_send(xfer, resource); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1498 g_free(resource); |
21556
4e98fb3661cc
Prevent multiple file offers from going out with a patch from galt. Fixes #3839.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21284
diff
changeset
|
1499 return; |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1500 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1501 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1502 jb = jabber_buddy_find(jsx->js, xfer->who, TRUE); |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1503 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1504 if(!jb || !jb->resources) { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1505 /* no resources online, we're trying to send to someone |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1506 * whose presence we're not subscribed to, or |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1507 * someone who is offline. Let's inform the user */ |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1508 char *msg; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1509 |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1510 if(!jb) { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1511 msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), xfer->who); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1512 } else if(jb->subscription & JABBER_SUB_TO) { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1513 msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), xfer->who); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1514 } else { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1515 msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1516 } |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1517 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1518 purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1519 g_free(msg); |
24497
f10aba5592c6
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents:
24423
diff
changeset
|
1520 } else if(!jb->resources->next) { |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1521 /* only 1 resource online (probably our most common case) |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1522 * so no need to ask who to send to */ |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1523 jbr = jb->resources->data; |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1524 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1525 do_transfer_send(xfer, jbr->name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1526 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 } else { |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1528 /* we've got multiple resources, we need to pick one to send to */ |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1529 GList *l; |
22204
a464d2bd6f01
I'm not sure how to disapprove a local change without it ever getting pushed... sorry for the double commit. I didn't intend to leave a trailing colon, since we didn't use punctuation at the end previously.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22203
diff
changeset
|
1530 char *msg = g_strdup_printf(_("Please select the resource of %s to which you would like to send a file"), xfer->who); |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1531 PurpleRequestFields *fields = purple_request_fields_new(); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1532 PurpleRequestField *field = purple_request_field_choice_new("resource", _("Resource"), 0); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1533 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1534 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1535 for(l = jb->resources; l; l = l->next) |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1536 { |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1537 jbr = l->data; |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1538 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1539 purple_request_field_choice_add(field, jbr->name); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1540 } |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1541 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1542 purple_request_field_group_add_field(group, field); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1543 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1544 purple_request_fields_add_group(fields, group); |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1545 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1546 purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields, |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1547 _("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb), |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1548 jsx->js->gc->account, xfer->who, NULL, xfer); |
17441
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1549 |
cc1b4d2e5a9b
if there are multiple resources available, ask the user which resource to
Nathan Walp <nwalp@pidgin.im>
parents:
15823
diff
changeset
|
1550 g_free(msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1551 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1553 xmlnode *si, *feature, *x, *field, *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 iq = jabber_iq_new(jsx->js, JABBER_IQ_RESULT); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 xmlnode_set_attrib(iq->node, "to", xfer->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1557 if(jsx->iq_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 jabber_iq_set_id(iq, jsx->iq_id); |
27635
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1559 else |
97eb110550ad
Properly send rejection to initiator if we reject a transfer.
Paul Aurich <paul@darkrain42.org>
parents:
27634
diff
changeset
|
1560 purple_debug_error("jabber", "Sending SI result with new IQ id.\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 jsx->accepted = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 si = xmlnode_new_child(iq->node, "si"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 feature = xmlnode_new_child(si, "feature"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 x = xmlnode_new_child(feature, "x"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 xmlnode_set_namespace(x, "jabber:x:data"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 xmlnode_set_attrib(x, "type", "submit"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 field = xmlnode_new_child(x, "field"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 xmlnode_set_attrib(field, "var", "stream-method"); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1575 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1576 /* we should maybe "remember" if bytestreams has failed before (in the |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1577 same session) with this JID, and only present IBB as an option to |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1578 avoid unnessesary timeout */ |
25241
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
1579 /* maybe we should have an account option to always just try IBB |
5d65993761c1
Add timeout when receiver waits for initiator to open an IBB session
Marcus Lundblad <ml@update.uu.se>
parents:
25236
diff
changeset
|
1580 for people who know their firewalls are very restrictive */ |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1581 if (jsx->stream_method & STREAM_METHOD_BYTESTREAMS) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1582 value = xmlnode_new_child(field, "value"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1583 xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1584 } else if(jsx->stream_method & STREAM_METHOD_IBB) { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1585 value = xmlnode_new_child(field, "value"); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1586 xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1587 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1588 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1590 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1591 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1592 |
15823 | 1593 PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1594 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 |
15823 | 1597 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1598 JabberSIXfer *jsx; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 |
15823 | 1602 xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 if (xfer) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 xfer->data = jsx = g_new0(JabberSIXfer, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 jsx->js = js; |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
1607 jsx->local_streamhost_fd = -1; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1608 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1609 jsx->ibb_session = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 |
15823 | 1611 purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init); |
1612 purple_xfer_set_cancel_send_fnc(xfer, jabber_si_xfer_cancel_send); | |
1613 purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1614 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 js->file_transfers = g_list_append(js->file_transfers, xfer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 return xfer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 |
15823 | 1621 void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 |
15823 | 1625 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 xfer = jabber_si_new_xfer(gc, who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 if (file) |
15823 | 1632 purple_xfer_request_accepted(xfer, file); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1633 else |
15823 | 1634 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
1637 void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
1638 const char *id, xmlnode *si) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1640 JabberSIXfer *jsx; |
15823 | 1641 PurpleXfer *xfer; |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
1642 xmlnode *file, *feature, *x, *field, *option, *value; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
1643 const char *stream_id, *filename, *filesize_c, *profile; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 size_t filesize = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 if(!(profile = xmlnode_get_attrib(si, "profile")) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1647 strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1649 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 if(!(stream_id = xmlnode_get_attrib(si, "id"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1652 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 if(!(file = xmlnode_get_child(si, "file"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1655 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1656 if(!(filename = xmlnode_get_attrib(file, "name"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1658 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1659 if((filesize_c = xmlnode_get_attrib(file, "size"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 filesize = atoi(filesize_c); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1661 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1662 if(!(feature = xmlnode_get_child(si, "feature"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1663 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1666 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
1668 if(!from) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1670 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1671 /* if they've already sent us this file transfer with the same damn id |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1672 * then we're gonna ignore it, until I think of something better to do |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1673 * with it */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1674 if((xfer = jabber_si_xfer_find(js, stream_id, from))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1675 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1676 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1677 jsx = g_new0(JabberSIXfer, 1); |
23029
3c33405fd630
applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22912
diff
changeset
|
1678 jsx->local_streamhost_fd = -1; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25264
diff
changeset
|
1679 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1680 jsx->ibb_session = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1682 for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1683 const char *var = xmlnode_get_attrib(field, "var"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1684 if(var && !strcmp(var, "stream-method")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1685 for(option = xmlnode_get_child(field, "option"); option; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1686 option = xmlnode_get_next_twin(option)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1687 if((value = xmlnode_get_child(option, "value"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1688 char *val; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1689 if((val = xmlnode_get_data(value))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1690 if(!strcmp(val, "http://jabber.org/protocol/bytestreams")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1691 jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1692 } else if(!strcmp(val, "http://jabber.org/protocol/ibb")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1693 jsx->stream_method |= STREAM_METHOD_IBB; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1694 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1695 g_free(val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1696 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1697 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1698 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1699 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1700 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1701 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1702 if(jsx->stream_method == STREAM_METHOD_UNKNOWN) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1703 g_free(jsx); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1705 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1706 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 jsx->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 jsx->stream_id = g_strdup(stream_id); |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
1709 jsx->iq_id = g_strdup(id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 |
15823 | 1711 xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); |
26309
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1712 g_return_if_fail(xfer != NULL); |
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1713 |
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1714 xfer->data = jsx; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1715 |
26309
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1716 purple_xfer_set_filename(xfer, filename); |
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1717 if(filesize > 0) |
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1718 purple_xfer_set_size(xfer, filesize); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1719 |
26309
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1720 purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init); |
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1721 purple_xfer_set_request_denied_fnc(xfer, jabber_si_xfer_request_denied); |
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1722 purple_xfer_set_cancel_recv_fnc(xfer, jabber_si_xfer_cancel_recv); |
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1723 purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1724 |
26309
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1725 js->file_transfers = g_list_append(js->file_transfers, xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 |
26309
58daeb191c10
purple_xfer_new only returns NULL if an assertion fails, so we should do
Mark Doliner <mark@kingant.net>
parents:
25981
diff
changeset
|
1727 purple_xfer_request(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1728 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1730 void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1731 jabber_si_init(void) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1732 { |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26997
diff
changeset
|
1733 jabber_iq_register_handler("si", "http://jabber.org/protocol/si", jabber_si_parse); |
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26997
diff
changeset
|
1734 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1735 jabber_ibb_register_open_handler(jabber_si_xfer_ibb_open_cb); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1736 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 |
23999
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1738 void |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1739 jabber_si_uninit(void) |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1740 { |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1741 jabber_ibb_unregister_open_handler(jabber_si_xfer_ibb_open_cb); |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1742 } |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23769
diff
changeset
|
1743 |