annotate libpurple/protocols/jabber/disco.c @ 27079:72bcdcb0629f

Add Gmail video support. Thanks to Eion for all his testing help.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 02 Jun 2009 05:00:20 +0000
parents 47d03538ee3f
children b709ab0cb4bc
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 /*
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15661
diff changeset
2 * purple - Jabber Protocol Plugin
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"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
25817
9195955395b6 Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents: 24820
diff changeset
26 #include "adhoccommands.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "buddy.h"
25817
9195955395b6 Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents: 24820
diff changeset
28 #include "disco.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "google.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "iq.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "jabber.h"
26014
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25718
diff changeset
32 #include "jingle/jingle.h"
25817
9195955395b6 Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents: 24820
diff changeset
33 #include "pep.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "presence.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "roster.h"
25817
9195955395b6 Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents: 24820
diff changeset
36 #include "useravatar.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 struct _jabber_disco_info_cb_data {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 gpointer data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 JabberDiscoInfoCallback *callback;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
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
43 #define SUPPORT_FEATURE(x) { \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 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
45 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
46 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47
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
48 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
49 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
50 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
51 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
52 {
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
53 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
54 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
55 "http://jabber.org/protocol/bytestreams");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
56
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
57 if (from && !strcmp(from, sh->jid) && query != NULL) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
58 xmlnode *sh_node = xmlnode_get_child(query, "streamhost");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
59 if (sh_node) {
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
60 const char *jid = xmlnode_get_attrib(sh_node, "jid");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
61 const char *port = xmlnode_get_attrib(sh_node, "port");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
62
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
63
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
64 if (jid == NULL || strcmp(jid, from) != 0)
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
65 purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
66 jid ? jid : "(null)");
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
67
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
68 sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host"));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
69 sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf"));
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
70 if (port != NULL)
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
71 sh->port = atoi(port);
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
72 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
73 }
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
74
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
75 purple_debug_info("jabber", "Discovered bytestream proxy server: "
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
76 "jid='%s' host='%s' port='%d' zeroconf='%s'\n",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
77 from ? from : "", sh->host ? sh->host : "",
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
78 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
79
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
80 /* TODO: When we support zeroconf proxies, fix this to handle them */
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
81 if (!(sh->jid && sh->host && sh->port > 0)) {
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
82 g_free(sh->jid);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
83 g_free(sh->host);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
84 g_free(sh->zeroconf);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
85 g_free(sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
86 js->bs_proxies = g_list_remove(js->bs_proxies, sh);
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
87 }
21603
a4b6854737d5 Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents: 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
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
91 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
92 JabberIqType type, const char *id,
26569
bc7fac8e2f79 propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
parents: 26539 26552
diff changeset
93 xmlnode *in_query)
bc7fac8e2f79 propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
parents: 26539 26552
diff changeset
94 {
26434
e23a74d7c97c Get rid of the rest of the extraneous changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26213
diff changeset
95
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
96 if(!from)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
99 if(type == JABBER_IQ_GET) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 xmlnode *query, *identity, *feature;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 JabberIq *iq;
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
102 const char *node = xmlnode_get_attrib(in_query, "node");
26569
bc7fac8e2f79 propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
parents: 26539 26552
diff changeset
103 char *node_uri = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
105 /* create custom caps node URI */
25742
4040da08a733 Entity Capabilities must be per-JabberStream
Paul Aurich <paul@darkrain42.org>
parents: 25741
diff changeset
106 node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 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
109 "http://jabber.org/protocol/disco#info");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
111 jabber_iq_set_id(iq, id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 xmlnode_set_attrib(iq->node, "to", from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 query = xmlnode_get_child(iq->node, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 if(node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 xmlnode_set_attrib(query, "node", node);
26434
e23a74d7c97c Get rid of the rest of the extraneous changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26213
diff changeset
118
26849
47d03538ee3f Fix a bad merge (*sigh*)
Paul Aurich <paul@darkrain42.org>
parents: 26817
diff changeset
119 if(!node || g_str_equal(node, node_uri)) {
25741
1225f3dcf5ab Fix compilation errors and many warnings
Paul Aurich <paul@darkrain42.org>
parents: 25716
diff changeset
120 GList *features, *identities;
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
121 for(identities = jabber_identities; identities; identities = identities->next) {
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
122 JabberIdentity *ident = (JabberIdentity*)identities->data;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
123 identity = xmlnode_new_child(query, "identity");
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
124 xmlnode_set_attrib(identity, "category", ident->category);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
125 xmlnode_set_attrib(identity, "type", ident->type);
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
126 if (ident->lang)
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
127 xmlnode_set_attrib(identity, "xml:lang", ident->lang);
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
128 if (ident->name)
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
129 xmlnode_set_attrib(identity, "name", ident->name);
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
130 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
131 for(features = jabber_features; features; features = features->next) {
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
132 JabberFeature *feat = (JabberFeature*)features->data;
25760
f462fa160f06 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
133 if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) {
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
134 feature = xmlnode_new_child(query, "feature");
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
135 xmlnode_set_attrib(feature, "var", 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
136 }
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
137 }
25664
d0ac3c438b71 Check remote JID's capabilities for audio and video XEP support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25637
diff changeset
138 #ifdef USE_VV
26539
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
139 } else if (g_str_equal(node, CAPS0115_NODE "#" "voice-v1")) {
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
140 /*
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
141 * HUGE HACK! We advertise this ext (see jabber_presence_create_js
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
142 * where we add <c/> to the <presence/>) for the Google Talk
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
143 * clients that don't actually check disco#info features.
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
144 *
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
145 * This specific feature is redundant but is what
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
146 * node='http://mail.google.com/xmpp/client/caps', ver='1.1'
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
147 * advertises as 'voice-v1'.
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
148 */
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
149 xmlnode *feature = xmlnode_new_child(query, "feature");
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26529
diff changeset
150 xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/voice/v1");
27079
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
151 } else if (g_str_equal(node, CAPS0115_NODE "#" "video-v1")) {
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
152 /*
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
153 * HUGE HACK! We advertise this ext (see jabber_presence_create_js
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
154 * where we add <c/> to the <presence/>) for the Google Talk
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
155 * clients that don't actually check disco#info features.
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
156 *
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
157 * This specific feature is redundant but is what
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
158 * node='http://mail.google.com/xmpp/client/caps', ver='1.1'
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
159 * advertises as 'video-v1'.
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
160 */
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
161 xmlnode *feature = xmlnode_new_child(query, "feature");
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26849
diff changeset
162 xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/video/v1");
25664
d0ac3c438b71 Check remote JID's capabilities for audio and video XEP support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25637
diff changeset
163 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 } else {
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
165 xmlnode *error, *inf;
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
166
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
167 /* XXX: gross hack, implement jabber_iq_set_type or something */
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
168 xmlnode_set_attrib(iq->node, "type", "error");
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
169 iq->type = JABBER_IQ_ERROR;
19489
b0733d5d7621 Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18685
diff changeset
170
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
171 error = xmlnode_new_child(query, "error");
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
172 xmlnode_set_attrib(error, "code", "404");
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
173 xmlnode_set_attrib(error, "type", "cancel");
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
174 inf = xmlnode_new_child(error, "item-not-found");
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
175 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 }
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21603
diff changeset
177 g_free(node_uri);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 jabber_iq_send(iq);
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
179 } else if(type == JABBER_IQ_RESULT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 JabberCapabilities capabilities = JABBER_CAP_NONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 struct _jabber_disco_info_cb_data *jdicd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 if((jid = jabber_id_new(from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 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
189 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
190 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 capabilities = jbr->capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
196 for(child = in_query->child; child; child = child->next) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 if(child->type != XMLNODE_TYPE_TAG)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 if(!strcmp(child->name, "identity")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 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
202 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
203 if(!category || !type)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 if(!strcmp(category, "conference") && !strcmp(type, "text")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 /* 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
208 /* 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
209 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
210 } 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
211 /* 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
212 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
213 } 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
214 /* 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
215 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
216 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
217
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
218 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
219
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
220 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
221 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
222 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
223
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
224 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
225 "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
226 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
227 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
228 jabber_iq_send(iq);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 } else if(!strcmp(child->name, "feature")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 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
233 if(!var)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 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
237 capabilities |= JABBER_CAP_SI;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 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
239 capabilities |= JABBER_CAP_SI_FILE_XFER;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 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
241 capabilities |= JABBER_CAP_BYTESTREAMS;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 else if(!strcmp(var, "jabber:iq:search"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 capabilities |= JABBER_CAP_IQ_SEARCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 else if(!strcmp(var, "jabber:iq:register"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 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
246 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
247 capabilities |= JABBER_CAP_PING;
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
248 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
249 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
250 }
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23645
diff changeset
251 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
252 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
253 capabilities |= JABBER_CAP_IBB;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents: 23645
diff changeset
254 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 capabilities |= JABBER_CAP_RETRIEVED;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 jbr->capabilities = capabilities;
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 if((jdicd = g_hash_table_lookup(js->disco_callbacks, from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 jdicd->callback(js, from, capabilities, jdicd->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 g_hash_table_remove(js->disco_callbacks, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 }
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
267 } else if(type == JABBER_IQ_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 JabberCapabilities capabilities = JABBER_CAP_NONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 struct _jabber_disco_info_cb_data *jdicd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 if(!(jdicd = g_hash_table_lookup(js->disco_callbacks, from)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 return;
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((jid = jabber_id_new(from))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 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
279 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
280 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 if(jbr)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 capabilities = jbr->capabilities;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 jdicd->callback(js, from, capabilities, jdicd->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 g_hash_table_remove(js->disco_callbacks, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
291 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
292 JabberIqType type, const char *id,
26569
bc7fac8e2f79 propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
parents: 26539 26552
diff changeset
293 xmlnode *query)
bc7fac8e2f79 propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
parents: 26539 26552
diff changeset
294 {
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
295 if(type == JABBER_IQ_GET) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 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
297 "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
298
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
299 /* preserve node */
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
300 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
301 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
302 if(node)
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
303 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
304
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
305 jabber_iq_set_id(iq, id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
307 if (from)
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25923
diff changeset
308 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
309 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 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
315 {
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
316 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
317
25831
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 25817
diff changeset
318 /*
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 25817
diff changeset
319 * This *should* happen only if the server supports vcard-temp, but there
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 25817
diff changeset
320 * are apparently some servers that don't advertise it even though they
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 25817
diff changeset
321 * support it.
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 25817
diff changeset
322 */
18163
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
323 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
324
25817
9195955395b6 Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents: 24820
diff changeset
325 if (js->pep)
9195955395b6 Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents: 24820
diff changeset
326 jabber_avatar_fetch_mine(js);
18163
703872bf33c6 server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents: 18153
diff changeset
327
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 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
329 /* 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
330 jabber_roster_request(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 }
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
332
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
333 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
334 /* 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
335 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
336 }
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
337
24820
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
338 /* 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
339 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
340 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
341 }
0700833f0c5d Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents: 23645
diff changeset
342
23645
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
343 /* 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
344 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
345 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
346 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
347 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
348 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
349 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
350 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
351
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
352 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
353 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
354 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
355 continue;
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
356
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
357 /* 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
358 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
359 *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
360
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
361 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
362 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
363 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
364
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
365 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
366 "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
367 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
368 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
369 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
370 }
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
371
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
372 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
373 }
10382f1e1353 Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21603
diff changeset
374
15374
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
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
378 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
379 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
380 xmlnode *packet, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 {
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
382 xmlnode *query, *child;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383
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
384 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
385 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
386 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388
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
389 if (type == JABBER_IQ_ERROR) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 /* 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
391 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
392 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 query = xmlnode_get_child(packet, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 if (!query) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 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
399 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
402 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
403 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 const char *category, *type, *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 category = xmlnode_get_attrib(child, "category");
17561
a75079eae085 added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents: 17440
diff changeset
406 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
407 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
408 js->pep = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 if (!category || strcmp(category, "server"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 if (!type || strcmp(type, "im"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 continue;
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
413
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 name = xmlnode_get_attrib(child, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 g_free(js->server_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 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
420 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
421 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
422 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
423
88f183f7dfc7 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents: 26062
diff changeset
424 /* 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
425 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
426 } else {
88f183f7dfc7 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents: 26062
diff changeset
427 /* TODO: add external service discovery here... */
26434
e23a74d7c97c Get rid of the rest of the extraneous changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26213
diff changeset
428 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
17438
48aebb50a93d whitespace
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
431 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
432 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 const char *var;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 var = xmlnode_get_attrib(child, "var");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 if (!var)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 if (!strcmp("google:mail:notify", var)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 js->server_caps |= JABBER_CAP_GMAIL_NOTIFY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 jabber_gmail_init(js);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 } else if (!strcmp("google:roster", var)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 js->server_caps |= JABBER_CAP_GOOGLE_ROSTER;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 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
444 } 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
445 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
446 } 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
447 js->server_caps |= JABBER_CAP_BLOCKING;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 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
452 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 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
455 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
456 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
457 xmlnode *packet, gpointer data)
15374
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 xmlnode *query, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460
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
461 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
462 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463
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
464 if (type == JABBER_IQ_ERROR)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 while(js->chat_servers) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 g_free(js->chat_servers->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 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
470 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 query = xmlnode_get_child(packet, "query");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 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
475 child = xmlnode_get_next_twin(child)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 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
477 const char *jid, *node;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 if(!(jid = xmlnode_get_attrib(child, "jid")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481
17440
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
482 /* 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
483 * 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
484 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
485 continue;
d42de194a364 skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents: 17438
diff changeset
486
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 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
488 xmlnode_set_attrib(iq->node, "to", jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 void jabber_disco_items_server(JabberStream *js)
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 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
496 "http://jabber.org/protocol/disco#items");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 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
499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 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
501 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502
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
503 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
504 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
505 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
506 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 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
510 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 JabberBuddyResource *jbr = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 struct _jabber_disco_info_cb_data *jdicd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 if((jid = jabber_id_new(who))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 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
519 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
520 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 callback(js, who, jbr->capabilities, data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 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
529 jdicd->data = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 jdicd->callback = callback;
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 g_hash_table_insert(js->disco_callbacks, g_strdup(who), jdicd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 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
535 xmlnode_set_attrib(iq->node, "to", who);
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 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 }