libpurple/protocols/jabber/disco.c

Wed, 13 May 2009 20:29:03 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Wed, 13 May 2009 20:29:03 +0000
changeset 27110
05ca719b901b
parent 26991
f7a85a922ef0
child 27202
5244a5510e0e
child 27214
36979dac48eb
child 27285
cb00245748c4
permissions
-rw-r--r--

Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.

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
25477
ada9e5c4a10a Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents: 25290
diff changeset
26 #include "adhoccommands.h"
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 #include "buddy.h"
25477
ada9e5c4a10a Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents: 25290
diff changeset
28 #include "disco.h"
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
29 #include "google.h"
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 #include "iq.h"
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
31 #include "jabber.h"
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents: 26106
diff changeset
32 #include "jingle/jingle.h"
25477
ada9e5c4a10a Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents: 25290
diff changeset
33 #include "pep.h"
15344
34b7f4e55861 [gaim-migrate @ 18072]
Evan Schoenberg <evands@pidgin.im>
parents: 15323
diff changeset
34 #include "presence.h"
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
35 #include "roster.h"
25477
ada9e5c4a10a Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents: 25290
diff changeset
36 #include "useravatar.h"
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 struct _jabber_disco_info_cb_data {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 gpointer data;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 JabberDiscoInfoCallback *callback;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 };
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42
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
43 #define SUPPORT_FEATURE(x) { \
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44 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
45 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
46 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47
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
48 static void
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
49 jabber_disco_bytestream_server_cb(JabberStream *js, const char *from,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
50 JabberIqType type, const char *id,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
51 xmlnode *packet, gpointer data)
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
52 {
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
53 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
54 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
55 "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
56
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 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
58 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
59 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
60 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
61 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
62
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
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 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
65 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
66 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
67
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->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
69 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
70 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
71 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
72 }
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 }
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
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 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
76 "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
77 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
78 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
79
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
80 /* 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
81 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
82 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
83 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
84 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
85 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
86 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
87 }
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
88 }
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
89
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
91 void jabber_disco_info_parse(JabberStream *js, const char *from,
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
92 JabberIqType type, const char *id,
26707
a4f7c5d5e5ae propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
parents: 26668 26692
diff changeset
93 xmlnode *in_query)
a4f7c5d5e5ae propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
parents: 26668 26692
diff changeset
94 {
26482
72d16a73cf12 Get rid of the rest of the extraneous changes.
Michael Ruprecht <maiku@pidgin.im>
parents: 26337
diff changeset
95
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
96 if(!from)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
97 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
98
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
99 if(type == JABBER_IQ_GET) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
100 xmlnode *query, *identity, *feature;
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
101 JabberIq *iq;
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
102 const char *node = xmlnode_get_attrib(in_query, "node");
26707
a4f7c5d5e5ae propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
parents: 26668 26692
diff changeset
103 char *node_uri = NULL;
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
104
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
105 /* create custom caps node URI */
24716
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
106 node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL);
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
107
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
108 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109 "http://jabber.org/protocol/disco#info");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
111 jabber_iq_set_id(iq, id);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
112
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
113 xmlnode_set_attrib(iq->node, "to", from);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
114 query = xmlnode_get_child(iq->node, "query");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
115
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
116 if(node)
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
117 xmlnode_set_attrib(query, "node", node);
26482
72d16a73cf12 Get rid of the rest of the extraneous changes.
Michael Ruprecht <maiku@pidgin.im>
parents: 26337
diff changeset
118
26991
f7a85a922ef0 Fix a bad merge (*sigh*)
Paul Aurich <darkrain42@pidgin.im>
parents: 26958
diff changeset
119 if(!node || g_str_equal(node, node_uri)) {
24715
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 23954
diff changeset
120 GList *features, *identities;
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
121 for(identities = jabber_identities; identities; identities = identities->next) {
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
122 JabberIdentity *ident = (JabberIdentity*)identities->data;
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
123 identity = xmlnode_new_child(query, "identity");
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
124 xmlnode_set_attrib(identity, "category", ident->category);
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
125 xmlnode_set_attrib(identity, "type", ident->type);
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
126 if (ident->lang)
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
127 xmlnode_set_attrib(identity, "xml:lang", ident->lang);
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
128 if (ident->name)
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
129 xmlnode_set_attrib(identity, "name", ident->name);
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
130 }
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
131 for(features = jabber_features; features; features = features->next) {
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
132 JabberFeature *feat = (JabberFeature*)features->data;
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
133 if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) {
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
134 feature = xmlnode_new_child(query, "feature");
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
135 xmlnode_set_attrib(feature, "var", 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
136 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
137 }
23714
a08cf0090382 Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents: 22648
diff changeset
138 #ifdef USE_VV
26668
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
139 } else if (g_str_equal(node, CAPS0115_NODE "#" "voice-v1")) {
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
140 /*
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
141 * HUGE HACK! We advertise this ext (see jabber_presence_create_js
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
142 * where we add <c/> to the <presence/>) for the Google Talk
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
143 * clients that don't actually check disco#info features.
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
144 *
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
145 * This specific feature is redundant but is what
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
146 * node='http://mail.google.com/xmpp/client/caps', ver='1.1'
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
147 * advertises as 'voice-v1'.
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
148 */
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
149 xmlnode *feature = xmlnode_new_child(query, "feature");
ef06285f3b64 Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents: 26659
diff changeset
150 xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/voice/v1");
23714
a08cf0090382 Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents: 22648
diff changeset
151 #endif
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
152 } else {
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
153 xmlnode *error, *inf;
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
154
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
155 /* XXX: gross hack, implement jabber_iq_set_type or something */
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
156 xmlnode_set_attrib(iq->node, "type", "error");
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
157 iq->type = JABBER_IQ_ERROR;
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
158
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
159 error = xmlnode_new_child(query, "error");
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
160 xmlnode_set_attrib(error, "code", "404");
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
161 xmlnode_set_attrib(error, "type", "cancel");
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
162 inf = xmlnode_new_child(error, "item-not-found");
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
163 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
164 }
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
165 g_free(node_uri);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
166 jabber_iq_send(iq);
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
167 } else if(type == JABBER_IQ_RESULT) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
168 xmlnode *child;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
169 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
170 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
171 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
172 JabberCapabilities capabilities = JABBER_CAP_NONE;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
173 struct _jabber_disco_info_cb_data *jdicd;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
174
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
175 if((jid = jabber_id_new(from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
176 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
177 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
178 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
179 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
180
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
181 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
182 capabilities = jbr->capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
183
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
184 for(child = in_query->child; child; child = child->next) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
185 if(child->type != XMLNODE_TYPE_TAG)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
186 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
187
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
188 if(!strcmp(child->name, "identity")) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
189 const char *category = xmlnode_get_attrib(child, "category");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
190 const char *type = xmlnode_get_attrib(child, "type");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
191 if(!category || !type)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
192 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
193
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
194 if(!strcmp(category, "conference") && !strcmp(type, "text")) {
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
195 /* 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
196 /* 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
197 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
198 } else if(!strcmp(category, "directory") && !strcmp(type, "user")) {
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
199 /* 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
200 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
201 } 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
202 /* 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
203 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
204 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
205
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
206 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
207
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
208 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
209 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
210 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
211
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
212 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
213 "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
214 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
215 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
216 jabber_iq_send(iq);
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
217 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 } else if(!strcmp(child->name, "feature")) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220 const char *var = xmlnode_get_attrib(child, "var");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221 if(!var)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224 if(!strcmp(var, "http://jabber.org/protocol/si"))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225 capabilities |= JABBER_CAP_SI;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226 else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer"))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227 capabilities |= JABBER_CAP_SI_FILE_XFER;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 else if(!strcmp(var, "http://jabber.org/protocol/bytestreams"))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229 capabilities |= JABBER_CAP_BYTESTREAMS;
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
230 else if(!strcmp(var, "jabber:iq:search"))
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
231 capabilities |= JABBER_CAP_IQ_SEARCH;
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
232 else if(!strcmp(var, "jabber:iq:register"))
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
233 capabilities |= JABBER_CAP_IQ_REGISTER;
26688
e036a4d105c1 Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
234 else if(!strcmp(var, "urn:xmpp:ping"))
17769
69d98a4da006 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents: 17768
diff changeset
235 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
236 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
237 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
238 }
24372
830701cec96f Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents: 23912
diff changeset
239 else if(!strcmp(var, "http://jabber.org/protocol/ibb")) {
830701cec96f Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents: 23912
diff changeset
240 purple_debug_info("jabber", "remote supports IBB\n");
830701cec96f Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents: 23912
diff changeset
241 capabilities |= JABBER_CAP_IBB;
830701cec96f Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents: 23912
diff changeset
242 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
243 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
245
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
246 capabilities |= JABBER_CAP_RETRIEVED;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
247
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
248 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
249 jbr->capabilities = capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
250
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
251 if((jdicd = g_hash_table_lookup(js->disco_callbacks, from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
252 jdicd->callback(js, from, capabilities, jdicd->data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
253 g_hash_table_remove(js->disco_callbacks, from);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
254 }
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
255 } else if(type == JABBER_IQ_ERROR) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
256 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
257 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
258 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
259 JabberCapabilities capabilities = JABBER_CAP_NONE;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
260 struct _jabber_disco_info_cb_data *jdicd;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
261
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
262 if(!(jdicd = g_hash_table_lookup(js->disco_callbacks, from)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265 if((jid = jabber_id_new(from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
267 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
268 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
269 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
270
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
271 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
272 capabilities = jbr->capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
273
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
274 jdicd->callback(js, from, capabilities, jdicd->data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
275 g_hash_table_remove(js->disco_callbacks, from);
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
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
279 void jabber_disco_items_parse(JabberStream *js, const char *from,
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
280 JabberIqType type, const char *id,
26707
a4f7c5d5e5ae propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
parents: 26668 26692
diff changeset
281 xmlnode *query)
a4f7c5d5e5ae propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
parents: 26668 26692
diff changeset
282 {
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
283 if(type == JABBER_IQ_GET) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
284 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
285 "http://jabber.org/protocol/disco#items");
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26026
diff changeset
286
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
287 /* preserve node */
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
288 xmlnode *iq_query = xmlnode_get_child(iq->node, "query");
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
289 const char *node = xmlnode_get_attrib(query, "node");
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
290 if(node)
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
291 xmlnode_set_attrib(iq_query,"node",node);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
292
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
293 jabber_iq_set_id(iq, id);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
294
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
295 if (from)
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
296 xmlnode_set_attrib(iq->node, "to", from);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
297 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
298 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
299 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
300
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
301 static void
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
302 jabber_disco_finish_server_info_result_cb(JabberStream *js)
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
303 {
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
304 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
305
25810
5cf3c22e52df Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents: 25477
diff changeset
306 /*
5cf3c22e52df Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents: 25477
diff changeset
307 * This *should* happen only if the server supports vcard-temp, but there
5cf3c22e52df Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents: 25477
diff changeset
308 * are apparently some servers that don't advertise it even though they
5cf3c22e52df Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents: 25477
diff changeset
309 * support it.
5cf3c22e52df Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents: 25477
diff changeset
310 */
18235
60a9bd99f035 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18225
diff changeset
311 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
312
25477
ada9e5c4a10a Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents: 25290
diff changeset
313 if (js->pep)
ada9e5c4a10a Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents: 25290
diff changeset
314 jabber_avatar_fetch_mine(js);
18235
60a9bd99f035 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18225
diff changeset
315
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
316 if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) {
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
317 /* 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
318 jabber_roster_request(js);
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
319 }
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
320
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
321 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
322 /* 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
323 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
324 }
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
325
25290
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
326 /* 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
327 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
328 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
329 }
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
330
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
331 /* 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
332 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
333 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
334 JabberIq *iq;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
335 JabberBytestreamsStreamhost *sh;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
336 int i;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
337 char *tmp;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
338 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
339
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
340 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
341 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
342 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
343 continue;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
344
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
345 /* 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
346 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
347 *tmp = '\0';
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
348
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
349 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
350 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
351 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
352
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
353 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
354 "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
355 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
356 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
357 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
358 }
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
359
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
360 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
361 }
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
362
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
363 }
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
364
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
365 static void
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
366 jabber_disco_server_info_result_cb(JabberStream *js, const char *from,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
367 JabberIqType type, const char *id,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
368 xmlnode *packet, gpointer data)
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
369 {
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
370 xmlnode *query, *child;
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
371
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
372 if (!from || strcmp(from, js->user->domain)) {
15358
c8179e0a5483 [gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents: 15355
diff changeset
373 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
374 return;
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
375 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
376
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
377 if (type == JABBER_IQ_ERROR) {
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
378 /* 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
379 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
380 return;
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
381 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
382
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
383 query = xmlnode_get_child(packet, "query");
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
384
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
385 if (!query) {
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
386 jabber_disco_finish_server_info_result_cb(js);
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
387 return;
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
388 }
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
389
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
390 for (child = xmlnode_get_child(query, "identity"); child;
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
391 child = xmlnode_get_next_twin(child)) {
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
392 const char *category, *type, *name;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
393 category = xmlnode_get_attrib(child, "category");
17768
7be011945a1b added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents: 17423
diff changeset
394 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
395 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
396 js->pep = TRUE;
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
397 if (!category || strcmp(category, "server"))
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
398 continue;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
399 if (!type || strcmp(type, "im"))
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
400 continue;
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
401
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
402 name = xmlnode_get_attrib(child, "name");
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
403 if (!name)
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
404 continue;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
405
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
406 g_free(js->server_name);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
407 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
408 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
409 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
410 js->googletalk = TRUE;
26286
443041606e32 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents: 26186
diff changeset
411
443041606e32 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents: 26186
diff changeset
412 /* autodiscover stun and relays */
443041606e32 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents: 26186
diff changeset
413 jabber_google_send_jingle_info(js);
443041606e32 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents: 26186
diff changeset
414 } else {
443041606e32 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents: 26186
diff changeset
415 /* TODO: add external service discovery here... */
26482
72d16a73cf12 Get rid of the rest of the extraneous changes.
Michael Ruprecht <maiku@pidgin.im>
parents: 26337
diff changeset
416 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
417 }
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
418
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
419 for (child = xmlnode_get_child(query, "feature"); child;
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
420 child = xmlnode_get_next_twin(child)) {
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
421 const char *var;
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
422 var = xmlnode_get_attrib(child, "var");
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
423 if (!var)
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
424 continue;
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
425
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
426 if (!strcmp("google:mail:notify", var)) {
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
427 js->server_caps |= JABBER_CAP_GMAIL_NOTIFY;
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
428 jabber_gmail_init(js);
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
429 } else if (!strcmp("google:roster", var)) {
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
430 js->server_caps |= JABBER_CAP_GOOGLE_ROSTER;
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
431 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
432 } 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
433 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
434 } 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
435 js->server_caps |= JABBER_CAP_BLOCKING;
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
436 }
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
437 }
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
438
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
439 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
440 }
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
441
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
442 static void
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
443 jabber_disco_server_items_result_cb(JabberStream *js, const char *from,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
444 JabberIqType type, const char *id,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
445 xmlnode *packet, gpointer data)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
446 {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
447 xmlnode *query, *child;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
448
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
449 if (!from || strcmp(from, js->user->domain) != 0)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
450 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
451
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26088
diff changeset
452 if (type == JABBER_IQ_ERROR)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
453 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
454
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
455 while(js->chat_servers) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
456 g_free(js->chat_servers->data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
457 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
458 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
459
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
460 query = xmlnode_get_child(packet, "query");
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
461
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
462 for(child = xmlnode_get_child(query, "item"); child;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
463 child = xmlnode_get_next_twin(child)) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
464 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
465 const char *jid, *node;
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
466
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
467 if(!(jid = xmlnode_get_attrib(child, "jid")))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
468 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
469
17423
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
470 /* 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
471 * 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
472 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
473 continue;
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
474
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
475 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
476 xmlnode_set_attrib(iq->node, "to", jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
477 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
478 }
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
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
481 void jabber_disco_items_server(JabberStream *js)
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 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
484 "http://jabber.org/protocol/disco#items");
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 xmlnode_set_attrib(iq->node, "to", js->user->domain);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
487
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
488 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
489 jabber_iq_send(iq);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
490
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
491 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
492 xmlnode_set_attrib(iq->node, "to", js->user->domain);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
493 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
494 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
495 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
496
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
497 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
498 {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
499 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
500 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
501 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
502 struct _jabber_disco_info_cb_data *jdicd;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
503 JabberIq *iq;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
504
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
505 if((jid = jabber_id_new(who))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
506 if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
507 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
508 jabber_id_free(jid);
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 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
512 callback(js, who, jbr->capabilities, data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
513 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
514 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
515
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
516 jdicd = g_new0(struct _jabber_disco_info_cb_data, 1);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
517 jdicd->data = data;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
518 jdicd->callback = callback;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
519
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
520 g_hash_table_insert(js->disco_callbacks, g_strdup(who), jdicd);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
521
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
522 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
523 xmlnode_set_attrib(iq->node, "to", who);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
524
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 }

mercurial