libpurple/protocols/jabber/disco.c

Tue, 02 Nov 2021 00:30:07 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 02 Nov 2021 00:30:07 -0500
changeset 41157
f223b69f7da2
parent 40726
645607090674
child 41967
025eee9e6f1d
permissions
-rw-r--r--

Fix some bugs with proxies for xmpp

Testing Done:
Compiled and ran, was unable to get it to actually use charles proxy though.

Reviewed at https://reviews.imfreedom.org/r/1118/

8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /*
26583
e115c7ef2fcf Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents: 26042
diff changeset
2 * purple - Jabber Service Discovery
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
28322
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28191
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28191
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28191
diff changeset
6 * source distribution.
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * 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
10 * the Free Software Foundation; either version 2 of the License, or
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19832
diff changeset
20 * 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
21 *
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 */
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23
40358
e6fe6fc1f516 move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents: 40137
diff changeset
24 #include <purple.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"
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 #include "iq.h"
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
30 #include "jabber.h"
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents: 26106
diff changeset
31 #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
32 #include "pep.h"
15344
34b7f4e55861 [gaim-migrate @ 18072]
Evan Schoenberg <evands@pidgin.im>
parents: 15323
diff changeset
33 #include "presence.h"
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
34 #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
35 #include "useravatar.h"
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 struct _jabber_disco_info_cb_data {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 gpointer data;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 JabberDiscoInfoCallback *callback;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 };
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41
26594
73f09a0501f4 jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents: 26593
diff changeset
42 struct _jabber_disco_items_cb_data {
73f09a0501f4 jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents: 26593
diff changeset
43 gpointer data;
73f09a0501f4 jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents: 26593
diff changeset
44 JabberDiscoItemsCallback *callback;
73f09a0501f4 jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents: 26593
diff changeset
45 };
73f09a0501f4 jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents: 26593
diff changeset
46
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
47 #define SUPPORT_FEATURE(x) { \
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
48 feature = purple_xmlnode_new_child(query, "feature"); \
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
49 purple_xmlnode_set_attrib(feature, "var", x); \
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
50 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51
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
52 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
53 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
54 JabberIqType type, const char *id,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
55 PurpleXmlNode *packet, gpointer data)
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
56 {
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
57 JabberBytestreamsStreamhost *sh = data;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
58 PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query",
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
59 NS_BYTESTREAMS);
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
60
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
61 if (from && purple_strequal(from, sh->jid) && query != NULL) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
62 PurpleXmlNode *sh_node = purple_xmlnode_get_child(query, "streamhost");
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
63 if (sh_node) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
64 const char *jid = purple_xmlnode_get_attrib(sh_node, "jid");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
65 const char *port = purple_xmlnode_get_attrib(sh_node, "port");
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
66
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
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
68 if (jid == NULL || !purple_strequal(jid, from))
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
69 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
70 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
71
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
72 sh->host = g_strdup(purple_xmlnode_get_attrib(sh_node, "host"));
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
73 sh->zeroconf = g_strdup(purple_xmlnode_get_attrib(sh_node, "zeroconf"));
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
74 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
75 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
76 }
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 }
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
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
79 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
80 "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
81 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
82 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
83
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
84 /* 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
85 if (!(sh->jid && sh->host && sh->port > 0)) {
28077
c2b493e058f1 Don't use pointers (even opaquely) once they're freed. Closes #9822.
Paul Aurich <darkrain42@pidgin.im>
parents: 28047
diff changeset
86 js->bs_proxies = g_list_remove(js->bs_proxies, sh);
40137
016690872c6c Add new and free functions for structs to reduce duplication
qarkai <qarkai@gmail.com>
parents: 40064
diff changeset
87 jabber_bytestreams_streamhost_free(sh);
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
88 }
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
89 }
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
90
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
92 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
93 JabberIqType type, const char *id,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
94 PurpleXmlNode *in_query)
26707
a4f7c5d5e5ae propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
parents: 26668 26692
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(type == JABBER_IQ_GET) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
97 PurpleXmlNode *query, *identity, *feature;
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
98 JabberIq *iq;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
99 const char *node = purple_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
100 char *node_uri = NULL;
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
101
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
102 /* create custom caps node URI */
24716
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
103 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
104
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
105 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_INFO);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
106
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
107 jabber_iq_set_id(iq, id);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108
28047
0f280c9653d2 jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <darkrain42@pidgin.im>
parents: 28028
diff changeset
109 if (from)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
110 purple_xmlnode_set_attrib(iq->node, "to", from);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
111 query = purple_xmlnode_get_child(iq->node, "query");
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
112
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
113 if(node)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
114 purple_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
115
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 31680
diff changeset
116 if(!node || purple_strequal(node, node_uri)) {
24715
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 23954
diff changeset
117 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
118 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
119 JabberIdentity *ident = (JabberIdentity*)identities->data;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
120 identity = purple_xmlnode_new_child(query, "identity");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
121 purple_xmlnode_set_attrib(identity, "category", ident->category);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
122 purple_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
123 if (ident->lang)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
124 purple_xmlnode_set_attrib(identity, "xml:lang", ident->lang);
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
125 if (ident->name)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
126 purple_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
127 }
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
128 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
129 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
130 if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
131 feature = purple_xmlnode_new_child(query, "feature");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
132 purple_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
133 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
134 }
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
135 } else {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
136 PurpleXmlNode *error, *inf;
27211
68a7be484fe1 propagate from branch 'im.pidgin.pidgin' (head feb6f844abcd8e7add3c986f3010f642838533e8)
Paul Aurich <darkrain42@pidgin.im>
parents: 26958 26928
diff changeset
137
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
138 /* XXX: gross hack, implement jabber_iq_set_type or something */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
139 purple_xmlnode_set_attrib(iq->node, "type", "error");
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
140 iq->type = JABBER_IQ_ERROR;
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26026
diff changeset
141
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
142 error = purple_xmlnode_new_child(query, "error");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
143 purple_xmlnode_set_attrib(error, "code", "404");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
144 purple_xmlnode_set_attrib(error, "type", "cancel");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
145 inf = purple_xmlnode_new_child(error, "item-not-found");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
146 purple_xmlnode_set_namespace(inf, NS_XMPP_STANZAS);
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
147 }
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
148 g_free(node_uri);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
149 jabber_iq_send(iq);
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
150 } else if (type == JABBER_IQ_SET) {
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
151 /* wtf? seriously. wtf‽ */
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
152 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
153 PurpleXmlNode *error, *bad_request;
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
154
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
155 /* Free the <query/> */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
156 purple_xmlnode_free(purple_xmlnode_get_child(iq->node, "query"));
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
157 /* Add an error */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
158 error = purple_xmlnode_new_child(iq->node, "error");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
159 purple_xmlnode_set_attrib(error, "type", "modify");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
160 bad_request = purple_xmlnode_new_child(error, "bad-request");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
161 purple_xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS);
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
162
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
163 jabber_iq_set_id(iq, id);
28047
0f280c9653d2 jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <darkrain42@pidgin.im>
parents: 28028
diff changeset
164 if (from)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
165 purple_xmlnode_set_attrib(iq->node, "to", from);
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
166
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
167 jabber_iq_send(iq);
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
168 }
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
169 }
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
170
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
171 static void jabber_disco_info_cb(JabberStream *js, const char *from,
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
172 JabberIqType type, const char *id,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
173 PurpleXmlNode *packet, gpointer data)
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
174 {
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
175 struct _jabber_disco_info_cb_data *jdicd = data;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
176 PurpleXmlNode *query;
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
177
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
178 query = purple_xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO);
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
179
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
180 if (type == JABBER_IQ_RESULT && query) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
181 PurpleXmlNode *child;
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
182 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
183 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
184 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
185 JabberCapabilities capabilities = JABBER_CAP_NONE;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
186
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
187 if((jid = jabber_id_new(from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
188 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
189 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
190 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
191 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
192
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
193 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
194 capabilities = jbr->capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
195
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
196 for(child = query->child; child; child = child->next) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
197 if(child->type != PURPLE_XMLNODE_TYPE_TAG)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
198 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
199
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
200 if(purple_strequal(child->name, "identity")) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
201 const char *category = purple_xmlnode_get_attrib(child, "category");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
202 const char *type = purple_xmlnode_get_attrib(child, "type");
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 if(!category || !type)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
206 if(purple_strequal(category, "conference") && purple_strequal(type, "text")) {
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
207 /* 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
208 /* 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
209 js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from));
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
210 } else if(purple_strequal(category, "directory") && purple_strequal(type, "user")) {
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
211 /* 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
212 js->user_directories = g_list_prepend(js->user_directories, g_strdup(from));
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
213 } else if(purple_strequal(category, "proxy") && purple_strequal(type, "bytestreams")) {
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
214 /* 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
215 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
216 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
217
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
218 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
219
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
220 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
221 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
222 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
223
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
224 iq = jabber_iq_new_query(js, JABBER_IQ_GET,
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
225 NS_BYTESTREAMS);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
226 purple_xmlnode_set_attrib(iq->node, "to", sh->jid);
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
227 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
228 jabber_iq_send(iq);
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
229 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
230
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
231 } else if(purple_strequal(child->name, "feature")) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
232 const char *var = purple_xmlnode_get_attrib(child, "var");
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
233 if(!var)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
234 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
235
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
236 if(purple_strequal(var, "http://jabber.org/protocol/si"))
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
237 capabilities |= JABBER_CAP_SI;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
238 else if(purple_strequal(var, "http://jabber.org/protocol/si/profile/file-transfer"))
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
239 capabilities |= JABBER_CAP_SI_FILE_XFER;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
240 else if(purple_strequal(var, NS_BYTESTREAMS))
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241 capabilities |= JABBER_CAP_BYTESTREAMS;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
242 else if(purple_strequal(var, "jabber:iq:search"))
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
243 capabilities |= JABBER_CAP_IQ_SEARCH;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
244 else if(purple_strequal(var, "jabber:iq:register"))
11675
0eae965a9098 [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
245 capabilities |= JABBER_CAP_IQ_REGISTER;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
246 else if(purple_strequal(var, NS_PING))
17769
69d98a4da006 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents: 17768
diff changeset
247 capabilities |= JABBER_CAP_PING;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
248 else if(purple_strequal(var, NS_DISCO_ITEMS))
26583
e115c7ef2fcf Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents: 26042
diff changeset
249 capabilities |= JABBER_CAP_ITEMS;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
250 else if(purple_strequal(var, "http://jabber.org/protocol/commands")) {
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
251 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
252 }
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
253 else if(purple_strequal(var, NS_IBB)) {
24372
830701cec96f Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents: 23912
diff changeset
254 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
255 capabilities |= JABBER_CAP_IBB;
830701cec96f Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents: 23912
diff changeset
256 }
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
257 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
258 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
259
28191
187bd9914401 Reverse the list of conference servers we find so that the first one in the
Etan Reisner <deryni@pidgin.im>
parents: 28077
diff changeset
260 js->chat_servers = g_list_reverse(js->chat_servers);
187bd9914401 Reverse the list of conference servers we find so that the first one in the
Etan Reisner <deryni@pidgin.im>
parents: 28077
diff changeset
261
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
262 capabilities |= JABBER_CAP_RETRIEVED;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265 jbr->capabilities = capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266
27790
b2f4880d4e96 Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 27292
diff changeset
267 if (jdicd && jdicd->callback)
b2f4880d4e96 Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 27292
diff changeset
268 jdicd->callback(js, from, capabilities, jdicd->data);
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
269 } else { /* type == JABBER_IQ_ERROR or query == NULL */
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
270 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
271 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
272 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
273 JabberCapabilities capabilities = JABBER_CAP_NONE;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
274
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
275 if((jid = jabber_id_new(from))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
276 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
277 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
278 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
280
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
281 if(jbr)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
282 capabilities = jbr->capabilities;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
283
27790
b2f4880d4e96 Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 27292
diff changeset
284 if (jdicd && jdicd->callback)
b2f4880d4e96 Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 27292
diff changeset
285 jdicd->callback(js, from, capabilities, jdicd->data);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
286 }
27790
b2f4880d4e96 Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 27292
diff changeset
287
b2f4880d4e96 Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 27292
diff changeset
288 g_free(jdicd);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
289 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
290
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
291 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
292 JabberIqType type, const char *id,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
293 PurpleXmlNode *query)
26707
a4f7c5d5e5ae propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
parents: 26668 26692
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(type == JABBER_IQ_GET) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
296 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
297 NS_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
298
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
299 /* preserve node */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
300 PurpleXmlNode *iq_query = purple_xmlnode_get_child(iq->node, "query");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
301 const char *node = purple_xmlnode_get_attrib(query, "node");
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
302 if(node)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
303 purple_xmlnode_set_attrib(iq_query,"node",node);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
304
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
305 jabber_iq_set_id(iq, id);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
306
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25553
diff changeset
307 if (from)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
308 purple_xmlnode_set_attrib(iq->node, "to", from);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
309 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
310 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
311 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
313 static void
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
314 jabber_disco_finish_server_info_result_cb(JabberStream *js)
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
315 {
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
316 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
317
25810
5cf3c22e52df Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents: 25477
diff changeset
318 /*
5cf3c22e52df Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents: 25477
diff changeset
319 * 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
320 * 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
321 * 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
322 */
18235
60a9bd99f035 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18225
diff changeset
323 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
324
25477
ada9e5c4a10a Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents: 25290
diff changeset
325 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
326 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
327
29103
aefa3f414775 jabber: The google roster request code was so lonely, so let's just drop-kick it and add the little custom logic to roster.c
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
328 /* Yes, please! */
aefa3f414775 jabber: The google roster request code was so lonely, so let's just drop-kick it and add the little custom logic to roster.c
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
329 jabber_roster_request(js);
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
330
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
331 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
332 /* 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
333 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
334 }
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
335
25290
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
336 /* 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
337 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
338 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
339 }
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
340
40594
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
341 /* If the server supports carbons, enable them! */
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
342 if(js->server_caps & JABBER_CAP_MESSAGE_CARBONS) {
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
343 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
344 PurpleXmlNode *enable = purple_xmlnode_new_child(iq->node, "enable");
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
345
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
346 purple_xmlnode_set_namespace(enable, NS_MESSAGE_CARBONS);
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
347
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
348 jabber_iq_send(iq);
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
349 }
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
350
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
351 /* If there are manually specified bytestream proxies, query them */
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32300
diff changeset
352 ft_proxies = purple_account_get_string(purple_connection_get_account(js->gc), "ft_proxies", NULL);
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
353 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
354 JabberIq *iq;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
355 JabberBytestreamsStreamhost *sh;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
356 int i;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
357 char *tmp;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
358 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
359
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
360 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
361 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
362 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
363 continue;
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
364
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
365 /* 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
366 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
367 *tmp = '\0';
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
368
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
369 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
370 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
371 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
372
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
373 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
374 purple_xmlnode_set_attrib(iq->node, "to", sh->jid);
23912
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
375 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
376 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
377 }
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
378
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
379 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
380 }
8169bfe82e47 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents: 21688
diff changeset
381
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
382 }
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
383
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
384 static void
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
385 jabber_disco_stun_srv_resolve_cb(GObject *sender, GAsyncResult *result, gpointer data) {
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
386 GError *error = NULL;
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
387 GList *services = NULL;
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
388 JabberStream *js = (JabberStream *) data;
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
389 gint results = 0;
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
390
37517
a67be31f9c7e Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents: 37466
diff changeset
391 services = g_resolver_lookup_service_finish(G_RESOLVER(sender),
a67be31f9c7e Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents: 37466
diff changeset
392 result, &error);
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
393
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
394 if(error != NULL) {
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
395 purple_debug_info("jabber", "Failed to look up a STUN record : %s\n", error->message);
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
396
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
397 g_error_free(error);
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
398
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
399 return;
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
400 }
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
401
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
402 results = g_list_length(services);
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
403
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
404 purple_debug_info("jabber", "got %d SRV responses for STUN.\n", results);
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
405
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
406 if (results > 0) {
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
407 GSrvTarget *target = (GSrvTarget *)services->data;
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
408 const gchar *hostname = g_srv_target_get_hostname(target);
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
409
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
410 js->stun_ip = g_strdup(hostname);
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
411 js->stun_port = g_srv_target_get_port(target);
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
412
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
413 purple_debug_info("jabber", "set stun address to %s:%d\n",
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
414 hostname, js->stun_port);
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
415 }
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
416
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
417 g_resolver_free_targets(services);
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
418 }
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
419
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
420
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
421 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
422 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
423 JabberIqType type, const char *id,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
424 PurpleXmlNode *packet, gpointer data)
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
425 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
426 PurpleXmlNode *query, *child;
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
427
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
428 if (!from || !purple_strequal(from, js->user->domain)) {
15358
c8179e0a5483 [gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents: 15355
diff changeset
429 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
430 return;
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
431 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
432
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
433 if (type == JABBER_IQ_ERROR) {
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
434 /* 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
435 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
436 return;
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
437 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
438
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
439 query = purple_xmlnode_get_child(packet, "query");
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
440
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
441 if (!query) {
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
442 jabber_disco_finish_server_info_result_cb(js);
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
443 return;
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
444 }
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
445
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
446 for (child = purple_xmlnode_get_child(query, "identity"); child;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
447 child = purple_xmlnode_get_next_twin(child)) {
38363
876661dc1375 Fix a bunch of stuff that was somehow broke in the last wave of pull requests
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
448 const char *category, *type, *name, *stun_ip;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
449 category = purple_xmlnode_get_attrib(child, "category");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
450 type = purple_xmlnode_get_attrib(child, "type");
38260
dcada91c0912 Remove redundant NULL checks
qarkai <qarkai@gmail.com>
parents: 38259
diff changeset
451 if(purple_strequal(category, "pubsub") && purple_strequal(type, "pep")) {
29814
ad92005bcdcf Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <malu@pidgin.im>
parents: 29247
diff changeset
452 PurpleConnection *gc = js->gc;
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 18719
diff changeset
453 js->pep = TRUE;
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32300
diff changeset
454 purple_connection_set_flags(gc,
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32300
diff changeset
455 purple_connection_get_flags(gc)
34746
dc9c911dbd35 Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents: 32678
diff changeset
456 | PURPLE_CONNECTION_FLAG_SUPPORT_MOODS
dc9c911dbd35 Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents: 32678
diff changeset
457 | PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES);
29814
ad92005bcdcf Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <malu@pidgin.im>
parents: 29247
diff changeset
458 }
38260
dcada91c0912 Remove redundant NULL checks
qarkai <qarkai@gmail.com>
parents: 38259
diff changeset
459 if (!purple_strequal(category, "server"))
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
460 continue;
38260
dcada91c0912 Remove redundant NULL checks
qarkai <qarkai@gmail.com>
parents: 38259
diff changeset
461 if (!purple_strequal(type, "im"))
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
462 continue;
17421
9399db1f7bbd whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15884
diff changeset
463
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
464 name = purple_xmlnode_get_attrib(child, "name");
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
465 if (!name)
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
466 continue;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
467
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
468 g_free(js->server_name);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
469 js->server_name = g_strdup(name);
38262
8c0b26d1d508 Replace empty string comparison with null character comparison
qarkai <qarkai@gmail.com>
parents: 38260
diff changeset
470 stun_ip = purple_network_get_stun_ip();
40726
645607090674 Remove Google Talk from the XMPP plugin.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
471 if (!stun_ip || !*stun_ip) {
37518
53c9ebedf2b7 Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents: 37517
diff changeset
472 GResolver *resolver = g_resolver_get_default();
53c9ebedf2b7 Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents: 37517
diff changeset
473 g_resolver_lookup_service_async(resolver,
37457
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
474 "stun",
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
475 "udp",
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
476 js->user->domain,
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
477 NULL,
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
478 jabber_disco_stun_srv_resolve_cb,
0b957b80c46a This should do it for XMPP
Gary Kramlich <grim@reaperworld.com>
parents: 35676
diff changeset
479 js);
37518
53c9ebedf2b7 Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents: 37517
diff changeset
480 g_object_unref(resolver);
28811
a6b47f7de931 jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents: 28322
diff changeset
481 /* TODO: add TURN support later... */
26482
72d16a73cf12 Get rid of the rest of the extraneous changes.
Michael Ruprecht <maiku@pidgin.im>
parents: 26337
diff changeset
482 }
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
483 }
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
484
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
485 for (child = purple_xmlnode_get_child(query, "feature"); child;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
486 child = purple_xmlnode_get_next_twin(child)) {
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
487 const char *var;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
488 var = purple_xmlnode_get_attrib(child, "var");
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
489 if (!var)
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
490 continue;
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
491
40726
645607090674 Remove Google Talk from the XMPP plugin.
Gary Kramlich <grim@reaperworld.com>
parents: 40694
diff changeset
492 if (purple_strequal("http://jabber.org/protocol/commands", var)) {
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
493 js->server_caps |= JABBER_CAP_ADHOC;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
494 } else if (purple_strequal(NS_SIMPLE_BLOCKING, var)) {
25290
033942580f51 Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents: 23912
diff changeset
495 js->server_caps |= JABBER_CAP_BLOCKING;
40594
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
496 } else if (purple_strequal(NS_MESSAGE_CARBONS, var)) {
e32ab786a04f Finally add XMPP Message Carbons XEP-0280
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
497 js->server_caps |= JABBER_CAP_MESSAGE_CARBONS;
15225
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
498 }
d04a059065dd [gaim-migrate @ 17949]
Sean Egan <seanegan@pidgin.im>
parents: 15197
diff changeset
499 }
15265
a5b0ab58b05d [gaim-migrate @ 17993]
Sean Egan <seanegan@pidgin.im>
parents: 15225
diff changeset
500
15355
1ce281d16071 [gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents: 15344
diff changeset
501 jabber_disco_finish_server_info_result_cb(js);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
502 }
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
503
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
504 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
505 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
506 JabberIqType type, const char *id,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
507 PurpleXmlNode *packet, gpointer data)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
508 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
509 PurpleXmlNode *query, *child;
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
510
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
511 if (!from || !purple_strequal(from, js->user->domain))
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
512 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
513
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
514 if (type == JABBER_IQ_ERROR)
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
515 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
516
40062
d25228fc7b8e Use g_list_free_full instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 38363
diff changeset
517 g_list_free_full(js->chat_servers, g_free);
40064
467eecebfa70 Set GList to NULL after free
qarkai <qarkai@gmail.com>
parents: 40062
diff changeset
518 js->chat_servers = NULL;
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
519
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
520 query = purple_xmlnode_get_child(packet, "query");
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
521
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
522 for(child = purple_xmlnode_get_child(query, "item"); child;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
523 child = purple_xmlnode_get_next_twin(child)) {
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
524 JabberIq *iq;
30784
35c4f2c99a81 Fix this inconsequential compile warning:
Mark Doliner <markdoliner@pidgin.im>
parents: 30744
diff changeset
525 const char *jid;
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
526
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
527 if(!(jid = purple_xmlnode_get_attrib(child, "jid")))
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
528 continue;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
529
17423
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
530 /* 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
531 * so we won't query them */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
532 if(purple_xmlnode_get_attrib(child, "node") != NULL)
17423
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
533 continue;
1f3a88fda48e skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17421
diff changeset
534
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
535 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
536 purple_xmlnode_set_attrib(iq->node, "to", jid);
27790
b2f4880d4e96 Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 27292
diff changeset
537 jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
538 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
539 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
540 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
541
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
542 void jabber_disco_items_server(JabberStream *js)
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
543 {
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
544 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
545
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
546 purple_xmlnode_set_attrib(iq->node, "to", js->user->domain);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
547
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
548 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
549 jabber_iq_send(iq);
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
550
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
551 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
552 purple_xmlnode_set_attrib(iq->node, "to", js->user->domain);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 14356
diff changeset
553 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
554 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
555 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
556
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
557 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
558 {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
559 JabberID *jid;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
560 JabberBuddy *jb;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
561 JabberBuddyResource *jbr = NULL;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
562 struct _jabber_disco_info_cb_data *jdicd;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
563 JabberIq *iq;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
564
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
565 if((jid = jabber_id_new(who))) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
566 if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE)))
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
567 jbr = jabber_buddy_find_resource(jb, jid->resource);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
568 jabber_id_free(jid);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
569 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
570
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
571 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) {
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
572 callback(js, who, jbr->capabilities, data);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
573 return;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
574 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
575
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
576 jdicd = g_new0(struct _jabber_disco_info_cb_data, 1);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
577 jdicd->data = data;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
578 jdicd->callback = callback;
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
579
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28979
diff changeset
580 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34746
diff changeset
581 purple_xmlnode_set_attrib(iq->node, "to", who);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
582
26910
7813befc9bf9 Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <darkrain42@pidgin.im>
parents: 26908
diff changeset
583 jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd);
8312
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
584 jabber_iq_send(iq);
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
585 }
3cb6d9d94694 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
586

mercurial