libpurple/protocols/bonjour/parser.c

Wed, 10 Feb 2010 03:32:29 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Wed, 10 Feb 2010 03:32:29 +0000
changeset 29328
cf4435714f5f
parent 27361
62f1aa8045bb
child 29697
dfeaa83ed16e
permissions
-rw-r--r--

Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.

If nobody has objections, I intend to add purple_unescape_text() to
util.[ch] for 2.7.0.

19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
1 /*
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
2 * purple - Bonjour Jabber XML parser stuff
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
3 *
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
6 * source distribution.
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
7 *
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
12 *
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
17 *
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19373
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
21 *
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
22 */
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
23 #include "internal.h"
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
24
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
25 #include <libxml/parser.h>
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
26
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
27 #include "connection.h"
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
28 #include "debug.h"
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
29 #include "jabber.h"
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
30 #include "parser.h"
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
31 #include "util.h"
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
32 #include "xmlnode.h"
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
33
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
34 static gboolean
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
35 parse_from_attrib_and_find_buddy(BonjourJabberConversation *bconv, int nb_attributes, const xmlChar **attributes) {
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
36 int i;
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
37
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
38 /* If the "from" attribute is specified, attach it to the conversation. */
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
39 for(i=0; i < nb_attributes * 5; i+=5) {
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
40 if(!xmlStrcmp(attributes[i], (xmlChar*) "from")) {
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
41 int len = attributes[i+4] - attributes[i+3];
22108
cb9819851163 Squash some compiler warnings, some from my -Wstrict-prototypes fixing.
Richard Laager <rlaager@pidgin.im>
parents: 21944
diff changeset
42 bconv->buddy_name = g_strndup((char *)attributes[i+3], len);
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
43 bonjour_jabber_conv_match_by_name(bconv);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
44
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
45 return (bconv->pb != NULL);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
46 }
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
47 }
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
48
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
49 return FALSE;
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
50 }
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
51
29328
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
52 static char *purple_unescape_text(const char *in)
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
53 {
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
54 GString *ret;
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
55 const char *c = in;
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
56
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
57 if (in == NULL)
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
58 return NULL;
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
59
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
60 ret = g_string_new("");
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
61 while (*c) {
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
62 int len;
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
63 const char *ent;
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
64
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
65 if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) {
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
66 g_string_append(ret, ent);
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
67 c += len;
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
68 } else {
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
69 g_string_append_c(ret, *c);
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
70 c++;
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
71 }
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
72 }
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
73
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
74 return g_string_free(ret, FALSE);
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
75 }
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
76
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
77 static void
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
78 bonjour_parser_element_start_libxml(void *user_data,
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
79 const xmlChar *element_name, const xmlChar *prefix, const xmlChar *namespace,
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
80 int nb_namespaces, const xmlChar **namespaces,
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
81 int nb_attributes, int nb_defaulted, const xmlChar **attributes)
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
82 {
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
83 BonjourJabberConversation *bconv = user_data;
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
84
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
85 xmlnode *node;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
86 int i;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
87
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
88 g_return_if_fail(element_name != NULL);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
89
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
90 if(!xmlStrcmp(element_name, (xmlChar*) "stream")) {
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
91 if(!bconv->recv_stream_start) {
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
92 bconv->recv_stream_start = TRUE;
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
93
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
94 if (bconv->pb == NULL)
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
95 parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
96
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
97 bonjour_jabber_stream_started(bconv);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
98 }
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
99 } else {
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
100
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
101 /* If we haven't yet attached a buddy and this isn't "<stream:features />",
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
102 * try to get a "from" attribute as a last resort to match our buddy. */
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
103 if(bconv->pb == NULL
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
104 && !(prefix && !xmlStrcmp(prefix, (xmlChar*) "stream")
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
105 && !xmlStrcmp(element_name, (xmlChar*) "features"))
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
106 && !parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes))
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
107 /* We've run out of options for finding who the conversation is from
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
108 using explicitly specified stuff; see if we can make a good match
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
109 by using the IP */
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
110 bonjour_jabber_conv_match_by_ip(bconv);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
111
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
112 if(bconv->current)
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
113 node = xmlnode_new_child(bconv->current, (const char*) element_name);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
114 else
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
115 node = xmlnode_new((const char*) element_name);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
116 xmlnode_set_namespace(node, (const char*) namespace);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
117
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
118 for(i=0; i < nb_attributes * 5; i+=5) {
26393
7420fd99903a Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23072
diff changeset
119 const char *name = (const char *)attributes[i];
7420fd99903a Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23072
diff changeset
120 const char *prefix = (const char *)attributes[i+1];
7420fd99903a Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23072
diff changeset
121 const char *attrib_ns = (const char *)attributes[i+2];
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
122 char *txt;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
123 int attrib_len = attributes[i+4] - attributes[i+3];
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
124 char *attrib = g_malloc(attrib_len + 1);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
125
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
126 memcpy(attrib, attributes[i+3], attrib_len);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
127 attrib[attrib_len] = '\0';
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
128
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
129 txt = attrib;
29328
cf4435714f5f Correctly parse "&lt;br&gt;" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents: 27361
diff changeset
130 attrib = purple_unescape_text(txt);
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
131 g_free(txt);
26393
7420fd99903a Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23072
diff changeset
132 xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib);
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
133 g_free(attrib);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
134 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
135
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
136 bconv->current = node;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
137 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
138 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
139
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
140 static void
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
141 bonjour_parser_element_end_libxml(void *user_data, const xmlChar *element_name,
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
142 const xmlChar *prefix, const xmlChar *namespace)
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
143 {
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
144 BonjourJabberConversation *bconv = user_data;
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
145
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
146 if(!bconv->current) {
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
147 /* We don't keep a reference to the start stream xmlnode,
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
148 * so we have to check for it here to close the conversation */
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
149 if(!xmlStrcmp(element_name, (xmlChar*) "stream"))
19373
5c4391d94bf5 Don't trigger another libxml2 parse from within one of the parsing callbacks. References #1652.
Daniel Atallah <datallah@pidgin.im>
parents: 19056
diff changeset
150 /* Asynchronously close the conversation to prevent bonjour_parser_setup()
5c4391d94bf5 Don't trigger another libxml2 parse from within one of the parsing callbacks. References #1652.
Daniel Atallah <datallah@pidgin.im>
parents: 19056
diff changeset
151 * being called from within this context */
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
152 async_bonjour_jabber_close_conversation(bconv);
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
153 return;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
154 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
155
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
156 if(bconv->current->parent) {
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
157 if(!xmlStrcmp((xmlChar*) bconv->current->name, element_name))
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
158 bconv->current = bconv->current->parent;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
159 } else {
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
160 xmlnode *packet = bconv->current;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
161 bconv->current = NULL;
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
162 bonjour_jabber_process_packet(bconv->pb, packet);
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
163 xmlnode_free(packet);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
164 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
165 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
166
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
167 static void
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
168 bonjour_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len)
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
169 {
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
170 BonjourJabberConversation *bconv = user_data;
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
171
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
172 if(!bconv->current)
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
173 return;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
174
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
175 if(!text || !text_len)
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
176 return;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
177
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
178 xmlnode_insert_data(bconv->current, (const char*) text, text_len);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
179 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
180
25726
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
181 static void
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
182 bonjour_parser_structured_error_handler(void *user_data, xmlErrorPtr error)
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
183 {
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
184 BonjourJabberConversation *bconv = user_data;
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
185
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
186 purple_debug_error("jabber", "XML parser error for BonjourJabberConversation %p: "
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
187 "Domain %i, code %i, level %i: %s",
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
188 bconv,
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
189 error->domain, error->code, error->level,
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
190 (error->message ? error->message : "(null)\n"));
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
191 }
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
192
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
193 static xmlSAXHandler bonjour_parser_libxml = {
23072
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
194 NULL, /*internalSubset*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
195 NULL, /*isStandalone*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
196 NULL, /*hasInternalSubset*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
197 NULL, /*hasExternalSubset*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
198 NULL, /*resolveEntity*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
199 NULL, /*getEntity*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
200 NULL, /*entityDecl*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
201 NULL, /*notationDecl*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
202 NULL, /*attributeDecl*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
203 NULL, /*elementDecl*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
204 NULL, /*unparsedEntityDecl*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
205 NULL, /*setDocumentLocator*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
206 NULL, /*startDocument*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
207 NULL, /*endDocument*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
208 NULL, /*startElement*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
209 NULL, /*endElement*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
210 NULL, /*reference*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
211 bonjour_parser_element_text_libxml, /*characters*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
212 NULL, /*ignorableWhitespace*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
213 NULL, /*processingInstruction*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
214 NULL, /*comment*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
215 NULL, /*warning*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
216 NULL, /*error*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
217 NULL, /*fatalError*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
218 NULL, /*getParameterEntity*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
219 NULL, /*cdataBlock*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
220 NULL, /*externalSubset*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
221 XML_SAX2_MAGIC, /*initialized*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
222 NULL, /*_private*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
223 bonjour_parser_element_start_libxml, /*startElementNs*/
6e7c147d622a Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents: 22108
diff changeset
224 bonjour_parser_element_end_libxml, /*endElementNs*/
25726
19e0c9302a43 *** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents: 23072
diff changeset
225 bonjour_parser_structured_error_handler /*serror*/
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
226 };
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
227
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
228 void
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
229 bonjour_parser_setup(BonjourJabberConversation *bconv)
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
230 {
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
231
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
232 /* This seems backwards, but it makes sense. The libxml code creates
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
233 * the parser context when you try to use it (this way, it can figure
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
234 * out the encoding at creation time. So, setting up the parser is
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
235 * just a matter of destroying any current parser. */
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
236 if (bconv->context) {
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
237 xmlParseChunk(bconv->context, NULL,0,1);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
238 xmlFreeParserCtxt(bconv->context);
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
239 bconv->context = NULL;
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
240 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
241 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
242
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
243
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
244 void bonjour_parser_process(BonjourJabberConversation *bconv, const char *buf, int len)
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
245 {
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
246
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
247 if (bconv->context == NULL) {
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
248 /* libxml inconsistently starts parsing on creating the
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
249 * parser, so do a ParseChunk right afterwards to force it. */
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
250 bconv->context = xmlCreatePushParserCtxt(&bonjour_parser_libxml, bconv, buf, len, NULL);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
251 xmlParseChunk(bconv->context, "", 0, 0);
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
252 } else if (xmlParseChunk(bconv->context, buf, len, 0) < 0)
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
253 /* TODO: What should we do here - I assume we should display an error or something (maybe just print something to the conv?) */
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
254 purple_debug_error("bonjour", "Error parsing xml.\n");
21944
c41d17a1b8d9 This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents: 21612
diff changeset
255
19056
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
256 }
05cd9ab28312 Update the Bonjour prpl to use libxml explicitly instead of the xml_node stuff. This allows us to deal with partial reads. I also fixed issues related to starting conversations with iChat and a couple other things. Fixes #2022,#1652
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
257

mercurial