annotate libpurple/protocols/jabber/disco.c @ 26680:1df3579a974b

Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics. How often do we get to remove something from the JabberStream?
author Paul Aurich <paul@darkrain42.org>
date Mon, 13 Apr 2009 04:34:17 +0000
parents 1de01f9594c8
children f1dd84b4964e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
2 * purple - Jabber Service Discovery
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19653
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "debug.h"
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
25 #include "request.h"
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
26 #include "notify.h"
26675
b290c7b9fc73 propagate from branch 'im.pidgin.pidgin' (head 3c568b43fb4447b65a2b06e6767340edd7763c53)
Paul Aurich <paul@darkrain42.org>
parents: 26552 26342
diff changeset
27 #include "libpurple/disco.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "buddy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "google.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "iq.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "disco.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "jabber.h"
26014
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25718
diff changeset
34 #include "jingle/jingle.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "presence.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "roster.h"
17561
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents: 17440
diff changeset
37 #include "pep.h"
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
38 #include "adhoccommands.h"
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
39 #include "xdata.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 struct _jabber_disco_info_cb_data {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 gpointer data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 JabberDiscoInfoCallback *callback;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
46 struct _jabber_disco_items_cb_data {
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
47 gpointer data;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
48 JabberDiscoItemsCallback *callback;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
49 };
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
50
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17566
diff changeset
51 #define SUPPORT_FEATURE(x) { \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 feature = xmlnode_new_child(query, "feature"); \
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17566
diff changeset
53 xmlnode_set_attrib(feature, "var", x); \
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17566
diff changeset
54 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
56 struct jabber_disco_list_data {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
57 JabberStream *js;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
58 PurpleDiscoList *list;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
59 char *server;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
60 int fetch_count;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
61 };
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
62
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
63 static void
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
64 jabber_disco_bytestream_server_cb(JabberStream *js, const char *from,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
65 JabberIqType type, const char *id,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
66 xmlnode *packet, gpointer data)
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
67 {
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
68 JabberBytestreamsStreamhost *sh = data;
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
69 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
70 "http://jabber.org/protocol/bytestreams");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
71
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
72 if (from && !strcmp(from, sh->jid) && query != NULL) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
73 xmlnode *sh_node = xmlnode_get_child(query, "streamhost");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
74 if (sh_node) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
75 const char *jid = xmlnode_get_attrib(sh_node, "jid");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
76 const char *port = xmlnode_get_attrib(sh_node, "port");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
77
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
78
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
79 if (jid == NULL || strcmp(jid, from) != 0)
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
80 purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
81 jid ? jid : "(null)");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
82
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
83 sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host"));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
84 sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf"));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
85 if (port != NULL)
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
86 sh->port = atoi(port);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
87 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
88 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
89
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
90 purple_debug_info("jabber", "Discovered bytestream proxy server: "
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
91 "jid='%s' host='%s' port='%d' zeroconf='%s'\n",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
92 from ? from : "", sh->host ? sh->host : "",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
93 sh->port, sh->zeroconf ? sh->zeroconf : "");
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
94
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
95 /* TODO: When we support zeroconf proxies, fix this to handle them */
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
96 if (!(sh->jid && sh->host && sh->port > 0)) {
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
97 g_free(sh->jid);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
98 g_free(sh->host);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
99 g_free(sh->zeroconf);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
100 g_free(sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
101 js->bs_proxies = g_list_remove(js->bs_proxies, sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
102 }
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
103 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
104
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
106 void jabber_disco_info_parse(JabberStream *js, const char *from,
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
107 JabberIqType type, const char *id,
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
108 xmlnode *in_query) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
110 if(!from)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
113 if(type == JABBER_IQ_GET) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 xmlnode *query, *identity, *feature;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 JabberIq *iq;
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
116 const char *node = xmlnode_get_attrib(in_query, "node");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 "http://jabber.org/protocol/disco#info");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120
26339
ce23e32a0ada Don't match in the disco callbacks hashtable on remote JID. Use IQ id instead.
Paul Aurich <paul@darkrain42.org>
parents: 26338
diff changeset
121 jabber_iq_set_id(iq, id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 xmlnode_set_attrib(iq->node, "to", from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 query = xmlnode_get_child(iq->node, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 if(node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 xmlnode_set_attrib(query, "node", node);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 identity = xmlnode_new_child(query, "identity");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 xmlnode_set_attrib(identity, "category", "client");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 * handheld, pc, phone,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 * web */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 xmlnode_set_attrib(identity, "name", PACKAGE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 SUPPORT_FEATURE("jabber:iq:last")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 SUPPORT_FEATURE("jabber:iq:oob")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 SUPPORT_FEATURE("jabber:iq:time")
25923
a73791d35fcc Marcus' eagle eyes noticed 'xmpp:urn:time', which is bogus.
Paul Aurich <paul@darkrain42.org>
parents: 24820
diff changeset
140 SUPPORT_FEATURE("urn:xmpp:time")
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 SUPPORT_FEATURE("jabber:iq:version")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 SUPPORT_FEATURE("jabber:x:conference")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items")
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23645
diff changeset
146 SUPPORT_FEATURE("http://jabber.org/protocol/ibb");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 SUPPORT_FEATURE("http://jabber.org/protocol/muc")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 SUPPORT_FEATURE("http://jabber.org/protocol/si")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im")
18109
3d7129ac1de9 respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents: 17440
diff changeset
152 SUPPORT_FEATURE("urn:xmpp:ping")
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25253
diff changeset
153
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
154 if(!node) { /* non-caps disco#info, add all enabled extensions */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
155 GList *features;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
156 for(features = jabber_features; features; features = features->next) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
157 JabberFeature *feat = (JabberFeature*)features->data;
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17566
diff changeset
158 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE)
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17566
diff changeset
159 SUPPORT_FEATURE(feat->namespace);
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
160 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
161 }
25664
d0ac3c438b71 Check remote JID's capabilities for audio and video XEP support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25637
diff changeset
162 #ifdef USE_VV
25545
315151da0dc6 Basic Google Talk voice call support. No UI; receiving a call auto-accepts it.
Sean Egan <seanegan@gmail.com>
parents: 18259
diff changeset
163 } else if (node && !strcmp(node, CAPS0115_NODE "#voice-v1")) {
26041
70ae1029bb70 Fix GTalk vv caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
164 SUPPORT_FEATURE("http://www.google.com/xmpp/protocol/session");
70ae1029bb70 Fix GTalk vv caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
165 SUPPORT_FEATURE("http://www.google.com/xmpp/protocol/voice/v1");
26014
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25718
diff changeset
166 SUPPORT_FEATURE(JINGLE);
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25718
diff changeset
167 SUPPORT_FEATURE(JINGLE_APP_RTP_SUPPORT_AUDIO);
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25718
diff changeset
168 SUPPORT_FEATURE(JINGLE_APP_RTP_SUPPORT_VIDEO);
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25718
diff changeset
169 SUPPORT_FEATURE(JINGLE_TRANSPORT_RAWUDP);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26041
diff changeset
170 SUPPORT_FEATURE(JINGLE_TRANSPORT_ICEUDP);
25664
d0ac3c438b71 Check remote JID's capabilities for audio and video XEP support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25637
diff changeset
171 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 } else {
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
173 const char *ext = NULL;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
174 unsigned pos;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
175 unsigned nodelen = strlen(node);
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
176 unsigned capslen = strlen(CAPS0115_NODE);
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
177 /* do a basic plausability check */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
178 if(nodelen > capslen+1) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
179 /* verify that the string is CAPS0115#<ext> and get the pointer to the ext part */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
180 for(pos = 0; pos < capslen+1; ++pos) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
181 if(pos == capslen) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
182 if(node[pos] == '#')
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
183 ext = &node[pos+1];
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
184 else
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
185 break;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
186 } else if(node[pos] != CAPS0115_NODE[pos])
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
187 break;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
188 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25253
diff changeset
189
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
190 if(ext != NULL) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
191 /* look for that ext */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
192 GList *features;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
193 for(features = jabber_features; features; features = features->next) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
194 JabberFeature *feat = (JabberFeature*)features->data;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
195 if(!strcmp(feat->shortname, ext)) {
17576
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17566
diff changeset
196 SUPPORT_FEATURE(feat->namespace);
e49b259fc7dd PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17566
diff changeset
197 break;
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
198 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
199 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
200 if(features == NULL)
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
201 ext = NULL;
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
202 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
203 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25253
diff changeset
204
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
205 if(ext == NULL) {
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
206 xmlnode *error, *inf;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25253
diff changeset
207
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
208 /* XXX: gross hack, implement jabber_iq_set_type or something */
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
209 xmlnode_set_attrib(iq->node, "type", "error");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
210 iq->type = JABBER_IQ_ERROR;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25253
diff changeset
211
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
212 error = xmlnode_new_child(query, "error");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
213 xmlnode_set_attrib(error, "code", "404");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
214 xmlnode_set_attrib(error, "type", "cancel");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
215 inf = xmlnode_new_child(error, "item-not-found");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
216 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
217 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 jabber_iq_send(iq);
26680
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
221 } else if (type == JABBER_IQ_SET) {
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
222 /* wtf? seriously. wtf‽ */
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
223 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR);
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
224 xmlnode *error, *bad_request;
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
225
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
226 /* Free the <query/> */
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
227 xmlnode_free(xmlnode_get_child(iq->node, "query"));
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
228 /* Add an error */
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
229 error = xmlnode_new_child(iq->node, "error");
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
230 xmlnode_set_attrib(error, "type", "modify");
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
231 bad_request = xmlnode_new_child(error, "bad-request");
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
232 xmlnode_set_namespace(bad_request, "urn:ietf:params:xml:ns:xmpp-stanzas");
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
233
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
234 jabber_iq_set_id(iq, id);
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
235 xmlnode_set_attrib(iq->node, "to", from);
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
236
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
237 jabber_iq_send(iq);
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
238 }
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
239 }
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
240
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
241 static void jabber_disco_info_cb(JabberStream *js, const char *from,
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
242 JabberIqType type, const char *id,
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
243 xmlnode *packet, gpointer data)
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
244 {
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
245 struct _jabber_disco_info_cb_data *jdicd = data;
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
246 xmlnode *query;
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
247
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
248 query = xmlnode_get_child_with_namespace(packet, "query",
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
249 "http://jabber.org/protocol/disco#info");
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
250
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
251 if (type == JABBER_IQ_RESULT && query) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 JabberCapabilities capabilities = JABBER_CAP_NONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 if((jid = jabber_id_new(from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 jbr = jabber_buddy_find_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 capabilities = jbr->capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
26680
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
267 for(child = query->child; child; child = child->next) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 if(child->type != XMLNODE_TYPE_TAG)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 if(!strcmp(child->name, "identity")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 const char *category = xmlnode_get_attrib(child, "category");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 const char *type = xmlnode_get_attrib(child, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 if(!category || !type)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 if(!strcmp(category, "conference") && !strcmp(type, "text")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 /* we found a groupchat or MUC server, add it to the list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 /* XXX: actually check for protocol/muc or gc-1.0 support */
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
280 js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 } else if(!strcmp(category, "directory") && !strcmp(type, "user")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 /* we found a JUD */
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
283 js->user_directories = g_list_prepend(js->user_directories, g_strdup(from));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
284 } else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
285 /* This is a bytestream proxy */
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
286 JabberIq *iq;
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
287 JabberBytestreamsStreamhost *sh;
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
288
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
289 purple_debug_info("jabber", "Found bytestream proxy server: %s\n", from);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
290
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
291 sh = g_new0(JabberBytestreamsStreamhost, 1);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
292 sh->jid = g_strdup(from);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
293 js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
294
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
295 iq = jabber_iq_new_query(js, JABBER_IQ_GET,
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
296 "http://jabber.org/protocol/bytestreams");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
297 xmlnode_set_attrib(iq->node, "to", sh->jid);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
298 jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
299 jabber_iq_send(iq);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 } else if(!strcmp(child->name, "feature")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 const char *var = xmlnode_get_attrib(child, "var");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 if(!var)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 if(!strcmp(var, "http://jabber.org/protocol/si"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 capabilities |= JABBER_CAP_SI;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 capabilities |= JABBER_CAP_SI_FILE_XFER;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 else if(!strcmp(var, "http://jabber.org/protocol/bytestreams"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 capabilities |= JABBER_CAP_BYTESTREAMS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 else if(!strcmp(var, "jabber:iq:search"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 capabilities |= JABBER_CAP_IQ_SEARCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 else if(!strcmp(var, "jabber:iq:register"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 capabilities |= JABBER_CAP_IQ_REGISTER;
26548
cde07a2e4531 Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
317 else if(!strcmp(var, "urn:xmpp:ping"))
17562
6ab1089e2101 applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents: 17561
diff changeset
318 capabilities |= JABBER_CAP_PING;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
319 else if(!strcmp(var, "http://jabber.org/protocol/disco#items"))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
320 capabilities |= JABBER_CAP_ITEMS;
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
321 else if(!strcmp(var, "http://jabber.org/protocol/commands")) {
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
322 capabilities |= JABBER_CAP_ADHOC;
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
323 }
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23645
diff changeset
324 else if(!strcmp(var, "http://jabber.org/protocol/ibb")) {
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23645
diff changeset
325 purple_debug_info("jabber", "remote supports IBB\n");
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23645
diff changeset
326 capabilities |= JABBER_CAP_IBB;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23645
diff changeset
327 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 capabilities |= JABBER_CAP_RETRIEVED;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 jbr->capabilities = capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335
26680
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
336 jdicd->callback(js, from, capabilities, jdicd->data);
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
337 } else { /* type == JABBER_IQ_ERROR or query == NULL */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 JabberCapabilities capabilities = JABBER_CAP_NONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 if((jid = jabber_id_new(from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 jbr = jabber_buddy_find_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 capabilities = jbr->capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 jdicd->callback(js, from, capabilities, jdicd->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
356 void jabber_disco_items_parse(JabberStream *js, const char *from,
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
357 JabberIqType type, const char *id,
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
358 xmlnode *query) {
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
359 if(type == JABBER_IQ_GET) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 "http://jabber.org/protocol/disco#items");
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25253
diff changeset
362
17619
22c848c81ccd Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17610
diff changeset
363 /* preserve node */
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
364 xmlnode *iq_query = xmlnode_get_child(iq->node, "query");
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
365 const char *node = xmlnode_get_attrib(query, "node");
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
366 if(node)
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
367 xmlnode_set_attrib(iq_query,"node",node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
369 jabber_iq_set_id(iq, id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
371 if (from)
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
372 xmlnode_set_attrib(iq->node, "to", from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 jabber_disco_finish_server_info_result_cb(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 {
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
380 const char *ft_proxies;
18163
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
381
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
382 jabber_vcard_fetch_mine(js);
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
383
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 jabber_roster_request(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 }
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
388
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 /* Send initial presence; this will trigger receipt of presence for contacts on the roster */
18685
c03e3fe11ea9 Fixed errors created by merge conflict resolve mistakes.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
390 jabber_presence_send(js->gc->account, NULL);
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
391
17610
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
392 if (js->server_caps & JABBER_CAP_ADHOC) {
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
393 /* The server supports ad-hoc commands, so let's request the list */
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
394 jabber_adhoc_server_get_list(js);
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
395 }
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
396
24820
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
397 /* If the server supports blocking, request the block list */
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
398 if (js->server_caps & JABBER_CAP_BLOCKING) {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
399 jabber_request_block_list(js);
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
400 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
401
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
402 /* If there are manually specified bytestream proxies, query them */
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
403 ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
404 if (ft_proxies) {
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
405 JabberIq *iq;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
406 JabberBytestreamsStreamhost *sh;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
407 int i;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
408 char *tmp;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
409 gchar **ft_proxy_list = g_strsplit(ft_proxies, ",", 0);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
410
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
411 for(i = 0; ft_proxy_list[i]; i++) {
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
412 g_strstrip(ft_proxy_list[i]);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
413 if(!(*ft_proxy_list[i]))
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
414 continue;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
415
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
416 /* We used to allow specifying a port directly here; get rid of it */
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
417 if((tmp = strchr(ft_proxy_list[i], ':')))
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
418 *tmp = '\0';
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
419
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
420 sh = g_new0(JabberBytestreamsStreamhost, 1);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
421 sh->jid = g_strdup(ft_proxy_list[i]);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
422 js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
423
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
424 iq = jabber_iq_new_query(js, JABBER_IQ_GET,
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
425 "http://jabber.org/protocol/bytestreams");
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
426 xmlnode_set_attrib(iq->node, "to", sh->jid);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
427 jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
428 jabber_iq_send(iq);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
429 }
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
430
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
431 g_strfreev(ft_proxy_list);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
432 }
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
433
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
436 struct _disco_data {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
437 struct jabber_disco_list_data *list_data;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
438 PurpleDiscoService *parent;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
439 char *node;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
440 };
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
441
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 static void
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
443 jabber_disco_server_info_result_cb(JabberStream *js, const char *from,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
444 JabberIqType type, const char *id,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
445 xmlnode *packet, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 {
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
447 xmlnode *query, *child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
449 if (!from || strcmp(from, js->user->domain)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
454 if (type == JABBER_IQ_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 /* A common way to get here is for the server not to support xmlns http://jabber.org/protocol/disco#info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 query = xmlnode_get_child(packet, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 if (!query) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
467 for (child = xmlnode_get_child(query, "identity"); child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 const char *category, *type, *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 category = xmlnode_get_attrib(child, "category");
17561
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents: 17440
diff changeset
471 type = xmlnode_get_attrib(child, "type");
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
472 if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep"))
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
473 js->pep = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 if (!category || strcmp(category, "server"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 if (!type || strcmp(type, "im"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 continue;
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
478
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 name = xmlnode_get_attrib(child, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 g_free(js->server_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 js->server_name = g_strdup(name);
15523
ccbdf500f13a Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
485 if (!strcmp(name, "Google Talk")) {
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
486 purple_debug_info("jabber", "Google Talk!\n");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
487 js->googletalk = TRUE;
26162
88f183f7dfc7 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents: 26062
diff changeset
488
88f183f7dfc7 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents: 26062
diff changeset
489 /* autodiscover stun and relays */
88f183f7dfc7 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents: 26062
diff changeset
490 jabber_google_send_jingle_info(js);
88f183f7dfc7 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents: 26062
diff changeset
491 } else {
88f183f7dfc7 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents: 26062
diff changeset
492 /* TODO: add external service discovery here... */
15523
ccbdf500f13a Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
493 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
496 for (child = xmlnode_get_child(query, "feature"); child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 const char *var;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 var = xmlnode_get_attrib(child, "var");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 if (!var)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 if (!strcmp("google:mail:notify", var)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 js->server_caps |= JABBER_CAP_GMAIL_NOTIFY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 jabber_gmail_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 } else if (!strcmp("google:roster", var)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 js->server_caps |= JABBER_CAP_GOOGLE_ROSTER;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 jabber_google_roster_init(js);
17610
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
509 } else if (!strcmp("http://jabber.org/protocol/commands", var)) {
9a19c46adf66 The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
510 js->server_caps |= JABBER_CAP_ADHOC;
24820
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
511 } else if (!strcmp("urn:xmpp:blocking", var)) {
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
512 js->server_caps |= JABBER_CAP_BLOCKING;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 jabber_disco_finish_server_info_result_cb(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 static void
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
520 jabber_disco_server_items_result_cb(JabberStream *js, const char *from,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
521 JabberIqType type, const char *id,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
522 xmlnode *packet, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 xmlnode *query, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
526 if (!from || strcmp(from, js->user->domain) != 0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25983
diff changeset
529 if (type == JABBER_IQ_ERROR)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 while(js->chat_servers) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 g_free(js->chat_servers->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 query = xmlnode_get_child(packet, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 for(child = xmlnode_get_child(query, "item"); child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 JabberIq *iq;
17440
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
542 const char *jid, *node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 if(!(jid = xmlnode_get_attrib(child, "jid")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546
17440
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
547 /* we don't actually care about the specific nodes,
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
548 * so we won't query them */
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
549 if((node = xmlnode_get_attrib(child, "node")))
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
550 continue;
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
551
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 xmlnode_set_attrib(iq->node, "to", jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 void jabber_disco_items_server(JabberStream *js)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 "http://jabber.org/protocol/disco#items");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 xmlnode_set_attrib(iq->node, "to", js->user->domain);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
568 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 xmlnode_set_attrib(iq->node, "to", js->user->domain);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 struct _jabber_disco_info_cb_data *jdicd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 if((jid = jabber_id_new(who))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 jbr = jabber_buddy_find_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 callback(js, who, jbr->capabilities, data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 jdicd = g_new0(struct _jabber_disco_info_cb_data, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 jdicd->data = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 jdicd->callback = callback;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 xmlnode_set_attrib(iq->node, "to", who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599
26680
1df3579a974b Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents: 26678
diff changeset
600 jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
604 static void
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
605 jabber_disco_list_data_destroy(struct jabber_disco_list_data *data)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
606 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
607 g_free(data->server);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
608 g_free(data);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
609 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
610
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
611 static void
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
612 disco_proto_data_destroy_cb(PurpleDiscoList *list)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
613 {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
614 struct jabber_disco_list_data *data;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
615
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
616 data = purple_disco_list_get_protocol_data(list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
617 jabber_disco_list_data_destroy(data);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
618 }
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
619
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
620 static PurpleDiscoServiceType
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
621 jabber_disco_category_from_string(const gchar *str)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
622 {
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
623 if (!g_ascii_strcasecmp(str, "gateway"))
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
624 return PURPLE_DISCO_SERVICE_TYPE_GATEWAY;
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
625 else if (!g_ascii_strcasecmp(str, "directory"))
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
626 return PURPLE_DISCO_SERVICE_TYPE_DIRECTORY;
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
627 else if (!g_ascii_strcasecmp(str, "conference"))
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
628 return PURPLE_DISCO_SERVICE_TYPE_CHAT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
630 return PURPLE_DISCO_SERVICE_TYPE_OTHER;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
631 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
632
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
633 static const gchar *
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
634 jabber_disco_type_from_string(const gchar *str)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
635 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
636 if (!strcasecmp(str, "xmpp"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
637 return "jabber";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
638 else if (!strcasecmp(str, "icq"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
639 return "icq";
26330
f19c214201db 'mrim' is the mail.ru IM service. 'smtp' is an XMPP<>email gateway
Paul Aurich <paul@darkrain42.org>
parents: 26329
diff changeset
640 else if (!strcasecmp(str, "smtp"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
641 return "smtp";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
642 else if (!strcasecmp(str, "yahoo"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
643 return "yahoo";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
644 else if (!strcasecmp(str, "irc"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
645 return "irc";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
646 else if (!strcasecmp(str, "gadu-gadu"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
647 return "gg";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
648 else if (!strcasecmp(str, "aim"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
649 return "aim";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
650 else if (!strcasecmp(str, "qq"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
651 return "qq";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
652 else if (!strcasecmp(str, "msn"))
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
653 return "msn";
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
654
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
655 /* fallback to the string itself */
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
656 return str;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
657 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
658
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
659 static void
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
660 jabber_disco_service_info_cb(JabberStream *js, const char *from,
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
661 JabberIqType type, const char *id,
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
662 xmlnode *packet, gpointer data);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
663
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
664 static void
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
665 jabber_disco_service_items_cb(JabberStream *js, const char *who, const char *node,
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
666 GSList *items, gpointer data)
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
667 {
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
668 GSList *l;
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
669 struct _disco_data *disco_data;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
670 struct jabber_disco_list_data *list_data;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
671 PurpleDiscoList *list;
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
672 PurpleDiscoService *parent;
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
673 const char *parent_node;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
674 gboolean has_items = FALSE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
675
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
676 disco_data = data;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
677 list_data = disco_data->list_data;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
678 list = list_data->list;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
679
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
680 --list_data->fetch_count;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
681
26338
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
682 if (list_data->list == NULL) {
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
683 if (list_data->fetch_count == 0)
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
684 jabber_disco_list_data_destroy(list_data);
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
685
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
686 return;
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
687 }
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
688
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
689 if (items == NULL) {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
690 if (list_data->fetch_count == 0)
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
691 purple_disco_list_set_in_progress(list, FALSE);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
692
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
693 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
694 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
695 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
696
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
697 parent = disco_data->parent;
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
698 parent_node = disco_data->node;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
699
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
700 for (l = items; l; l = l->next) {
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
701 JabberDiscoItem *item = l->data;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
702 JabberIq *iq;
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
703 struct _disco_data *req_data;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
704 char *full_node;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
705
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
706 if (parent_node) {
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
707 if (item->node) {
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
708 full_node = g_strdup_printf("%s/%s", parent_node, item->node);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
709 } else {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
710 continue;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
711 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
712 } else {
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
713 full_node = g_strdup(item->node);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
714 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
715
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
716 req_data = g_new0(struct _disco_data, 1);
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
717 req_data->list_data = list_data;
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
718 req_data->parent = parent;
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
719 req_data->node = full_node;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
720
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
721 has_items = TRUE;
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
722
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
723 ++list_data->fetch_count;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
724 purple_disco_list_ref(list);
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
725
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
726 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
727 xmlnode_set_attrib(iq->node, "to", item->jid);
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
728 if (full_node)
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
729 xmlnode_set_attrib(xmlnode_get_child(iq->node, "query"),
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
730 "node", full_node);
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
731 jabber_iq_set_callback(iq, jabber_disco_service_info_cb, req_data);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
732
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
733 jabber_iq_send(iq);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
734 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
735
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
736 g_slist_foreach(items, (GFunc)jabber_disco_item_free, NULL);
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
737 g_slist_free(items);
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
738
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
739 if (list_data->fetch_count == 0)
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
740 purple_disco_list_set_in_progress(list, FALSE);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
741
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
742 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
743
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
744 g_free(disco_data->node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
745 g_free(disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
746 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
747
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
748 static void
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
749 jabber_disco_service_info_cb(JabberStream *js, const char *from,
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
750 JabberIqType type, const char *id,
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
751 xmlnode *packet, gpointer data)
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
752 {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
753 struct _disco_data *disco_data = data;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
754 struct jabber_disco_list_data *list_data;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
755 PurpleDiscoList *list;
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
756 PurpleDiscoService *parent;
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
757 char *node;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
758 xmlnode *query, *ident, *child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
759 const char *acat, *atype, *adesc, *anode;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
760 char *aname;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
761 PurpleDiscoService *s;
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
762 PurpleDiscoServiceType service_type;
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
763 const char *gateway_type = NULL;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
764 PurpleDiscoServiceFlags flags = PURPLE_DISCO_ADD;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
765
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
766 list_data = disco_data->list_data;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
767 list = list_data->list;
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
768 parent = disco_data->parent;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
769
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
770 node = disco_data->node;
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
771 disco_data->node = NULL;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
772 g_free(disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
773
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
774 --list_data->fetch_count;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
775
26338
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
776 if (list_data->list == NULL) {
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
777 if (list_data->fetch_count == 0)
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
778 jabber_disco_list_data_destroy(list_data);
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
779
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
780 return;
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
781 }
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
782
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
783 if (!from || type == JABBER_IQ_ERROR
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
784 || (!(query = xmlnode_get_child(packet, "query")))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
785 || (!(ident = xmlnode_get_child(query, "identity")))) {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
786 if (list_data->fetch_count == 0)
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
787 purple_disco_list_set_in_progress(list, FALSE);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
788
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
789 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
790 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
791 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
792
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
793 acat = xmlnode_get_attrib(ident, "category");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
794 atype = xmlnode_get_attrib(ident, "type");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
795 adesc = xmlnode_get_attrib(ident, "name");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
796 anode = xmlnode_get_attrib(query, "node");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
797
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
798 if (anode) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
799 aname = g_new0(char, strlen(from) + strlen(anode) + 1);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
800 strcat(aname, from);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
801 strcat(aname, anode);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
802 } else {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
803 aname = g_strdup(from);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
804 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
805
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
806 service_type = jabber_disco_category_from_string(acat);
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
807 if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY)
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
808 gateway_type = jabber_disco_type_from_string(atype);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
809
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
810 for (child = xmlnode_get_child(query, "feature"); child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
811 child = xmlnode_get_next_twin(child)) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
812 const char *var;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
813
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
814 if (!(var = xmlnode_get_attrib(child, "var")))
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
815 continue;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
816
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
817 if (!strcmp(var, "jabber:iq:register"))
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
818 flags |= PURPLE_DISCO_REGISTER;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
819
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
820 if (!strcmp(var, "http://jabber.org/protocol/disco#items"))
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
821 flags |= PURPLE_DISCO_BROWSE;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
822
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
823 if (!strcmp(var, "http://jabber.org/protocol/muc"))
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
824 service_type = PURPLE_DISCO_SERVICE_TYPE_CHAT;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
825 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
826
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
827 purple_debug_info("disco", "service %s, category %s (%d), type %s (%s), description %s, flags %04x\n",
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
828 aname,
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
829 acat, service_type,
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
830 atype, gateway_type ? gateway_type : "(null)",
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
831 adesc, flags);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
832
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
833 s = purple_disco_list_service_new(service_type, aname, adesc, flags);
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
834 if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY)
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
835 purple_disco_service_set_gateway_type(s, gateway_type);
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26341
diff changeset
836
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
837 purple_disco_list_service_add(list, s, parent);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
838
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
839 /* if (flags & PURPLE_DISCO_FLAG_BROWSE) - not all browsable services has this future */
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
840 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
841 ++list_data->fetch_count;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
842 purple_disco_list_ref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
843 disco_data = g_new0(struct _disco_data, 1);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
844 disco_data->list_data = list_data;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
845 disco_data->parent = s;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
846
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
847 jabber_disco_items_do(js, from, node, jabber_disco_service_items_cb,
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
848 disco_data);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
849 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
850
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
851 if (list_data->fetch_count == 0)
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
852 purple_disco_list_set_in_progress(list, FALSE);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
853
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
854 purple_disco_list_unref(list);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
855
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
856 g_free(aname);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
857 g_free(node);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
858 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
859
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
860 static void
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
861 jabber_disco_server_items_cb(JabberStream *js, const char *from,
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
862 JabberIqType type, const char *id,
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
863 xmlnode *packet, gpointer data)
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
864 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
865 struct jabber_disco_list_data *list_data;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
866 xmlnode *query, *child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
867 gboolean has_items = FALSE;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
868
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
869 if (!from || type == JABBER_IQ_ERROR)
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
870 return;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
871
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
872 list_data = data;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
873 --list_data->fetch_count;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
874
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
875 if (list_data->list == NULL) {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
876 if (list_data->fetch_count == 0)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
877 jabber_disco_list_data_destroy(list_data);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
878
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
879 return;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
880 }
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
881
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
882 query = xmlnode_get_child(packet, "query");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
883
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
884 for(child = xmlnode_get_child(query, "item"); child;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
885 child = xmlnode_get_next_twin(child)) {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
886 JabberIq *iq;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
887 const char *jid;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
888 struct _disco_data *disco_data;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
889
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
890 if(!(jid = xmlnode_get_attrib(child, "jid")))
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
891 continue;
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
892
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
893 disco_data = g_new0(struct _disco_data, 1);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
894 disco_data->list_data = list_data;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
895
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
896 has_items = TRUE;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
897 ++list_data->fetch_count;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
898 purple_disco_list_ref(list_data->list);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
899 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
900 xmlnode_set_attrib(iq->node, "to", jid);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
901 jabber_iq_set_callback(iq, jabber_disco_service_info_cb, disco_data);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
902
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
903 jabber_iq_send(iq);
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
904 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
905
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
906 if (!has_items)
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
907 purple_disco_list_set_in_progress(list_data->list, FALSE);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
908
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
909 purple_disco_list_unref(list_data->list);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
910 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
911
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
912 static void
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
913 jabber_disco_server_info_cb(JabberStream *js, const char *who, JabberCapabilities caps, gpointer data)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
914 {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
915 struct jabber_disco_list_data *list_data;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
916
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
917 list_data = data;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
918 --list_data->fetch_count;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
919
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
920 if (!list_data->list) {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
921 purple_disco_list_unref(list_data->list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
922
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
923 if (list_data->fetch_count == 0)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
924 jabber_disco_list_data_destroy(list_data);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
925
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
926 return;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
927 }
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
928
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
929 if (caps & JABBER_CAP_ITEMS) {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
930 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
931 xmlnode_set_attrib(iq->node, "to", who);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
932 jabber_iq_set_callback(iq, jabber_disco_server_items_cb, list_data);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
933
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
934 ++list_data->fetch_count;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
935 purple_disco_list_ref(list_data->list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
936
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
937 jabber_iq_send(iq);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
938 } else {
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
939 purple_notify_error(NULL, _("Error"), _("Server doesn't support service discovery"), NULL);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
940 purple_disco_list_set_in_progress(list_data->list, FALSE);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
941 }
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
942
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
943 purple_disco_list_unref(list_data->list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
944 }
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
945
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
946 static void discolist_cancel_cb(struct jabber_disco_list_data *list_data, const char *server)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
947 {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
948 purple_disco_list_set_in_progress(list_data->list, FALSE);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
949 purple_disco_list_unref(list_data->list);
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
950 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
951
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
952 static void discolist_ok_cb(struct jabber_disco_list_data *list_data, const char *server)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
953 {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
954 JabberStream *js;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
955
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
956 js = list_data->js;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
957
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
958 if (!server || !*server) {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
959 purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
960
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
961 purple_disco_list_set_in_progress(list_data->list, FALSE);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
962 purple_disco_list_unref(list_data->list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
963 return;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
964 }
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
965
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
966 list_data->server = g_strdup(server);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
967 if (js->last_disco_server)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
968 g_free(js->last_disco_server);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
969 js->last_disco_server = g_strdup(server);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
970
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
971 purple_disco_list_set_in_progress(list_data->list, TRUE);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
972
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
973 ++list_data->fetch_count;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
974 jabber_disco_info_do(js, list_data->server, jabber_disco_server_info_cb, list_data);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
975 }
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
976
26678
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
977 static void
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
978 jabber_disco_cancel(PurpleDiscoList *list)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
979 {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
980 struct jabber_disco_list_data *list_data = purple_disco_list_get_protocol_data(list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
981 purple_disco_list_set_protocol_data(list, NULL, NULL);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
982
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
983 if (list_data->fetch_count == 0) {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
984 /* Nothing outstanding, just free it now... */
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
985 jabber_disco_list_data_destroy(list_data);
26338
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
986 } else {
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
987 int i;
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
988 /* Lose all our references to the PurpleDiscoList */
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
989 for (i = 0; i < list_data->fetch_count; ++i) {
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
990 purple_disco_list_unref(list);
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
991 }
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
992
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
993 /* We'll free list_data when fetch_count is down to 0 */
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26335
diff changeset
994 list_data->list = NULL;
26338
cda9031ecabc Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <paul@darkrain42.org>
parents: 26337
diff changeset
995 }
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
996 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
997
26678
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
998 static void
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
999 jabber_disco_service_register(PurpleConnection *gc, PurpleDiscoService *service)
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
1000 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
1001 JabberStream *js = purple_connection_get_protocol_data(gc);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
1002
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
1003 jabber_register_gateway(js, purple_disco_service_get_name(service));
26678
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1004 }
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
1005
26678
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1006
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1007 PurpleDiscoList *
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1008 jabber_disco_get_list(PurpleConnection *gc)
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1009 {
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1010 PurpleAccount *account;
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1011 PurpleDiscoList *list;
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1012 JabberStream *js;
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1013 struct jabber_disco_list_data *disco_list_data;
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1014
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1015 account = purple_connection_get_account(gc);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1016 js = purple_connection_get_protocol_data(gc);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1017
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1018 /* We start with a ref */
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1019 list = purple_disco_list_new(account);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1020
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1021 disco_list_data = g_new0(struct jabber_disco_list_data, 1);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1022 disco_list_data->list = list;
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1023 disco_list_data->js = js;
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1024 purple_disco_list_set_protocol_data(list, disco_list_data, disco_proto_data_destroy_cb);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1025 purple_disco_list_set_cancel_func(list, jabber_disco_cancel);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1026 purple_disco_list_set_register_func(list, jabber_disco_service_register);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1027
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1028 purple_request_input(gc, _("Server name request"), _("Enter an XMPP Server"),
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1029 _("Select an XMPP server to query"),
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1030 js->last_disco_server ? js->last_disco_server : js->user->domain,
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1031 FALSE, FALSE, NULL,
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1032 _("Find Services"), PURPLE_CALLBACK(discolist_ok_cb),
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1033 _("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb),
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1034 account, NULL, NULL, disco_list_data);
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1035
1de01f9594c8 Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <paul@darkrain42.org>
parents: 26677
diff changeset
1036 return list;
26329
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
1037 }
f5e613e05332 Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents: 25443
diff changeset
1038
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1039 static void
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
1040 jabber_disco_items_cb(JabberStream *js, const char *from, JabberIqType type,
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
1041 const char *id, xmlnode *packet, gpointer data)
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1042 {
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1043 struct _jabber_disco_items_cb_data *jdicd;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1044 xmlnode *query, *child;
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1045 const char *node = NULL;
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1046 GSList *items = NULL;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1047
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1048 jdicd = data;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1049
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1050 query = xmlnode_get_child(packet, "query");
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1051
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1052 if (query)
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1053 node = xmlnode_get_attrib(query, "node");
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1054
26677
30221bc3da0e Fix merge (convert to IQ-handlers syntax)
Paul Aurich <paul@darkrain42.org>
parents: 26675
diff changeset
1055 if (!from || !query || type == JABBER_IQ_ERROR) {
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1056 jdicd->callback(js, from, node, NULL, jdicd->data);
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1057 g_free(jdicd);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1058 return;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1059 }
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1060
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1061 for (child = xmlnode_get_child(query, "item"); child;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1062 child = xmlnode_get_next_twin(child)) {
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1063 JabberDiscoItem *item;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1064
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1065 item = g_new0(JabberDiscoItem, 1);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1066 item->jid = g_strdup(xmlnode_get_attrib(child, "jid"));
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1067 item->node = g_strdup(xmlnode_get_attrib(child, "node"));
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1068 item->name = g_strdup(xmlnode_get_attrib(child, "name"));
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1069
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1070 items = g_slist_prepend(items, item);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1071 }
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1072
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1073 items = g_slist_reverse(items);
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1074 jdicd->callback(js, from, node, items, jdicd->data);
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1075 g_free(jdicd);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1076 }
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1077
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1078 void jabber_disco_items_do(JabberStream *js, const char *who, const char *node,
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1079 JabberDiscoItemsCallback *callback, gpointer data)
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1080 {
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1081 struct _jabber_disco_items_cb_data *jdicd;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1082 JabberIq *iq;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1083
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1084 jdicd = g_new0(struct _jabber_disco_items_cb_data, 1);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1085 jdicd->data = data;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1086 jdicd->callback = callback;
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1087
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1088 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
26341
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1089 if (node)
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1090 xmlnode_set_attrib(xmlnode_get_child(iq->node, "query"), "node", node);
9d0bad6f4b0d Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <paul@darkrain42.org>
parents: 26340
diff changeset
1091
26340
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1092 xmlnode_set_attrib(iq->node, "to", who);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1093
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1094 jabber_iq_set_callback(iq, jabber_disco_items_cb, jdicd);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1095 jabber_iq_send(iq);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1096 }
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1097
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1098 void jabber_disco_item_free(JabberDiscoItem *item)
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1099 {
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1100 g_free((char *)item->jid);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1101 g_free((char *)item->node);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1102 g_free((char *)item->name);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1103 g_free(item);
b5fe3f47487b jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents: 26339
diff changeset
1104 }