Mercurial > pidgin
annotate libpurple/protocols/bonjour/parser.c @ 25827:0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 14 Nov 2008 05:32:35 +0000 |
parents | 1c87e81c44fa |
children | f424f26dd329 b03430dae08e |
rev | line source |
---|---|
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:
diff
changeset
|
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:
diff
changeset
|
2 * purple - Bonjour Jabber XML parser stuff |
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:
diff
changeset
|
3 * |
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:
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
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:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
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:
diff
changeset
|
6 * source distribution. |
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:
diff
changeset
|
7 * |
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:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
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:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
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:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
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:
diff
changeset
|
11 * (at your option) any later version. |
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:
diff
changeset
|
12 * |
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:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
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:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
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:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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:
diff
changeset
|
16 * GNU General Public License for more details. |
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:
diff
changeset
|
17 * |
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:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
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:
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:
19233
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
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:
diff
changeset
|
21 * |
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:
diff
changeset
|
22 */ |
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:
diff
changeset
|
23 #include "internal.h" |
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:
diff
changeset
|
24 |
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:
diff
changeset
|
25 #include <libxml/parser.h> |
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:
diff
changeset
|
26 |
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:
diff
changeset
|
27 #include "connection.h" |
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:
diff
changeset
|
28 #include "debug.h" |
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:
diff
changeset
|
29 #include "jabber.h" |
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:
diff
changeset
|
30 #include "parser.h" |
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:
diff
changeset
|
31 #include "util.h" |
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:
diff
changeset
|
32 #include "xmlnode.h" |
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:
diff
changeset
|
33 |
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:
21527
diff
changeset
|
34 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:
21527
diff
changeset
|
35 parse_from_attrib_and_find_buddy(BonjourJabberConversation *bconv, int nb_attributes, const xmlChar **attributes) { |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
36 int i; |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
37 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
38 /* If the "from" attribute is specified, attach it to the 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:
21527
diff
changeset
|
39 for(i=0; i < nb_attributes * 5; i+=5) { |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
40 if(!xmlStrcmp(attributes[i], (xmlChar*) "from")) { |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
41 int len = attributes[i+4] - attributes[i+3]; |
22011
76e0463db3aa
Squash some compiler warnings, some from my -Wstrict-prototypes fixing.
Richard Laager <rlaager@wiktel.com>
parents:
21829
diff
changeset
|
42 bconv->buddy_name = g_strndup((char *)attributes[i+3], len); |
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:
21527
diff
changeset
|
43 bonjour_jabber_conv_match_by_name(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:
21527
diff
changeset
|
44 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
45 return (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:
21527
diff
changeset
|
46 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
47 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
48 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
49 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:
21527
diff
changeset
|
50 } |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
51 |
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:
diff
changeset
|
52 static void |
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:
diff
changeset
|
53 bonjour_parser_element_start_libxml(void *user_data, |
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:
diff
changeset
|
54 const xmlChar *element_name, const xmlChar *prefix, const xmlChar *namespace, |
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:
diff
changeset
|
55 int nb_namespaces, const xmlChar **namespaces, |
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:
diff
changeset
|
56 int nb_attributes, int nb_defaulted, const xmlChar **attributes) |
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:
diff
changeset
|
57 { |
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:
21527
diff
changeset
|
58 BonjourJabberConversation *bconv = user_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:
diff
changeset
|
59 |
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:
diff
changeset
|
60 xmlnode *node; |
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:
diff
changeset
|
61 int i; |
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:
diff
changeset
|
62 |
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:
21527
diff
changeset
|
63 g_return_if_fail(element_name != 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:
21527
diff
changeset
|
64 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
65 if(!xmlStrcmp(element_name, (xmlChar*) "stream")) { |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
66 if(!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:
21527
diff
changeset
|
67 bconv->recv_stream_start = TRUE; |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
68 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
69 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:
21527
diff
changeset
|
70 parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes); |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
71 |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
72 bonjour_jabber_stream_started(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:
21527
diff
changeset
|
73 } |
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:
diff
changeset
|
74 } else { |
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:
diff
changeset
|
75 |
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:
21527
diff
changeset
|
76 /* If we haven't yet attached a buddy and this isn't "<stream:features />", |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
77 * try to get a "from" attribute as a last resort to match our 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:
21527
diff
changeset
|
78 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:
21527
diff
changeset
|
79 && !(prefix && !xmlStrcmp(prefix, (xmlChar*) "stream") |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
80 && !xmlStrcmp(element_name, (xmlChar*) "features")) |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
81 && !parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes)) |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
82 /* We've run out of options for finding who the conversation is from |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
83 using explicitly specified stuff; see if we can make a good match |
cc0809ec0c85
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21527
diff
changeset
|
84 by using the 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:
21527
diff
changeset
|
85 bonjour_jabber_conv_match_by_ip(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:
21527
diff
changeset
|
86 |
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:
diff
changeset
|
87 if(bconv->current) |
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:
diff
changeset
|
88 node = xmlnode_new_child(bconv->current, (const char*) element_name); |
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:
diff
changeset
|
89 else |
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:
diff
changeset
|
90 node = xmlnode_new((const char*) element_name); |
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:
diff
changeset
|
91 xmlnode_set_namespace(node, (const char*) namespace); |
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:
diff
changeset
|
92 |
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:
diff
changeset
|
93 for(i=0; i < nb_attributes * 5; i+=5) { |
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:
diff
changeset
|
94 char *txt; |
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:
diff
changeset
|
95 int attrib_len = attributes[i+4] - attributes[i+3]; |
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:
diff
changeset
|
96 char *attrib = g_malloc(attrib_len + 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:
diff
changeset
|
97 char *attrib_ns = 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:
diff
changeset
|
98 |
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:
diff
changeset
|
99 if (attributes[i+2]) { |
20332
3a9709bfde65
applied changes from 4d50bf3b08569aa2108a9f5da47fb1548d0c7dd9
Luke Schierer <lschiere@pidgin.im>
parents:
20329
diff
changeset
|
100 attrib_ns = g_strdup((char*)attributes[i+2]); |
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:
diff
changeset
|
101 } |
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:
diff
changeset
|
102 |
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:
diff
changeset
|
103 memcpy(attrib, attributes[i+3], attrib_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:
diff
changeset
|
104 attrib[attrib_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:
diff
changeset
|
105 |
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:
diff
changeset
|
106 txt = attrib; |
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:
diff
changeset
|
107 attrib = purple_unescape_html(txt); |
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:
diff
changeset
|
108 g_free(txt); |
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:
diff
changeset
|
109 xmlnode_set_attrib_with_namespace(node, (const char*) attributes[i], attrib_ns, attrib); |
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:
diff
changeset
|
110 g_free(attrib); |
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:
diff
changeset
|
111 g_free(attrib_ns); |
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:
diff
changeset
|
112 } |
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:
diff
changeset
|
113 |
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:
diff
changeset
|
114 bconv->current = node; |
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:
diff
changeset
|
115 } |
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:
diff
changeset
|
116 } |
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:
diff
changeset
|
117 |
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:
diff
changeset
|
118 static void |
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:
diff
changeset
|
119 bonjour_parser_element_end_libxml(void *user_data, const xmlChar *element_name, |
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:
diff
changeset
|
120 const xmlChar *prefix, const xmlChar *namespace) |
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:
diff
changeset
|
121 { |
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:
21527
diff
changeset
|
122 BonjourJabberConversation *bconv = user_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:
diff
changeset
|
123 |
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:
diff
changeset
|
124 if(!bconv->current) { |
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:
diff
changeset
|
125 /* We don't keep a reference to the start stream xmlnode, |
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:
diff
changeset
|
126 * so we have to check for it here to close the conversation */ |
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:
21527
diff
changeset
|
127 if(!xmlStrcmp(element_name, (xmlChar*) "stream")) |
19233
6e3cd5e80420
Don't trigger another libxml2 parse from within one of the parsing callbacks. References #1652.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18761
diff
changeset
|
128 /* Asynchronously close the conversation to prevent bonjour_parser_setup() |
6e3cd5e80420
Don't trigger another libxml2 parse from within one of the parsing callbacks. References #1652.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18761
diff
changeset
|
129 * being called from within this context */ |
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:
21527
diff
changeset
|
130 async_bonjour_jabber_close_conversation(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:
diff
changeset
|
131 return; |
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:
diff
changeset
|
132 } |
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:
diff
changeset
|
133 |
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:
diff
changeset
|
134 if(bconv->current->parent) { |
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:
diff
changeset
|
135 if(!xmlStrcmp((xmlChar*) bconv->current->name, element_name)) |
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:
diff
changeset
|
136 bconv->current = bconv->current->parent; |
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:
diff
changeset
|
137 } else { |
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:
diff
changeset
|
138 xmlnode *packet = bconv->current; |
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:
diff
changeset
|
139 bconv->current = 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:
21527
diff
changeset
|
140 bonjour_jabber_process_packet(bconv->pb, packet); |
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:
diff
changeset
|
141 xmlnode_free(packet); |
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:
diff
changeset
|
142 } |
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:
diff
changeset
|
143 } |
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:
diff
changeset
|
144 |
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:
diff
changeset
|
145 static void |
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:
diff
changeset
|
146 bonjour_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_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:
diff
changeset
|
147 { |
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:
21527
diff
changeset
|
148 BonjourJabberConversation *bconv = user_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:
diff
changeset
|
149 |
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:
diff
changeset
|
150 if(!bconv->current) |
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:
diff
changeset
|
151 return; |
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:
diff
changeset
|
152 |
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:
diff
changeset
|
153 if(!text || !text_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:
diff
changeset
|
154 return; |
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:
diff
changeset
|
155 |
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:
diff
changeset
|
156 xmlnode_insert_data(bconv->current, (const char*) text, text_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:
diff
changeset
|
157 } |
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:
diff
changeset
|
158 |
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:
diff
changeset
|
159 static xmlSAXHandler bonjour_parser_libxml = { |
22907
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
160 NULL, /*internalSubset*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
161 NULL, /*isStandalone*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
162 NULL, /*hasInternalSubset*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
163 NULL, /*hasExternalSubset*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
164 NULL, /*resolveEntity*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
165 NULL, /*getEntity*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
166 NULL, /*entityDecl*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
167 NULL, /*notationDecl*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
168 NULL, /*attributeDecl*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
169 NULL, /*elementDecl*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
170 NULL, /*unparsedEntityDecl*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
171 NULL, /*setDocumentLocator*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
172 NULL, /*startDocument*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
173 NULL, /*endDocument*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
174 NULL, /*startElement*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
175 NULL, /*endElement*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
176 NULL, /*reference*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
177 bonjour_parser_element_text_libxml, /*characters*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
178 NULL, /*ignorableWhitespace*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
179 NULL, /*processingInstruction*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
180 NULL, /*comment*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
181 NULL, /*warning*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
182 NULL, /*error*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
183 NULL, /*fatalError*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
184 NULL, /*getParameterEntity*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
185 NULL, /*cdataBlock*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
186 NULL, /*externalSubset*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
187 XML_SAX2_MAGIC, /*initialized*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
188 NULL, /*_private*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
189 bonjour_parser_element_start_libxml, /*startElementNs*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
190 bonjour_parser_element_end_libxml, /*endElementNs*/ |
1c87e81c44fa
Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22011
diff
changeset
|
191 NULL /*serror*/ |
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:
diff
changeset
|
192 }; |
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:
diff
changeset
|
193 |
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:
diff
changeset
|
194 void |
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:
diff
changeset
|
195 bonjour_parser_setup(BonjourJabberConversation *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:
diff
changeset
|
196 { |
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:
diff
changeset
|
197 |
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:
diff
changeset
|
198 /* This seems backwards, but it makes sense. The libxml code creates |
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:
diff
changeset
|
199 * the parser context when you try to use it (this way, it can figure |
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:
diff
changeset
|
200 * out the encoding at creation time. So, setting up the parser is |
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:
diff
changeset
|
201 * just a matter of destroying any current parser. */ |
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:
diff
changeset
|
202 if (bconv->context) { |
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:
diff
changeset
|
203 xmlParseChunk(bconv->context, NULL,0,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:
diff
changeset
|
204 xmlFreeParserCtxt(bconv->context); |
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:
diff
changeset
|
205 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:
diff
changeset
|
206 } |
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:
diff
changeset
|
207 } |
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:
diff
changeset
|
208 |
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:
diff
changeset
|
209 |
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:
21527
diff
changeset
|
210 void bonjour_parser_process(BonjourJabberConversation *bconv, const char *buf, int len) |
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:
diff
changeset
|
211 { |
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:
diff
changeset
|
212 |
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:
21527
diff
changeset
|
213 if (bconv->context == 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:
diff
changeset
|
214 /* libxml inconsistently starts parsing on creating the |
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:
diff
changeset
|
215 * parser, so do a ParseChunk right afterwards to force it. */ |
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:
21527
diff
changeset
|
216 bconv->context = xmlCreatePushParserCtxt(&bonjour_parser_libxml, bconv, buf, len, 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:
21527
diff
changeset
|
217 xmlParseChunk(bconv->context, "", 0, 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:
21527
diff
changeset
|
218 } else if (xmlParseChunk(bconv->context, buf, len, 0) < 0) |
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:
diff
changeset
|
219 /* TODO: What should we do here - I assume we should display an error or something (maybe just print something to the conv?) */ |
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:
diff
changeset
|
220 purple_debug_error("bonjour", "Error parsing xml.\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:
21527
diff
changeset
|
221 |
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:
diff
changeset
|
222 } |
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:
diff
changeset
|
223 |