Mercurial > pidgin
annotate libpurple/protocols/bonjour/jabber.c @ 22111:603d5325af4c
Prevent a crash caused by freed memory being accessed.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 14 Jan 2008 23:29:52 +0000 |
parents | cc0809ec0c85 |
children | 3225c99785b8 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15822 | 2 * purple - Bonjour Protocol Plugin |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19654
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 */ |
21438
4fe9acb6b514
Some platforms require additional includes before net/if.h, and this
Ethan Blanton <elb@pidgin.im>
parents:
21437
diff
changeset
|
22 |
4fe9acb6b514
Some platforms require additional includes before net/if.h, and this
Ethan Blanton <elb@pidgin.im>
parents:
21437
diff
changeset
|
23 #include "internal.h" |
4fe9acb6b514
Some platforms require additional includes before net/if.h, and this
Ethan Blanton <elb@pidgin.im>
parents:
21437
diff
changeset
|
24 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #ifndef _WIN32 |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
26 #include <net/if.h> |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
27 #include <sys/ioctl.h> |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include <sys/socket.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include <netinet/in.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include <arpa/inet.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "libc_interface.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include <sys/types.h> |
21802
d01d9107f263
Fix #4079 for real.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21797
diff
changeset
|
35 |
d01d9107f263
Fix #4079 for real.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21797
diff
changeset
|
36 /* Solaris */ |
d01d9107f263
Fix #4079 for real.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21797
diff
changeset
|
37 #if defined (__SVR4) && defined (__sun) |
d01d9107f263
Fix #4079 for real.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21797
diff
changeset
|
38 #include <sys/sockio.h> |
d01d9107f263
Fix #4079 for real.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21797
diff
changeset
|
39 #endif |
d01d9107f263
Fix #4079 for real.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21797
diff
changeset
|
40 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include <glib.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include <unistd.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include <fcntl.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include "network.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 #include "eventloop.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #include "connection.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 #include "blist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 #include "jabber.h" |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
55 #include "parser.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 #include "bonjour.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 #include "buddy.h" |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
58 #include "bonjour_ft.h" |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
59 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
60 #ifdef _SIZEOF_ADDR_IFREQ |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
61 # define HX_SIZE_OF_IFREQ(a) _SIZEOF_ADDR_IFREQ(a) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
62 #else |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
63 # define HX_SIZE_OF_IFREQ(a) sizeof(a) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
64 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 |
17554
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
66 #define STREAM_END "</stream:stream>" |
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
67 /* TODO: specify version='1.0' and send stream features */ |
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
68 #define DOCTYPE "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" \ |
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
69 "<stream:stream xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" from=\"%s\" to=\"%s\">" |
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
70 |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
71 enum sent_stream_start_types { |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
72 NOT_SENT = 0, |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
73 PARTIALLY_SENT = 1, |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
74 FULLY_SENT = 2 |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
75 }; |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
76 |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
77 static void |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
78 xep_iq_parse(xmlnode *packet, PurpleConnection *connection, PurpleBuddy *pb); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
79 |
17555
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
80 static BonjourJabberConversation * |
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:
21820
diff
changeset
|
81 bonjour_jabber_conv_new(PurpleBuddy *pb, PurpleAccount *account, const char *ip) { |
17555
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
82 |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
83 BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1); |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
84 bconv->socket = -1; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
85 bconv->tx_buf = purple_circ_buffer_new(512); |
19399
649ac48fce1d
Reset unsigned int input handlers to 0 instead of -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19233
diff
changeset
|
86 bconv->tx_handler = 0; |
649ac48fce1d
Reset unsigned int input handlers to 0 instead of -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19233
diff
changeset
|
87 bconv->rx_handler = 0; |
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:
21466
diff
changeset
|
88 bconv->pb = pb; |
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:
21820
diff
changeset
|
89 bconv->account = account; |
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:
21820
diff
changeset
|
90 bconv->ip = g_strdup(ip); |
17555
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
91 |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
92 bonjour_parser_setup(bconv); |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
93 |
17555
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
94 return bconv; |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
95 } |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
96 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 static const char * |
15822 | 98 _font_size_ichat_to_purple(int size) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 if (size > 24) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 return "7"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 } else if (size >= 21) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 return "6"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 } else if (size >= 17) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 return "5"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 } else if (size >= 14) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 return "4"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 } else if (size >= 12) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 return "3"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 } else if (size >= 10) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 return "2"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 return "1"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 } |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
116 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 static void |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
118 _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 { |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
120 xmlnode *body_node, *html_node, *events_node; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
121 PurpleConnection *gc = pb->account->gc; |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
122 gchar *body = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 gboolean composing_event = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
125 body_node = xmlnode_get_child(message_node, "body"); |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
126 html_node = xmlnode_get_child(message_node, "html"); |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
127 |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
128 if (body_node == NULL && html_node == NULL) { |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
129 purple_debug_error("bonjour", "No body or html node found, discarding message.\n"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 return; |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
131 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
133 events_node = xmlnode_get_child_with_namespace(message_node, "x", "jabber:x:event"); |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
134 if (events_node != NULL) { |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
135 if (xmlnode_get_child(events_node, "composing") != NULL) |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
136 composing_event = TRUE; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
137 if (xmlnode_get_child(events_node, "id") != NULL) { |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
138 /* The user is just typing */ |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
139 /* TODO: Deal with typing notification */ |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
140 return; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
141 } |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
142 } |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
143 |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
144 if (html_node != NULL) { |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
145 xmlnode *html_body_node; |
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
146 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 html_body_node = xmlnode_get_child(html_node, "body"); |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
148 if (html_body_node != NULL) { |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
149 xmlnode *html_body_font_node; |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
150 const char *ichat_balloon_color = NULL; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
151 const char *ichat_text_color = NULL; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
152 const char *font_face = NULL; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
153 const char *font_size = NULL; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
154 const char *font_color = NULL; |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
155 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 html_body_font_node = xmlnode_get_child(html_body_node, "font"); |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
159 |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
160 /* Types of messages sent by iChat */ |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
161 if (html_body_font_node != NULL) { |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
162 gchar *html_body; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
163 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 font_face = xmlnode_get_attrib(html_body_font_node, "face"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 /* The absolute iChat font sizes should be converted to 1..7 range */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 font_size = xmlnode_get_attrib(html_body_font_node, "ABSZ"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 if (font_size != NULL) |
15822 | 168 font_size = _font_size_ichat_to_purple(atoi(font_size)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 font_color = xmlnode_get_attrib(html_body_font_node, "color"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 html_body = xmlnode_get_data(html_body_font_node); |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
171 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 if (html_body == NULL) |
15822 | 173 /* This is the kind of formated messages that Purple creates */ |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
174 html_body = xmlnode_to_str(html_body_font_node, NULL); |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
175 |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
176 if (html_body != NULL) { |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
177 /* Use some sane defaults */ |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
178 if (font_face == NULL) font_face = "Helvetica"; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
179 if (font_size == NULL) font_size = "3"; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
180 if (ichat_text_color == NULL) ichat_text_color = "#000000"; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
181 if (ichat_balloon_color == NULL) ichat_balloon_color = "#FFFFFF"; |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
182 |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
183 body = g_strdup_printf("<font face='%s' size='%s' color='%s' back='%s'>%s</font>", |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
184 font_face, font_size, ichat_text_color, ichat_balloon_color, |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
185 html_body); |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
186 |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
187 g_free(html_body); |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
188 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
193 /* Compose the message */ |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
194 if (body == NULL && body_node != NULL) |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
195 body = xmlnode_get_data(body_node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
197 if (body == NULL) { |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
198 purple_debug_error("bonjour", "No html body or regular body found.\n"); |
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
199 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 /* Send the message to the UI */ |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
203 serv_got_im(gc, pb->name, body, 0, time(NULL)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 g_free(body); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 |
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:
21820
diff
changeset
|
208 struct _match_buddies_by_address_t { |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
209 const char *address; |
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:
21820
diff
changeset
|
210 GSList *matched_buddies; |
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:
21820
diff
changeset
|
211 BonjourJabber *jdata; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 static void |
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:
21820
diff
changeset
|
215 _match_buddies_by_address(gpointer key, gpointer value, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 { |
17554
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
217 PurpleBuddy *pb = value; |
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:
21820
diff
changeset
|
218 struct _match_buddies_by_address_t *mbba = data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 /* |
15822 | 221 * If the current PurpleBuddy's data is not null and the PurpleBuddy's account |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 * is the same as the account requesting the check then continue to determine |
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:
21802
diff
changeset
|
223 * whether one of the buddies IPs matches the target IP. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 */ |
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:
21820
diff
changeset
|
225 if (mbba->jdata->account == pb->account && pb->proto_data != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 { |
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:
21820
diff
changeset
|
227 const char *ip; |
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:
21820
diff
changeset
|
228 BonjourBuddy *bb = pb->proto_data; |
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:
21820
diff
changeset
|
229 GSList *tmp = bb->ips; |
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:
21802
diff
changeset
|
230 |
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:
21820
diff
changeset
|
231 while(tmp) { |
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:
21820
diff
changeset
|
232 ip = tmp->data; |
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:
21820
diff
changeset
|
233 if (ip != NULL && g_ascii_strcasecmp(ip, mbba->address) == 0) { |
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:
21820
diff
changeset
|
234 mbba->matched_buddies = g_slist_prepend(mbba->matched_buddies, pb); |
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:
21820
diff
changeset
|
235 break; |
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:
21802
diff
changeset
|
236 } |
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:
21820
diff
changeset
|
237 tmp = tmp->next; |
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:
21802
diff
changeset
|
238 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
242 static void |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
243 _send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 { |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
245 PurpleBuddy *pb = data; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
246 BonjourBuddy *bb = pb->proto_data; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
247 BonjourJabberConversation *bconv = bb->conversation; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
248 int ret, writelen; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
249 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
250 writelen = purple_circ_buffer_get_max_read(bconv->tx_buf); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
251 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
252 if (writelen == 0) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
253 purple_input_remove(bconv->tx_handler); |
19399
649ac48fce1d
Reset unsigned int input handlers to 0 instead of -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19233
diff
changeset
|
254 bconv->tx_handler = 0; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
255 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
256 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
258 ret = send(bconv->socket, bconv->tx_buf->outptr, writelen, 0); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
259 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
260 if (ret < 0 && errno == EAGAIN) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
261 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
262 else if (ret <= 0) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
263 PurpleConversation *conv; |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
264 const char *error = g_strerror(errno); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
265 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
266 purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
267 purple_buddy_get_name(pb), error ? error : "(null)"); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
268 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
269 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
270 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
271 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
272 _("Unable to send message."), |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
273 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
274 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
275 bonjour_jabber_close_conversation(bb->conversation); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
276 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
277 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
280 purple_circ_buffer_mark_read(bconv->tx_buf, ret); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
281 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
282 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
283 static gint |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
284 _send_data(PurpleBuddy *pb, char *message) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
285 { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
286 gint ret; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
287 int len = strlen(message); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
288 BonjourBuddy *bb = pb->proto_data; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
289 BonjourJabberConversation *bconv = bb->conversation; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
290 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
291 /* If we're not ready to actually send, append it to the buffer */ |
19399
649ac48fce1d
Reset unsigned int input handlers to 0 instead of -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19233
diff
changeset
|
292 if (bconv->tx_handler != 0 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
293 || bconv->connect_data != NULL |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
294 || bconv->sent_stream_start != FULLY_SENT |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
295 || !bconv->recv_stream_start |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
296 || purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
297 ret = -1; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
298 errno = EAGAIN; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
299 } else { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
300 ret = send(bconv->socket, message, len, 0); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
301 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
302 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
303 if (ret == -1 && errno == EAGAIN) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
304 ret = 0; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
305 else if (ret <= 0) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
306 PurpleConversation *conv; |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
307 const char *error = g_strerror(errno); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
308 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
309 purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
310 purple_buddy_get_name(pb), error ? error : "(null)"); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
311 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
312 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
313 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
314 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
315 _("Unable to send message."), |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
316 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
317 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
318 bonjour_jabber_close_conversation(bb->conversation); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
319 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
320 return -1; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
321 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
322 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
323 if (ret < len) { |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
324 /* Don't interfere with the stream starting */ |
21820
509871e4f61c
Cleanup to prevent unnecessary alloc/free. Also a small fix to remove the possiblity that a message will be sent before the stream is started.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21806
diff
changeset
|
325 if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start && bconv->tx_handler == 0) |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
326 bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
327 _send_data_write_cb, pb); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
328 purple_circ_buffer_append(bconv->tx_buf, message + ret, len - ret); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
329 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
330 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
331 return ret; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
334 void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet) { |
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
|
335 |
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
|
336 g_return_if_fail(packet != 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:
21820
diff
changeset
|
337 g_return_if_fail(pb != NULL); |
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
|
338 |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
339 if (!strcmp(packet->name, "message")) |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
340 _jabber_parse_and_write_message_to_ui(packet, pb); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
341 else if(!strcmp(packet->name, "iq")) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
342 xep_iq_parse(packet, NULL, pb); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
343 else |
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
|
344 purple_debug_warning("bonjour", "Unknown packet: %s\n", packet->name ? packet->name : "(null)"); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
345 } |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
346 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
347 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 static void |
15822 | 349 _client_socket_handler(gpointer data, gint socket, PurpleInputCondition condition) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 { |
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:
21820
diff
changeset
|
351 BonjourJabberConversation *bconv = data; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
352 gint len, message_length; |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
353 static char message[4096]; |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
354 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 /* Read the data from the socket */ |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
356 if ((len = recv(socket, message, sizeof(message) - 1, 0)) == -1) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 /* There have been an error reading from the socket */ |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
358 if (errno != EAGAIN) { |
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
|
359 const char *err = g_strerror(errno); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
360 |
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
|
361 purple_debug_warning("bonjour", "receive error: %s\n", err ? err : "(null)"); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
362 |
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:
21820
diff
changeset
|
363 bonjour_jabber_close_conversation(bconv); |
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:
21820
diff
changeset
|
364 if (bconv->pb != NULL) { |
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:
21820
diff
changeset
|
365 BonjourBuddy *bb = bconv->pb->proto_data; |
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:
21820
diff
changeset
|
366 bb->conversation = NULL; |
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:
21820
diff
changeset
|
367 } |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
368 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
369 /* I guess we really don't need to notify the user. |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
370 * If they try to send another message it'll reconnect */ |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
371 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 return; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
373 } else if (len == 0) { /* The other end has closed the socket */ |
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:
21820
diff
changeset
|
374 purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", (bconv->pb && bconv->pb->name) ? bconv->pb->name : "(unknown)"); |
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:
21820
diff
changeset
|
375 bonjour_jabber_stream_ended(bconv); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
376 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 } else { |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
378 message_length = len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 message[message_length] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
381 while (message_length > 0 && g_ascii_iscntrl(message[message_length - 1])) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 message[message_length - 1] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 message_length--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
387 purple_debug_info("bonjour", "Receive: -%s- %d bytes\n", message, len); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
388 |
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:
21820
diff
changeset
|
389 bonjour_parser_process(bconv, message, message_length); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
390 } |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
391 |
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:
21820
diff
changeset
|
392 void bonjour_jabber_stream_ended(BonjourJabberConversation *bconv) { |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
393 |
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:
21820
diff
changeset
|
394 purple_debug_info("bonjour", "Recieved conversation close notification from %s.\n", bconv->pb ? bconv->pb->name : "(unknown)"); |
19233
6e3cd5e80420
Don't trigger another libxml2 parse from within one of the parsing callbacks. References #1652.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18761
diff
changeset
|
395 |
19574
917b6f45c458
Prevent duplicate window closed notifications.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19399
diff
changeset
|
396 /* Inform the user that the conversation has been closed */ |
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:
21820
diff
changeset
|
397 if (bconv != NULL) { |
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:
21820
diff
changeset
|
398 BonjourBuddy *bb = NULL; |
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:
21820
diff
changeset
|
399 |
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:
21820
diff
changeset
|
400 if(bconv->pb != NULL) |
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:
21820
diff
changeset
|
401 bb = bconv->pb->proto_data; |
21007
d55617a15301
don't assume </stream:stream> means the conversation window is closed. Fixes #3690
Sean Egan <seanegan@gmail.com>
parents:
20347
diff
changeset
|
402 #if 0 |
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:
21820
diff
changeset
|
403 if(bconv->pb != NULL) { |
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:
21820
diff
changeset
|
404 PurpleConversation *conv; |
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:
21820
diff
changeset
|
405 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bconv->pb->name, bconv->pb->account); |
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:
21820
diff
changeset
|
406 if (conv != NULL) { |
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:
21820
diff
changeset
|
407 char *tmp = g_strdup_printf(_("%s has closed the conversation."), bconv->pb->name); |
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:
21820
diff
changeset
|
408 purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
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:
21820
diff
changeset
|
409 g_free(tmp); |
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:
21820
diff
changeset
|
410 } |
19574
917b6f45c458
Prevent duplicate window closed notifications.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19399
diff
changeset
|
411 } |
21007
d55617a15301
don't assume </stream:stream> means the conversation window is closed. Fixes #3690
Sean Egan <seanegan@gmail.com>
parents:
20347
diff
changeset
|
412 #endif |
19574
917b6f45c458
Prevent duplicate window closed notifications.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19399
diff
changeset
|
413 /* Close the socket, clear the watcher and free memory */ |
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:
21820
diff
changeset
|
414 bonjour_jabber_close_conversation(bconv); |
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:
21820
diff
changeset
|
415 if(bb) |
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:
21820
diff
changeset
|
416 bb->conversation = NULL; |
19574
917b6f45c458
Prevent duplicate window closed notifications.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19399
diff
changeset
|
417 } |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
418 } |
18651
b981d3c39d0b
Fix memory leak (also includes an efficiency rearrangement for the xmlnode parsing that has been sitting on my machine for a while).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18276
diff
changeset
|
419 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
421 struct _stream_start_data { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
422 char *msg; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
423 }; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
424 |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
425 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
426 static void |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
427 _start_stream(gpointer data, gint source, PurpleInputCondition condition) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
428 { |
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:
21820
diff
changeset
|
429 BonjourJabberConversation *bconv = data; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
430 struct _stream_start_data *ss = bconv->stream_data; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
431 int len, ret; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
432 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
433 len = strlen(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
434 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
435 /* Start Stream */ |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
436 ret = send(source, ss->msg, len, 0); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
437 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
438 if (ret == -1 && errno == EAGAIN) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
439 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
440 else if (ret <= 0) { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
441 const char *err = g_strerror(errno); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
442 PurpleConversation *conv; |
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:
21820
diff
changeset
|
443 const char *bname = bconv->buddy_name; |
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:
21820
diff
changeset
|
444 BonjourBuddy *bb = NULL; |
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:
21802
diff
changeset
|
445 |
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:
21820
diff
changeset
|
446 if(bconv->pb) { |
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:
21820
diff
changeset
|
447 bb = bconv->pb->proto_data; |
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:
21820
diff
changeset
|
448 bname = purple_buddy_get_name(bconv->pb); |
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:
21820
diff
changeset
|
449 } |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
450 |
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:
21820
diff
changeset
|
451 purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", |
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:
21820
diff
changeset
|
452 bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
453 |
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:
21820
diff
changeset
|
454 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
455 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
456 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
457 _("Unable to send the message, the conversation couldn't be started."), |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
458 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
459 |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
460 bonjour_jabber_close_conversation(bconv); |
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:
21820
diff
changeset
|
461 if(bb != NULL) |
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:
21820
diff
changeset
|
462 bb->conversation = NULL; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
463 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
464 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
465 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
466 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
467 /* This is EXTREMELY unlikely to happen */ |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
468 if (ret < len) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
469 char *tmp = g_strdup(ss->msg + ret); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
470 g_free(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
471 ss->msg = tmp; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
472 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
473 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
474 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
475 g_free(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
476 g_free(ss); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
477 bconv->stream_data = NULL; |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
478 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
479 /* Stream started; process the send buffer if there is one */ |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
480 purple_input_remove(bconv->tx_handler); |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
481 bconv->tx_handler = 0; |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
482 bconv->sent_stream_start = FULLY_SENT; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
483 |
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:
21820
diff
changeset
|
484 bonjour_jabber_stream_started(bconv); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
485 } |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
486 |
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:
21820
diff
changeset
|
487 static gboolean bonjour_jabber_send_stream_init(BonjourJabberConversation *bconv, int client_socket) |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
488 { |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
489 int ret, len; |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
490 char *stream_start; |
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:
21820
diff
changeset
|
491 const char *bname = bconv->buddy_name; |
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:
21820
diff
changeset
|
492 |
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:
21820
diff
changeset
|
493 if (bconv->pb != NULL) |
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:
21820
diff
changeset
|
494 bname = purple_buddy_get_name(bconv->pb); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
495 |
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:
21820
diff
changeset
|
496 /* If we have no idea who "to" is, use an empty string. |
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:
21820
diff
changeset
|
497 * If we don't know now, it is because the other side isn't playing nice, so they can't complain. */ |
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:
21820
diff
changeset
|
498 if (bname == NULL) |
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:
21820
diff
changeset
|
499 bname = ""; |
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:
21820
diff
changeset
|
500 |
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:
21820
diff
changeset
|
501 stream_start = g_strdup_printf(DOCTYPE, purple_account_get_username(bconv->account), bname); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
502 len = strlen(stream_start); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
503 |
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:
21820
diff
changeset
|
504 bconv->sent_stream_start = PARTIALLY_SENT; |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
505 |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
506 /* Start the stream */ |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
507 ret = send(client_socket, stream_start, len, 0); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
508 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
509 if (ret == -1 && errno == EAGAIN) |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
510 ret = 0; |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
511 else if (ret <= 0) { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
512 const char *err = g_strerror(errno); |
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:
21820
diff
changeset
|
513 |
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:
21820
diff
changeset
|
514 purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", |
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:
21820
diff
changeset
|
515 (*bname) ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); |
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:
21802
diff
changeset
|
516 |
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:
21820
diff
changeset
|
517 if (bconv->pb) { |
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:
21820
diff
changeset
|
518 PurpleConversation *conv; |
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:
21820
diff
changeset
|
519 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); |
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:
21820
diff
changeset
|
520 if (conv != NULL) |
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:
21820
diff
changeset
|
521 purple_conversation_write(conv, NULL, |
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:
21820
diff
changeset
|
522 _("Unable to send the message, the conversation couldn't be started."), |
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:
21820
diff
changeset
|
523 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
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:
21820
diff
changeset
|
524 } |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
525 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
526 close(client_socket); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
527 g_free(stream_start); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
528 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
529 return FALSE; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
530 } |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
531 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
532 /* This is unlikely to happen */ |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
533 if (ret < len) { |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
534 struct _stream_start_data *ss = g_new(struct _stream_start_data, 1); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
535 ss->msg = g_strdup(stream_start + ret); |
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:
21820
diff
changeset
|
536 bconv->stream_data = ss; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
537 /* Finish sending the stream start */ |
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:
21820
diff
changeset
|
538 bconv->tx_handler = purple_input_add(client_socket, |
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:
21820
diff
changeset
|
539 PURPLE_INPUT_WRITE, _start_stream, bconv); |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
540 } else |
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:
21820
diff
changeset
|
541 bconv->sent_stream_start = FULLY_SENT; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
542 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
543 g_free(stream_start); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
544 |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
545 return TRUE; |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
546 } |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
547 |
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:
21820
diff
changeset
|
548 /* This gets called when we've successfully sent our <stream:stream /> |
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:
21820
diff
changeset
|
549 * AND when we've recieved a <stream:stream /> */ |
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:
21820
diff
changeset
|
550 void bonjour_jabber_stream_started(BonjourJabberConversation *bconv) { |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
551 |
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:
21820
diff
changeset
|
552 if (bconv->sent_stream_start == NOT_SENT && !bonjour_jabber_send_stream_init(bconv, bconv->socket)) { |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
553 const char *err = g_strerror(errno); |
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:
21820
diff
changeset
|
554 const char *bname = bconv->buddy_name; |
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:
21802
diff
changeset
|
555 |
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:
21820
diff
changeset
|
556 if (bconv->pb) |
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:
21820
diff
changeset
|
557 bname = purple_buddy_get_name(bconv->pb); |
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:
21820
diff
changeset
|
558 |
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:
21820
diff
changeset
|
559 purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", |
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:
21820
diff
changeset
|
560 bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
561 |
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:
21820
diff
changeset
|
562 if (bconv->pb) { |
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:
21820
diff
changeset
|
563 PurpleConversation *conv; |
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:
21820
diff
changeset
|
564 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); |
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:
21820
diff
changeset
|
565 if (conv != NULL) |
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:
21820
diff
changeset
|
566 purple_conversation_write(conv, NULL, |
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:
21820
diff
changeset
|
567 _("Unable to send the message, the conversation couldn't be started."), |
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:
21820
diff
changeset
|
568 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
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:
21820
diff
changeset
|
569 } |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
570 |
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:
21820
diff
changeset
|
571 /* We don't want to recieve anything else */ |
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:
21820
diff
changeset
|
572 close(bconv->socket); |
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:
21820
diff
changeset
|
573 bconv->socket = -1; |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
574 |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
575 /* This must be asynchronous because it destroys the parser and we |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
576 * may be in the middle of parsing. |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
577 */ |
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:
21820
diff
changeset
|
578 async_bonjour_jabber_close_conversation(bconv); |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
579 return; |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
580 } |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
581 |
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:
21820
diff
changeset
|
582 /* If the stream has been completely started and we know who we're talking to, we can start doing stuff. */ |
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:
21820
diff
changeset
|
583 /* I don't think the circ_buffer can actually contain anything without a buddy being associated, but lets be explicit. */ |
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:
21820
diff
changeset
|
584 if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start |
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:
21820
diff
changeset
|
585 && bconv->pb && purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
586 /* Watch for when we can write the buffered messages */ |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
587 bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, |
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:
21820
diff
changeset
|
588 _send_data_write_cb, bconv->pb); |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
589 /* We can probably write the data right now. */ |
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:
21820
diff
changeset
|
590 _send_data_write_cb(bconv->pb, bconv->socket, PURPLE_INPUT_WRITE); |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
591 } |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
592 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
593 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
594 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 static void |
15822 | 596 _server_socket_handler(gpointer data, int server_socket, PurpleInputCondition condition) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 { |
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:
21820
diff
changeset
|
598 BonjourJabber *jdata = data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 struct sockaddr_in their_addr; /* connector's address information */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 socklen_t sin_size = sizeof(struct sockaddr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 int client_socket; |
20347
04fe5601fedb
applied changes from 2762c6075c0dc52a96098c5478c5bf68cfd890a3
Luke Schierer <lschiere@pidgin.im>
parents:
19681
diff
changeset
|
602 int flags; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 char *address_text = 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:
21820
diff
changeset
|
604 struct _match_buddies_by_address_t *mbba; |
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:
21820
diff
changeset
|
605 BonjourJabberConversation *bconv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 /* Check that it is a read condition */ |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
608 if (condition != PURPLE_INPUT_READ) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 if ((client_socket = accept(server_socket, (struct sockaddr *)&their_addr, &sin_size)) == -1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 return; |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
613 |
20347
04fe5601fedb
applied changes from 2762c6075c0dc52a96098c5478c5bf68cfd890a3
Luke Schierer <lschiere@pidgin.im>
parents:
19681
diff
changeset
|
614 flags = fcntl(client_socket, F_GETFL); |
04fe5601fedb
applied changes from 2762c6075c0dc52a96098c5478c5bf68cfd890a3
Luke Schierer <lschiere@pidgin.im>
parents:
19681
diff
changeset
|
615 fcntl(client_socket, F_SETFL, flags | O_NONBLOCK); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 /* Look for the buddy that has opened the conversation and fill information */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 address_text = inet_ntoa(their_addr.sin_addr); |
19654
941965d6fd88
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19574
diff
changeset
|
619 purple_debug_info("bonjour", "Received incoming connection from %s.\n", address_text); |
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:
21820
diff
changeset
|
620 mbba = g_new0(struct _match_buddies_by_address_t, 1); |
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:
21820
diff
changeset
|
621 mbba->address = address_text; |
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:
21820
diff
changeset
|
622 mbba->jdata = jdata; |
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:
21820
diff
changeset
|
623 g_hash_table_foreach(purple_get_blist()->buddies, _match_buddies_by_address, mbba); |
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:
21820
diff
changeset
|
624 |
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:
21820
diff
changeset
|
625 if (mbba->matched_buddies == NULL) { |
15822 | 626 purple_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n"); |
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:
21820
diff
changeset
|
627 g_slist_free(mbba->matched_buddies); |
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:
21820
diff
changeset
|
628 g_free(mbba); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 close(client_socket); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 |
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:
21820
diff
changeset
|
633 g_slist_free(mbba->matched_buddies); |
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:
21820
diff
changeset
|
634 g_free(mbba); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
635 |
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:
21820
diff
changeset
|
636 /* We've established that this *could* be from one of our buddies. |
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:
21820
diff
changeset
|
637 * Wait for the stream open to see if that matches too before assigning it. |
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:
21820
diff
changeset
|
638 */ |
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:
21820
diff
changeset
|
639 bconv = bonjour_jabber_conv_new(NULL, jdata->account, address_text); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
640 |
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:
21820
diff
changeset
|
641 /* We wait for the stream start before doing anything else */ |
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:
21820
diff
changeset
|
642 bconv->socket = client_socket; |
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:
21820
diff
changeset
|
643 bconv->rx_handler = purple_input_add(client_socket, PURPLE_INPUT_READ, _client_socket_handler, bconv); |
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:
21820
diff
changeset
|
644 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 gint |
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:
21820
diff
changeset
|
648 bonjour_jabber_start(BonjourJabber *jdata) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 struct sockaddr_in my_addr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 int yes = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 gboolean bind_successful; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 /* Open a listening socket for incoming conversations */ |
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:
21820
diff
changeset
|
656 if ((jdata->socket = socket(PF_INET, SOCK_STREAM, 0)) < 0) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
658 purple_debug_error("bonjour", "Cannot open socket: %s\n", g_strerror(errno)); |
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:
21820
diff
changeset
|
659 purple_connection_error_reason (jdata->account->gc, |
21358 | 660 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
661 _("Cannot open socket")); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 /* Make the socket reusable */ |
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:
21820
diff
changeset
|
666 if (setsockopt(jdata->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
668 purple_debug_error("bonjour", "Error setting socket options: %s\n", g_strerror(errno)); |
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:
21820
diff
changeset
|
669 purple_connection_error_reason (jdata->account->gc, |
21358 | 670 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
671 _("Error setting socket options")); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 memset(&my_addr, 0, sizeof(struct sockaddr_in)); |
21696
fded60f269bc
Don't advertise our presence in avahi on IPv6 or listen for sevices since we don't support receiving connections from or connecting to IPv6 buddies. If someone needs to do that, they can submit a patch. Fixes #4188.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21667
diff
changeset
|
676 my_addr.sin_family = AF_INET; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 /* Attempt to find a free port */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 bind_successful = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 for (i = 0; i < 10; i++) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 { |
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:
21820
diff
changeset
|
682 my_addr.sin_port = htons(jdata->port); |
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:
21820
diff
changeset
|
683 if (bind(jdata->socket, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) == 0) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 bind_successful = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 } |
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:
21820
diff
changeset
|
688 jdata->port++; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 /* On no! We tried 10 ports and could not bind to ANY of them */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 if (!bind_successful) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
694 purple_debug_error("bonjour", "Cannot bind socket: %s\n", g_strerror(errno)); |
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:
21820
diff
changeset
|
695 purple_connection_error_reason (jdata->account->gc, |
21358 | 696 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
697 _("Could not bind socket to port")); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 /* Attempt to listen on the bound socket */ |
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:
21820
diff
changeset
|
702 if (listen(jdata->socket, 10) != 0) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
704 purple_debug_error("bonjour", "Cannot listen on socket: %s\n", g_strerror(errno)); |
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:
21820
diff
changeset
|
705 purple_connection_error_reason (jdata->account->gc, |
21358 | 706 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
707 _("Could not listen on socket")); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 /* TODO: Why isn't this being used? */ |
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:
21820
diff
changeset
|
713 data->socket = purple_network_listen(jdata->port, SOCK_STREAM); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 |
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:
21820
diff
changeset
|
715 if (jdata->socket == -1) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 { |
15822 | 717 purple_debug_error("bonjour", "No se ha podido crear el socket\n"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 /* Open a watcher in the socket we have just opened */ |
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:
21820
diff
changeset
|
722 jdata->watcher_id = purple_input_add(jdata->socket, PURPLE_INPUT_READ, _server_socket_handler, jdata); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 |
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:
21820
diff
changeset
|
724 return jdata->port; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
727 static void |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
728 _connected_to_buddy(gpointer data, gint source, const gchar *error) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
729 { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
730 PurpleBuddy *pb = data; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
731 BonjourBuddy *bb = pb->proto_data; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
732 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
733 bb->conversation->connect_data = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
734 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
735 if (source < 0) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
736 PurpleConversation *conv; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
737 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
738 purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n", |
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:
21820
diff
changeset
|
739 purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error ? error : "(null)"); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
740 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
741 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
742 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
743 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
744 _("Unable to send the message, the conversation couldn't be started."), |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
745 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
746 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
747 bonjour_jabber_close_conversation(bb->conversation); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
748 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
749 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
750 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
751 |
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:
21820
diff
changeset
|
752 if (!bonjour_jabber_send_stream_init(bb->conversation, source)) { |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
753 const char *err = g_strerror(errno); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
754 PurpleConversation *conv; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
755 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
756 purple_debug_error("bonjour", "Error starting stream with buddy %s at %s:%d error: %s\n", |
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:
21820
diff
changeset
|
757 purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, err ? err : "(null)"); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
758 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
759 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, pb->account); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
760 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
761 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
762 _("Unable to send the message, the conversation couldn't be started."), |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
763 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
764 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
765 close(source); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
766 bonjour_jabber_close_conversation(bb->conversation); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
767 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
768 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
769 } |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
770 |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
771 /* Start listening for the stream acknowledgement */ |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
772 bb->conversation->socket = source; |
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
773 bb->conversation->rx_handler = purple_input_add(source, |
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:
21820
diff
changeset
|
774 PURPLE_INPUT_READ, _client_socket_handler, bb->conversation); |
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:
21820
diff
changeset
|
775 } |
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:
21820
diff
changeset
|
776 |
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:
21820
diff
changeset
|
777 void |
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:
21820
diff
changeset
|
778 bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { |
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:
21820
diff
changeset
|
779 PurpleBuddy *pb; |
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:
21820
diff
changeset
|
780 |
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:
21820
diff
changeset
|
781 g_return_if_fail(bconv->ip != NULL); |
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:
21820
diff
changeset
|
782 g_return_if_fail(bconv->pb == NULL); |
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:
21820
diff
changeset
|
783 |
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:
21820
diff
changeset
|
784 pb = purple_find_buddy(bconv->account, bconv->buddy_name); |
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:
21820
diff
changeset
|
785 if (pb && pb->proto_data) { |
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:
21820
diff
changeset
|
786 BonjourBuddy *bb = pb->proto_data; |
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:
21820
diff
changeset
|
787 const char *ip; |
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:
21820
diff
changeset
|
788 GSList *tmp = bb->ips; |
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:
21820
diff
changeset
|
789 |
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:
21820
diff
changeset
|
790 purple_debug_info("bonjour", "Found buddy %s for incoming conversation \"from\" attrib.\n", |
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:
21820
diff
changeset
|
791 purple_buddy_get_name(pb)); |
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:
21820
diff
changeset
|
792 |
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:
21820
diff
changeset
|
793 /* Check that one of the buddy's IPs matches */ |
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:
21820
diff
changeset
|
794 while(tmp) { |
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:
21820
diff
changeset
|
795 ip = tmp->data; |
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:
21820
diff
changeset
|
796 if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) { |
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:
21820
diff
changeset
|
797 BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; |
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:
21820
diff
changeset
|
798 |
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:
21820
diff
changeset
|
799 purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n", |
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:
21820
diff
changeset
|
800 purple_buddy_get_name(pb), bconv->ip); |
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:
21820
diff
changeset
|
801 |
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:
21820
diff
changeset
|
802 /* Attach conv. to buddy and remove from pending list */ |
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:
21820
diff
changeset
|
803 jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); |
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:
21820
diff
changeset
|
804 |
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:
21820
diff
changeset
|
805 /* Check if the buddy already has a conversation and, if so, replace it */ |
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:
21820
diff
changeset
|
806 if(bb->conversation != NULL && bb->conversation != bconv) |
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:
21820
diff
changeset
|
807 bonjour_jabber_close_conversation(bb->conversation); |
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:
21820
diff
changeset
|
808 |
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:
21820
diff
changeset
|
809 bconv->pb = pb; |
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:
21820
diff
changeset
|
810 bb->conversation = bconv; |
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:
21820
diff
changeset
|
811 |
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:
21820
diff
changeset
|
812 break; |
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:
21820
diff
changeset
|
813 } |
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:
21820
diff
changeset
|
814 tmp = tmp->next; |
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:
21820
diff
changeset
|
815 } |
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:
21820
diff
changeset
|
816 } |
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:
21820
diff
changeset
|
817 |
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:
21820
diff
changeset
|
818 /* We've failed to match a buddy - give up */ |
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:
21820
diff
changeset
|
819 if (bconv->pb == NULL) { |
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:
21820
diff
changeset
|
820 /* This must be asynchronous because it destroys the parser and we |
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:
21820
diff
changeset
|
821 * may be in the middle of parsing. |
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:
21820
diff
changeset
|
822 */ |
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:
21820
diff
changeset
|
823 async_bonjour_jabber_close_conversation(bconv); |
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:
21820
diff
changeset
|
824 } |
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:
21820
diff
changeset
|
825 } |
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:
21820
diff
changeset
|
826 |
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:
21820
diff
changeset
|
827 |
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:
21820
diff
changeset
|
828 void |
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:
21820
diff
changeset
|
829 bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { |
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:
21820
diff
changeset
|
830 BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; |
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:
21820
diff
changeset
|
831 struct _match_buddies_by_address_t *mbba; |
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:
21820
diff
changeset
|
832 |
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:
21820
diff
changeset
|
833 mbba = g_new0(struct _match_buddies_by_address_t, 1); |
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:
21820
diff
changeset
|
834 mbba->address = bconv->ip; |
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:
21820
diff
changeset
|
835 mbba->jdata = jdata; |
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:
21820
diff
changeset
|
836 g_hash_table_foreach(purple_get_blist()->buddies, _match_buddies_by_address, mbba); |
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:
21820
diff
changeset
|
837 |
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:
21820
diff
changeset
|
838 /* If there is exactly one match, use it */ |
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:
21820
diff
changeset
|
839 if(mbba->matched_buddies != NULL) { |
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:
21820
diff
changeset
|
840 if(mbba->matched_buddies->next != NULL) |
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:
21820
diff
changeset
|
841 purple_debug_error("bonjour", "More than one buddy matched for ip %s.\n", bconv->ip); |
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:
21820
diff
changeset
|
842 else { |
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:
21820
diff
changeset
|
843 PurpleBuddy *pb = mbba->matched_buddies->data; |
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:
21820
diff
changeset
|
844 BonjourBuddy *bb = pb->proto_data; |
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:
21820
diff
changeset
|
845 |
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:
21820
diff
changeset
|
846 purple_debug_info("bonjour", "Matched buddy %s to incoming conversation using IP (%s)\n", |
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:
21820
diff
changeset
|
847 purple_buddy_get_name(pb), bconv->ip); |
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:
21820
diff
changeset
|
848 |
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:
21820
diff
changeset
|
849 /* Attach conv. to buddy and remove from pending list */ |
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:
21820
diff
changeset
|
850 jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); |
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:
21820
diff
changeset
|
851 |
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:
21820
diff
changeset
|
852 /* Check if the buddy already has a conversation and, if so, replace it */ |
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:
21820
diff
changeset
|
853 if (bb->conversation != NULL && bb->conversation != bconv) |
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:
21820
diff
changeset
|
854 bonjour_jabber_close_conversation(bb->conversation); |
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:
21820
diff
changeset
|
855 |
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:
21820
diff
changeset
|
856 bconv->pb = pb; |
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:
21820
diff
changeset
|
857 bb->conversation = bconv; |
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:
21820
diff
changeset
|
858 } |
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:
21820
diff
changeset
|
859 } else |
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:
21820
diff
changeset
|
860 purple_debug_error("bonjour", "No buddies matched for ip %s.\n", bconv->ip); |
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:
21820
diff
changeset
|
861 |
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:
21820
diff
changeset
|
862 /* We've failed to match a buddy - give up */ |
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:
21820
diff
changeset
|
863 if (bconv->pb == NULL) { |
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:
21820
diff
changeset
|
864 /* This must be asynchronous because it destroys the parser and we |
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:
21820
diff
changeset
|
865 * may be in the middle of parsing. |
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:
21820
diff
changeset
|
866 */ |
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:
21820
diff
changeset
|
867 async_bonjour_jabber_close_conversation(bconv); |
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:
21820
diff
changeset
|
868 } |
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:
21820
diff
changeset
|
869 |
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:
21820
diff
changeset
|
870 g_slist_free(mbba->matched_buddies); |
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:
21820
diff
changeset
|
871 g_free(mbba); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
872 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
873 |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
874 static PurpleBuddy * |
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:
21820
diff
changeset
|
875 _find_or_start_conversation(BonjourJabber *jdata, const gchar *to) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 { |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
877 PurpleBuddy *pb = NULL; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
878 BonjourBuddy *bb = NULL; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
879 |
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:
21820
diff
changeset
|
880 g_return_val_if_fail(jdata != NULL, NULL); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
881 g_return_val_if_fail(to != NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 |
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:
21820
diff
changeset
|
883 pb = purple_find_buddy(jdata->account, to); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
884 if (pb == NULL || pb->proto_data == NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 /* You can not send a message to an offline buddy */ |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
886 return NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
888 bb = (BonjourBuddy *) pb->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 |
17500
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
890 /* Check if there is a previously open conversation */ |
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
891 if (bb->conversation == NULL) |
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
892 { |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
893 PurpleProxyConnectData *connect_data; |
17599
bce4211c4980
More robust hack to force Bonjour to use no proxy when directly connecting to buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17558
diff
changeset
|
894 PurpleProxyInfo *proxy_info; |
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:
21802
diff
changeset
|
895 /* For better or worse, use the first IP*/ |
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:
21820
diff
changeset
|
896 const char *ip = bb->ips->data; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
897 |
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
|
898 purple_debug_info("bonjour", "Starting conversation with %s\n", to); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
899 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
900 /* Make sure that the account always has a proxy of "none". |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
901 * This is kind of dirty, but proxy_connect_none() isn't exposed. */ |
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:
21820
diff
changeset
|
902 proxy_info = purple_account_get_proxy_info(jdata->account); |
17599
bce4211c4980
More robust hack to force Bonjour to use no proxy when directly connecting to buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17558
diff
changeset
|
903 if (proxy_info == NULL) { |
bce4211c4980
More robust hack to force Bonjour to use no proxy when directly connecting to buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17558
diff
changeset
|
904 proxy_info = purple_proxy_info_new(); |
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:
21820
diff
changeset
|
905 purple_account_set_proxy_info(jdata->account, proxy_info); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
906 } |
17599
bce4211c4980
More robust hack to force Bonjour to use no proxy when directly connecting to buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17558
diff
changeset
|
907 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_NONE); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
908 |
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:
21820
diff
changeset
|
909 connect_data = purple_proxy_connect(NULL, jdata->account, |
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:
21802
diff
changeset
|
910 ip, bb->port_p2pj, _connected_to_buddy, pb); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
911 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
912 if (connect_data == NULL) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
913 purple_debug_error("bonjour", "Unable to connect to buddy (%s).\n", to); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
914 return NULL; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
915 } |
17500
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
916 |
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:
21820
diff
changeset
|
917 bb->conversation = bonjour_jabber_conv_new(pb, jdata->account, ip); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
918 bb->conversation->connect_data = connect_data; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
919 /* We don't want _send_data() to register the tx_handler; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
920 * that neeeds to wait until we're actually connected. */ |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
921 bb->conversation->tx_handler = 0; |
17500
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
922 } |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
923 return pb; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
924 } |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
925 |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
926 int |
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:
21820
diff
changeset
|
927 bonjour_jabber_send_message(BonjourJabber *jdata, const gchar *to, const gchar *body) |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
928 { |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
929 xmlnode *message_node, *node, *node2; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
930 gchar *message; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
931 PurpleBuddy *pb; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
932 BonjourBuddy *bb; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
933 int ret; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
934 |
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:
21820
diff
changeset
|
935 pb = _find_or_start_conversation(jdata, to); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
936 if (pb == NULL) { |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
937 purple_debug_info("bonjour", "Can't send a message to an offline buddy (%s).\n", to); |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
938 /* You can not send a message to an offline buddy */ |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
939 return -10000; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
940 } |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
941 |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
942 bb = pb->proto_data; |
17500
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
943 |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
944 message_node = xmlnode_new("message"); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
945 xmlnode_set_attrib(message_node, "to", bb->name); |
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:
21820
diff
changeset
|
946 xmlnode_set_attrib(message_node, "from", purple_account_get_username(jdata->account)); |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
947 xmlnode_set_attrib(message_node, "type", "chat"); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
948 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 /* Enclose the message from the UI within a "font" node */ |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
950 node = xmlnode_new_child(message_node, "body"); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
951 message = purple_markup_strip_html(body); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
952 xmlnode_insert_data(node, message, strlen(message)); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
953 g_free(message); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
955 node = xmlnode_new_child(message_node, "html"); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
956 xmlnode_set_namespace(node, "http://www.w3.org/1999/xhtml"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
958 node = xmlnode_new_child(node, "body"); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
959 message = g_strdup_printf("<font>%s</font>", body); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
960 node2 = xmlnode_from_str(message, strlen(message)); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
961 g_free(message); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
962 xmlnode_insert_child(node, node2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
964 node = xmlnode_new_child(message_node, "x"); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
965 xmlnode_set_namespace(node, "jabber:x:event"); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
966 xmlnode_insert_child(node, xmlnode_new("composing")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
968 message = xmlnode_to_str(message_node, NULL); |
15811 | 969 xmlnode_free(message_node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
971 ret = _send_data(pb, message) >= 0; |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
972 |
15811 | 973 g_free(message); |
974 | |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
975 return ret; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 |
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:
21820
diff
changeset
|
978 static gboolean |
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:
21820
diff
changeset
|
979 _async_bonjour_jabber_close_conversation_cb(gpointer data) { |
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:
21820
diff
changeset
|
980 BonjourJabberConversation *bconv = data; |
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:
21820
diff
changeset
|
981 bonjour_jabber_close_conversation(bconv); |
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:
21820
diff
changeset
|
982 return FALSE; |
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:
21820
diff
changeset
|
983 } |
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:
21820
diff
changeset
|
984 |
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:
21820
diff
changeset
|
985 void |
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:
21820
diff
changeset
|
986 async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) { |
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:
21820
diff
changeset
|
987 BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; |
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:
21820
diff
changeset
|
988 |
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:
21820
diff
changeset
|
989 jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); |
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:
21820
diff
changeset
|
990 |
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:
21820
diff
changeset
|
991 /* Disconnect this conv. from the buddy here so it can't be disposed of twice.*/ |
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:
21820
diff
changeset
|
992 if(bconv->pb != NULL) { |
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:
21820
diff
changeset
|
993 BonjourBuddy *bb = bconv->pb->proto_data; |
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:
21820
diff
changeset
|
994 if (bb->conversation == bconv) |
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:
21820
diff
changeset
|
995 bb->conversation = NULL; |
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:
21820
diff
changeset
|
996 } |
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:
21820
diff
changeset
|
997 |
22111
603d5325af4c
Prevent a crash caused by freed memory being accessed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21829
diff
changeset
|
998 bconv->close_timeout = purple_timeout_add(0, _async_bonjour_jabber_close_conversation_cb, bconv); |
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:
21820
diff
changeset
|
999 } |
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:
21820
diff
changeset
|
1000 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 void |
17556
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17555
diff
changeset
|
1002 bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 { |
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:
21466
diff
changeset
|
1004 if (bconv != 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:
21820
diff
changeset
|
1005 BonjourData *bd = NULL; |
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:
21820
diff
changeset
|
1006 |
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:
21820
diff
changeset
|
1007 if(PURPLE_CONNECTION_IS_VALID(bconv->account->gc)) { |
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:
21820
diff
changeset
|
1008 bd = bconv->account->gc->proto_data; |
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:
21820
diff
changeset
|
1009 bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv); |
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:
21820
diff
changeset
|
1010 } |
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:
21466
diff
changeset
|
1011 |
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:
21466
diff
changeset
|
1012 /* Cancel any file transfers that are waiting to begin */ |
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:
21820
diff
changeset
|
1013 /* There wont be any transfers if it hasn't been attached to a buddy */ |
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:
21820
diff
changeset
|
1014 if (bconv->pb != NULL && bd != NULL) { |
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:
21820
diff
changeset
|
1015 GSList *xfers, *tmp_next; |
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:
21820
diff
changeset
|
1016 xfers = bd->xfer_lists; |
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:
21820
diff
changeset
|
1017 while(xfers != NULL) { |
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:
21820
diff
changeset
|
1018 PurpleXfer *xfer = xfers->data; |
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:
21820
diff
changeset
|
1019 tmp_next = xfers->next; |
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:
21820
diff
changeset
|
1020 /* We only need to cancel this if it hasn't actually started transferring. */ |
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:
21820
diff
changeset
|
1021 /* This will change if we ever support IBB transfers. */ |
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:
21820
diff
changeset
|
1022 if (strcmp(xfer->who, bconv->pb->name) == 0 |
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:
21820
diff
changeset
|
1023 && (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_NOT_STARTED |
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:
21820
diff
changeset
|
1024 || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_UNKNOWN)) { |
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:
21820
diff
changeset
|
1025 purple_xfer_cancel_remote(xfer); |
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:
21820
diff
changeset
|
1026 } |
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:
21820
diff
changeset
|
1027 xfers = tmp_next; |
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:
21466
diff
changeset
|
1028 } |
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:
21466
diff
changeset
|
1029 } |
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:
21466
diff
changeset
|
1030 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 /* Close the socket and remove the watcher */ |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1032 if (bconv->socket >= 0) { |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1033 /* Send the end of the stream to the other end of the conversation */ |
21734
d4c01ceb50a1
Fix #4189 to make the bonjour prpl more standards compliant by sending the stream response in the correct order. Thanks to Sjoerd Simons from Telepathy Salut for noticing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21696
diff
changeset
|
1034 if (bconv->sent_stream_start == FULLY_SENT) |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1035 send(bconv->socket, STREAM_END, strlen(STREAM_END), 0); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1036 /* TODO: We're really supposed to wait for "</stream:stream>" before closing the socket */ |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1037 close(bconv->socket); |
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1038 } |
19399
649ac48fce1d
Reset unsigned int input handlers to 0 instead of -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19233
diff
changeset
|
1039 if (bconv->rx_handler != 0) |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1040 purple_input_remove(bconv->rx_handler); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1041 if (bconv->tx_handler > 0) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1042 purple_input_remove(bconv->tx_handler); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 /* Free all the data related to the conversation */ |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1045 purple_circ_buffer_destroy(bconv->tx_buf); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1046 if (bconv->connect_data != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1047 purple_proxy_connect_cancel(bconv->connect_data); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1048 if (bconv->stream_data != NULL) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1049 struct _stream_start_data *ss = bconv->stream_data; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1050 g_free(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1051 g_free(ss); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1052 } |
18761
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
1053 |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
1054 if (bconv->context != NULL) |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
1055 bonjour_parser_setup(bconv); |
316be7e715c6
Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18651
diff
changeset
|
1056 |
22111
603d5325af4c
Prevent a crash caused by freed memory being accessed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21829
diff
changeset
|
1057 if (bconv->close_timeout != 0) |
603d5325af4c
Prevent a crash caused by freed memory being accessed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21829
diff
changeset
|
1058 purple_timeout_remove(bconv->close_timeout); |
603d5325af4c
Prevent a crash caused by freed memory being accessed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21829
diff
changeset
|
1059 |
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:
21820
diff
changeset
|
1060 g_free(bconv->buddy_name); |
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:
21820
diff
changeset
|
1061 g_free(bconv->ip); |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1062 g_free(bconv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 void |
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:
21820
diff
changeset
|
1067 bonjour_jabber_stop(BonjourJabber *jdata) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 { |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
1069 /* Close the server socket and remove the watcher */ |
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:
21820
diff
changeset
|
1070 if (jdata->socket >= 0) |
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:
21820
diff
changeset
|
1071 close(jdata->socket); |
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:
21820
diff
changeset
|
1072 if (jdata->watcher_id > 0) |
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:
21820
diff
changeset
|
1073 purple_input_remove(jdata->watcher_id); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
1075 /* Close all the conversation sockets and remove all the watchers after sending end streams */ |
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:
21820
diff
changeset
|
1076 if (jdata->account->gc != NULL) { |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17542
diff
changeset
|
1077 GSList *buddies, *l; |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
1078 |
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:
21820
diff
changeset
|
1079 buddies = purple_find_buddies(jdata->account, NULL); |
17556
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17555
diff
changeset
|
1080 for (l = buddies; l; l = l->next) { |
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17555
diff
changeset
|
1081 BonjourBuddy *bb = ((PurpleBuddy*) l->data)->proto_data; |
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17555
diff
changeset
|
1082 bonjour_jabber_close_conversation(bb->conversation); |
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17555
diff
changeset
|
1083 bb->conversation = NULL; |
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17555
diff
changeset
|
1084 } |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1085 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 g_slist_free(buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 } |
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:
21820
diff
changeset
|
1088 |
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:
21820
diff
changeset
|
1089 while (jdata->pending_conversations != NULL) { |
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:
21820
diff
changeset
|
1090 bonjour_jabber_close_conversation(jdata->pending_conversations->data); |
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:
21820
diff
changeset
|
1091 jdata->pending_conversations = g_slist_delete_link(jdata->pending_conversations, jdata->pending_conversations); |
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:
21820
diff
changeset
|
1092 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 } |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1094 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1095 XepIq * |
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:
21466
diff
changeset
|
1096 xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id) |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1097 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1098 xmlnode *iq_node = NULL; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1099 XepIq *iq = NULL; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1100 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1101 g_return_val_if_fail(data != NULL, NULL); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1102 g_return_val_if_fail(to != NULL, NULL); |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1103 g_return_val_if_fail(id != NULL, NULL); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1104 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1105 iq_node = xmlnode_new("iq"); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1106 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1107 xmlnode_set_attrib(iq_node, "to", to); |
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:
21466
diff
changeset
|
1108 xmlnode_set_attrib(iq_node, "from", from); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1109 xmlnode_set_attrib(iq_node, "id", id); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1110 switch (type) { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1111 case XEP_IQ_SET: |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1112 xmlnode_set_attrib(iq_node, "type", "set"); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1113 break; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1114 case XEP_IQ_GET: |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1115 xmlnode_set_attrib(iq_node, "type", "get"); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1116 break; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1117 case XEP_IQ_RESULT: |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1118 xmlnode_set_attrib(iq_node, "type", "result"); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1119 break; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1120 case XEP_IQ_ERROR: |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1121 xmlnode_set_attrib(iq_node, "type", "error"); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1122 break; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1123 case XEP_IQ_NONE: |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1124 default: |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1125 xmlnode_set_attrib(iq_node, "type", "none"); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1126 break; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1127 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1128 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1129 iq = g_new0(XepIq, 1); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1130 iq->node = iq_node; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1131 iq->type = type; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1132 iq->data = ((BonjourData*)data)->jabber_data; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1133 iq->to = (char*)to; |
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:
21466
diff
changeset
|
1134 |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1135 return iq; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1136 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1137 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1138 static gboolean |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1139 check_if_blocked(PurpleBuddy *pb) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1140 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1141 gboolean blocked = FALSE; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1142 GSList *l = NULL; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1143 PurpleAccount *acc = NULL; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1144 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1145 if(pb == NULL) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1146 return FALSE; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1147 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1148 acc = pb->account; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1149 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1150 for(l = acc->deny; l != NULL; l = l->next) { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1151 if(!purple_utf8_strcasecmp(pb->name, (char *)l->data)) { |
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
|
1152 purple_debug_info("bonjour", "%s has been blocked.\n", pb->name, acc->username); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1153 blocked = TRUE; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1154 break; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1155 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1156 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1157 return blocked; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1158 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1159 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1160 static void |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1161 xep_iq_parse(xmlnode *packet, PurpleConnection *connection, PurpleBuddy *pb) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1162 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1163 xmlnode *child = NULL; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1164 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1165 if(packet == NULL || pb == NULL) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1166 return; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1167 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1168 if(connection == NULL) { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1169 if(pb->account != NULL) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1170 connection = (pb->account)->gc; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1171 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1172 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1173 if(check_if_blocked(pb)) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1174 return; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1175 |
21464
577d90f8794e
I messed this up at some point.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21463
diff
changeset
|
1176 if ((child = xmlnode_get_child(packet, "si")) || (child = xmlnode_get_child(packet, "error"))) |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1177 xep_si_parse(connection, packet, pb); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1178 else |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1179 xep_bytestreams_parse(connection, packet, pb); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1180 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1181 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1182 int |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1183 xep_iq_send_and_free(XepIq *iq) |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1184 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1185 int ret = -1; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1186 PurpleBuddy *pb = NULL; |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1187 |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1188 /* start the talk, reuse the message socket */ |
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:
21820
diff
changeset
|
1189 pb = _find_or_start_conversation((BonjourJabber*) iq->data, iq->to); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1190 /* Send the message */ |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1191 if (pb != NULL) { |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1192 /* Convert xml node into stream */ |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1193 gchar *msg = xmlnode_to_str(iq->node, NULL); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1194 ret = _send_data(pb, msg); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1195 g_free(msg); |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1196 } |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1197 |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1198 xmlnode_free(iq->node); |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1199 iq->node = NULL; |
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1200 g_free(iq); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1201 |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1202 return (ret >= 0) ? 0 : -1; |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1203 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1204 |
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:
21437
diff
changeset
|
1205 /* This returns a ';' delimited string containing all non-localhost IPs */ |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1206 const char * |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1207 purple_network_get_my_ip_ext2(int fd) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1208 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1209 char buffer[1024]; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1210 static char ip_ext[17 * 10]; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1211 char *tmp; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1212 char *tip; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1213 struct ifconf ifc; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1214 struct ifreq *ifr; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1215 struct sockaddr_in *sinptr; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1216 guint32 lhost = htonl(127 * 256 * 256 * 256 + 1); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1217 long unsigned int add; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1218 int source = fd; |
21463
2b6553584385
Don't allow the buffer to be overrun when you have lots of local IPs.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
1219 int len, count = 0; |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1220 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1221 if (fd < 0) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1222 source = socket(PF_INET, SOCK_STREAM, 0); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1223 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1224 ifc.ifc_len = sizeof(buffer); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1225 ifc.ifc_req = (struct ifreq *)buffer; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1226 ioctl(source, SIOCGIFCONF, &ifc); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1227 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1228 if (fd < 0) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1229 close(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:
21437
diff
changeset
|
1230 |
d8106b63b0a4
I thought I was just fixing a leak in this commit, but it turns out I forgot to add the new files in the previous commit.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21437
diff
changeset
|
1231 memset(ip_ext, 0, sizeof(ip_ext)); |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1232 memcpy(ip_ext, "0.0.0.0", 7); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1233 tmp = buffer; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1234 tip = ip_ext; |
21463
2b6553584385
Don't allow the buffer to be overrun when you have lots of local IPs.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
1235 while (tmp < buffer + ifc.ifc_len && count < 10) |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1236 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1237 ifr = (struct ifreq *)tmp; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1238 tmp += HX_SIZE_OF_IFREQ(*ifr); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1239 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1240 if (ifr->ifr_addr.sa_family == AF_INET) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1241 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1242 sinptr = (struct sockaddr_in *)&ifr->ifr_addr; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1243 if (sinptr->sin_addr.s_addr != lhost) |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1244 { |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1245 add = ntohl(sinptr->sin_addr.s_addr); |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1246 len = g_snprintf(tip, 17, "%lu.%lu.%lu.%lu;", |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1247 ((add >> 24) & 255), |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1248 ((add >> 16) & 255), |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1249 ((add >> 8) & 255), |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1250 add & 255); |
21552
9736ee1ca29e
Get rid of two compile warnings:
Mark Doliner <mark@kingant.net>
parents:
21527
diff
changeset
|
1251 tip = &tip[len]; |
21463
2b6553584385
Don't allow the buffer to be overrun when you have lots of local IPs.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21441
diff
changeset
|
1252 count++; |
21437
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1253 continue; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1254 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1255 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1256 } |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1257 |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1258 return ip_ext; |
db7fa42845f6
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21418
diff
changeset
|
1259 } |