libpurple/protocols/jabber/disco.c

Tue, 13 Jan 2009 19:23:07 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Tue, 13 Jan 2009 19:23:07 +0000
branch
cpw.malu.xmpp.attention
changeset 25971
96c54b083cb5
parent 25290
033942580f51
child 25477
ada9e5c4a10a
child 25482
d3ab10d1c900
child 25553
c88d576c7005
child 25577
ca0b40451bbc
child 26026
7f7d1c031890
child 26186
18143bdefcd4
permissions
-rw-r--r--

Change error message shown when trying to buzz a buddy who doesn't announce
support to reflect the fact that disabling "attention" also implies the client
should not advertize support, or as we do in libpurple, don't announce support
when the status is set to "Busy".

8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15722
diff changeset
2 * purple - Jabber Protocol Plugin
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * (at your option) any later version.
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19832
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 */
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 #include "internal.h"
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 #include "prefs.h"
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
24 #include "debug.h"
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include "buddy.h"
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
27 #include "google.h"
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 #include "iq.h"
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 #include "disco.h"
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
30 #include "jabber.h"
15344
34b7f4e55861 [gaim-migrate @ 18072]
Evan Schoenberg <evands@pidgin.im>
parents: 15323
diff changeset
31 #include "presence.h"
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
32 #include "roster.h"
17768
7be011945a1b added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents: 17423
diff changeset
33 #include "pep.h"
17816
1b7362b4a7a2 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 <am@adiumx.com>
parents: 17783
diff changeset
34 #include "adhoccommands.h"
1b7362b4a7a2 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 <am@adiumx.com>
parents: 17783
diff changeset
35
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 struct _jabber_disco_info_cb_data {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 gpointer data;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 JabberDiscoInfoCallback *callback;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 };
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41
17783
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
42 #define SUPPORT_FEATURE(x) { \
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43 feature = xmlnode_new_child(query, "feature"); \
17783
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
44 xmlnode_set_attrib(feature, "var", x); \
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
45 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46
21688
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
47 static void
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
48 jabber_disco_bytestream_server_cb(JabberStream *js, xmlnode *packet, gpointer data) {
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
49 JabberBytestreamsStreamhost *sh = data;
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
50 const char *from = xmlnode_get_attrib(packet, "from");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
51 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
52 "http://jabber.org/protocol/bytestreams");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
53
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
54 if (from && !strcmp(from, sh->jid) && query != NULL) {
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
55 xmlnode *sh_node = xmlnode_get_child(query, "streamhost");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
56 if (sh_node) {
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
57 const char *jid = xmlnode_get_attrib(sh_node, "jid");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
58 const char *port = xmlnode_get_attrib(sh_node, "port");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
59
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
60
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
61 if (jid == NULL || strcmp(jid, from) != 0)
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
62 purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n",
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
63 jid ? jid : "(null)");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
64
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
65 sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host"));
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
66 sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf"));
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
67 if (port != NULL)
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
68 sh->port = atoi(port);
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
69 }
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
70 }
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
71
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
72 purple_debug_info("jabber", "Discovered bytestream proxy server: "
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
73 "jid='%s' host='%s' port='%d' zeroconf='%s'\n",
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
74 from ? from : "", sh->host ? sh->host : "",
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
75 sh->port, sh->zeroconf ? sh->zeroconf : "");
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
76
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
77 /* TODO: When we support zeroconf proxies, fix this to handle them */
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
78 if (!(sh->jid && sh->host && sh->port > 0)) {
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
79 g_free(sh->jid);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
80 g_free(sh->host);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
81 g_free(sh->zeroconf);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
82 g_free(sh);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
83 js->bs_proxies = g_list_remove(js->bs_proxies, sh);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
84 }
21688
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
85 }
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
86
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
87
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89 const char *from = xmlnode_get_attrib(packet, "from");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90 const char *type = xmlnode_get_attrib(packet, "type");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
92 if(!from || !type)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
93 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
94
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
95 if(!strcmp(type, "get")) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
96 xmlnode *query, *identity, *feature;
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
97 JabberIq *iq;
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
98
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
99 xmlnode *in_query;
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
100 const char *node = NULL;
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
101
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
102 if((in_query = xmlnode_get_child(packet, "query"))) {
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
103 node = xmlnode_get_attrib(in_query, "node");
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
104 }
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
105
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
106
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
107 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108 "http://jabber.org/protocol/disco#info");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id"));
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
111
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
112 xmlnode_set_attrib(iq->node, "to", from);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
113 query = xmlnode_get_child(iq->node, "query");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
114
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
115 if(node)
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
116 xmlnode_set_attrib(query, "node", node);
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
117
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
118 if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) {
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
119 identity = xmlnode_new_child(query, "identity");
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
120 xmlnode_set_attrib(identity, "category", "client");
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
121 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console,
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
122 * handheld, pc, phone,
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
123 * web */
13704
5800709f09f0 [gaim-migrate @ 16105]
Nathan Walp <nwalp@pidgin.im>
parents: 13703
diff changeset
124 xmlnode_set_attrib(identity, "name", PACKAGE);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
125
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
126 SUPPORT_FEATURE("jabber:iq:last")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
127 SUPPORT_FEATURE("jabber:iq:oob")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
128 SUPPORT_FEATURE("jabber:iq:time")
18317
6c814e134e56 support replying to XEP-0202 queries
Nathan Walp <nwalp@pidgin.im>
parents: 18235
diff changeset
129 SUPPORT_FEATURE("xmpp:urn:time")
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
130 SUPPORT_FEATURE("jabber:iq:version")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
131 SUPPORT_FEATURE("jabber:x:conference")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
132 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
133 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
134 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items")
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 #if 0
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
136 SUPPORT_FEATURE("http://jabber.org/protocol/ibb")
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 #endif
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
138 SUPPORT_FEATURE("http://jabber.org/protocol/muc")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
139 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
140 SUPPORT_FEATURE("http://jabber.org/protocol/si")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
141 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer")
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
142 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im")
18181
736c6abf62f4 respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents: 17423
diff changeset
143 SUPPORT_FEATURE("urn:xmpp:ping")
17769
69d98a4da006 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents: 17768
diff changeset
144 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns")
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
145
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
146 if(!node) { /* non-caps disco#info, add all enabled extensions */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
147 GList *features;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
148 for(features = jabber_features; features; features = features->next) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
149 JabberFeature *feat = (JabberFeature*)features->data;
17783
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
150 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE)
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
151 SUPPORT_FEATURE(feat->namespace);
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
152 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
153 }
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
154 } else {
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
155 const char *ext = NULL;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
156 unsigned pos;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
157 unsigned nodelen = strlen(node);
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
158 unsigned capslen = strlen(CAPS0115_NODE);
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
159 /* do a basic plausability check */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
160 if(nodelen > capslen+1) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
161 /* verify that the string is CAPS0115#<ext> and get the pointer to the ext part */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
162 for(pos = 0; pos < capslen+1; ++pos) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
163 if(pos == capslen) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
164 if(node[pos] == '#')
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
165 ext = &node[pos+1];
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
166 else
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
167 break;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
168 } else if(node[pos] != CAPS0115_NODE[pos])
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
169 break;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
170 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
171
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
172 if(ext != NULL) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
173 /* look for that ext */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
174 GList *features;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
175 for(features = jabber_features; features; features = features->next) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
176 JabberFeature *feat = (JabberFeature*)features->data;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
177 if(!strcmp(feat->shortname, ext)) {
17783
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
178 SUPPORT_FEATURE(feat->namespace);
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
179 break;
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
180 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
181 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
182 if(features == NULL)
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
183 ext = NULL;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
184 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
185 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
186
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
187 if(ext == NULL) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
188 xmlnode *error, *inf;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
189
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
190 /* XXX: gross hack, implement jabber_iq_set_type or something */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
191 xmlnode_set_attrib(iq->node, "type", "error");
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
192 iq->type = JABBER_IQ_ERROR;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
193
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
194 error = xmlnode_new_child(query, "error");
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
195 xmlnode_set_attrib(error, "code", "404");
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
196 xmlnode_set_attrib(error, "type", "cancel");
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
197 inf = xmlnode_new_child(error, "item-not-found");
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
198 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
199 }
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
200 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
201
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
202 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 } else if(!strcmp(type, "result")) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 xmlnode *query = xmlnode_get_child(packet, "query");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205 xmlnode *child;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
207 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
208 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209 JabberCapabilities capabilities = JABBER_CAP_NONE;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
210 struct _jabber_disco_info_cb_data *jdicd;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
211
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212 if((jid = jabber_id_new(from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
214 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
215 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 capabilities = jbr->capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221 for(child = query->child; child; child = child->next) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 if(child->type != XMLNODE_TYPE_TAG)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225 if(!strcmp(child->name, "identity")) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226 const char *category = xmlnode_get_attrib(child, "category");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227 const char *type = xmlnode_get_attrib(child, "type");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 if(!category || !type)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
230
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
231 if(!strcmp(category, "conference") && !strcmp(type, "text")) {
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
232 /* we found a groupchat or MUC server, add it to the list */
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
233 /* XXX: actually check for protocol/muc or gc-1.0 support */
21688
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
234 js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from));
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
235 } else if(!strcmp(category, "directory") && !strcmp(type, "user")) {
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
236 /* we found a JUD */
21688
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
237 js->user_directories = g_list_prepend(js->user_directories, g_strdup(from));
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
238 } else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) {
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
239 /* This is a bytestream proxy */
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
240 JabberIq *iq;
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
241 JabberBytestreamsStreamhost *sh;
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
242
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
243 purple_debug_info("jabber", "Found bytestream proxy server: %s\n", from);
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
244
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
245 sh = g_new0(JabberBytestreamsStreamhost, 1);
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
246 sh->jid = g_strdup(from);
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
247 js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
248
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
249 iq = jabber_iq_new_query(js, JABBER_IQ_GET,
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
250 "http://jabber.org/protocol/bytestreams");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
251 xmlnode_set_attrib(iq->node, "to", sh->jid);
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
252 jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
253 jabber_iq_send(iq);
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
254 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
255
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
256 } else if(!strcmp(child->name, "feature")) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
257 const char *var = xmlnode_get_attrib(child, "var");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
258 if(!var)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
259 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
260
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
261 if(!strcmp(var, "http://jabber.org/protocol/si"))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
262 capabilities |= JABBER_CAP_SI;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263 else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer"))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264 capabilities |= JABBER_CAP_SI_FILE_XFER;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265 else if(!strcmp(var, "http://jabber.org/protocol/bytestreams"))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266 capabilities |= JABBER_CAP_BYTESTREAMS;
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
267 else if(!strcmp(var, "jabber:iq:search"))
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
268 capabilities |= JABBER_CAP_IQ_SEARCH;
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
269 else if(!strcmp(var, "jabber:iq:register"))
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
270 capabilities |= JABBER_CAP_IQ_REGISTER;
17769
69d98a4da006 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents: 17768
diff changeset
271 else if(!strcmp(var, "http://www.xmpp.org/extensions/xep-0199.html#ns"))
69d98a4da006 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents: 17768
diff changeset
272 capabilities |= JABBER_CAP_PING;
17816
1b7362b4a7a2 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 <am@adiumx.com>
parents: 17783
diff changeset
273 else if(!strcmp(var, "http://jabber.org/protocol/commands")) {
1b7362b4a7a2 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 <am@adiumx.com>
parents: 17783
diff changeset
274 capabilities |= JABBER_CAP_ADHOC;
1b7362b4a7a2 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 <am@adiumx.com>
parents: 17783
diff changeset
275 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
276 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
277 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
278
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279 capabilities |= JABBER_CAP_RETRIEVED;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
280
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
281 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
282 jbr->capabilities = capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
283
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
284 if((jdicd = g_hash_table_lookup(js->disco_callbacks, from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
285 jdicd->callback(js, from, capabilities, jdicd->data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
286 g_hash_table_remove(js->disco_callbacks, from);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
287 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
288 } else if(!strcmp(type, "error")) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
289 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
290 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
291 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
292 JabberCapabilities capabilities = JABBER_CAP_NONE;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
293 struct _jabber_disco_info_cb_data *jdicd;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
294
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
295 if(!(jdicd = g_hash_table_lookup(js->disco_callbacks, from)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
296 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
297
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
298 if((jid = jabber_id_new(from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
299 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
300 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
301 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
302 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
303
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
304 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
305 capabilities = jbr->capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
306
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
307 jdicd->callback(js, from, capabilities, jdicd->data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
308 g_hash_table_remove(js->disco_callbacks, from);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
309 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
310 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
311
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
312 void jabber_disco_items_parse(JabberStream *js, xmlnode *packet) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
313 const char *from = xmlnode_get_attrib(packet, "from");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
314 const char *type = xmlnode_get_attrib(packet, "type");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
315
14356
7f4abf922cfa [gaim-migrate @ 16984]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
316 if(type && !strcmp(type, "get")) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
317 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
318 "http://jabber.org/protocol/disco#items");
17826
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
319
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
320 /* preserve node */
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
321 xmlnode *iq_query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
322 if(iq_query) {
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
323 xmlnode *query = xmlnode_get_child_with_namespace(packet,"query","http://jabber.org/protocol/disco#items");
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
324 if(query) {
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
325 const char *node = xmlnode_get_attrib(query,"node");
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
326 if(node)
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
327 xmlnode_set_attrib(iq_query,"node",node);
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
328 }
8f31a68b1d70 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 <am@adiumx.com>
parents: 17817
diff changeset
329 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
330
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
331 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id"));
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
332
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
333 xmlnode_set_attrib(iq->node, "to", from);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
334 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
335 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
336 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
337
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
338 static void
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
339 jabber_disco_finish_server_info_result_cb(JabberStream *js)
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
340 {
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
341 const char *ft_proxies;
18235
60a9bd99f035 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18225
diff changeset
342
60a9bd99f035 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18225
diff changeset
343 jabber_vcard_fetch_mine(js);
60a9bd99f035 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18225
diff changeset
344
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
345 if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) {
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
346 /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
347 jabber_roster_request(js);
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
348 }
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
349
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
350 /* Send initial presence; this will trigger receipt of presence for contacts on the roster */
18719
7a0465381cea Fixed errors created by merge conflict resolve mistakes.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
351 jabber_presence_send(js->gc->account, NULL);
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
352
17817
8e0f271aab78 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 <am@adiumx.com>
parents: 17816
diff changeset
353 if (js->server_caps & JABBER_CAP_ADHOC) {
8e0f271aab78 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 <am@adiumx.com>
parents: 17816
diff changeset
354 /* The server supports ad-hoc commands, so let's request the list */
8e0f271aab78 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 <am@adiumx.com>
parents: 17816
diff changeset
355 jabber_adhoc_server_get_list(js);
8e0f271aab78 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 <am@adiumx.com>
parents: 17816
diff changeset
356 }
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
357
25290
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
358 /* If the server supports blocking, request the block list */
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
359 if (js->server_caps & JABBER_CAP_BLOCKING) {
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
360 jabber_request_block_list(js);
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
361 }
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
362
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
363 /* If there are manually specified bytestream proxies, query them */
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
364 ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
365 if (ft_proxies) {
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
366 JabberIq *iq;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
367 JabberBytestreamsStreamhost *sh;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
368 int i;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
369 char *tmp;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
370 gchar **ft_proxy_list = g_strsplit(ft_proxies, ",", 0);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
371
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
372 for(i = 0; ft_proxy_list[i]; i++) {
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
373 g_strstrip(ft_proxy_list[i]);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
374 if(!(*ft_proxy_list[i]))
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
375 continue;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
376
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
377 /* We used to allow specifying a port directly here; get rid of it */
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
378 if((tmp = strchr(ft_proxy_list[i], ':')))
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
379 *tmp = '\0';
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
380
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
381 sh = g_new0(JabberBytestreamsStreamhost, 1);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
382 sh->jid = g_strdup(ft_proxy_list[i]);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
383 js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
384
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
385 iq = jabber_iq_new_query(js, JABBER_IQ_GET,
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
386 "http://jabber.org/protocol/bytestreams");
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
387 xmlnode_set_attrib(iq->node, "to", sh->jid);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
388 jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
389 jabber_iq_send(iq);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
390 }
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
391
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
392 g_strfreev(ft_proxy_list);
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
393 }
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
394
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
395 }
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
396
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
397 static void
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
398 jabber_disco_server_info_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
399 {
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
400 xmlnode *query, *child;
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
401 const char *from = xmlnode_get_attrib(packet, "from");
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
402 const char *type = xmlnode_get_attrib(packet, "type");
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
403
15358
c8179e0a5483 [gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents: 15355
diff changeset
404 if((!from || !type) ||
c8179e0a5483 [gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents: 15355
diff changeset
405 (strcmp(from, js->user->domain))) {
c8179e0a5483 [gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents: 15355
diff changeset
406 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
407 return;
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
408 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
409
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
410 if(strcmp(type, "result")) {
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
411 /* A common way to get here is for the server not to support xmlns http://jabber.org/protocol/disco#info */
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
412 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
413 return;
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
414 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
415
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
416 query = xmlnode_get_child(packet, "query");
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
417
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
418 if (!query) {
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
419 jabber_disco_finish_server_info_result_cb(js);
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
420 return;
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
421 }
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
422
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
423 for (child = xmlnode_get_child(query, "identity"); child;
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
424 child = xmlnode_get_next_twin(child)) {
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
425 const char *category, *type, *name;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
426 category = xmlnode_get_attrib(child, "category");
17768
7be011945a1b added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents: 17423
diff changeset
427 type = xmlnode_get_attrib(child, "type");
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
428 if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep"))
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
429 js->pep = TRUE;
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
430 if (!category || strcmp(category, "server"))
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
431 continue;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
432 if (!type || strcmp(type, "im"))
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
433 continue;
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
434
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
435 name = xmlnode_get_attrib(child, "name");
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
436 if (!name)
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
437 continue;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
438
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
439 g_free(js->server_name);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
440 js->server_name = g_strdup(name);
15587
cbedd543bfae Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
441 if (!strcmp(name, "Google Talk")) {
21688
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
442 purple_debug_info("jabber", "Google Talk!\n");
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
443 js->googletalk = TRUE;
15587
cbedd543bfae Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
444 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
445 }
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
446
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
447 for (child = xmlnode_get_child(query, "feature"); child;
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
448 child = xmlnode_get_next_twin(child)) {
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
449 const char *var;
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
450 var = xmlnode_get_attrib(child, "var");
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
451 if (!var)
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
452 continue;
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
453
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
454 if (!strcmp("google:mail:notify", var)) {
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
455 js->server_caps |= JABBER_CAP_GMAIL_NOTIFY;
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
456 jabber_gmail_init(js);
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
457 } else if (!strcmp("google:roster", var)) {
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
458 js->server_caps |= JABBER_CAP_GOOGLE_ROSTER;
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
459 jabber_google_roster_init(js);
17817
8e0f271aab78 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 <am@adiumx.com>
parents: 17816
diff changeset
460 } else if (!strcmp("http://jabber.org/protocol/commands", var)) {
8e0f271aab78 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 <am@adiumx.com>
parents: 17816
diff changeset
461 js->server_caps |= JABBER_CAP_ADHOC;
25290
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
462 } else if (!strcmp("urn:xmpp:blocking", var)) {
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
463 js->server_caps |= JABBER_CAP_BLOCKING;
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
464 }
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
465 }
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
466
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
467 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
468 }
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
469
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
470 static void
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
471 jabber_disco_server_items_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
472 {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
473 xmlnode *query, *child;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
474 const char *from = xmlnode_get_attrib(packet, "from");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
475 const char *type = xmlnode_get_attrib(packet, "type");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
476
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
477 if(!from || !type)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
478 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
479
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
480 if(strcmp(from, js->user->domain))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
481 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
482
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
483 if(strcmp(type, "result"))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
484 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
485
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
486 while(js->chat_servers) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
487 g_free(js->chat_servers->data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
488 js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
489 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
490
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
491 query = xmlnode_get_child(packet, "query");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
492
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
493 for(child = xmlnode_get_child(query, "item"); child;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
494 child = xmlnode_get_next_twin(child)) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
495 JabberIq *iq;
17423
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
496 const char *jid, *node;
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
497
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
498 if(!(jid = xmlnode_get_attrib(child, "jid")))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
499 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
500
17423
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
501 /* we don't actually care about the specific nodes,
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
502 * so we won't query them */
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
503 if((node = xmlnode_get_attrib(child, "node")))
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
504 continue;
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
505
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
506 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
507 xmlnode_set_attrib(iq->node, "to", jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
508 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
509 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
510 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
511
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
512 void jabber_disco_items_server(JabberStream *js)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
513 {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
514 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
515 "http://jabber.org/protocol/disco#items");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
516
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
517 xmlnode_set_attrib(iq->node, "to", js->user->domain);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
518
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
519 jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
520 jabber_iq_send(iq);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
521
21688
a16385b34219 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 <datallah@pidgin.im>
parents: 19897
diff changeset
522 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
523 xmlnode_set_attrib(iq->node, "to", js->user->domain);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
524 jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
525 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
526 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
527
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
528 void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
529 {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
530 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
531 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
532 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
533 struct _jabber_disco_info_cb_data *jdicd;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
534 JabberIq *iq;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
535
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
536 if((jid = jabber_id_new(who))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
537 if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
538 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
539 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
540 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
541
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
542 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
543 callback(js, who, jbr->capabilities, data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
544 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
545 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
546
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
547 jdicd = g_new0(struct _jabber_disco_info_cb_data, 1);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
548 jdicd->data = data;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
549 jdicd->callback = callback;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
550
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
551 g_hash_table_insert(js->disco_callbacks, g_strdup(who), jdicd);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
552
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
553 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
554 xmlnode_set_attrib(iq->node, "to", who);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
555
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
556 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
557 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
558
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
559

mercurial