Mercurial > pidgin
annotate libpurple/protocols/jabber/disco.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 2ec94166be43 |
children |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
26247
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25952
diff
changeset
|
2 * purple - Jabber Service Discovery |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
28048
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27914
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27914
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27914
diff
changeset
|
6 * source distribution. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * 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
|
9 * 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
|
10 * 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
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * 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
|
14 * 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
|
15 * 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
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * 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
|
19 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19654
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
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 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "internal.h" |
28925
4f3a9ddfa34e
jabber: Only make the SRV lookup for STUN based on the domain if no STUN
Marcus Lundblad <ml@update.uu.se>
parents:
28767
diff
changeset
|
25 #include "network.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "debug.h" |
26971 | 28 #include "request.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
24855
diff
changeset
|
30 #include "adhoccommands.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "buddy.h" |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
24855
diff
changeset
|
32 #include "disco.h" |
30472
ae615b3d3e47
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <ml@update.uu.se>
parents:
29529
diff
changeset
|
33 #include "google/google.h" |
ae615b3d3e47
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <ml@update.uu.se>
parents:
29529
diff
changeset
|
34 #include "google/gmail.h" |
ae615b3d3e47
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <ml@update.uu.se>
parents:
29529
diff
changeset
|
35 #include "google/jingleinfo.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "jabber.h" |
24938
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23867
diff
changeset
|
38 #include "jingle/jingle.h" |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
24855
diff
changeset
|
39 #include "pep.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "presence.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "roster.h" |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
24855
diff
changeset
|
42 #include "useravatar.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 struct _jabber_disco_info_cb_data { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 gpointer data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 JabberDiscoInfoCallback *callback; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
26258
b5fe3f47487b
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents:
26257
diff
changeset
|
49 struct _jabber_disco_items_cb_data { |
b5fe3f47487b
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents:
26257
diff
changeset
|
50 gpointer data; |
b5fe3f47487b
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents:
26257
diff
changeset
|
51 JabberDiscoItemsCallback *callback; |
b5fe3f47487b
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents:
26257
diff
changeset
|
52 }; |
b5fe3f47487b
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <paul@darkrain42.org>
parents:
26257
diff
changeset
|
53 |
17849
e49b259fc7dd
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17839
diff
changeset
|
54 #define SUPPORT_FEATURE(x) { \ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 feature = xmlnode_new_child(query, "feature"); \ |
17849
e49b259fc7dd
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17839
diff
changeset
|
56 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:
17839
diff
changeset
|
57 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 |
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:
19697
diff
changeset
|
59 static void |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
60 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:
25979
diff
changeset
|
61 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:
25979
diff
changeset
|
62 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:
25979
diff
changeset
|
63 { |
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:
19697
diff
changeset
|
64 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:
19697
diff
changeset
|
65 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
66 NS_BYTESTREAMS); |
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:
19697
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:
19697
diff
changeset
|
68 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:
19697
diff
changeset
|
69 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:
19697
diff
changeset
|
70 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:
19697
diff
changeset
|
71 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:
19697
diff
changeset
|
72 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:
19697
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:
19697
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:
19697
diff
changeset
|
75 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:
19697
diff
changeset
|
76 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:
19697
diff
changeset
|
77 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:
19697
diff
changeset
|
78 |
a4b6854737d5
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19697
diff
changeset
|
79 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:
19697
diff
changeset
|
80 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:
19697
diff
changeset
|
81 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:
19697
diff
changeset
|
82 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:
19697
diff
changeset
|
83 } |
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:
19697
diff
changeset
|
84 } |
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:
19697
diff
changeset
|
85 |
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:
19697
diff
changeset
|
86 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:
19697
diff
changeset
|
87 "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:
19697
diff
changeset
|
88 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:
19697
diff
changeset
|
89 sh->port, sh->zeroconf ? sh->zeroconf : ""); |
23600
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
90 |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
91 /* 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
|
92 if (!(sh->jid && sh->host && sh->port > 0)) { |
27800
deecc1d663c4
Don't use pointers (even opaquely) once they're freed. Closes #9822.
Paul Aurich <paul@darkrain42.org>
parents:
27776
diff
changeset
|
93 js->bs_proxies = g_list_remove(js->bs_proxies, sh); |
23600
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
94 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
|
95 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
|
96 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
|
97 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
|
98 } |
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:
19697
diff
changeset
|
99 } |
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:
19697
diff
changeset
|
100 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
102 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:
25638
diff
changeset
|
103 JabberIqType type, const char *id, |
26487
bc7fac8e2f79
propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
104 xmlnode *in_query) |
bc7fac8e2f79
propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
105 { |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
106 if(type == JABBER_IQ_GET) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 xmlnode *query, *identity, *feature; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 JabberIq *iq; |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
109 const char *node = xmlnode_get_attrib(in_query, "node"); |
26487
bc7fac8e2f79
propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
110 char *node_uri = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 |
25164
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25147
diff
changeset
|
112 /* create custom caps node URI */ |
25146
4040da08a733
Entity Capabilities must be per-JabberStream
Paul Aurich <paul@darkrain42.org>
parents:
25145
diff
changeset
|
113 node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
115 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_INFO); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
117 jabber_iq_set_id(iq, id); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
27776
cbbde19ce02d
jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <paul@darkrain42.org>
parents:
27742
diff
changeset
|
119 if (from) |
cbbde19ce02d
jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <paul@darkrain42.org>
parents:
27742
diff
changeset
|
120 xmlnode_set_attrib(iq->node, "to", from); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 if(node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 xmlnode_set_attrib(query, "node", node); |
26352
e23a74d7c97c
Get rid of the rest of the extraneous changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
125 |
27054
dd7e7071d46d
Whitespace + a change cluttering up the diff with im.pidgin.pidgin
Paul Aurich <paul@darkrain42.org>
parents:
27053
diff
changeset
|
126 if(!node || g_str_equal(node, node_uri)) { |
25145
1225f3dcf5ab
Fix compilation errors and many warnings
Paul Aurich <paul@darkrain42.org>
parents:
25124
diff
changeset
|
127 GList *features, *identities; |
25017
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
128 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
|
129 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
|
130 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
|
131 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
|
132 xmlnode_set_attrib(identity, "type", ident->type); |
25164
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25147
diff
changeset
|
133 if (ident->lang) |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25147
diff
changeset
|
134 xmlnode_set_attrib(identity, "xml:lang", ident->lang); |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25147
diff
changeset
|
135 if (ident->name) |
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25147
diff
changeset
|
136 xmlnode_set_attrib(identity, "name", ident->name); |
25017
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
137 } |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
138 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
|
139 JabberFeature *feat = (JabberFeature*)features->data; |
25164
f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <paul@darkrain42.org>
parents:
25147
diff
changeset
|
140 if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { |
25017
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
141 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
|
142 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
|
143 } |
b0733d5d7621
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18685
diff
changeset
|
144 } |
23814
d0ac3c438b71
Check remote JID's capabilities for audio and video XEP support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23787
diff
changeset
|
145 #ifdef USE_VV |
26457
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26447
diff
changeset
|
146 } 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:
26447
diff
changeset
|
147 /* |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26447
diff
changeset
|
148 * 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:
26447
diff
changeset
|
149 * 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:
26447
diff
changeset
|
150 * 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:
26447
diff
changeset
|
151 * |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26447
diff
changeset
|
152 * 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:
26447
diff
changeset
|
153 * 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:
26447
diff
changeset
|
154 * advertises as 'voice-v1'. |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26447
diff
changeset
|
155 */ |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26447
diff
changeset
|
156 xmlnode *feature = xmlnode_new_child(query, "feature"); |
28645
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28494
diff
changeset
|
157 xmlnode_set_attrib(feature, "var", NS_GOOGLE_VOICE); |
26997
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
158 } else if (g_str_equal(node, CAPS0115_NODE "#" "video-v1")) { |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
159 /* |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
160 * HUGE HACK! We advertise this ext (see jabber_presence_create_js |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
161 * where we add <c/> to the <presence/>) for the Google Talk |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
162 * clients that don't actually check disco#info features. |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
163 * |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
164 * This specific feature is redundant but is what |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
165 * node='http://mail.google.com/xmpp/client/caps', ver='1.1' |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
166 * advertises as 'video-v1'. |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
167 */ |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26767
diff
changeset
|
168 xmlnode *feature = xmlnode_new_child(query, "feature"); |
28645
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28494
diff
changeset
|
169 xmlnode_set_attrib(feature, "var", NS_GOOGLE_VIDEO); |
27742
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
170 } else if (g_str_equal(node, CAPS0115_NODE "#" "camera-v1")) { |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
171 /* |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
172 * HUGE HACK! We advertise this ext (see jabber_presence_create_js |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
173 * where we add <c/> to the <presence/>) for the Google Talk |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
174 * clients that don't actually check disco#info features. |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
175 * |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
176 * This specific feature is redundant but is what |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
177 * node='http://mail.google.com/xmpp/client/caps', ver='1.1' |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
178 * advertises as 'camera-v1'. |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
179 */ |
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27540
diff
changeset
|
180 xmlnode *feature = xmlnode_new_child(query, "feature"); |
28645
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28494
diff
changeset
|
181 xmlnode_set_attrib(feature, "var", NS_GOOGLE_CAMERA); |
23814
d0ac3c438b71
Check remote JID's capabilities for audio and video XEP support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23787
diff
changeset
|
182 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 } else { |
25017
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
184 xmlnode *error, *inf; |
26970
413006df9828
propagate from branch 'im.pidgin.pidgin' (head 13ac492a493b4d31c8b29905174b43a533304300)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
185 |
25017
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
186 /* 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
|
187 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
|
188 iq->type = JABBER_IQ_ERROR; |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25762
diff
changeset
|
189 |
25017
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 inf = xmlnode_new_child(error, "item-not-found"); |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
194 xmlnode_set_namespace(inf, NS_XMPP_STANZAS); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 } |
25017
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21603
diff
changeset
|
196 g_free(node_uri); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 jabber_iq_send(iq); |
26598
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
198 } else if (type == JABBER_IQ_SET) { |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
199 /* wtf? seriously. wtf‽ */ |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
200 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
201 xmlnode *error, *bad_request; |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
202 |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
203 /* Free the <query/> */ |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
204 xmlnode_free(xmlnode_get_child(iq->node, "query")); |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
205 /* Add an error */ |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
206 error = xmlnode_new_child(iq->node, "error"); |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
207 xmlnode_set_attrib(error, "type", "modify"); |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
208 bad_request = xmlnode_new_child(error, "bad-request"); |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
209 xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS); |
26598
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
210 |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
211 jabber_iq_set_id(iq, id); |
27776
cbbde19ce02d
jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <paul@darkrain42.org>
parents:
27742
diff
changeset
|
212 if (from) |
cbbde19ce02d
jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <paul@darkrain42.org>
parents:
27742
diff
changeset
|
213 xmlnode_set_attrib(iq->node, "to", from); |
26598
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
214 |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
215 jabber_iq_send(iq); |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
216 } |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
217 } |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
218 |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
219 static void jabber_disco_info_cb(JabberStream *js, const char *from, |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
220 JabberIqType type, const char *id, |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
221 xmlnode *packet, gpointer data) |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
222 { |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
223 struct _jabber_disco_info_cb_data *jdicd = data; |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
224 xmlnode *query; |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
225 |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
226 query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO); |
26598
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
227 |
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
228 if (type == JABBER_IQ_RESULT && query) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 JabberBuddyResource *jbr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 JabberCapabilities capabilities = JABBER_CAP_NONE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 if((jid = jabber_id_new(from))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 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
|
237 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
|
238 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 if(jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 capabilities = jbr->capabilities; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
26598
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
244 for(child = query->child; child; child = child->next) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 if(child->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 if(!strcmp(child->name, "identity")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 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
|
250 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
|
251 if(!category || !type) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 if(!strcmp(category, "conference") && !strcmp(type, "text")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 /* 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
|
256 /* 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:
19697
diff
changeset
|
257 js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 } 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
|
259 /* 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:
19697
diff
changeset
|
260 js->user_directories = g_list_prepend(js->user_directories, g_strdup(from)); |
30548
3b6106598b13
jabber: Fix picking up bytestream proxies advertised by the server
Paul Aurich <paul@darkrain42.org>
parents:
30544
diff
changeset
|
261 } else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) { |
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:
19697
diff
changeset
|
262 /* 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:
19697
diff
changeset
|
263 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:
19697
diff
changeset
|
264 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:
19697
diff
changeset
|
265 |
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:
19697
diff
changeset
|
266 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:
19697
diff
changeset
|
267 |
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:
19697
diff
changeset
|
268 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:
19697
diff
changeset
|
269 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:
19697
diff
changeset
|
270 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:
19697
diff
changeset
|
271 |
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:
19697
diff
changeset
|
272 iq = jabber_iq_new_query(js, JABBER_IQ_GET, |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
273 NS_BYTESTREAMS); |
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:
19697
diff
changeset
|
274 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:
19697
diff
changeset
|
275 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:
19697
diff
changeset
|
276 jabber_iq_send(iq); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 } else if(!strcmp(child->name, "feature")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 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
|
281 if(!var) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 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
|
285 capabilities |= JABBER_CAP_SI; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 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
|
287 capabilities |= JABBER_CAP_SI_FILE_XFER; |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
288 else if(!strcmp(var, NS_BYTESTREAMS)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 capabilities |= JABBER_CAP_BYTESTREAMS; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 else if(!strcmp(var, "jabber:iq:search")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 capabilities |= JABBER_CAP_IQ_SEARCH; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 else if(!strcmp(var, "jabber:iq:register")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 capabilities |= JABBER_CAP_IQ_REGISTER; |
28645
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28494
diff
changeset
|
294 else if(!strcmp(var, NS_PING)) |
17835
6ab1089e2101
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <pidgin@monitzer.com>
parents:
17834
diff
changeset
|
295 capabilities |= JABBER_CAP_PING; |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
296 else if(!strcmp(var, NS_DISCO_ITEMS)) |
26247
f5e613e05332
Applied disco-2.patch from nops with some modifications:
Paul Aurich <paul@darkrain42.org>
parents:
25952
diff
changeset
|
297 capabilities |= JABBER_CAP_ITEMS; |
17882
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:
17849
diff
changeset
|
298 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:
17849
diff
changeset
|
299 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:
17849
diff
changeset
|
300 } |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
301 else if(!strcmp(var, NS_IBB)) { |
25129
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23600
diff
changeset
|
302 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:
23600
diff
changeset
|
303 capabilities |= JABBER_CAP_IBB; |
b4ec5481a67a
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
23600
diff
changeset
|
304 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 |
27914
2b9da4c0c47b
Reverse the list of conference servers we find so that the first one in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
27800
diff
changeset
|
308 js->chat_servers = g_list_reverse(js->chat_servers); |
2b9da4c0c47b
Reverse the list of conference servers we find so that the first one in the
Etan Reisner <pidgin@unreliablesource.net>
parents:
27800
diff
changeset
|
309 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 capabilities |= JABBER_CAP_RETRIEVED; |
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 if(jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 jbr->capabilities = capabilities; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
27540
d953b613a794
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <paul@darkrain42.org>
parents:
27054
diff
changeset
|
315 if (jdicd && jdicd->callback) |
d953b613a794
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <paul@darkrain42.org>
parents:
27054
diff
changeset
|
316 jdicd->callback(js, from, capabilities, jdicd->data); |
26598
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
317 } else { /* type == JABBER_IQ_ERROR or query == NULL */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 JabberBuddyResource *jbr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 JabberCapabilities capabilities = JABBER_CAP_NONE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 if((jid = jabber_id_new(from))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 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
|
325 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
|
326 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 if(jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 capabilities = jbr->capabilities; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 |
27540
d953b613a794
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <paul@darkrain42.org>
parents:
27054
diff
changeset
|
332 if (jdicd && jdicd->callback) |
d953b613a794
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <paul@darkrain42.org>
parents:
27054
diff
changeset
|
333 jdicd->callback(js, from, capabilities, jdicd->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 } |
27540
d953b613a794
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <paul@darkrain42.org>
parents:
27054
diff
changeset
|
335 |
d953b613a794
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <paul@darkrain42.org>
parents:
27054
diff
changeset
|
336 g_free(jdicd); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
339 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:
25638
diff
changeset
|
340 JabberIqType type, const char *id, |
26487
bc7fac8e2f79
propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
341 xmlnode *query) |
bc7fac8e2f79
propagate from branch 'im.pidgin.pidgin' (head f144c6bda9daf701aa891c875fce7a4dedd611ae)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
342 { |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
343 if(type == JABBER_IQ_GET) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
345 NS_DISCO_ITEMS); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25762
diff
changeset
|
346 |
17892
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:
17883
diff
changeset
|
347 /* preserve node */ |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
348 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:
25638
diff
changeset
|
349 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:
25638
diff
changeset
|
350 if(node) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
351 xmlnode_set_attrib(iq_query,"node",node); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
353 jabber_iq_set_id(iq, id); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
355 if (from) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25638
diff
changeset
|
356 xmlnode_set_attrib(iq->node, "to", from); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 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
|
363 { |
23600
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
364 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
|
365 |
25425
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
366 /* |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
367 * 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:
25353
diff
changeset
|
368 * 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:
25353
diff
changeset
|
369 * support it. |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
370 */ |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18153
diff
changeset
|
371 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
|
372 |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
24855
diff
changeset
|
373 if (js->pep) |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
24855
diff
changeset
|
374 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
|
375 |
28767
9ab75ab032b4
jabber: The google roster request code was so lonely, so let's just drop-kick it and add the little custom logic to roster.c
Paul Aurich <paul@darkrain42.org>
parents:
28650
diff
changeset
|
376 /* Yes, please! */ |
9ab75ab032b4
jabber: The google roster request code was so lonely, so let's just drop-kick it and add the little custom logic to roster.c
Paul Aurich <paul@darkrain42.org>
parents:
28650
diff
changeset
|
377 jabber_roster_request(js); |
17362 | 378 |
17883
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:
17882
diff
changeset
|
379 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:
17882
diff
changeset
|
380 /* 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:
17882
diff
changeset
|
381 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:
17882
diff
changeset
|
382 } |
23600
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
383 |
24855
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
23600
diff
changeset
|
384 /* 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:
23600
diff
changeset
|
385 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:
23600
diff
changeset
|
386 jabber_request_block_list(js); |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
23600
diff
changeset
|
387 } |
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
23600
diff
changeset
|
388 |
23600
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
389 /* If there are manually specified bytestream proxies, query them */ |
32305
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32016
diff
changeset
|
390 ft_proxies = purple_account_get_string(purple_connection_get_account(js->gc), "ft_proxies", NULL); |
23600
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
391 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
|
392 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
|
393 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
|
394 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
|
395 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
|
396 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
|
397 |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
398 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
|
399 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
|
400 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
|
401 continue; |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
402 |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
403 /* 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
|
404 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
|
405 *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
|
406 |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
407 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
|
408 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
|
409 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
|
410 |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
411 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS); |
23600
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
412 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
|
413 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
|
414 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
|
415 } |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
416 |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
417 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
|
418 } |
10382f1e1353
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21603
diff
changeset
|
419 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
28493
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
422 /* should probably share this code with google.c, or maybe from 2.7.0 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
423 introduce an abstracted hostname -> IP function in dns.c */ |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
424 static void |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
425 jabber_disco_stun_lookup_cb(GSList *hosts, gpointer data, |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
426 const char *error_message) |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
427 { |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
428 JabberStream *js = (JabberStream *) data; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
429 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
430 if (error_message) { |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
431 purple_debug_error("jabber", "STUN lookup failed: %s\n", |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
432 error_message); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
433 g_slist_free(hosts); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
434 js->stun_query = NULL; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
435 return; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
436 } |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
437 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
438 if (hosts && g_slist_next(hosts)) { |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
439 struct sockaddr *addr = g_slist_next(hosts)->data; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
440 char dst[INET6_ADDRSTRLEN]; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
441 int port; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
442 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
443 if (addr->sa_family == AF_INET6) { |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
444 inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
445 dst, sizeof(dst)); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
446 port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
447 } else { |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
448 inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
449 dst, sizeof(dst)); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
450 port = ntohs(((struct sockaddr_in *) addr)->sin_port); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
451 } |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
452 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
453 if (js->stun_ip) |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
454 g_free(js->stun_ip); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
455 js->stun_ip = g_strdup(dst); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
456 js->stun_port = port; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
457 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
458 purple_debug_info("jabber", "set STUN IP/port address: " |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
459 "%s:%d\n", dst, port); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
460 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
461 /* unmark ongoing query */ |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
462 js->stun_query = NULL; |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
463 } |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
464 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
465 while (hosts != NULL) { |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
466 hosts = g_slist_delete_link(hosts, hosts); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
467 /* Free the address */ |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
468 g_free(hosts->data); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
469 hosts = g_slist_delete_link(hosts, hosts); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
470 } |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
471 } |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
472 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
473 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
474 static void |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
475 jabber_disco_stun_srv_resolve_cb(PurpleSrvResponse *resp, int results, gpointer data) |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
476 { |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
477 JabberStream *js = (JabberStream *) data; |
28494
d6cc51c4e375
Removed a couple of stray whitespaces...
Marcus Lundblad <ml@update.uu.se>
parents:
28493
diff
changeset
|
478 |
28493
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
479 purple_debug_info("jabber", "got %d SRV responses for STUN.\n", results); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
480 js->srv_query_data = NULL; |
28494
d6cc51c4e375
Removed a couple of stray whitespaces...
Marcus Lundblad <ml@update.uu.se>
parents:
28493
diff
changeset
|
481 |
28493
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
482 if (results > 0) { |
31481
b671728e6ee9
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31086
diff
changeset
|
483 PurpleAccount *account; |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30548
diff
changeset
|
484 purple_debug_info("jabber", "looking up IP for %s:%d\n", |
28493
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
485 resp[0].hostname, resp[0].port); |
31481
b671728e6ee9
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31086
diff
changeset
|
486 account = purple_connection_get_account(js->gc); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30548
diff
changeset
|
487 js->stun_query = |
32013
f22bc8b5b9dc
Replace purple_dnsquery_a_account with purple_dnsquery_a.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31481
diff
changeset
|
488 purple_dnsquery_a(account, resp[0].hostname, resp[0].port, |
28493
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
489 jabber_disco_stun_lookup_cb, js); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
490 } |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
491 } |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
492 |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
493 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 static void |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
495 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:
25979
diff
changeset
|
496 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:
25979
diff
changeset
|
497 xmlnode *packet, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 { |
17362 | 499 xmlnode *query, *child; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
501 if (!from || strcmp(from, js->user->domain)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 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
|
503 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
506 if (type == JABBER_IQ_ERROR) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 /* 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
|
508 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
|
509 return; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 query = xmlnode_get_child(packet, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 if (!query) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 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
|
516 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 |
17362 | 519 for (child = xmlnode_get_child(query, "identity"); child; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 child = xmlnode_get_next_twin(child)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 const char *category, *type, *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 category = xmlnode_get_attrib(child, "category"); |
17834
a75079eae085
added preliminary frame for pep-support
Andreas Monitzer <pidgin@monitzer.com>
parents:
17364
diff
changeset
|
523 type = xmlnode_get_attrib(child, "type"); |
29529
3e5bb4e2334c
Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <ml@update.uu.se>
parents:
28925
diff
changeset
|
524 if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) { |
3e5bb4e2334c
Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <ml@update.uu.se>
parents:
28925
diff
changeset
|
525 PurpleConnection *gc = js->gc; |
19489
b0733d5d7621
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18685
diff
changeset
|
526 js->pep = TRUE; |
32305
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32016
diff
changeset
|
527 purple_connection_set_flags(gc, |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32016
diff
changeset
|
528 purple_connection_get_flags(gc) |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32016
diff
changeset
|
529 | PURPLE_CONNECTION_SUPPORT_MOODS |
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32016
diff
changeset
|
530 | PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES); |
29529
3e5bb4e2334c
Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <ml@update.uu.se>
parents:
28925
diff
changeset
|
531 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 if (!category || strcmp(category, "server")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 if (!type || strcmp(type, "im")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 continue; |
17362 | 536 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 name = xmlnode_get_attrib(child, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 if (!name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 g_free(js->server_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 js->server_name = g_strdup(name); |
15522
ccbdf500f13a
Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@gmail.com>
parents:
15373
diff
changeset
|
543 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:
19697
diff
changeset
|
544 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:
19697
diff
changeset
|
545 js->googletalk = TRUE; |
26080
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
24986
diff
changeset
|
546 |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
24986
diff
changeset
|
547 /* autodiscover stun and relays */ |
28925
4f3a9ddfa34e
jabber: Only make the SRV lookup for STUN based on the domain if no STUN
Marcus Lundblad <ml@update.uu.se>
parents:
28767
diff
changeset
|
548 if (purple_network_get_stun_ip() == NULL || |
4f3a9ddfa34e
jabber: Only make the SRV lookup for STUN based on the domain if no STUN
Marcus Lundblad <ml@update.uu.se>
parents:
28767
diff
changeset
|
549 purple_strequal(purple_network_get_stun_ip(), "")) { |
4f3a9ddfa34e
jabber: Only make the SRV lookup for STUN based on the domain if no STUN
Marcus Lundblad <ml@update.uu.se>
parents:
28767
diff
changeset
|
550 jabber_google_send_jingle_info(js); |
4f3a9ddfa34e
jabber: Only make the SRV lookup for STUN based on the domain if no STUN
Marcus Lundblad <ml@update.uu.se>
parents:
28767
diff
changeset
|
551 } |
4f3a9ddfa34e
jabber: Only make the SRV lookup for STUN based on the domain if no STUN
Marcus Lundblad <ml@update.uu.se>
parents:
28767
diff
changeset
|
552 } else if (purple_network_get_stun_ip() == NULL || |
4f3a9ddfa34e
jabber: Only make the SRV lookup for STUN based on the domain if no STUN
Marcus Lundblad <ml@update.uu.se>
parents:
28767
diff
changeset
|
553 purple_strequal(purple_network_get_stun_ip(), "")) { |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30548
diff
changeset
|
554 js->srv_query_data = |
32016
efe38e6319f2
Clean up SRV/TXT query functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32013
diff
changeset
|
555 purple_srv_resolve( |
31481
b671728e6ee9
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31086
diff
changeset
|
556 purple_connection_get_account(js->gc), "stun", "udp", |
b671728e6ee9
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31086
diff
changeset
|
557 js->user->domain, |
28493
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
558 jabber_disco_stun_srv_resolve_cb, js); |
fc8c85e8b6e1
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
559 /* TODO: add TURN support later... */ |
26352
e23a74d7c97c
Get rid of the rest of the extraneous changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
560 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 |
17362 | 563 for (child = xmlnode_get_child(query, "feature"); child; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 child = xmlnode_get_next_twin(child)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 const char *var; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 var = xmlnode_get_attrib(child, "var"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 if (!var) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
570 if (!strcmp(NS_GOOGLE_MAIL_NOTIFY, var)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 jabber_gmail_init(js); |
28767
9ab75ab032b4
jabber: The google roster request code was so lonely, so let's just drop-kick it and add the little custom logic to roster.c
Paul Aurich <paul@darkrain42.org>
parents:
28650
diff
changeset
|
573 } else if (!strcmp(NS_GOOGLE_ROSTER, var)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; |
17883
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:
17882
diff
changeset
|
575 } 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:
17882
diff
changeset
|
576 js->server_caps |= JABBER_CAP_ADHOC; |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
577 } else if (!strcmp(NS_SIMPLE_BLOCKING, var)) { |
24855
0700833f0c5d
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <mark@kingant.net>
parents:
23600
diff
changeset
|
578 js->server_caps |= JABBER_CAP_BLOCKING; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 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
|
583 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 static void |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
586 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:
25979
diff
changeset
|
587 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:
25979
diff
changeset
|
588 xmlnode *packet, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 xmlnode *query, *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
592 if (!from || strcmp(from, js->user->domain) != 0) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
595 if (type == JABBER_IQ_ERROR) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 while(js->chat_servers) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 g_free(js->chat_servers->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 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
|
601 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 query = xmlnode_get_child(packet, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 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
|
606 child = xmlnode_get_next_twin(child)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 JabberIq *iq; |
30544
718c16d7c6c9
Fix this inconsequential compile warning:
Mark Doliner <mark@kingant.net>
parents:
30476
diff
changeset
|
608 const char *jid; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 if(!(jid = xmlnode_get_attrib(child, "jid"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 |
17364
d42de194a364
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17362
diff
changeset
|
613 /* 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:
17362
diff
changeset
|
614 * so we won't query them */ |
30413
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29529
diff
changeset
|
615 if(xmlnode_get_attrib(child, "node") != NULL) |
17364
d42de194a364
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17362
diff
changeset
|
616 continue; |
d42de194a364
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17362
diff
changeset
|
617 |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
618 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 xmlnode_set_attrib(iq->node, "to", jid); |
27540
d953b613a794
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <paul@darkrain42.org>
parents:
27054
diff
changeset
|
620 jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 void jabber_disco_items_server(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 { |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
627 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 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
|
630 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 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
|
632 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
634 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 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
|
636 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
|
637 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 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
|
641 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 JabberBuddyResource *jbr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 struct _jabber_disco_info_cb_data *jdicd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 if((jid = jabber_id_new(who))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 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
|
650 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
|
651 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 callback(js, who, jbr->capabilities, data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 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
|
660 jdicd->data = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 jdicd->callback = callback; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 |
28650
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
663 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 xmlnode_set_attrib(iq->node, "to", who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 |
26598
1df3579a974b
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
Paul Aurich <paul@darkrain42.org>
parents:
26596
diff
changeset
|
666 jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 |