annotate libpurple/protocols/jabber/disco.c @ 26248:f19c214201db

'mrim' is the mail.ru IM service. 'smtp' is an XMPP<>email gateway
author Paul Aurich <paul@darkrain42.org>
date Sun, 29 Mar 2009 19:38:31 +0000
parents f5e613e05332
children 2efdd76f5dc0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
2 * purple - Jabber Service Discovery
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19654
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "debug.h"
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
25 #include "request.h"
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
26 #include "notify.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "buddy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "google.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "iq.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "disco.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "jabber.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "presence.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "roster.h"
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents: 17364
diff changeset
35 #include "pep.h"
17882
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17849
diff changeset
36 #include "adhoccommands.h"
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
37 #include "xdata.h"
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
38 #include "libpurple/disco.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 struct _jabber_disco_info_cb_data {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 gpointer data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 JabberDiscoInfoCallback *callback;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
17849
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
45 #define SUPPORT_FEATURE(x) { \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 feature = xmlnode_new_child(query, "feature"); \
17849
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
47 xmlnode_set_attrib(feature, "var", x); \
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
48 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
50 static void
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
51 jabber_disco_bytestream_server_cb(JabberStream *js, xmlnode *packet, gpointer data) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
52 JabberBytestreamsStreamhost *sh = data;
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
53 const char *from = xmlnode_get_attrib(packet, "from");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
54 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
55 "http://jabber.org/protocol/bytestreams");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
56
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
57 if (from && !strcmp(from, sh->jid) && query != NULL) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
58 xmlnode *sh_node = xmlnode_get_child(query, "streamhost");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
59 if (sh_node) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
60 const char *jid = xmlnode_get_attrib(sh_node, "jid");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
61 const char *port = xmlnode_get_attrib(sh_node, "port");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
62
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
63
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
64 if (jid == NULL || strcmp(jid, from) != 0)
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
65 purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
66 jid ? jid : "(null)");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
67
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
68 sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host"));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
69 sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf"));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
70 if (port != NULL)
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
71 sh->port = atoi(port);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
72 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
73 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
74
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
75 purple_debug_info("jabber", "Discovered bytestream proxy server: "
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
76 "jid='%s' host='%s' port='%d' zeroconf='%s'\n",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
77 from ? from : "", sh->host ? sh->host : "",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
78 sh->port, sh->zeroconf ? sh->zeroconf : "");
23600
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
79
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
80 /* TODO: When we support zeroconf proxies, fix this to handle them */
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
81 if (!(sh->jid && sh->host && sh->port > 0)) {
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
82 g_free(sh->jid);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
83 g_free(sh->host);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
84 g_free(sh->zeroconf);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
85 g_free(sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
86 js->bs_proxies = g_list_remove(js->bs_proxies, sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
87 }
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
88 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
89
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 const char *from = xmlnode_get_attrib(packet, "from");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 if(!from || !type)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 if(!strcmp(type, "get")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 xmlnode *query, *identity, *feature;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 xmlnode *in_query;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 const char *node = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 if((in_query = xmlnode_get_child(packet, "query"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 node = xmlnode_get_attrib(in_query, "node");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 "http://jabber.org/protocol/disco#info");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 xmlnode_set_attrib(iq->node, "to", from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 query = xmlnode_get_child(iq->node, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 if(node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 xmlnode_set_attrib(query, "node", node);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 identity = xmlnode_new_child(query, "identity");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 xmlnode_set_attrib(identity, "category", "client");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 * handheld, pc, phone,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 * web */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 xmlnode_set_attrib(identity, "name", PACKAGE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 SUPPORT_FEATURE("jabber:iq:last")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 SUPPORT_FEATURE("jabber:iq:oob")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 SUPPORT_FEATURE("jabber:iq:time")
18259
c5c265dff90c support replying to XEP-0202 queries
Nathan Walp <nwalp@pidgin.im>
parents: 18163
diff changeset
132 SUPPORT_FEATURE("xmpp:urn:time")
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 SUPPORT_FEATURE("jabber:iq:version")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 SUPPORT_FEATURE("jabber:x:conference")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items")
25129
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23600
diff changeset
138 SUPPORT_FEATURE("http://jabber.org/protocol/ibb");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 SUPPORT_FEATURE("http://jabber.org/protocol/muc")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 SUPPORT_FEATURE("http://jabber.org/protocol/si")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im")
18109
3d7129ac1de9 respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents: 17364
diff changeset
144 SUPPORT_FEATURE("urn:xmpp:ping")
17835
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
145 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns")
25952
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25762
diff changeset
146
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
147 if(!node) { /* non-caps disco#info, add all enabled extensions */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
148 GList *features;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
149 for(features = jabber_features; features; features = features->next) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
150 JabberFeature *feat = (JabberFeature*)features->data;
17849
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
151 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE)
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
152 SUPPORT_FEATURE(feat->namespace);
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
153 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
154 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 } else {
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
156 const char *ext = NULL;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
157 unsigned pos;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
158 unsigned nodelen = strlen(node);
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
159 unsigned capslen = strlen(CAPS0115_NODE);
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
160 /* do a basic plausability check */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
161 if(nodelen > capslen+1) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
162 /* verify that the string is CAPS0115#<ext> and get the pointer to the ext part */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
163 for(pos = 0; pos < capslen+1; ++pos) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
164 if(pos == capslen) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
165 if(node[pos] == '#')
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
166 ext = &node[pos+1];
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
167 else
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
168 break;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
169 } else if(node[pos] != CAPS0115_NODE[pos])
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
170 break;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
171 }
25952
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25762
diff changeset
172
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
173 if(ext != NULL) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
174 /* look for that ext */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
175 GList *features;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
176 for(features = jabber_features; features; features = features->next) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
177 JabberFeature *feat = (JabberFeature*)features->data;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
178 if(!strcmp(feat->shortname, ext)) {
17849
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
179 SUPPORT_FEATURE(feat->namespace);
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17839
diff changeset
180 break;
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
181 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
182 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
183 if(features == NULL)
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
184 ext = NULL;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
185 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
186 }
25952
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25762
diff changeset
187
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
188 if(ext == NULL) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
189 xmlnode *error, *inf;
25952
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25762
diff changeset
190
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
191 /* XXX: gross hack, implement jabber_iq_set_type or something */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
192 xmlnode_set_attrib(iq->node, "type", "error");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
193 iq->type = JABBER_IQ_ERROR;
25952
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25762
diff changeset
194
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
195 error = xmlnode_new_child(query, "error");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
196 xmlnode_set_attrib(error, "code", "404");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
197 xmlnode_set_attrib(error, "type", "cancel");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
198 inf = xmlnode_new_child(error, "item-not-found");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
199 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
200 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 } else if(!strcmp(type, "result")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 xmlnode *query = xmlnode_get_child(packet, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 JabberCapabilities capabilities = JABBER_CAP_NONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 struct _jabber_disco_info_cb_data *jdicd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 if((jid = jabber_id_new(from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 jbr = jabber_buddy_find_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 capabilities = jbr->capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 for(child = query->child; child; child = child->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 if(child->type != XMLNODE_TYPE_TAG)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 if(!strcmp(child->name, "identity")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 const char *category = xmlnode_get_attrib(child, "category");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 const char *type = xmlnode_get_attrib(child, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 if(!category || !type)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 if(!strcmp(category, "conference") && !strcmp(type, "text")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 /* we found a groupchat or MUC server, add it to the list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 /* XXX: actually check for protocol/muc or gc-1.0 support */
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
235 js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 } else if(!strcmp(category, "directory") && !strcmp(type, "user")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 /* we found a JUD */
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
238 js->user_directories = g_list_prepend(js->user_directories, g_strdup(from));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
239 } else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
240 /* This is a bytestream proxy */
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
241 JabberIq *iq;
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
242 JabberBytestreamsStreamhost *sh;
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
243
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
244 purple_debug_info("jabber", "Found bytestream proxy server: %s\n", from);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
245
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
246 sh = g_new0(JabberBytestreamsStreamhost, 1);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
247 sh->jid = g_strdup(from);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
248 js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
249
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
250 iq = jabber_iq_new_query(js, JABBER_IQ_GET,
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
251 "http://jabber.org/protocol/bytestreams");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
252 xmlnode_set_attrib(iq->node, "to", sh->jid);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
253 jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
254 jabber_iq_send(iq);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 } else if(!strcmp(child->name, "feature")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 const char *var = xmlnode_get_attrib(child, "var");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 if(!var)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 if(!strcmp(var, "http://jabber.org/protocol/si"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 capabilities |= JABBER_CAP_SI;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 capabilities |= JABBER_CAP_SI_FILE_XFER;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 else if(!strcmp(var, "http://jabber.org/protocol/bytestreams"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 capabilities |= JABBER_CAP_BYTESTREAMS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 else if(!strcmp(var, "jabber:iq:search"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 capabilities |= JABBER_CAP_IQ_SEARCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 else if(!strcmp(var, "jabber:iq:register"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 capabilities |= JABBER_CAP_IQ_REGISTER;
17835
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
272 else if(!strcmp(var, "http://www.xmpp.org/extensions/xep-0199.html#ns"))
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17834
diff changeset
273 capabilities |= JABBER_CAP_PING;
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
274 else if(!strcmp(var, "http://jabber.org/protocol/disco#items"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
275 capabilities |= JABBER_CAP_ITEMS;
17882
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17849
diff changeset
276 else if(!strcmp(var, "http://jabber.org/protocol/commands")) {
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17849
diff changeset
277 capabilities |= JABBER_CAP_ADHOC;
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17849
diff changeset
278 }
25129
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23600
diff changeset
279 else if(!strcmp(var, "http://jabber.org/protocol/ibb")) {
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23600
diff changeset
280 purple_debug_info("jabber", "remote supports IBB\n");
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23600
diff changeset
281 capabilities |= JABBER_CAP_IBB;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23600
diff changeset
282 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 capabilities |= JABBER_CAP_RETRIEVED;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 jbr->capabilities = capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 if((jdicd = g_hash_table_lookup(js->disco_callbacks, from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 jdicd->callback(js, from, capabilities, jdicd->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 g_hash_table_remove(js->disco_callbacks, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 } else if(!strcmp(type, "error")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 JabberCapabilities capabilities = JABBER_CAP_NONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 struct _jabber_disco_info_cb_data *jdicd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 if(!(jdicd = g_hash_table_lookup(js->disco_callbacks, from)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 if((jid = jabber_id_new(from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 jbr = jabber_buddy_find_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 capabilities = jbr->capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 jdicd->callback(js, from, capabilities, jdicd->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 g_hash_table_remove(js->disco_callbacks, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
319 void jabber_disco_items_parse(JabberStream *js, xmlnode *packet)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
320 {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 const char *from = xmlnode_get_attrib(packet, "from");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 if(type && !strcmp(type, "get")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 "http://jabber.org/protocol/disco#items");
25952
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25762
diff changeset
327
17892
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
328 /* preserve node */
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
329 xmlnode *iq_query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
330 if(iq_query) {
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
331 xmlnode *query = xmlnode_get_child_with_namespace(packet,"query","http://jabber.org/protocol/disco#items");
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
332 if(query) {
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
333 const char *node = xmlnode_get_attrib(query,"node");
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
334 if(node)
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
335 xmlnode_set_attrib(iq_query,"node",node);
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
336 }
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17883
diff changeset
337 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 xmlnode_set_attrib(iq->node, "to", from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 jabber_disco_finish_server_info_result_cb(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 {
23600
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
349 const char *ft_proxies;
18163
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
350
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
351 jabber_vcard_fetch_mine(js);
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
352
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 jabber_roster_request(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 }
17362
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15822
diff changeset
357
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 /* Send initial presence; this will trigger receipt of presence for contacts on the roster */
18685
c03e3fe11ea9 Fixed errors created by merge conflict resolve mistakes.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
359 jabber_presence_send(js->gc->account, NULL);
23600
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
360
17883
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
361 if (js->server_caps & JABBER_CAP_ADHOC) {
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
362 /* The server supports ad-hoc commands, so let's request the list */
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
363 jabber_adhoc_server_get_list(js);
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
364 }
23600
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
365
24855
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23600
diff changeset
366 /* If the server supports blocking, request the block list */
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23600
diff changeset
367 if (js->server_caps & JABBER_CAP_BLOCKING) {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23600
diff changeset
368 jabber_request_block_list(js);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23600
diff changeset
369 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23600
diff changeset
370
23600
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
371 /* If there are manually specified bytestream proxies, query them */
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
372 ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
373 if (ft_proxies) {
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
374 JabberIq *iq;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
375 JabberBytestreamsStreamhost *sh;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
376 int i;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
377 char *tmp;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
378 gchar **ft_proxy_list = g_strsplit(ft_proxies, ",", 0);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
379
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
380 for(i = 0; ft_proxy_list[i]; i++) {
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
381 g_strstrip(ft_proxy_list[i]);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
382 if(!(*ft_proxy_list[i]))
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
383 continue;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
384
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
385 /* We used to allow specifying a port directly here; get rid of it */
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
386 if((tmp = strchr(ft_proxy_list[i], ':')))
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
387 *tmp = '\0';
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
388
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
389 sh = g_new0(JabberBytestreamsStreamhost, 1);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
390 sh->jid = g_strdup(ft_proxy_list[i]);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
391 js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
392
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
393 iq = jabber_iq_new_query(js, JABBER_IQ_GET,
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
394 "http://jabber.org/protocol/bytestreams");
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
395 xmlnode_set_attrib(iq->node, "to", sh->jid);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
396 jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
397 jabber_iq_send(iq);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
398 }
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
399
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
400 g_strfreev(ft_proxy_list);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
401 }
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
402
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
405 struct _disco_data {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
406 PurpleDiscoList *list;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
407 PurpleDiscoService *parent;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
408 char *node;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
409 };
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
410
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 jabber_disco_server_info_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 {
17362
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15822
diff changeset
414 xmlnode *query, *child;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 const char *from = xmlnode_get_attrib(packet, "from");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 if((!from || !type) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 (strcmp(from, js->user->domain))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 if(strcmp(type, "result")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 /* A common way to get here is for the server not to support xmlns http://jabber.org/protocol/disco#info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 query = xmlnode_get_child(packet, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 if (!query) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436
17362
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15822
diff changeset
437 for (child = xmlnode_get_child(query, "identity"); child;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 const char *category, *type, *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 category = xmlnode_get_attrib(child, "category");
17834
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents: 17364
diff changeset
441 type = xmlnode_get_attrib(child, "type");
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
442 if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep"))
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
443 js->pep = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 if (!category || strcmp(category, "server"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 if (!type || strcmp(type, "im"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 continue;
17362
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15822
diff changeset
448
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 name = xmlnode_get_attrib(child, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 g_free(js->server_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 js->server_name = g_strdup(name);
15522
ccbdf500f13a Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
455 if (!strcmp(name, "Google Talk")) {
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
456 purple_debug_info("jabber", "Google Talk!\n");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
457 js->googletalk = TRUE;
15522
ccbdf500f13a Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
458 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460
17362
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15822
diff changeset
461 for (child = xmlnode_get_child(query, "feature"); child;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 const char *var;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 var = xmlnode_get_attrib(child, "var");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 if (!var)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 if (!strcmp("google:mail:notify", var)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 js->server_caps |= JABBER_CAP_GMAIL_NOTIFY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 jabber_gmail_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 } else if (!strcmp("google:roster", var)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 js->server_caps |= JABBER_CAP_GOOGLE_ROSTER;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 jabber_google_roster_init(js);
17883
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
474 } else if (!strcmp("http://jabber.org/protocol/commands", var)) {
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
475 js->server_caps |= JABBER_CAP_ADHOC;
24855
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23600
diff changeset
476 } else if (!strcmp("urn:xmpp:blocking", var)) {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23600
diff changeset
477 js->server_caps |= JABBER_CAP_BLOCKING;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 jabber_disco_server_items_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 xmlnode *query, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 const char *from = xmlnode_get_attrib(packet, "from");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 if(!from || !type)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 if(strcmp(from, js->user->domain))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 if(strcmp(type, "result"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 while(js->chat_servers) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 g_free(js->chat_servers->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 query = xmlnode_get_child(packet, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 for(child = xmlnode_get_child(query, "item"); child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 JabberIq *iq;
17364
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17362
diff changeset
510 const char *jid, *node;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 if(!(jid = xmlnode_get_attrib(child, "jid")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514
17364
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17362
diff changeset
515 /* we don't actually care about the specific nodes,
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17362
diff changeset
516 * so we won't query them */
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17362
diff changeset
517 if((node = xmlnode_get_attrib(child, "node")))
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17362
diff changeset
518 continue;
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17362
diff changeset
519
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 xmlnode_set_attrib(iq->node, "to", jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 void jabber_disco_items_server(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 "http://jabber.org/protocol/disco#items");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 xmlnode_set_attrib(iq->node, "to", js->user->domain);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19697
diff changeset
536 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 xmlnode_set_attrib(iq->node, "to", js->user->domain);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 struct _jabber_disco_info_cb_data *jdicd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 if((jid = jabber_id_new(who))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 jbr = jabber_buddy_find_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 callback(js, who, jbr->capabilities, data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 jdicd = g_new0(struct _jabber_disco_info_cb_data, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 jdicd->data = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 jdicd->callback = callback;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 g_hash_table_insert(js->disco_callbacks, g_strdup(who), jdicd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 xmlnode_set_attrib(iq->node, "to", who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
573 static PurpleDiscoServiceCategory
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
574 jabber_disco_category_from_string(const gchar *str)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
575 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
576 if (!strcasecmp(str, "gateway"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
577 return PURPLE_DISCO_SERVICE_CAT_GATEWAY;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
578 else if (!strcasecmp(str, "directory"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
579 return PURPLE_DISCO_SERVICE_CAT_DIRECTORY;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
580 else if (!strcasecmp(str, "conference"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
581 return PURPLE_DISCO_SERVICE_CAT_MUC;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
583 return PURPLE_DISCO_SERVICE_CAT_NONE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
584 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
585
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
586 static PurpleDiscoServiceType
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
587 jabber_disco_type_from_string(const gchar *str)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
588 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
589 if (!strcasecmp(str, "xmpp"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
590 return PURPLE_DISCO_SERVICE_TYPE_XMPP;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
591 else if (!strcasecmp(str, "icq"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
592 return PURPLE_DISCO_SERVICE_TYPE_ICQ;
26248
f19c214201db 'mrim' is the mail.ru IM service. 'smtp' is an XMPP<>email gateway
Paul Aurich <paul@darkrain42.org>
parents: 26247
diff changeset
593 else if (!strcasecmp(str, "smtp"))
26247
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
594 return PURPLE_DISCO_SERVICE_TYPE_MAIL;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
595 else if (!strcasecmp(str, "user"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
596 return PURPLE_DISCO_SERVICE_TYPE_USER;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
597 else if (!strcasecmp(str, "yahoo"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
598 return PURPLE_DISCO_SERVICE_TYPE_YAHOO;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
599 else if (!strcasecmp(str, "irc"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
600 return PURPLE_DISCO_SERVICE_TYPE_IRC;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
601 else if (!strcasecmp(str, "gadu-gadu"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
602 return PURPLE_DISCO_SERVICE_TYPE_GG;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
603 else if (!strcasecmp(str, "aim"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
604 return PURPLE_DISCO_SERVICE_TYPE_AIM;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
605 else if (!strcasecmp(str, "qq"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
606 return PURPLE_DISCO_SERVICE_TYPE_QQ;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
607 else if (!strcasecmp(str, "msn"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
608 return PURPLE_DISCO_SERVICE_TYPE_MSN;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
609
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
610 return PURPLE_DISCO_SERVICE_TYPE_NONE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
611 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
612
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
613 static void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
614 jabber_disco_service_info_cb(JabberStream *js, xmlnode *packet, gpointer data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
615
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
616 static void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
617 jabber_disco_service_items_cb(JabberStream *js, xmlnode *packet, gpointer data)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
618 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
619 struct _disco_data *disco_data = data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
620 PurpleDiscoList *list = disco_data->list;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
621 PurpleDiscoService *parent = disco_data->parent;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
622 const char *parent_node = disco_data->node;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
623 xmlnode *query = xmlnode_get_child(packet, "query");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
624 const char *from = xmlnode_get_attrib(packet, "from");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
625 const char *result = xmlnode_get_attrib(packet, "type");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
626 xmlnode *child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
627 gboolean has_items = FALSE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
628
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
629 purple_disco_list_set_fetch_count(list, purple_disco_list_get_fetch_count(list) - 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
630
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
631 if (!from || !result || !query || (strcmp(result, "result")
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
632 || !purple_disco_list_get_proto_data(list))) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
633 if (!purple_disco_list_get_fetch_count(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
634 purple_disco_set_in_progress(list, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
635
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
636 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
637 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
638 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
639
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
640 query = xmlnode_get_child(packet, "query");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
641
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
642 for(child = xmlnode_get_child(query, "item"); child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
643 child = xmlnode_get_next_twin(child)) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
644 JabberIq *iq;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
645 xmlnode *q;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
646 const char *jid, *node;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
647 struct _disco_data *disco_data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
648 char *full_node;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
649
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
650 if(!(jid = xmlnode_get_attrib(child, "jid")) || !purple_disco_list_get_proto_data(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
651 continue;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
652
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
653 node = xmlnode_get_attrib(child, "node");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
654
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
655 if (parent_node) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
656 if (node) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
657 full_node = g_new0(char, strlen(parent_node) + 1 + strlen(node) + 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
658 strcat(full_node, parent_node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
659 strcat(full_node, "/");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
660 strcat(full_node, node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
661 } else {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
662 continue;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
663 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
664 } else {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
665 full_node = g_strdup(node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
666 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
667
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
668 disco_data = g_new0(struct _disco_data, 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
669 disco_data->list = list;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
670 disco_data->parent = parent;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
671 disco_data->node = full_node;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
672
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
673 has_items = TRUE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
674 purple_disco_list_set_fetch_count(list, purple_disco_list_get_fetch_count(list) + 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
675 purple_disco_list_ref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
676 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
677 xmlnode_set_attrib(iq->node, "to", jid);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
678 if (full_node && (q = xmlnode_get_child(iq->node, "query")))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
679 xmlnode_set_attrib(q, "node", full_node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
680 jabber_iq_set_callback(iq, jabber_disco_service_info_cb, disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
681
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
682 jabber_iq_send(iq);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
683 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
684
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
685 if (!purple_disco_list_get_fetch_count(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
686 purple_disco_set_in_progress(list, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
687 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
688
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
689 g_free(disco_data->node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
690 g_free(disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
691 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
692
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
693 static void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
694 jabber_disco_service_info_cb(JabberStream *js, xmlnode *packet, gpointer data)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
695 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
696 struct _disco_data *disco_data = data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
697 PurpleDiscoList *list = disco_data->list;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
698 PurpleDiscoService *parent = disco_data->parent;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
699 char *node = g_strdup(disco_data->node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
700 xmlnode *query, *ident, *child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
701 const char *from = xmlnode_get_attrib(packet, "from");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
702 const char *result = xmlnode_get_attrib(packet, "type");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
703 const char *acat, *atype, *adesc, *anode;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
704 char *aname;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
705 PurpleDiscoService *s;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
706 PurpleDiscoServiceCategory cat;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
707 PurpleDiscoServiceType type;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
708 int flags = PURPLE_DISCO_FLAG_ADD;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
709
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
710 g_free(disco_data->node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
711 g_free(disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
712 purple_disco_list_set_fetch_count(list, purple_disco_list_get_fetch_count(list) - 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
713
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
714 if (!from || !result || (strcmp(result, "result") || !purple_disco_list_get_proto_data(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
715 || (!(query = xmlnode_get_child(packet, "query")))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
716 || (!(ident = xmlnode_get_child(query, "identity")))) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
717 if (!purple_disco_list_get_fetch_count(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
718 purple_disco_set_in_progress(list, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
719
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
720 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
721 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
722 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
723
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
724 acat = xmlnode_get_attrib(ident, "category");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
725 atype = xmlnode_get_attrib(ident, "type");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
726 adesc = xmlnode_get_attrib(ident, "name");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
727 anode = xmlnode_get_attrib(query, "node");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
728
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
729 if (anode) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
730 aname = g_new0(char, strlen(from) + strlen(anode) + 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
731 strcat(aname, from);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
732 strcat(aname, anode);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
733 } else {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
734 aname = g_strdup(from);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
735 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
736
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
737 cat = jabber_disco_category_from_string(acat);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
738 type = jabber_disco_type_from_string(atype);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
739
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
740 for (child = xmlnode_get_child(query, "feature"); child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
741 child = xmlnode_get_next_twin(child)) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
742 const char *var;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
743
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
744 if (!(var = xmlnode_get_attrib(child, "var")))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
745 continue;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
746
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
747 if (!strcmp(var, "jabber:iq:register"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
748 flags |= PURPLE_DISCO_FLAG_REGISTER;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
749
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
750 if (!strcmp(var, "http://jabber.org/protocol/disco#items"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
751 flags |= PURPLE_DISCO_FLAG_BROWSE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
752
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
753 if (!strcmp(var, "http://jabber.org/protocol/muc"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
754 cat = PURPLE_DISCO_SERVICE_CAT_MUC;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
755 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
756
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
757 purple_debug_info("disco", "service %s, category %s (%d), type %s (%d), description %s, flags %04x\n",
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
758 aname,
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
759 acat, cat,
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
760 atype, type,
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
761 adesc, flags);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
762
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
763 s = purple_disco_list_service_new(cat, aname, type, adesc, flags);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
764 purple_disco_list_service_add(list, s, parent);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
765
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
766 /* if (flags & PURPLE_DISCO_FLAG_BROWSE) - not all browsable services has this future */
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
767 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
768 xmlnode *q;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
769 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
770
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
771 purple_disco_list_set_fetch_count(list, purple_disco_list_get_fetch_count(list) + 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
772 purple_disco_list_ref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
773 disco_data = g_new0(struct _disco_data, 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
774 disco_data->list = list;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
775 disco_data->parent = s;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
776
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
777 xmlnode_set_attrib(iq->node, "to", from);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
778 jabber_iq_set_callback(iq, jabber_disco_service_items_cb, disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
779 if (anode && (q = xmlnode_get_child(iq->node, "query")))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
780 xmlnode_set_attrib(q, "node", node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
781 jabber_iq_send(iq);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
782 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
783
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
784 if (!purple_disco_list_get_fetch_count(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
785 purple_disco_set_in_progress(list, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
786
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
787 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
788
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
789 g_free(aname);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
790 g_free(node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
791 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
792
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
793 static void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
794 jabber_disco_server_items_cb(JabberStream *js, xmlnode *packet, gpointer data)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
795 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
796 PurpleDiscoList *list = data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
797 xmlnode *query, *child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
798 const char *from = xmlnode_get_attrib(packet, "from");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
799 const char *type = xmlnode_get_attrib(packet, "type");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
800 gboolean has_items = FALSE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
801
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
802 if (!from || !type)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
803 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
804
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
805 if (strcmp(type, "result"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
806 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
807
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
808 query = xmlnode_get_child(packet, "query");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
809
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
810 for(child = xmlnode_get_child(query, "item"); child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
811 child = xmlnode_get_next_twin(child)) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
812 JabberIq *iq;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
813 const char *jid;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
814 struct _disco_data *disco_data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
815
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
816 if(!(jid = xmlnode_get_attrib(child, "jid")) || !purple_disco_list_get_proto_data(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
817 continue;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
818
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
819 disco_data = g_new0(struct _disco_data, 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
820 disco_data->list = list;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
821
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
822 has_items = TRUE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
823 purple_disco_list_set_fetch_count(list, purple_disco_list_get_fetch_count(list) + 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
824 purple_disco_list_ref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
825 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
826 xmlnode_set_attrib(iq->node, "to", jid);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
827 jabber_iq_set_callback(iq, jabber_disco_service_info_cb, disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
828
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
829 jabber_iq_send(iq);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
830 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
831
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
832 if (!has_items)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
833 purple_disco_set_in_progress(list, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
834
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
835 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
836 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
837
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
838 static void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
839 jabber_disco_server_info_cb(JabberStream *js, const char *who, JabberCapabilities caps, gpointer data)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
840 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
841 PurpleDiscoList *list = data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
842 JabberIq *iq;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
843
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
844 if (caps & JABBER_CAP_ITEMS) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
845 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
846 xmlnode_set_attrib(iq->node, "to", who);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
847 jabber_iq_set_callback(iq, jabber_disco_server_items_cb, list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
848
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
849 if (purple_disco_list_get_proto_data(list))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
850 jabber_iq_send(iq);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
851 else
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
852 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
853
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
854 } else {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
855 purple_notify_error(NULL, _("Error"), _("Server doesn't support service discovery"), NULL);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
856 purple_disco_set_in_progress(list, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
857 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
858 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
859 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
860
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
861 static void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
862 jabber_disco_server_cb(PurpleDiscoList *list, PurpleRequestFields *fields)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
863 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
864 JabberStream *js;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
865 const char *server_name;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
866
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
867 server_name = purple_request_fields_get_string(fields, "server");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
868
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
869 js = purple_disco_list_get_proto_data(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
870 if (!js) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
871 purple_debug_error("jabber", "Service discovery requested for %s "
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
872 "without proto_data", server_name);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
873 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
874 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
875
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
876 purple_disco_set_in_progress(list, TRUE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
877 purple_debug_misc("jabber", "Service discovery for %s\n", server_name);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
878 if (js->last_disco_server)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
879 g_free(js->last_disco_server);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
880 js->last_disco_server = g_strdup(server_name);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
881
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
882 jabber_disco_info_do(js, server_name, jabber_disco_server_info_cb, list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
883 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
884
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
885 void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
886 jabber_disco_get_list(PurpleConnection *gc, PurpleDiscoList *list)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
887 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
888 PurpleRequestFields *fields;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
889 PurpleRequestFieldGroup *g;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
890 PurpleRequestField *f;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
891 JabberStream *js;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
892 const char *last_server;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
893
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
894 purple_debug_misc("disco.c", "get_list\n");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
895
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
896 js = purple_connection_get_protocol_data(gc);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
897 purple_disco_list_set_proto_data(list, js);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
898
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
899 last_server = js->last_disco_server;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
900 if (last_server == NULL)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
901 last_server = js->user->domain;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
902
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
903
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
904 fields = purple_request_fields_new();
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
905 g = purple_request_field_group_new(NULL);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
906 f = purple_request_field_string_new("server", _("Server"),
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
907 last_server ? last_server : js->user->domain, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
908
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
909 purple_request_field_group_add_field(g, f);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
910 purple_request_fields_add_group(fields, g);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
911
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
912 purple_disco_list_ref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
913
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
914 purple_request_fields(gc,
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
915 _("Server name request"),
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
916 _("Enter server name"),
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
917 NULL,
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
918 fields,
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
919 _("OK"), G_CALLBACK(jabber_disco_server_cb),
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
920 _("Cancel"), NULL,
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
921 purple_connection_get_account(gc), NULL, NULL, list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
922 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
923
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
924 void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
925 jabber_disco_cancel(PurpleDiscoList *list)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
926 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
927 purple_disco_list_set_proto_data(list, NULL);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
928 purple_disco_set_in_progress(list, FALSE);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
929 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
930
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
931 int
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
932 jabber_disco_service_register(PurpleConnection *gc, PurpleDiscoService *service)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
933 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
934 JabberStream *js = gc->proto_data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
935
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
936 jabber_register_gateway(js, service->name);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
937
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
938 return 0;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
939 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25952
diff changeset
940