Mercurial > pidgin
annotate libpurple/protocols/bonjour/jabber.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 0cf09e1ae01a |
children |
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> |
22907
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22680
diff
changeset
|
42 #ifdef HAVE_UNISTD_H |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include <unistd.h> |
22907
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22680
diff
changeset
|
44 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include <fcntl.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
47 #ifdef HAVE_GETIFADDRS |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
48 #include <ifaddrs.h> |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
49 #endif |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
50 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
51 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 #include "network.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 #include "eventloop.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 #include "connection.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 #include "blist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 #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
|
62 #include "parser.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 #include "bonjour.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 #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
|
65 #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
|
66 |
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
|
67 #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
|
68 # 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
|
69 #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
|
70 # 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
|
71 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
17554
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
73 #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
|
74 /* 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
|
75 #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
|
76 "<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
|
77 |
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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 }; |
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
|
83 |
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
|
84 static void |
24675
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24674
diff
changeset
|
85 xep_iq_parse(xmlnode *packet, PurpleBuddy *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
|
86 |
17555
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
87 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
|
88 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
|
89 |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
90 BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1); |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
91 bconv->socket = -1; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 bconv->ip = g_strdup(ip); |
17555
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
98 |
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
|
99 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
|
100 |
17555
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
101 return bconv; |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
102 } |
b13850d13391
Consolidate BonjourJabberConversation creation and deletion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17554
diff
changeset
|
103 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 static const char * |
15822 | 105 _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
|
106 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 if (size > 24) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 return "7"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 } else if (size >= 21) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 return "6"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 } else if (size >= 17) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 return "5"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 } else if (size >= 14) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 return "4"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 } else if (size >= 12) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 return "3"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 } else if (size >= 10) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 return "2"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 return "1"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 } |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
123 |
22680
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
124 static gchar * |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
125 get_xmlnode_contents(xmlnode *node) |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
126 { |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
127 gchar *contents; |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
128 |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
129 contents = xmlnode_to_str(node, NULL); |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
130 |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
131 /* we just want the stuff inside <font></font> |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
132 * There isn't stuff exposed in xmlnode.c to do this more cleanly. */ |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
133 |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
134 if (contents) { |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
135 char *bodystart = strchr(contents, '>'); |
24674
7b10acb20526
Fix CID 399 - I'm reasonably sure this couldn't ever actually cause a NULL deref.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24673
diff
changeset
|
136 char *bodyend = bodystart ? strrchr(bodystart, '<') : NULL; |
22680
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
137 if (bodystart && bodyend && (bodystart + 1) != bodyend) { |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
138 *bodyend = '\0'; |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
139 memmove(contents, bodystart + 1, (bodyend - bodystart)); |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
140 } |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
141 } |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
142 |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
143 return contents; |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
144 } |
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
145 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 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
|
147 _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
|
148 { |
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
|
149 xmlnode *body_node, *html_node, *events_node; |
24344
fe7504f465a2
More Bonjour struct hiding fixes.
Richard Laager <rlaager@wiktel.com>
parents:
24170
diff
changeset
|
150 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(pb)); |
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
|
151 gchar *body = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 gboolean composing_event = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
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
|
154 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
|
155 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
|
156 |
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
|
157 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
|
158 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
|
159 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
|
160 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 /* 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
|
168 /* 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
|
169 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
|
170 } |
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 } |
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
|
172 |
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
|
173 if (html_node != NULL) { |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
174 xmlnode *html_body_node; |
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
175 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 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
|
177 if (html_body_node != NULL) { |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
178 xmlnode *html_body_font_node; |
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
179 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 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
|
181 /* 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
|
182 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
|
183 gchar *html_body; |
23999
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
184 const char *font_face, *font_size, *font_color, |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
185 *ichat_balloon_color, *ichat_text_color; |
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
|
186 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 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
|
188 /* 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
|
189 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
|
190 if (font_size != NULL) |
15822 | 191 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
|
192 font_color = xmlnode_get_attrib(html_body_font_node, "color"); |
23999
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
193 ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor"); |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
194 ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor"); |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
195 |
22680
dfb1cf26e0c8
Fix an issue with formatting in Bonjour messages. It looks like it has been
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22486
diff
changeset
|
196 html_body = get_xmlnode_contents(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
|
197 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 if (html_body == NULL) |
23999
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
199 /* This is the kind of formatted 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
|
200 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
|
201 |
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
|
202 if (html_body != NULL) { |
23999
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
203 GString *str = g_string_new("<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
|
204 |
23999
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
205 if (font_face) |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
206 g_string_append_printf(str, " face='%s'", font_face); |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
207 if (font_size) |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
208 g_string_append_printf(str, " size='%s'", font_size); |
32409
0cf09e1ae01a
It seems like we should be using this color tag for something...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32391
diff
changeset
|
209 if (font_color) |
0cf09e1ae01a
It seems like we should be using this color tag for something...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32391
diff
changeset
|
210 g_string_append_printf(str, " color='%s'", font_color); |
0cf09e1ae01a
It seems like we should be using this color tag for something...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32391
diff
changeset
|
211 else if (ichat_text_color) |
23999
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
212 g_string_append_printf(str, " color='%s'", ichat_text_color); |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
213 if (ichat_balloon_color) |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
214 g_string_append_printf(str, " back='%s'", ichat_balloon_color); |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
215 g_string_append_printf(str, ">%s</font>", html_body); |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
216 |
48da97d84886
Don't arbitrarily default font settings when none are specified for incoming
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23708
diff
changeset
|
217 body = g_string_free(str, FALSE); |
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
|
218 |
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
|
219 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
|
220 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 |
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
|
225 /* 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
|
226 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
|
227 body = xmlnode_get_data(body_node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 |
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
|
229 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
|
230 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
|
231 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 /* Send the message to the UI */ |
24344
fe7504f465a2
More Bonjour struct hiding fixes.
Richard Laager <rlaager@wiktel.com>
parents:
24170
diff
changeset
|
235 serv_got_im(gc, purple_buddy_get_name(pb), body, 0, time(NULL)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 g_free(body); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 |
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
|
240 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
|
241 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
|
242 GSList *matched_buddies; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 static void |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
246 _match_buddies_by_address(gpointer value, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 { |
17554
a1d05bc43d95
Send 'to' and 'from' attributes in the stream start message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
248 PurpleBuddy *pb = value; |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
249 BonjourBuddy *bb = 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
|
250 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
|
251 |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
252 bb = purple_buddy_get_protocol_data(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
253 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 /* |
26766
9331016df8ac
Use more efficient purple_find_buddies in bonjour.
Paul Aurich <paul@darkrain42.org>
parents:
26538
diff
changeset
|
255 * If the current PurpleBuddy's data is not null, 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
|
256 * 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
|
257 */ |
26766
9331016df8ac
Use more efficient purple_find_buddies in bonjour.
Paul Aurich <paul@darkrain42.org>
parents:
26538
diff
changeset
|
258 if (bb != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 { |
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
|
260 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
|
261 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
|
262 |
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
|
263 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
|
264 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
|
265 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
|
266 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
|
267 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
|
268 } |
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
|
269 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
|
270 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
274 static void |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
275 _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
|
276 { |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
277 PurpleBuddy *pb = data; |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
278 BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
279 BonjourJabberConversation *bconv = bb->conversation; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
280 int ret, writelen; |
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 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
|
283 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
284 if (writelen == 0) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
285 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
|
286 bconv->tx_handler = 0; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
287 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
288 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
290 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
|
291 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
292 if (ret < 0 && errno == EAGAIN) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
293 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
294 else if (ret <= 0) { |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
295 PurpleConversation *conv = NULL; |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
296 PurpleAccount *account = NULL; |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
297 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
|
298 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
299 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
|
300 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
|
301 |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
302 account = purple_buddy_get_account(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
303 |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
304 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
305 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
306 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
307 _("Unable to send message."), |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
308 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
309 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
310 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
|
311 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
312 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
315 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
|
316 } |
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 static gint |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
319 _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
|
320 { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
321 gint ret; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
322 int len = strlen(message); |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
323 BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
324 BonjourJabberConversation *bconv = bb->conversation; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
325 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
326 /* 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
|
327 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
|
328 || 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
|
329 || 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
|
330 || !bconv->recv_stream_start |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
331 || 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
|
332 ret = -1; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
333 errno = EAGAIN; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
334 } else { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
335 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
|
336 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
337 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
338 if (ret == -1 && errno == EAGAIN) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
339 ret = 0; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
340 else if (ret <= 0) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
341 PurpleConversation *conv; |
25877
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
342 PurpleAccount *account; |
21121
35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21017
diff
changeset
|
343 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
|
344 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
345 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
|
346 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
|
347 |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
348 account = purple_buddy_get_account(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
349 |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
350 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
351 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
352 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
353 _("Unable to send message."), |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
354 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
355 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
356 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
|
357 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
358 return -1; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
359 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
360 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
361 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
|
362 /* 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
|
363 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
|
364 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
|
365 _send_data_write_cb, pb); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
366 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
|
367 } |
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 return ret; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 |
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
|
372 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
|
373 |
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
|
374 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
|
375 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
|
376 |
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
|
377 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
|
378 _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
|
379 else if(!strcmp(packet->name, "iq")) |
24675
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24674
diff
changeset
|
380 xep_iq_parse(packet, 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
|
381 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
|
382 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
|
383 } |
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
|
384 |
24673
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
385 static void bonjour_jabber_stream_ended(BonjourJabberConversation *bconv) { |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
386 |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
387 /* Inform the user that the conversation has been closed */ |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
388 BonjourBuddy *bb = NULL; |
25906
716b14deee97
a few struct hiding clean ups
Gary Kramlich <grim@reaperworld.com>
parents:
25880
diff
changeset
|
389 const gchar *name = bconv->pb ? purple_buddy_get_name(bconv->pb) : "(unknown)"; |
24673
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
390 |
29960
815bd8b41638
I before E, except after C
Stu Tomlinson <stu@nosnilmot.com>
parents:
29931
diff
changeset
|
391 purple_debug_info("bonjour", "Received conversation close notification from %s.\n", name); |
24673
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
392 |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
393 if(bconv->pb != NULL) |
25880
be87547aa431
merge of '0bf6462dd433df38943094bbed0393698d91a037'
Sadrul Habib Chowdhury <imadil@gmail.com>
diff
changeset
|
394 bb = purple_buddy_get_protocol_data(bconv->pb); |
24673
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
395 #if 0 |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
396 if(bconv->pb != NULL) { |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
397 PurpleConversation *conv; |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
398 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bconv->pb->name, bconv->pb->account); |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
399 if (conv != NULL) { |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
400 char *tmp = g_strdup_printf(_("%s has closed the conversation."), bconv->pb->name); |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
401 purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
402 g_free(tmp); |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
403 } |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
404 } |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
405 #endif |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
406 /* Close the socket, clear the watcher and free memory */ |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
407 bonjour_jabber_close_conversation(bconv); |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
408 if(bb) |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
409 bb->conversation = NULL; |
5706043db5b5
Clean up some stuff that the behavior has changed on to fix CID 398.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24344
diff
changeset
|
410 } |
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
|
411 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 static void |
15822 | 413 _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
|
414 { |
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
|
415 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
|
416 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
|
417 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
|
418 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 /* 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
|
420 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
|
421 /* 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
|
422 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
|
423 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
|
424 |
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
|
425 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
|
426 |
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
|
427 bonjour_jabber_close_conversation(bconv); |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
428 if (bconv->pb != NULL) { |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
429 BonjourBuddy *bb = purple_buddy_get_protocol_data(bconv->pb); |
30583
9c8b28dc6656
The hostname used for a bonjour account should always be the current machine
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30413
diff
changeset
|
430 |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
431 if(bb != NULL) |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
432 bb->conversation = 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
|
433 } |
17558
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 /* 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
|
436 * 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
|
437 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 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
|
439 } else if (len == 0) { /* The other end has closed the socket */ |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
440 const gchar *name = purple_buddy_get_name(bconv->pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
441 purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", (name) ? name : "(unknown)"); |
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
|
442 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
|
443 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 } 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
|
445 message_length = len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 message[message_length] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 |
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
|
448 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
|
449 message[message_length - 1] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 message_length--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 |
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
|
454 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
|
455 |
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
|
456 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
|
457 } |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
458 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
459 struct _stream_start_data { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
460 char *msg; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
461 }; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
462 |
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
|
463 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
464 static void |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
465 _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
|
466 { |
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
|
467 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
|
468 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
|
469 int len, ret; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
470 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
471 len = strlen(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
472 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
473 /* Start Stream */ |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
474 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
|
475 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
476 if (ret == -1 && errno == EAGAIN) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
477 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
478 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
|
479 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
|
480 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
|
481 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
|
482 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
|
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 if(bconv->pb) { |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
485 bb = purple_buddy_get_protocol_data(bconv->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
|
486 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
|
487 } |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
488 |
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
|
489 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
|
490 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
|
491 |
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
|
492 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
|
493 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
494 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
495 _("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
|
496 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
497 |
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
|
498 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
|
499 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
|
500 bb->conversation = NULL; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
501 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
502 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
503 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
504 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
505 /* 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
|
506 if (ret < len) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
507 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
|
508 g_free(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
509 ss->msg = tmp; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
510 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
511 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
512 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
513 g_free(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
514 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
|
515 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
|
516 |
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
|
517 /* 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
|
518 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
|
519 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
|
520 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
|
521 |
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
|
522 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
|
523 } |
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
|
524 |
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
|
525 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
|
526 { |
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 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
|
528 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
|
529 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
|
530 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
531 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
|
532 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
|
533 |
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
|
534 /* 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
|
535 * 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
|
536 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
|
537 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
|
538 |
30583
9c8b28dc6656
The hostname used for a bonjour account should always be the current machine
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30413
diff
changeset
|
539 stream_start = g_strdup_printf(DOCTYPE, bonjour_get_jid(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
|
540 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
|
541 |
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
|
542 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
|
543 |
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
|
544 /* 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
|
545 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
|
546 |
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
|
547 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
|
548 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
|
549 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
|
550 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
|
551 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 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
|
553 (*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
|
554 |
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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 _("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
|
561 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
|
562 } |
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
|
563 |
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
|
564 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
|
565 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
|
566 |
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
|
567 return FALSE; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
568 } |
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
|
569 |
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 /* 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 /* 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
|
576 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
|
577 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
|
578 } 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
|
579 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
|
580 |
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
|
581 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
|
582 |
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
|
583 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
|
584 } |
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
|
585 |
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
|
586 /* This gets called when we've successfully sent our <stream:stream /> |
29960
815bd8b41638
I before E, except after C
Stu Tomlinson <stu@nosnilmot.com>
parents:
29931
diff
changeset
|
587 * AND when we've received a <stream:stream /> */ |
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 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
|
589 |
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 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
|
591 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
|
592 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
|
593 |
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
|
594 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
|
595 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
|
596 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
597 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
|
598 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
|
599 |
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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 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
|
605 _("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
|
606 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
|
607 } |
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
|
608 |
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
|
609 /* 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
|
610 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
|
611 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
|
612 |
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
|
613 /* 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
|
614 * 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
|
615 */ |
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
|
616 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
|
617 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
|
618 } |
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
|
619 |
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 /* 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
|
621 /* 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
|
622 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
|
623 && 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
|
624 /* 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
|
625 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
|
626 _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
|
627 /* 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
|
628 _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
|
629 } |
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
|
630 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
631 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
632 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
633 #ifndef INET6_ADDRSTRLEN |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
634 #define INET6_ADDRSTRLEN 46 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
635 #endif |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
636 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 static void |
15822 | 638 _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
|
639 { |
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
|
640 BonjourJabber *jdata = data; |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
641 struct sockaddr_storage their_addr; /* connector's address information */ |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
642 socklen_t sin_size = sizeof(struct sockaddr_storage); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 int client_socket; |
20347
04fe5601fedb
applied changes from 2762c6075c0dc52a96098c5478c5bf68cfd890a3
Luke Schierer <lschiere@pidgin.im>
parents:
19681
diff
changeset
|
644 int flags; |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
645 #ifdef HAVE_INET_NTOP |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
646 char addrstr[INET6_ADDRSTRLEN]; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
647 #endif |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
648 const char *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
|
649 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
|
650 BonjourJabberConversation *bconv; |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
651 GSList *buddies; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 /* 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
|
654 if (condition != PURPLE_INPUT_READ) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
657 memset(&their_addr, 0, sin_size); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
658 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
659 if ((client_socket = accept(server_socket, (struct sockaddr*)&their_addr, &sin_size)) == -1) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 return; |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
661 |
20347
04fe5601fedb
applied changes from 2762c6075c0dc52a96098c5478c5bf68cfd890a3
Luke Schierer <lschiere@pidgin.im>
parents:
19681
diff
changeset
|
662 flags = fcntl(client_socket, F_GETFL); |
04fe5601fedb
applied changes from 2762c6075c0dc52a96098c5478c5bf68cfd890a3
Luke Schierer <lschiere@pidgin.im>
parents:
19681
diff
changeset
|
663 fcntl(client_socket, F_SETFL, flags | O_NONBLOCK); |
23708
0dd3df365017
These fds don't need to be inherited by child processes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23567
diff
changeset
|
664 #ifndef _WIN32 |
0dd3df365017
These fds don't need to be inherited by child processes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23567
diff
changeset
|
665 fcntl(client_socket, F_SETFD, FD_CLOEXEC); |
0dd3df365017
These fds don't need to be inherited by child processes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23567
diff
changeset
|
666 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 /* Look for the buddy that has opened the conversation and fill information */ |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
669 #ifdef HAVE_INET_NTOP |
32369
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
670 if (their_addr.ss_family == AF_INET6) { |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
671 address_text = inet_ntop(their_addr.ss_family, &((struct sockaddr_in6 *)&their_addr)->sin6_addr, |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
672 addrstr, sizeof(addrstr)); |
32369
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
673 |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
674 append_iface_if_linklocal(addrstr, |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
675 ((struct sockaddr_in6 *)&their_addr)->sin6_scope_id); |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
676 } |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
677 else |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
678 address_text = inet_ntop(their_addr.ss_family, &((struct sockaddr_in *)&their_addr)->sin_addr, |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
679 addrstr, sizeof(addrstr)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
680 #else |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
681 address_text = inet_ntoa(((struct sockaddr_in *)&their_addr)->sin_addr); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
682 #endif |
19654
941965d6fd88
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19574
diff
changeset
|
683 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
|
684 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
|
685 mbba->address = address_text; |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
686 |
26766
9331016df8ac
Use more efficient purple_find_buddies in bonjour.
Paul Aurich <paul@darkrain42.org>
parents:
26538
diff
changeset
|
687 buddies = purple_find_buddies(jdata->account, NULL); |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
688 g_slist_foreach(buddies, _match_buddies_by_address, mbba); |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
689 g_slist_free(buddies); |
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
|
690 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
691 if (mbba->matched_buddies == NULL) { |
29716 | 692 purple_debug_info("bonjour", "We don't like invisible buddies, this is not a superheroes 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
|
693 g_free(mbba); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 close(client_socket); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
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
|
698 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
|
699 g_free(mbba); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
700 |
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
|
701 /* 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
|
702 * 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
|
703 */ |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
704 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
|
705 |
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
|
706 /* 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
|
707 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
|
708 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
|
709 |
15373
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 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
712 static int |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
713 start_serversocket_listening(int port, int socket, struct sockaddr *addr, size_t addr_size, gboolean ip6, gboolean allow_port_fallback) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 { |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
715 int ret_port = port; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
717 purple_debug_info("bonjour", "Attempting to bind IPv%d socket to port %d.\n", ip6 ? 6 : 4, port); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 |
25497
f38799160cfa
Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24675
diff
changeset
|
719 /* Try to use the specified port - if it isn't available, use a random port */ |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
720 if (bind(socket, addr, addr_size) != 0) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
721 |
27371
96cafa3d271c
Make some error messages more uniform.
Mark Doliner <mark@kingant.net>
parents:
27119
diff
changeset
|
722 purple_debug_info("bonjour", "Unable to bind to specified " |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
723 "port %i: %s\n", port, g_strerror(errno)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
724 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
725 if (!allow_port_fallback) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
726 purple_debug_warning("bonjour", "Not attempting random port assignment.\n"); |
25497
f38799160cfa
Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24675
diff
changeset
|
727 return -1; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 } |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
729 #ifdef PF_INET6 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
730 if (ip6) |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
731 ((struct sockaddr_in6 *) addr)->sin6_port = 0; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
732 else |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
733 #endif |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
734 ((struct sockaddr_in *) addr)->sin_port = 0; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
735 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
736 if (bind(socket, addr, addr_size) != 0) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
737 purple_debug_error("bonjour", "Unable to bind IPv%d socket to port: %s\n", ip6 ? 6 : 4, g_strerror(errno)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
738 return -1; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
739 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
740 ret_port = purple_network_get_port_from_fd(socket); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
743 purple_debug_info("bonjour", "Bound IPv%d socket to port %d.\n", ip6 ? 6 : 4, ret_port); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
744 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 /* Attempt to listen on the bound socket */ |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
746 if (listen(socket, 10) != 0) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
747 purple_debug_error("bonjour", "Unable to listen on IPv%d socket: %s\n", ip6 ? 6 : 4, g_strerror(errno)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 /* TODO: Why isn't this being used? */ |
32216
d2ef8926b960
Remove deprecated purple_network_listen_map_external().
andrew.victor@mxit.com
parents:
32214
diff
changeset
|
753 data->socket = purple_network_listen(jdata->port, AF_UNSPEC, SOCK_STREAM, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 |
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
|
755 if (jdata->socket == -1) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 { |
15822 | 757 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
|
758 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
761 return ret_port; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
762 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
763 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
764 gint |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
765 bonjour_jabber_start(BonjourJabber *jdata) |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
766 { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
767 int ipv6_port = -1, ipv4_port = -1; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
768 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
769 /* Open a listening socket for incoming conversations */ |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
770 #ifdef PF_INET6 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
771 jdata->socket6 = socket(PF_INET6, SOCK_STREAM, 0); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
772 #endif |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
773 jdata->socket = socket(PF_INET, SOCK_STREAM, 0); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
774 if (jdata->socket == -1 && jdata->socket6 == -1) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
775 purple_debug_error("bonjour", "Unable to create socket: %s", |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
776 g_strerror(errno)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
777 return -1; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
778 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
779 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
780 #ifdef PF_INET6 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
781 if (jdata->socket6 != -1) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
782 struct sockaddr_in6 addr6; |
30585
03988b6b41dd
Use IPV6_V6ONLY for the bonjour IPv6 socket so that we can register the separate IPv4 socket on the same port. Fixes #12657
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30583
diff
changeset
|
783 #ifdef IPV6_V6ONLY |
03988b6b41dd
Use IPV6_V6ONLY for the bonjour IPv6 socket so that we can register the separate IPv4 socket on the same port. Fixes #12657
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30583
diff
changeset
|
784 int on = 1; |
03988b6b41dd
Use IPV6_V6ONLY for the bonjour IPv6 socket so that we can register the separate IPv4 socket on the same port. Fixes #12657
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30583
diff
changeset
|
785 setsockopt(jdata->socket6, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)); |
03988b6b41dd
Use IPV6_V6ONLY for the bonjour IPv6 socket so that we can register the separate IPv4 socket on the same port. Fixes #12657
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30583
diff
changeset
|
786 #endif |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
787 memset(&addr6, 0, sizeof(addr6)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
788 addr6.sin6_family = AF_INET6; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
789 addr6.sin6_port = htons(jdata->port); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
790 addr6.sin6_addr = in6addr_any; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
791 ipv6_port = start_serversocket_listening(jdata->port, jdata->socket6, (struct sockaddr *) &addr6, sizeof(addr6), TRUE, TRUE); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
792 /* Open a watcher in the socket we have just opened */ |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
793 if (ipv6_port > 0) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
794 jdata->watcher_id6 = purple_input_add(jdata->socket6, PURPLE_INPUT_READ, _server_socket_handler, jdata); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
795 jdata->port = ipv6_port; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
796 } else { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
797 purple_debug_error("bonjour", "Failed to start listening on IPv6 socket.\n"); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
798 close(jdata->socket6); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
799 jdata->socket6 = -1; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
800 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
801 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
802 #endif |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
803 if (jdata->socket != -1) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
804 struct sockaddr_in addr4; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
805 memset(&addr4, 0, sizeof(addr4)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
806 addr4.sin_family = AF_INET; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
807 addr4.sin_port = htons(jdata->port); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
808 ipv4_port = start_serversocket_listening(jdata->port, jdata->socket, (struct sockaddr *) &addr4, sizeof(addr4), FALSE, ipv6_port != -1); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
809 /* Open a watcher in the socket we have just opened */ |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
810 if (ipv4_port > 0) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
811 jdata->watcher_id = purple_input_add(jdata->socket, PURPLE_INPUT_READ, _server_socket_handler, jdata); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
812 jdata->port = ipv4_port; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
813 } else { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
814 purple_debug_error("bonjour", "Failed to start listening on IPv4 socket.\n"); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
815 close(jdata->socket); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
816 jdata->socket = -1; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
817 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
818 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
819 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
820 if (!(ipv6_port > 0 || ipv4_port > 0)) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
821 purple_debug_error("bonjour", "Unable to listen on socket: %s", |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
822 g_strerror(errno)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
823 return -1; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
824 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 |
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
|
826 return jdata->port; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
829 static void |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
830 _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
|
831 { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
832 PurpleBuddy *pb = data; |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
833 BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
834 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
835 bb->conversation->connect_data = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
836 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
837 if (source < 0) { |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
838 PurpleConversation *conv = NULL; |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
839 PurpleAccount *account = NULL; |
31537
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
840 GSList *tmp = bb->ips; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
841 |
31537
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
842 purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d (%s); Trying next IP address\n", |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
843 purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error); |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
844 |
31538
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
845 /* There may be multiple entries for the same IP - one per |
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
846 * presence recieved (e.g. multiple interfaces). |
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
847 * We need to make sure that we find the previously used entry. |
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
848 */ |
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
849 while (tmp && bb->conversation->ip_link != tmp->data) |
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
850 tmp = g_slist_next(tmp); |
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
851 if (tmp) |
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
852 tmp = g_slist_next(tmp); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
853 |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
854 account = purple_buddy_get_account(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
855 |
31537
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
856 if (tmp != NULL) { |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
857 const gchar *ip; |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
858 PurpleProxyConnectData *connect_data; |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
859 |
31538
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
860 bb->conversation->ip_link = ip = tmp->data; |
31537
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
861 |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
862 purple_debug_info("bonjour", "Starting conversation with %s at %s:%d\n", |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
863 purple_buddy_get_name(pb), ip, bb->port_p2pj); |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
864 |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
865 connect_data = purple_proxy_connect(purple_account_get_connection(account), |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
866 account, ip, bb->port_p2pj, _connected_to_buddy, pb); |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
867 |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
868 if (connect_data != NULL) { |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
869 g_free(bb->conversation->ip); |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
870 bb->conversation->ip = g_strdup(ip); |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
871 bb->conversation->connect_data = connect_data; |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
872 |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
873 return; |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
874 } |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
875 } |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
876 |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
877 purple_debug_error("bonjour", "No more addresses for buddy %s. Aborting", purple_buddy_get_name(pb)); |
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
878 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24170
diff
changeset
|
879 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
880 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
881 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
882 _("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
|
883 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
884 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
885 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
|
886 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
887 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
888 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
889 |
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
|
890 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
|
891 const char *err = g_strerror(errno); |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
892 PurpleConversation *conv = NULL; |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
893 PurpleAccount *account = NULL; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
894 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
895 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
|
896 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
|
897 |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
898 account = purple_buddy_get_account(pb); |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
899 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24170
diff
changeset
|
900 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
901 if (conv != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
902 purple_conversation_write(conv, NULL, |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
903 _("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
|
904 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
905 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
906 close(source); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
907 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
|
908 bb->conversation = NULL; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
909 return; |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
910 } |
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
|
911 |
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
|
912 /* 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
|
913 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
|
914 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
|
915 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
|
916 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
918 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
|
919 bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
920 PurpleBuddy *pb = NULL; |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
921 BonjourBuddy *bb = 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
|
922 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
923 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
|
924 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
|
925 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
926 pb = purple_find_buddy(bconv->account, bconv->buddy_name); |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
927 if (pb && (bb = purple_buddy_get_protocol_data(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
|
928 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
|
929 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
|
930 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
931 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
|
932 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
|
933 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
934 /* 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
|
935 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
|
936 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
|
937 if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) { |
31932
61ce89013291
Use accessor functions in a few places
Mark Doliner <mark@kingant.net>
parents:
31538
diff
changeset
|
938 PurpleConnection *pc = purple_account_get_connection(bconv->account); |
31979
e895aebcb504
Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
31932
diff
changeset
|
939 BonjourData *bd = purple_connection_get_protocol_data(pc); |
e895aebcb504
Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
31932
diff
changeset
|
940 BonjourJabber *jdata = bd->jabber_data; |
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
|
941 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
942 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
|
943 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
|
944 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
945 /* 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
|
946 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
|
947 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
948 /* 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
|
949 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
|
950 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
|
951 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
952 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
|
953 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
|
954 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
955 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
|
956 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
957 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
|
958 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
959 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
960 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
961 /* 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
|
962 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
|
963 /* 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
|
964 * 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
|
965 */ |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
966 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
|
967 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
968 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
969 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
970 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
971 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
|
972 bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { |
31932
61ce89013291
Use accessor functions in a few places
Mark Doliner <mark@kingant.net>
parents:
31538
diff
changeset
|
973 PurpleConnection *pc = purple_account_get_connection(bconv->account); |
31979
e895aebcb504
Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
31932
diff
changeset
|
974 BonjourData *bd = purple_connection_get_protocol_data(pc); |
e895aebcb504
Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
31932
diff
changeset
|
975 BonjourJabber *jdata = bd->jabber_data; |
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
|
976 struct _match_buddies_by_address_t *mbba; |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
977 GSList *buddies; |
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 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 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
|
980 mbba->address = bconv->ip; |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
981 |
26766
9331016df8ac
Use more efficient purple_find_buddies in bonjour.
Paul Aurich <paul@darkrain42.org>
parents:
26538
diff
changeset
|
982 buddies = purple_find_buddies(jdata->account, NULL); |
26538
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
983 g_slist_foreach(buddies, _match_buddies_by_address, mbba); |
2b7604ede0e4
Change purple_blist_get_buddies to return a list instead of the hash table.
Paul Aurich <paul@darkrain42.org>
parents:
25947
diff
changeset
|
984 g_slist_free(buddies); |
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
|
985 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 /* 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
|
987 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
|
988 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
|
989 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
|
990 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
|
991 PurpleBuddy *pb = mbba->matched_buddies->data; |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
992 BonjourBuddy *bb = purple_buddy_get_protocol_data(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
|
993 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 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
|
995 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
|
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 /* 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
|
998 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
|
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 /* 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
|
1001 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
|
1002 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
|
1003 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1004 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
|
1005 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
|
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 } 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
|
1008 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
|
1009 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 /* 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
|
1011 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
|
1012 /* 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
|
1013 * 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
|
1014 */ |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 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
|
1016 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting 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 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
|
1019 g_free(mbba); |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1020 } |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1021 |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1022 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
|
1023 _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
|
1024 { |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1025 PurpleBuddy *pb = NULL; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1026 BonjourBuddy *bb = NULL; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1027 |
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
|
1028 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
|
1029 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
|
1030 |
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
|
1031 pb = purple_find_buddy(jdata->account, to); |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1032 if (pb == NULL || (bb = purple_buddy_get_protocol_data(pb)) == NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 /* 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
|
1034 return NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 |
17500
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
1036 /* 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
|
1037 if (bb->conversation == NULL) |
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
1038 { |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1039 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
|
1040 PurpleProxyInfo *proxy_info; |
31537
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
1041 const char *ip = bb->ips->data; /* Start with the first IP address. */ |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1042 |
31537
6ec53e134447
bonjour: Recurse through user IP addresses instead of using the first one only
Simon van der Linden <simon@vanderlinden.eu.org>
parents:
30585
diff
changeset
|
1043 purple_debug_info("bonjour", "Starting conversation with %s at %s:%d\n", to, ip, bb->port_p2pj); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1044 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1045 /* 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
|
1046 * 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
|
1047 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
|
1048 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
|
1049 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
|
1050 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
|
1051 } |
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
|
1052 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
|
1053 |
27119
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
26766
diff
changeset
|
1054 connect_data = purple_proxy_connect( |
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
26766
diff
changeset
|
1055 purple_account_get_connection(jdata->account), |
d078048fb03a
Pass the gc as the handle in a bunch of calls to purple_proxy_connect
Mark Doliner <mark@kingant.net>
parents:
26766
diff
changeset
|
1056 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
|
1057 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
|
1058 |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1059 if (connect_data == NULL) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1060 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
|
1061 return NULL; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1062 } |
17500
bca2780f7669
Improve error handling while connecting to a bonjour buddy.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
1063 |
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
|
1064 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
|
1065 bb->conversation->connect_data = connect_data; |
31538
e1d31abb245c
bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31537
diff
changeset
|
1066 bb->conversation->ip_link = ip; |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1067 /* 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
|
1068 * 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
|
1069 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
|
1070 } |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1071 return pb; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1072 } |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1073 |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1074 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
|
1075 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
|
1076 { |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1077 xmlnode *message_node, *node, *node2; |
24170
bb8aa63494e7
Looks like we need to convert the message into XHTML first. Fixes #7160.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23999
diff
changeset
|
1078 gchar *message, *xhtml; |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1079 PurpleBuddy *pb; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1080 BonjourBuddy *bb; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1081 int ret; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1082 |
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
|
1083 pb = _find_or_start_conversation(jdata, to); |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1084 if (pb == NULL || (bb = purple_buddy_get_protocol_data(pb)) == NULL) { |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1085 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
|
1086 /* 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
|
1087 return -10000; |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1088 } |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1089 |
24170
bb8aa63494e7
Looks like we need to convert the message into XHTML first. Fixes #7160.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23999
diff
changeset
|
1090 purple_markup_html_to_xhtml(body, &xhtml, &message); |
bb8aa63494e7
Looks like we need to convert the message into XHTML first. Fixes #7160.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23999
diff
changeset
|
1091 |
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
|
1092 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
|
1093 xmlnode_set_attrib(message_node, "to", bb->name); |
30583
9c8b28dc6656
The hostname used for a bonjour account should always be the current machine
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30413
diff
changeset
|
1094 xmlnode_set_attrib(message_node, "from", bonjour_get_jid(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
|
1095 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
|
1096 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 /* 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
|
1098 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
|
1099 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
|
1100 g_free(message); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 |
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
|
1102 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
|
1103 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
|
1104 |
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
|
1105 node = xmlnode_new_child(node, "body"); |
24170
bb8aa63494e7
Looks like we need to convert the message into XHTML first. Fixes #7160.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23999
diff
changeset
|
1106 message = g_strdup_printf("<font>%s</font>", xhtml); |
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
|
1107 node2 = xmlnode_from_str(message, strlen(message)); |
24170
bb8aa63494e7
Looks like we need to convert the message into XHTML first. Fixes #7160.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23999
diff
changeset
|
1108 g_free(xhtml); |
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
|
1109 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
|
1110 xmlnode_insert_child(node, node2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 |
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
|
1112 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
|
1113 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
|
1114 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
|
1115 |
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
|
1116 message = xmlnode_to_str(message_node, NULL); |
15811 | 1117 xmlnode_free(message_node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1119 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
|
1120 |
15811 | 1121 g_free(message); |
1122 | |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1123 return ret; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1124 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 |
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
|
1126 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
|
1127 _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
|
1128 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
|
1129 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
|
1130 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
|
1131 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1132 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1133 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
|
1134 async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) { |
31932
61ce89013291
Use accessor functions in a few places
Mark Doliner <mark@kingant.net>
parents:
31538
diff
changeset
|
1135 PurpleConnection *pc = purple_account_get_connection(bconv->account); |
31979
e895aebcb504
Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
31932
diff
changeset
|
1136 BonjourData *bd = purple_connection_get_protocol_data(pc); |
e895aebcb504
Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
31932
diff
changeset
|
1137 BonjourJabber *jdata = bd->jabber_data; |
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
|
1138 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1139 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
|
1140 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1141 /* 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
|
1142 if(bconv->pb != NULL) { |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1143 BonjourBuddy *bb = purple_buddy_get_protocol_data(bconv->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
|
1144 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
|
1145 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
|
1146 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1147 |
22111
603d5325af4c
Prevent a crash caused by freed memory being accessed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21829
diff
changeset
|
1148 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
|
1149 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1150 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 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
|
1152 bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 { |
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
|
1154 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
|
1155 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
|
1156 |
31932
61ce89013291
Use accessor functions in a few places
Mark Doliner <mark@kingant.net>
parents:
31538
diff
changeset
|
1157 PurpleConnection *pc = purple_account_get_connection(bconv->account); |
61ce89013291
Use accessor functions in a few places
Mark Doliner <mark@kingant.net>
parents:
31538
diff
changeset
|
1158 if (PURPLE_CONNECTION_IS_VALID(pc)) { |
31979
e895aebcb504
Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
31932
diff
changeset
|
1159 bd = purple_connection_get_protocol_data(pc); |
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
|
1160 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
|
1161 } |
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
|
1162 |
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
|
1163 /* 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
|
1164 /* 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
|
1165 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
|
1166 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
|
1167 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
|
1168 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
|
1169 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
|
1170 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
|
1171 /* 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
|
1172 /* This will change if we ever support IBB transfers. */ |
32331
1ffa35da9a7b
Bonjour: Use file-transfer accessor functions.
andrew.victor@mxit.com
parents:
32216
diff
changeset
|
1173 if (strcmp(purple_xfer_get_remote_user(xfer), purple_buddy_get_name(bconv->pb)) == 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
|
1174 && (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
|
1175 || 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
|
1176 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
|
1177 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1178 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
|
1179 } |
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
|
1180 } |
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
|
1181 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 /* 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
|
1183 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
|
1184 /* 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
|
1185 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
|
1186 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
|
1187 /* 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
|
1188 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
|
1189 } |
19399
649ac48fce1d
Reset unsigned int input handlers to 0 instead of -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19233
diff
changeset
|
1190 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
|
1191 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
|
1192 if (bconv->tx_handler > 0) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1193 purple_input_remove(bconv->tx_handler); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 /* 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
|
1196 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
|
1197 if (bconv->connect_data != NULL) |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1198 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
|
1199 if (bconv->stream_data != NULL) { |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1200 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
|
1201 g_free(ss->msg); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1202 g_free(ss); |
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1203 } |
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
|
1204 |
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
|
1205 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
|
1206 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
|
1207 |
22111
603d5325af4c
Prevent a crash caused by freed memory being accessed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21829
diff
changeset
|
1208 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
|
1209 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
|
1210 |
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
|
1211 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
|
1212 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
|
1213 g_free(bconv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1215 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 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
|
1218 bonjour_jabber_stop(BonjourJabber *jdata) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 { |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
1220 /* 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
|
1221 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
|
1222 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
|
1223 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
|
1224 purple_input_remove(jdata->watcher_id); |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1225 if (jdata->socket6 >= 0) |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1226 close(jdata->socket6); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1227 if (jdata->watcher_id6 > 0) |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1228 purple_input_remove(jdata->watcher_id6); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1229 |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
1230 /* Close all the conversation sockets and remove all the watchers after sending end streams */ |
31932
61ce89013291
Use accessor functions in a few places
Mark Doliner <mark@kingant.net>
parents:
31538
diff
changeset
|
1231 if (!purple_account_is_disconnected(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
|
1232 GSList *buddies, *l; |
17542
496d007a8912
Some more Bonjour cleanup and leak fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
1233 |
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
|
1234 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
|
1235 for (l = buddies; l; l = l->next) { |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1236 BonjourBuddy *bb = purple_buddy_get_protocol_data((PurpleBuddy*) l->data); |
29931
55913ed2a229
bonjour: Fix a crash-on-disconnect I introduced. Closes #11851
Paul Aurich <paul@darkrain42.org>
parents:
29716
diff
changeset
|
1237 if (bb && bb->conversation) { |
29649
99c9595e14a2
Fix two related on-disconnect double frees.
Paul Aurich <paul@darkrain42.org>
parents:
29481
diff
changeset
|
1238 /* Any ongoing connection attempt is cancelled |
99c9595e14a2
Fix two related on-disconnect double frees.
Paul Aurich <paul@darkrain42.org>
parents:
29481
diff
changeset
|
1239 * by _purple_connection_destroy */ |
99c9595e14a2
Fix two related on-disconnect double frees.
Paul Aurich <paul@darkrain42.org>
parents:
29481
diff
changeset
|
1240 bb->conversation->connect_data = NULL; |
23018
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22907
diff
changeset
|
1241 bonjour_jabber_close_conversation(bb->conversation); |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22907
diff
changeset
|
1242 bb->conversation = NULL; |
ef0bcbe33689
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22907
diff
changeset
|
1243 } |
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
|
1244 } |
17558
6e4e2d234c3a
Update Bonjour to do nonblocking I/O correctly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17556
diff
changeset
|
1245 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 g_slist_free(buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 } |
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
|
1248 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21820
diff
changeset
|
1249 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
|
1250 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
|
1251 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
|
1252 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 } |
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
|
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 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
|
1256 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
|
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 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
|
1259 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
|
1260 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1261 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
|
1262 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
|
1263 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
|
1264 |
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
|
1265 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
|
1266 |
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
|
1267 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
|
1268 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
|
1269 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
|
1270 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
|
1271 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
|
1272 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
|
1273 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
|
1274 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
|
1275 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
|
1276 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
|
1277 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
|
1278 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
|
1279 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
|
1280 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
|
1281 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
|
1282 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
|
1283 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
|
1284 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
|
1285 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
|
1286 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
|
1287 } |
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
|
1288 |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1289 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
|
1290 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
|
1291 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
|
1292 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
|
1293 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
|
1294 |
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
|
1295 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
|
1296 } |
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
|
1297 |
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
|
1298 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
|
1299 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
|
1300 { |
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
|
1301 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
|
1302 GSList *l = NULL; |
24675
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24674
diff
changeset
|
1303 PurpleAccount *acc = purple_buddy_get_account(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
|
1304 |
24675
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24674
diff
changeset
|
1305 if(acc == 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
|
1306 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
|
1307 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24170
diff
changeset
|
1308 acc = purple_buddy_get_account(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
|
1309 |
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
|
1310 for(l = acc->deny; l != NULL; l = l->next) { |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1311 const gchar *name = purple_buddy_get_name(pb); |
30583
9c8b28dc6656
The hostname used for a bonjour account should always be the current machine
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30413
diff
changeset
|
1312 const gchar *username = bonjour_get_jid(acc); |
25791
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1313 |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1314 if(!purple_utf8_strcasecmp(name, (char *)l->data)) { |
252e26edb7a9
Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents:
24344
diff
changeset
|
1315 purple_debug_info("bonjour", "%s has been blocked by %s.\n", name, 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
|
1316 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
|
1317 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
|
1318 } |
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
|
1319 } |
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
|
1320 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
|
1321 } |
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
|
1322 |
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
|
1323 static void |
24675
35d0ce5f319a
Further cleanup to fix CID 373.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24674
diff
changeset
|
1324 xep_iq_parse(xmlnode *packet, PurpleBuddy *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
|
1325 { |
25877
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
1326 PurpleAccount *account; |
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
1327 PurpleConnection *gc; |
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
|
1328 |
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
|
1329 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
|
1330 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
|
1331 |
25877
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
1332 account = purple_buddy_get_account(pb); |
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
1333 gc = purple_account_get_connection(account); |
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
1334 |
30413
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29960
diff
changeset
|
1335 if (xmlnode_get_child(packet, "si") != NULL || xmlnode_get_child(packet, "error") != NULL) |
25877
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
1336 xep_si_parse(gc, 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
|
1337 else |
25877
1260a3fb60f4
propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
1338 xep_bytestreams_parse(gc, 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
|
1339 } |
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
|
1340 |
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
|
1341 int |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1342 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
|
1343 { |
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
|
1344 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
|
1345 PurpleBuddy *pb = NULL; |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1346 |
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
|
1347 /* 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
|
1348 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
|
1349 /* Send the message */ |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1350 if (pb != NULL) { |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1351 /* Convert xml node into stream */ |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1352 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
|
1353 ret = _send_data(pb, msg); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1354 g_free(msg); |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1355 } |
21465
e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21464
diff
changeset
|
1356 |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1357 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
|
1358 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
|
1359 g_free(iq); |
21441
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1360 |
da75dd6c41fb
Leak fix, cleanup and code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21440
diff
changeset
|
1361 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
|
1362 } |
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
|
1363 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1364 /* This returns a list containing all non-localhost IPs */ |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1365 GSList * |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1366 bonjour_jabber_get_local_ips(int fd) |
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
|
1367 { |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1368 GSList *ips = NULL; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1369 const char *address_text; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1370 int ret; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1371 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1372 #ifdef HAVE_GETIFADDRS /* This is required for IPv6 */ |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1373 { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1374 struct ifaddrs *ifap, *ifa; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1375 struct sockaddr *addr; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1376 char addrstr[INET6_ADDRSTRLEN]; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1377 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1378 ret = getifaddrs(&ifap); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1379 if (ret != 0) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1380 const char *error = g_strerror(errno); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1381 purple_debug_error("bonjour", "getifaddrs() error: %s\n", error ? error : "(null)"); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1382 return NULL; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1383 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1384 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1385 for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1386 if (!(ifa->ifa_flags & IFF_RUNNING) || (ifa->ifa_flags & IFF_LOOPBACK) || ifa->ifa_addr == NULL) |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1387 continue; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1388 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1389 addr = ifa->ifa_addr; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1390 address_text = NULL; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1391 switch (addr->sa_family) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1392 case AF_INET: |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1393 address_text = inet_ntop(addr->sa_family, &((struct sockaddr_in *)addr)->sin_addr, |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1394 addrstr, sizeof(addrstr)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1395 break; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1396 #ifdef PF_INET6 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1397 case AF_INET6: |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1398 address_text = inet_ntop(addr->sa_family, &((struct sockaddr_in6 *)addr)->sin6_addr, |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1399 addrstr, sizeof(addrstr)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1400 break; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1401 #endif |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1402 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1403 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1404 if (address_text != NULL) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1405 if (addr->sa_family == AF_INET) |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1406 ips = g_slist_append(ips, g_strdup(address_text)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1407 else |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1408 ips = g_slist_prepend(ips, g_strdup(address_text)); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1409 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1410 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1411 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1412 freeifaddrs(ifap); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1413 |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1414 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1415 #else |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1416 { |
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
|
1417 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
|
1418 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
|
1419 struct ifreq *ifr; |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1420 char buffer[1024]; |
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
|
1421 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
|
1422 int source = 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
|
1423 |
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
|
1424 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
|
1425 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
|
1426 |
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
|
1427 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
|
1428 ifc.ifc_req = (struct ifreq *)buffer; |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1429 ret = ioctl(source, SIOCGIFCONF, &ifc); |
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
|
1430 |
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
|
1431 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
|
1432 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
|
1433 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1434 if (ret < 0) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1435 const char *error = g_strerror(errno); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1436 purple_debug_error("bonjour", "ioctl(SIOCGIFCONF) error: %s\n", error ? error : "(null)"); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1437 return NULL; |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1438 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1439 |
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
|
1440 tmp = buffer; |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1441 while (tmp < buffer + ifc.ifc_len) { |
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
|
1442 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
|
1443 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
|
1444 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1445 if (ifr->ifr_addr.sa_family == AF_INET) { |
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
|
1446 sinptr = (struct sockaddr_in *)&ifr->ifr_addr; |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1447 if ((ntohl(sinptr->sin_addr.s_addr) >> 24) != 127) { |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1448 address_text = inet_ntoa(sinptr->sin_addr); |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1449 ips = g_slist_prepend(ips, g_strdup(address_text)); |
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
|
1450 } |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1451 } |
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
|
1452 } |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1453 } |
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1454 #endif |
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
|
1455 |
29481
755219afed9f
Implementation of IPv6 support for Bonjour
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27371
diff
changeset
|
1456 return ips; |
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
|
1457 } |
32369
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1458 |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1459 void |
32390
c0c60e110c82
Fix the compilation of the Bonjour prpl on Windows.
Eion Robb <eion@robbmob.com>
parents:
32369
diff
changeset
|
1460 append_iface_if_linklocal(char *ip, guint32 interface_param) { |
32369
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1461 struct in6_addr in6_addr; |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1462 int len_remain = INET6_ADDRSTRLEN - strlen(ip); |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1463 |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1464 if (len_remain <= 1) |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1465 return; |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1466 |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1467 if (inet_pton(AF_INET6, ip, &in6_addr) != 1 || |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1468 !IN6_IS_ADDR_LINKLOCAL(&in6_addr)) |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1469 return; |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1470 |
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1471 snprintf(ip + strlen(ip), len_remain, "%%%d", |
32390
c0c60e110c82
Fix the compilation of the Bonjour prpl on Windows.
Eion Robb <eion@robbmob.com>
parents:
32369
diff
changeset
|
1472 interface_param); |
32369
d6cc1ff0d9b7
Append interface ID only to local interfaces for IPv6 Bonjour.
linus.luessing@web.de
parents:
31538
diff
changeset
|
1473 } |