Mercurial > pidgin.yaz
annotate libpurple/protocols/bonjour/bonjour_ft.c @ 30454:09e15f831d7e
A direct connection shouldn't be FT-only.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 23 Apr 2010 20:45:05 +0000 |
parents | 755219afed9f |
children | 9c8b28dc6656 |
rev | line source |
---|---|
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
1 /* |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
2 * purple - Bonjour Protocol Plugin |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
3 * |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
6 * source distribution. |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
7 * |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
12 * |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
17 * |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
28420
7921a53b94b3
Oops, Elliott correctly pointed out this was wrong...
Paul Aurich <paul@darkrain42.org>
parents:
28399
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
21 */ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
22 #include "internal.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
23 #include "util.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
24 #include "debug.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
25 #include "notify.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
26 #include "proxy.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
27 #include "ft.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
28 #include "buddy.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
29 #include "bonjour.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
30 #include "bonjour_ft.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
31 #include "cipher.h" |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
32 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
33 static void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
34 bonjour_bytestreams_init(PurpleXfer *xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
35 static void |
21533
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
36 bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
37 static void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
38 bonjour_xfer_init(PurpleXfer *xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
39 static void |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
40 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
41 const int filesize, const char *filename, int option); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
42 static void bonjour_free_xfer(PurpleXfer *xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
43 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
44 /* Look for specific xfer handle */ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
45 static unsigned int next_id = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
46 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
47 static void |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
48 xep_ft_si_reject(BonjourData *bd, const char *id, const char *to, const char *error_code, const char *error_type) |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
49 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
50 xmlnode *error_node; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
51 XepIq *iq; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
52 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
53 g_return_if_fail(error_code != NULL); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
54 g_return_if_fail(error_type != NULL); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
55 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
56 if(!to || !id) |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
57 return; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
58 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
59 purple_debug_info("bonjour", "xep file transfer stream initialization error.\n"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
60 iq = xep_iq_new(bd, XEP_IQ_ERROR, to, purple_account_get_username(bd->jabber_data->account), id); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
61 if(iq == NULL) |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
62 return; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
63 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
64 error_node = xmlnode_new_child(iq->node, "error"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
65 xmlnode_set_attrib(error_node, "code", error_code); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
66 xmlnode_set_attrib(error_node, "type", error_type); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
67 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
68 /* TODO: Make this better */ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
69 if (!strcmp(error_code, "403")) { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
70 xmlnode *tmp_node = xmlnode_new_child(error_node, "forbidden"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
71 xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
72 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
73 tmp_node = xmlnode_new_child(error_node, "text"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
74 xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
75 xmlnode_insert_data(tmp_node, "Offer Declined", -1); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
76 } else if (!strcmp(error_code, "404")) { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
77 xmlnode *tmp_node = xmlnode_new_child(error_node, "item-not-found"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
78 xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
79 } |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
80 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
81 xep_iq_send_and_free(iq); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
82 } |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
83 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
84 static void bonjour_xfer_cancel_send(PurpleXfer *xfer) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
85 { |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
86 purple_debug_info("bonjour", "Bonjour-xfer-cancel-send.\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
87 bonjour_free_xfer(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
88 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
89 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
90 static void bonjour_xfer_request_denied(PurpleXfer *xfer) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
91 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
92 XepXfer *xf = xfer->data; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
93 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
94 purple_debug_info("bonjour", "Bonjour-xfer-request-denied.\n"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
95 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
96 if(xf) |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
97 xep_ft_si_reject(xf->data, xf->sid, xfer->who, "403", "cancel"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
98 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
99 bonjour_free_xfer(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
100 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
101 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
102 static void bonjour_xfer_cancel_recv(PurpleXfer *xfer) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
103 { |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
104 purple_debug_info("bonjour", "Bonjour-xfer-cancel-recv.\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
105 bonjour_free_xfer(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
106 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
107 |
21467
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
108 struct socket_cleanup { |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
109 int fd; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
110 guint handle; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
111 }; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
112 |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
113 static void |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
114 _wait_for_socket_close(gpointer data, gint source, PurpleInputCondition cond) |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
115 { |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
116 struct socket_cleanup *sc = data; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
117 char buf[1]; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
118 int ret; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
119 |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
120 ret = recv(source, buf, 1, 0); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
121 |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
122 if (ret == 0 || (ret == -1 && !(errno == EAGAIN || errno == EWOULDBLOCK))) { |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
123 purple_debug_info("bonjour", "Client completed recieving; closing server socket.\n"); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
124 purple_input_remove(sc->handle); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
125 close(sc->fd); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
126 g_free(sc); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
127 } |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
128 } |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
129 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
130 static void bonjour_xfer_end(PurpleXfer *xfer) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
131 { |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
132 purple_debug_info("bonjour", "Bonjour-xfer-end.\n"); |
21467
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
133 |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
134 /* We can't allow the server side to close the connection until the client is complete, |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
135 * otherwise there is a RST resulting in an error on the client side */ |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
136 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_is_completed(xfer)) { |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
137 struct socket_cleanup *sc = g_new0(struct socket_cleanup, 1); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
138 sc->fd = xfer->fd; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
139 xfer->fd = -1; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
140 sc->handle = purple_input_add(sc->fd, PURPLE_INPUT_READ, |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
141 _wait_for_socket_close, sc); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
142 } |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
143 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
144 bonjour_free_xfer(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
145 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
146 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
147 static PurpleXfer* |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
148 bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
149 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
150 GSList *xfers; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
151 PurpleXfer *xfer; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
152 XepXfer *xf; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
153 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
154 if(!sid || !from || !bd) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
155 return NULL; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
156 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
157 purple_debug_info("bonjour", "Look for sid=%s from=%s xferlists.\n", |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
158 sid, from); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
159 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
160 for(xfers = bd->xfer_lists; xfers; xfers = xfers->next) { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
161 xfer = xfers->data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
162 if(xfer == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
163 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
164 xf = xfer->data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
165 if(xf == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
166 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
167 if(xf->sid && xfer->who && !strcmp(xf->sid, sid) && |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
168 !strcmp(xfer->who, from)) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
169 return xfer; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
170 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
171 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
172 purple_debug_info("bonjour", "Look for xfer list fail\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
173 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
174 return NULL; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
175 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
176 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
177 static void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
178 xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
179 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
180 xmlnode *si_node, *feature, *field, *file, *x; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
181 XepIq *iq; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
182 XepXfer *xf = xfer->data; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
183 BonjourData *bd = NULL; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
184 char buf[32]; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
185 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
186 if(!xf) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
187 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
188 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
189 bd = xf->data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
190 if(!bd) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
191 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
192 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
193 purple_debug_info("bonjour", "xep file transfer stream initialization offer-id=%d.\n", next_id); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
194 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
195 /* Assign stream id. */ |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
196 g_free(xf->iq_id); |
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
197 xf->iq_id = g_strdup_printf("%u", next_id++); |
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
198 iq = xep_iq_new(xf->data, XEP_IQ_SET, to, purple_account_get_username(bd->jabber_data->account), xf->iq_id); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
199 if(iq == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
200 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
201 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
202 /*Construct Stream initialization offer message.*/ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
203 si_node = xmlnode_new_child(iq->node, "si"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
204 xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
205 xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer"); |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
206 g_free(xf->sid); |
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
207 xf->sid = g_strdup(xf->iq_id); |
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
208 xmlnode_set_attrib(si_node, "id", xf->sid); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
209 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
210 file = xmlnode_new_child(si_node, "file"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
211 xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
212 xmlnode_set_attrib(file, "name", xfer->filename); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
213 g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
214 xmlnode_set_attrib(file, "size", buf); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
215 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
216 feature = xmlnode_new_child(si_node, "feature"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
217 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
218 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
219 x = xmlnode_new_child(feature, "x"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
220 xmlnode_set_namespace(x, "jabber:x:data"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
221 xmlnode_set_attrib(x, "type", "form"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
222 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
223 field = xmlnode_new_child(x, "field"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
224 xmlnode_set_attrib(field, "var", "stream-method"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
225 xmlnode_set_attrib(field, "type", "list-single"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
226 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
227 if (xf->mode & XEP_BYTESTREAMS) { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
228 xmlnode *option = xmlnode_new_child(field, "option"); |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
229 xmlnode *value = xmlnode_new_child(option, "value"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
230 xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
231 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
232 if (xf->mode & XEP_IBB) { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
233 xmlnode *option = xmlnode_new_child(field, "option"); |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
234 xmlnode *value = xmlnode_new_child(option, "value"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
235 xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
236 } |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
237 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
238 xep_iq_send_and_free(iq); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
239 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
240 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
241 static void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
242 xep_ft_si_result(PurpleXfer *xfer, char *to) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
243 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
244 xmlnode *si_node, *feature, *field, *value, *x; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
245 XepIq *iq; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
246 XepXfer *xf; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
247 BonjourData *bd; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
248 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
249 if(!to || !xfer) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
250 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
251 xf = xfer->data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
252 if(!xf) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
253 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
254 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
255 bd = xf->data; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
256 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
257 purple_debug_info("bonjour", "xep file transfer stream initialization result.\n"); |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
258 iq = xep_iq_new(bd, XEP_IQ_RESULT, to, purple_account_get_username(bd->jabber_data->account), xf->iq_id); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
259 if(iq == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
260 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
261 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
262 si_node = xmlnode_new_child(iq->node, "si"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
263 xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
264 /*xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer");*/ |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
265 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
266 feature = xmlnode_new_child(si_node, "feature"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
267 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
268 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
269 x = xmlnode_new_child(feature, "x"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
270 xmlnode_set_namespace(x, "jabber:x:data"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
271 xmlnode_set_attrib(x, "type", "submit"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
272 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
273 field = xmlnode_new_child(x, "field"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
274 xmlnode_set_attrib(field, "var", "stream-method"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
275 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
276 value = xmlnode_new_child(field, "value"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
277 xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
278 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
279 xep_iq_send_and_free(iq); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
280 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
281 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
282 static void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
283 bonjour_free_xfer(PurpleXfer *xfer) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
284 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
285 XepXfer *xf; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
286 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
287 if(xfer == NULL) { |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
288 purple_debug_info("bonjour", "bonjour-free-xfer-null.\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
289 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
290 } |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
291 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
292 purple_debug_info("bonjour", "bonjour-free-xfer-%p.\n", xfer); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
293 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
294 xf = (XepXfer*)xfer->data; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
295 if(xf != NULL) { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
296 BonjourData *bd = (BonjourData*)xf->data; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
297 if(bd != NULL) { |
21829
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
298 bd->xfer_lists = g_slist_remove(bd->xfer_lists, xfer); |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
299 purple_debug_info("bonjour", "B free xfer from lists(%p).\n", bd->xfer_lists); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
300 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
301 if (xf->proxy_connection != NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
302 purple_proxy_connect_cancel(xf->proxy_connection); |
23604
3ba2cddc49f0
Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971. (this time only commit the one file instead of my whole tree)
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23603
diff
changeset
|
303 if (xf->proxy_info != NULL) |
3ba2cddc49f0
Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971. (this time only commit the one file instead of my whole tree)
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23603
diff
changeset
|
304 purple_proxy_info_destroy(xf->proxy_info); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
305 if (xf->listen_data != NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
306 purple_network_listen_cancel(xf->listen_data); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
307 g_free(xf->iq_id); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
308 g_free(xf->jid); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
309 g_free(xf->proxy_host); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
310 g_free(xf->buddy_ip); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
311 g_free(xf->sid); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
312 g_free(xf); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
313 xfer->data = NULL; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
314 } |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
315 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
316 purple_debug_info("bonjour", "Need close socket=%d.\n", xfer->fd); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
317 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
318 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
319 PurpleXfer * |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
320 bonjour_new_xfer(PurpleConnection *gc, const char *who) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
321 { |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
322 PurpleXfer *xfer; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
323 XepXfer *xep_xfer; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
324 BonjourData *bd; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
325 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
326 if(who == NULL || gc == NULL) |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
327 return NULL; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
328 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
329 purple_debug_info("bonjour", "Bonjour-new-xfer to %s.\n", who); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
330 bd = (BonjourData*) gc->proto_data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
331 if(bd == NULL) |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
332 return NULL; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
333 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
334 /* Build the file transfer handle */ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
335 xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
336 xfer->data = xep_xfer = g_new0(XepXfer, 1); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
337 xep_xfer->data = bd; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
338 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
339 purple_debug_info("bonjour", "Bonjour-new-xfer bd=%p data=%p.\n", bd, xep_xfer->data); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
340 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
341 /* We don't support IBB yet */ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
342 /*xep_xfer->mode = XEP_BYTESTREAMS | XEP_IBB;*/ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
343 xep_xfer->mode = XEP_BYTESTREAMS; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
344 xep_xfer->sid = NULL; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
345 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
346 purple_xfer_set_init_fnc(xfer, bonjour_xfer_init); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
347 purple_xfer_set_cancel_send_fnc(xfer, bonjour_xfer_cancel_send); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
348 purple_xfer_set_end_fnc(xfer, bonjour_xfer_end); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
349 |
21829
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
350 bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
351 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
352 return xfer; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
353 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
354 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
355 void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
356 bonjour_send_file(PurpleConnection *gc, const char *who, const char *file) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
357 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
358 PurpleXfer *xfer; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
359 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
360 g_return_if_fail(gc != NULL); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
361 g_return_if_fail(who != NULL); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
362 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
363 purple_debug_info("bonjour", "Bonjour-send-file to=%s.\n", who); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
364 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
365 xfer = bonjour_new_xfer(gc, who); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
366 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
367 if (file) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
368 purple_xfer_request_accepted(xfer, file); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
369 else |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
370 purple_xfer_request(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
371 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
372 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
373 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
374 static void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
375 bonjour_xfer_init(PurpleXfer *xfer) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
376 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
377 PurpleBuddy *buddy; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
378 BonjourBuddy *bb; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
379 XepXfer *xf; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
380 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
381 xf = (XepXfer*)xfer->data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
382 if(xf == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
383 return; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
384 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
385 purple_debug_info("bonjour", "Bonjour-xfer-init.\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
386 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
387 buddy = purple_find_buddy(xfer->account, xfer->who); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
388 /* this buddy is offline. */ |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
389 if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
390 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
391 |
21806
41959f031322
Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21533
diff
changeset
|
392 /* Assume it is the first IP. We could do something like keep track of which one is in use or something. */ |
41959f031322
Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21533
diff
changeset
|
393 if (bb->ips) |
41959f031322
Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21533
diff
changeset
|
394 xf->buddy_ip = g_strdup(bb->ips->data); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
395 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
396 /* initiate file transfer, send SI offer. */ |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
397 purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_SEND.\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
398 xep_ft_si_offer(xfer, xfer->who); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
399 } else { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
400 /* accept file transfer request, send SI result. */ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
401 xep_ft_si_result(xfer, xfer->who); |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
402 purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_RECEIVE.\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
403 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
404 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
405 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
406 void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
407 xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
408 { |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
409 const char *type, *id; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
410 BonjourData *bd; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
411 PurpleXfer *xfer; |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
412 const gchar *name = NULL; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
413 |
24623
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23770
diff
changeset
|
414 g_return_if_fail(pc != NULL); |
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23770
diff
changeset
|
415 g_return_if_fail(packet != NULL); |
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23770
diff
changeset
|
416 g_return_if_fail(pb != NULL); |
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23770
diff
changeset
|
417 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
418 bd = (BonjourData*) pc->proto_data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
419 if(bd == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
420 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
421 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
422 purple_debug_info("bonjour", "xep-si-parse.\n"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
423 |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
424 name = purple_buddy_get_name(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
425 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
426 type = xmlnode_get_attrib(packet, "type"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
427 id = xmlnode_get_attrib(packet, "id"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
428 if(type) { |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
429 if(!strcmp(type, "set")) { |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
430 const char *profile; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
431 xmlnode *si; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
432 gboolean parsed_receive = FALSE; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
433 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
434 si = xmlnode_get_child(packet, "si"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
435 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
436 purple_debug_info("bonjour", "si offer Message type - SET.\n"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
437 if (si && (profile = xmlnode_get_attrib(si, "profile")) |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
438 && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
439 const char *filename = NULL, *filesize_str = NULL; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
440 int filesize = 0; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
441 xmlnode *file; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
442 |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
443 const char *sid = xmlnode_get_attrib(si, "id"); |
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
444 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
445 if ((file = xmlnode_get_child(si, "file"))) { |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
446 filename = xmlnode_get_attrib(file, "name"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
447 if((filesize_str = xmlnode_get_attrib(file, "size"))) |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
448 filesize = atoi(filesize_str); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
449 } |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
450 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
451 /* TODO: Make sure that it is advertising a bytestreams transfer */ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
452 |
28289
db99cde1845c
Fix crashes when filenames end up being NULL in some prpls. Fixed a minor
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27201
diff
changeset
|
453 if (filename) { |
db99cde1845c
Fix crashes when filenames end up being NULL in some prpls. Fixed a minor
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27201
diff
changeset
|
454 bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
455 |
28289
db99cde1845c
Fix crashes when filenames end up being NULL in some prpls. Fixed a minor
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27201
diff
changeset
|
456 parsed_receive = TRUE; |
db99cde1845c
Fix crashes when filenames end up being NULL in some prpls. Fixed a minor
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27201
diff
changeset
|
457 } |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
458 } |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
459 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
460 if (!parsed_receive) { |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
461 BonjourData *bd = purple_connection_get_protocol_data(pc); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
462 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
463 purple_debug_info("bonjour", "rejecting unrecognized si SET offer.\n"); |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
464 xep_ft_si_reject(bd, id, name, "403", "cancel"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
465 /*TODO: Send Cancel (501) */ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
466 } |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
467 } else if(!strcmp(type, "result")) { |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
468 purple_debug_info("bonjour", "si offer Message type - RESULT.\n"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
469 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23770
diff
changeset
|
470 xfer = bonjour_si_xfer_find(bd, id, name); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
471 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
472 if(xfer == NULL) { |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
473 BonjourData *bd = purple_connection_get_protocol_data(pc); |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
474 purple_debug_info("bonjour", "xfer find fail.\n"); |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
475 xep_ft_si_reject(bd, id, name, "403", "cancel"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
476 } else |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
477 bonjour_bytestreams_init(xfer); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
478 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
479 } else if(!strcmp(type, "error")) { |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
480 purple_debug_info("bonjour", "si offer Message type - ERROR.\n"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
481 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23770
diff
changeset
|
482 xfer = bonjour_si_xfer_find(bd, id, name); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
483 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
484 if(xfer == NULL) |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
485 purple_debug_info("bonjour", "xfer find fail.\n"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
486 else |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
487 purple_xfer_cancel_remote(xfer); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
488 } else |
22475
3225c99785b8
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents:
21829
diff
changeset
|
489 purple_debug_info("bonjour", "si offer Message type - Unknown-%s.\n", type); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
490 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
491 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
492 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
493 void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
494 xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
495 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
496 const char *type, *from; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
497 xmlnode *query; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
498 BonjourData *bd; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
499 |
24623
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23770
diff
changeset
|
500 g_return_if_fail(pc != NULL); |
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23770
diff
changeset
|
501 g_return_if_fail(packet != NULL); |
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23770
diff
changeset
|
502 g_return_if_fail(pb != NULL); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
503 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
504 bd = (BonjourData*) pc->proto_data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
505 if(bd == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
506 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
507 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
508 purple_debug_info("bonjour", "xep-bytestreams-parse.\n"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
509 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
510 type = xmlnode_get_attrib(packet, "type"); |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23770
diff
changeset
|
511 from = purple_buddy_get_name(pb); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
512 query = xmlnode_get_child(packet,"query"); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
513 if(type) { |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
514 if(!strcmp(type, "set")) { |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
515 const char *iq_id, *sid; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
516 gboolean found = FALSE; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
517 PurpleXfer *xfer; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
518 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
519 purple_debug_info("bonjour", "bytestream offer Message type - SET.\n"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
520 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
521 iq_id = xmlnode_get_attrib(packet, "id"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
522 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
523 sid = xmlnode_get_attrib(query, "sid"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
524 xfer = bonjour_si_xfer_find(bd, sid, from); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
525 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
526 if(xfer) { |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
527 const char *jid, *host, *port; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
528 xmlnode *streamhost; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
529 int portnum; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
530 XepXfer *xf = NULL; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
531 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
532 xf = (XepXfer*)xfer->data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
533 for(streamhost = xmlnode_get_child(query, "streamhost"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
534 streamhost; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
535 streamhost = xmlnode_get_next_twin(streamhost)) { |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
536 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
537 if((jid = xmlnode_get_attrib(streamhost, "jid")) && |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
538 (host = xmlnode_get_attrib(streamhost, "host")) && |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
539 (port = xmlnode_get_attrib(streamhost, "port")) && |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
540 (portnum = atoi(port))) { |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
541 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
542 if(!strcmp(host, xf->buddy_ip)) { |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
543 g_free(xf->iq_id); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
544 xf->iq_id = g_strdup(iq_id); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
545 xf->jid = g_strdup(jid); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
546 xf->proxy_host = g_strdup(host); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
547 xf->proxy_port = portnum; |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
548 purple_debug_info("bonjour", "bytestream offer parse" |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
549 "jid=%s host=%s port=%d.\n", jid, host, portnum); |
21533
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
550 bonjour_bytestreams_connect(xfer, pb); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
551 found = TRUE; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
552 break; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
553 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
554 } else { |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
555 purple_debug_info("bonjour", "bytestream offer Message parse error.\n"); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
556 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
557 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
558 } else { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
559 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
560 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
561 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
562 if (!found) { |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
563 purple_debug_error("bonjour", "Didn't find an acceptable streamhost.\n"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
564 |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
565 if (iq_id && xfer != NULL) |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
566 xep_ft_si_reject(bd, iq_id, xfer->who, "404", "cancel"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
567 } |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
568 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
569 } else { |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
570 purple_debug_info("bonjour", "bytestream offer Message type - Unknown-%s.\n", type); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
571 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
572 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
573 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
574 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
575 static void |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
576 bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
577 const int filesize, const char *filename, int option) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
578 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
579 PurpleXfer *xfer; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
580 XepXfer *xf; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
581 BonjourData *bd; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
582 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
583 if(pc == NULL || id == NULL || from == NULL) |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
584 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
585 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
586 bd = (BonjourData*) pc->proto_data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
587 if(bd == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
588 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
589 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
590 purple_debug_info("bonjour", "bonjour-xfer-receive.\n"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
591 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
592 /* Build the file transfer handle */ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
593 xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
594 xfer->data = xf = g_new0(XepXfer, 1); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
595 xf->data = bd; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
596 purple_xfer_set_filename(xfer, filename); |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
597 xf->iq_id = g_strdup(id); |
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
598 xf->sid = g_strdup(sid); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
599 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
600 if(filesize > 0) |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
601 purple_xfer_set_size(xfer, filesize); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
602 purple_xfer_set_init_fnc(xfer, bonjour_xfer_init); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
603 purple_xfer_set_request_denied_fnc(xfer, bonjour_xfer_request_denied); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
604 purple_xfer_set_cancel_recv_fnc(xfer, bonjour_xfer_cancel_recv); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
605 purple_xfer_set_end_fnc(xfer, bonjour_xfer_end); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
606 |
21829
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
607 bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
608 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
609 purple_xfer_request(xfer); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
610 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
611 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
612 static void |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
613 bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
614 { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
615 PurpleXfer *xfer = data; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
616 XepXfer *xf = xfer->data; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
617 int acceptfd; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
618 int len = 0; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
619 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
620 if(xf == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
621 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
622 |
21467
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
623 purple_debug_info("bonjour", "bonjour_sock5_request_cb - req_state = 0x%x\n", xf->sock5_req_state); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
624 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
625 switch(xf->sock5_req_state){ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
626 case 0x00: |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
627 acceptfd = accept(source, NULL, 0); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
628 if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
629 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
630 } else if(acceptfd == -1) { |
21527
5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21522
diff
changeset
|
631 /* This should cancel the ft */ |
21531
07c91ea3da0e
Fix some confusion between iq ids and sids. This allows me to send files to Gajim (as long as Gajim has initiated the connection to me - there seems to a bug there where it will try to make a new connection if I've initiated the connection). Also fix a null ptr deref crash.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
632 purple_debug_error("bonjour", "Error accepting incoming SOCKS5 connection. (%d)\n", errno); |
21527
5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21522
diff
changeset
|
633 |
5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21522
diff
changeset
|
634 purple_input_remove(xfer->watcher); |
5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21522
diff
changeset
|
635 xfer->watcher = 0; |
5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21522
diff
changeset
|
636 close(source); |
5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21522
diff
changeset
|
637 purple_xfer_cancel_remote(xfer); |
5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21522
diff
changeset
|
638 return; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
639 } else { |
21467
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
640 int flags; |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
641 |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
642 purple_debug_info("bonjour", "Accepted SOCKS5 ft connection - fd=%d\n", acceptfd); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
643 |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
644 flags = fcntl(acceptfd, F_GETFL); |
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
645 fcntl(acceptfd, F_SETFL, flags | O_NONBLOCK); |
23770
0dd3df365017
These fds don't need to be inherited by child processes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23604
diff
changeset
|
646 #ifndef _WIN32 |
0dd3df365017
These fds don't need to be inherited by child processes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23604
diff
changeset
|
647 fcntl(acceptfd, F_SETFD, FD_CLOEXEC); |
0dd3df365017
These fds don't need to be inherited by child processes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23604
diff
changeset
|
648 #endif |
21467
3d70e3ec8a47
My changes to disable external port mapping exposed a flaw where the server socket was being closed immediately, before the client had read all the data - this caused the client to receive a RST and consequently error. The solution is to wait for the client to close the connection before closing the server connection. I'm surprised this hasn't been a problem elsewhere - it seems like it would be.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21466
diff
changeset
|
649 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
650 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
651 close(source); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
652 xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
653 bonjour_sock5_request_cb, xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
654 xf->sock5_req_state++; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
655 xf->rxlen = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
656 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
657 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
658 case 0x01: |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
659 xfer->fd = source; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
660 len = read(source, xf->rx_buf + xf->rxlen, 3); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
661 if(len < 0 && errno == EAGAIN) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
662 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
663 else if(len <= 0){ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
664 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
665 xfer->watcher = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
666 close(source); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
667 purple_xfer_cancel_remote(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
668 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
669 } else { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
670 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
671 xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
672 bonjour_sock5_request_cb, xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
673 xf->sock5_req_state++; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
674 xf->rxlen = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
675 bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
676 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
677 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
678 case 0x02: |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
679 xf->tx_buf[0] = 0x05; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
680 xf->tx_buf[1] = 0x00; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
681 len = write(source, xf->tx_buf, 2); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
682 if (len < 0 && errno == EAGAIN) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
683 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
684 else if (len < 0) { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
685 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
686 xfer->watcher = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
687 close(source); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
688 purple_xfer_cancel_remote(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
689 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
690 } else { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
691 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
692 xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
693 bonjour_sock5_request_cb, xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
694 xf->sock5_req_state++; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
695 xf->rxlen = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
696 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
697 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
698 case 0x03: |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
699 len = read(source, xf->rx_buf + xf->rxlen, 20); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
700 if(len<=0){ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
701 } else { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
702 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
703 xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
704 bonjour_sock5_request_cb, xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
705 xf->sock5_req_state++; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
706 xf->rxlen = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
707 bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
708 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
709 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
710 case 0x04: |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
711 xf->tx_buf[0] = 0x05; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
712 xf->tx_buf[1] = 0x00; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
713 xf->tx_buf[2] = 0x00; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
714 xf->tx_buf[3] = 0x03; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
715 xf->tx_buf[4] = strlen(xf->buddy_ip); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
716 memcpy(xf->tx_buf + 5, xf->buddy_ip, strlen(xf->buddy_ip)); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
717 xf->tx_buf[5+strlen(xf->buddy_ip)] = 0x00; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
718 xf->tx_buf[6+strlen(xf->buddy_ip)] = 0x00; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
719 len = write(source, xf->tx_buf, 7 + strlen(xf->buddy_ip)); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
720 if (len < 0 && errno == EAGAIN) { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
721 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
722 } else if (len < 0) { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
723 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
724 xfer->watcher = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
725 close(source); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
726 purple_xfer_cancel_remote(xfer); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
727 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
728 } else { |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
729 purple_input_remove(xfer->watcher); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
730 xfer->watcher = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
731 xf->rxlen = 0; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
732 /*close(source);*/ |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
733 purple_xfer_start(xfer, source, NULL, -1); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
734 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
735 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
736 default: |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
737 break; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
738 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
739 return; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
740 } |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
741 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
742 static void |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
743 bonjour_bytestreams_listen(int sock, gpointer data) |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
744 { |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
745 PurpleXfer *xfer = data; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
746 XepXfer *xf; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
747 XepIq *iq; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
748 xmlnode *query, *streamhost; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
749 gchar *port; |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
750 GSList *local_ips; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
751 BonjourData *bd; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
752 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
753 purple_debug_info("bonjour", "Bonjour-bytestreams-listen. sock=%d.\n", sock); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
754 if (sock < 0 || xfer == NULL) { |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
755 /*purple_xfer_cancel_local(xfer);*/ |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
756 return; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
757 } |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
758 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
759 xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
760 bonjour_sock5_request_cb, xfer); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
761 xf = (XepXfer*)xfer->data; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
762 xf->listen_data = NULL; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
763 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
764 bd = xf->data; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
765 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
766 iq = xep_iq_new(bd, XEP_IQ_SET, xfer->who, purple_account_get_username(bd->jabber_data->account), xf->sid); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
767 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
768 query = xmlnode_new_child(iq->node, "query"); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
769 xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams"); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
770 xmlnode_set_attrib(query, "sid", xf->sid); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
771 xmlnode_set_attrib(query, "mode", "tcp"); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
772 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
773 xfer->local_port = purple_network_get_port_from_fd(sock); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
774 |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
775 local_ips = bonjour_jabber_get_local_ips(sock); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
776 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
777 port = g_strdup_printf("%hu", xfer->local_port); |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
778 while(local_ips) { |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
779 streamhost = xmlnode_new_child(query, "streamhost"); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
780 xmlnode_set_attrib(streamhost, "jid", xf->sid); |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
781 xmlnode_set_attrib(streamhost, "host", local_ips->data); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
782 xmlnode_set_attrib(streamhost, "port", port); |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
783 g_free(local_ips->data); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
784 local_ips = g_slist_delete_link(local_ips, local_ips); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
785 } |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
786 g_free(port); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
787 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
788 xep_iq_send_and_free(iq); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
789 } |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
790 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
791 static void |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
792 bonjour_bytestreams_init(PurpleXfer *xfer) |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
793 { |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
794 XepXfer *xf; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
795 if(xfer == NULL) |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
796 return; |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
797 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
798 purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
799 xf = xfer->data; |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
800 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
801 purple_network_listen_map_external(FALSE); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
802 xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
803 bonjour_bytestreams_listen, xfer); |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
804 purple_network_listen_map_external(TRUE); |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
805 if (xf->listen_data == NULL) |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
806 purple_xfer_cancel_local(xfer); |
29877
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
28420
diff
changeset
|
807 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
808 return; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
809 } |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
810 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
811 static void |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
812 bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
813 { |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
814 PurpleXfer *xfer = data; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
815 XepXfer *xf = xfer->data; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
816 XepIq *iq; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
817 xmlnode *q_node, *tmp_node; |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
818 BonjourData *bd; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
819 |
23604
3ba2cddc49f0
Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971. (this time only commit the one file instead of my whole tree)
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23603
diff
changeset
|
820 xf->proxy_connection = NULL; |
3ba2cddc49f0
Fix a double free when connecting to the sender of a bonjour file fails. Also plug a small leak. Fixes #5971. (this time only commit the one file instead of my whole tree)
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23603
diff
changeset
|
821 |
21533
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
822 if(source < 0) { |
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
823 purple_debug_error("bonjour", "Error connecting via SOCKS5 - %s\n", |
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
824 error_message ? error_message : "(null)"); |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
825 xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
826 /* Cancel the connection */ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
827 purple_xfer_cancel_local(xfer); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
828 return; |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
829 } |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
830 |
21533
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
831 purple_debug_info("bonjour", "Connected successfully via SOCKS5, starting transfer.\n"); |
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
832 |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
833 bd = xf->data; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
834 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
835 /* Here, start the file transfer.*/ |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
836 |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
837 /* Notify Initiator of Connection */ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
838 iq = xep_iq_new(bd, XEP_IQ_RESULT, xfer->who, purple_account_get_username(bd->jabber_data->account), xf->iq_id); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
839 q_node = xmlnode_new_child(iq->node, "query"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
840 xmlnode_set_namespace(q_node, "http://jabber.org/protocol/bytestreams"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
841 tmp_node = xmlnode_new_child(q_node, "streamhost-used"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
842 xmlnode_set_attrib(tmp_node, "jid", xf->jid); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
843 xep_iq_send_and_free(iq); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
844 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
845 purple_xfer_start(xfer, source, NULL, -1); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
846 } |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
847 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
848 static void |
21533
178fe7d45700
Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21531
diff
changeset
|
849 bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb) |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
850 { |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
851 PurpleAccount *account = NULL; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
852 XepXfer *xf; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
853 char dstaddr[41]; |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
854 const gchar *name = NULL; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
855 unsigned char hashval[20]; |
23020
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22475
diff
changeset
|
856 char *p; |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
857 int i; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
858 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
859 if(xfer == NULL) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
860 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
861 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21465
diff
changeset
|
862 purple_debug_info("bonjour", "bonjour-bytestreams-connect.\n"); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
863 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
864 xf = (XepXfer*)xfer->data; |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
865 if(!xf) |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
866 return; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
867 |
25282
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
868 name = purple_buddy_get_name(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
869 account = purple_buddy_get_account(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
870 |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
23770
diff
changeset
|
871 p = g_strdup_printf("%s%s%s", xf->sid, name, purple_account_get_username(account)); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
872 purple_cipher_digest_region("sha1", (guchar *)p, strlen(p), |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
873 sizeof(hashval), hashval, NULL); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
874 g_free(p); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
875 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
876 memset(dstaddr, 0, 41); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
877 p = dstaddr; |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
878 for(i = 0; i < 20; i++, p += 2) |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
879 snprintf(p, 3, "%02x", hashval[i]); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
880 |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
881 xf->proxy_info = purple_proxy_info_new(); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
882 purple_proxy_info_set_type(xf->proxy_info, PURPLE_PROXY_SOCKS5); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
883 purple_proxy_info_set_host(xf->proxy_info, xf->proxy_host); |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
884 purple_proxy_info_set_port(xf->proxy_info, xf->proxy_port); |
27201
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
25362
diff
changeset
|
885 xf->proxy_connection = purple_proxy_connect_socks5( |
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
25362
diff
changeset
|
886 purple_account_get_connection(account), |
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
25362
diff
changeset
|
887 xf->proxy_info, |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
888 dstaddr, 0, |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
889 bonjour_bytestreams_connect_cb, xfer); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
890 |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
891 if(xf->proxy_connection == NULL) { |
21522
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
892 xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
893 /* Cancel the connection */ |
dc703f13449a
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21467
diff
changeset
|
894 purple_xfer_cancel_local(xfer); |
21440
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
895 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
896 } |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
897 |