Sun, 05 Apr 2009 21:13:10 +0000
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
to branch 'im.pidgin.cpw.darkrain42.xmpp.bosh' (head 133392eaf4b8c117a1b4d46b2ec6dc025d2cdcc3)
| 8312 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 8312 | 3 | * |
| 4 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8312 | 19 | * |
| 20 | */ | |
| 21 | ||
| 22 | #include "internal.h" | |
| 23 | #include "prefs.h" | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
24 | #include "debug.h" |
| 8312 | 25 | |
| 26 | #include "buddy.h" | |
| 15225 | 27 | #include "google.h" |
| 8312 | 28 | #include "iq.h" |
| 29 | #include "disco.h" | |
| 13385 | 30 | #include "jabber.h" |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
31 | #include "jingle/jingle.h" |
|
15344
34b7f4e55861
[gaim-migrate @ 18072]
Evan Schoenberg <evands@pidgin.im>
parents:
15323
diff
changeset
|
32 | #include "presence.h" |
| 15265 | 33 | #include "roster.h" |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17423
diff
changeset
|
34 | #include "pep.h" |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
35 | #include "adhoccommands.h" |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
36 | |
| 8312 | 37 | |
| 38 | struct _jabber_disco_info_cb_data { | |
| 39 | gpointer data; | |
| 40 | JabberDiscoInfoCallback *callback; | |
| 41 | }; | |
| 42 | ||
|
17783
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
43 | #define SUPPORT_FEATURE(x) { \ |
| 8312 | 44 | feature = xmlnode_new_child(query, "feature"); \ |
|
17783
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
45 | xmlnode_set_attrib(feature, "var", x); \ |
|
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
46 | } |
| 8312 | 47 | |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
48 | static void |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
49 | jabber_disco_bytestream_server_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
50 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
51 | xmlnode *packet, gpointer data) |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
52 | { |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
53 | JabberBytestreamsStreamhost *sh = data; |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
54 | xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
55 | "http://jabber.org/protocol/bytestreams"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
56 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
57 | if (from && !strcmp(from, sh->jid) && query != NULL) { |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
58 | xmlnode *sh_node = xmlnode_get_child(query, "streamhost"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
59 | if (sh_node) { |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
60 | const char *jid = xmlnode_get_attrib(sh_node, "jid"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
61 | const char *port = xmlnode_get_attrib(sh_node, "port"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
62 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
63 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
64 | if (jid == NULL || strcmp(jid, from) != 0) |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
65 | purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n", |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
66 | jid ? jid : "(null)"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
67 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
68 | sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host")); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
69 | sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf")); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
70 | if (port != NULL) |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
71 | sh->port = atoi(port); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
72 | } |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
73 | } |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
74 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
75 | purple_debug_info("jabber", "Discovered bytestream proxy server: " |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
76 | "jid='%s' host='%s' port='%d' zeroconf='%s'\n", |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
77 | from ? from : "", sh->host ? sh->host : "", |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
78 | sh->port, sh->zeroconf ? sh->zeroconf : ""); |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
79 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
80 | /* TODO: When we support zeroconf proxies, fix this to handle them */ |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
81 | if (!(sh->jid && sh->host && sh->port > 0)) { |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
82 | g_free(sh->jid); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
83 | g_free(sh->host); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
84 | g_free(sh->zeroconf); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
85 | g_free(sh); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
86 | js->bs_proxies = g_list_remove(js->bs_proxies, sh); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
87 | } |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
88 | } |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
89 | |
| 8312 | 90 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
91 | void jabber_disco_info_parse(JabberStream *js, const char *from, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
92 | JabberIqType type, const char *id, |
|
26707
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
93 | xmlnode *in_query) |
|
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
94 | { |
|
26482
72d16a73cf12
Get rid of the rest of the extraneous changes.
Michael Ruprecht <maiku@pidgin.im>
parents:
26337
diff
changeset
|
95 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
96 | if(!from) |
| 8312 | 97 | return; |
| 98 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
99 | if(type == JABBER_IQ_GET) { |
| 8312 | 100 | xmlnode *query, *identity, *feature; |
| 13385 | 101 | JabberIq *iq; |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
102 | const char *node = xmlnode_get_attrib(in_query, "node"); |
|
26707
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
103 | char *node_uri = NULL; |
| 13385 | 104 | |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
105 | /* create custom caps node URI */ |
|
24716
047f5075ca58
Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents:
24715
diff
changeset
|
106 | node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL); |
| 13385 | 107 | |
| 108 | iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, | |
| 8312 | 109 | "http://jabber.org/protocol/disco#info"); |
| 110 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
111 | jabber_iq_set_id(iq, id); |
| 8312 | 112 | |
| 113 | xmlnode_set_attrib(iq->node, "to", from); | |
| 114 | query = xmlnode_get_child(iq->node, "query"); | |
| 115 | ||
| 13385 | 116 | if(node) |
| 117 | xmlnode_set_attrib(query, "node", node); | |
|
26482
72d16a73cf12
Get rid of the rest of the extraneous changes.
Michael Ruprecht <maiku@pidgin.im>
parents:
26337
diff
changeset
|
118 | |
| 13385 | 119 | if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) { |
| 120 | identity = xmlnode_new_child(query, "identity"); | |
| 121 | xmlnode_set_attrib(identity, "category", "client"); | |
| 122 | xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console, | |
| 123 | * handheld, pc, phone, | |
| 124 | * web */ | |
| 13704 | 125 | xmlnode_set_attrib(identity, "name", PACKAGE); |
|
26073
62f7a54ea3a8
Fix up merge (why can't it simply make the changes to my WD first?)
Paul Aurich <darkrain42@pidgin.im>
parents:
26072
diff
changeset
|
126 | } |
| 8312 | 127 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
128 | if(!node || !strcmp(node, node_uri)) { |
|
24715
69aaae59e205
Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents:
23954
diff
changeset
|
129 | GList *features, *identities; |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
130 | for(identities = jabber_identities; identities; identities = identities->next) { |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
131 | JabberIdentity *ident = (JabberIdentity*)identities->data; |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
132 | identity = xmlnode_new_child(query, "identity"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
133 | xmlnode_set_attrib(identity, "category", ident->category); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
134 | xmlnode_set_attrib(identity, "type", ident->type); |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
135 | if (ident->lang) |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
136 | xmlnode_set_attrib(identity, "xml:lang", ident->lang); |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
137 | if (ident->name) |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
138 | xmlnode_set_attrib(identity, "name", ident->name); |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
139 | } |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
140 | for(features = jabber_features; features; features = features->next) { |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
141 | JabberFeature *feat = (JabberFeature*)features->data; |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
142 | if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
143 | feature = xmlnode_new_child(query, "feature"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
144 | xmlnode_set_attrib(feature, "var", feat->namespace); |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
145 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
146 | } |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
22648
diff
changeset
|
147 | #ifdef USE_VV |
|
26668
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
148 | } else if (g_str_equal(node, CAPS0115_NODE "#" "voice-v1")) { |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
149 | /* |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
150 | * HUGE HACK! We advertise this ext (see jabber_presence_create_js |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
151 | * where we add <c/> to the <presence/>) for the Google Talk |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
152 | * clients that don't actually check disco#info features. |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
153 | * |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
154 | * This specific feature is redundant but is what |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
155 | * node='http://mail.google.com/xmpp/client/caps', ver='1.1' |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
156 | * advertises as 'voice-v1'. |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
157 | */ |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
158 | xmlnode *feature = xmlnode_new_child(query, "feature"); |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
159 | xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/voice/v1"); |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
22648
diff
changeset
|
160 | #endif |
| 13385 | 161 | } else { |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
162 | xmlnode *error, *inf; |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
163 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
164 | /* XXX: gross hack, implement jabber_iq_set_type or something */ |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
165 | xmlnode_set_attrib(iq->node, "type", "error"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
166 | iq->type = JABBER_IQ_ERROR; |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
167 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
168 | error = xmlnode_new_child(query, "error"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
169 | xmlnode_set_attrib(error, "code", "404"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
170 | xmlnode_set_attrib(error, "type", "cancel"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
171 | inf = xmlnode_new_child(error, "item-not-found"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
172 | xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
| 13385 | 173 | } |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
174 | g_free(node_uri); |
| 8312 | 175 | jabber_iq_send(iq); |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
176 | } else if(type == JABBER_IQ_RESULT) { |
| 8312 | 177 | xmlnode *child; |
| 178 | JabberID *jid; | |
| 179 | JabberBuddy *jb; | |
| 180 | JabberBuddyResource *jbr = NULL; | |
| 181 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 182 | struct _jabber_disco_info_cb_data *jdicd; | |
| 183 | ||
| 184 | if((jid = jabber_id_new(from))) { | |
| 185 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 186 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 187 | jabber_id_free(jid); | |
| 188 | } | |
| 189 | ||
| 190 | if(jbr) | |
| 191 | capabilities = jbr->capabilities; | |
| 192 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
193 | for(child = in_query->child; child; child = child->next) { |
| 8312 | 194 | if(child->type != XMLNODE_TYPE_TAG) |
| 195 | continue; | |
| 196 | ||
| 197 | if(!strcmp(child->name, "identity")) { | |
| 198 | const char *category = xmlnode_get_attrib(child, "category"); | |
| 199 | const char *type = xmlnode_get_attrib(child, "type"); | |
| 200 | if(!category || !type) | |
| 201 | continue; | |
| 202 | ||
| 11675 | 203 | if(!strcmp(category, "conference") && !strcmp(type, "text")) { |
| 204 | /* we found a groupchat or MUC server, add it to the list */ | |
| 205 | /* XXX: actually check for protocol/muc or gc-1.0 support */ | |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
206 | js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from)); |
| 11675 | 207 | } else if(!strcmp(category, "directory") && !strcmp(type, "user")) { |
| 208 | /* we found a JUD */ | |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
209 | js->user_directories = g_list_prepend(js->user_directories, g_strdup(from)); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
210 | } else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) { |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
211 | /* This is a bytestream proxy */ |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
212 | JabberIq *iq; |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
213 | JabberBytestreamsStreamhost *sh; |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
214 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
215 | purple_debug_info("jabber", "Found bytestream proxy server: %s\n", from); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
216 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
217 | sh = g_new0(JabberBytestreamsStreamhost, 1); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
218 | sh->jid = g_strdup(from); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
219 | js->bs_proxies = g_list_prepend(js->bs_proxies, sh); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
220 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
221 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
222 | "http://jabber.org/protocol/bytestreams"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
223 | xmlnode_set_attrib(iq->node, "to", sh->jid); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
224 | jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
225 | jabber_iq_send(iq); |
| 11675 | 226 | } |
| 8312 | 227 | |
| 228 | } else if(!strcmp(child->name, "feature")) { | |
| 229 | const char *var = xmlnode_get_attrib(child, "var"); | |
| 230 | if(!var) | |
| 231 | continue; | |
| 232 | ||
| 233 | if(!strcmp(var, "http://jabber.org/protocol/si")) | |
| 234 | capabilities |= JABBER_CAP_SI; | |
| 235 | else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer")) | |
| 236 | capabilities |= JABBER_CAP_SI_FILE_XFER; | |
| 237 | else if(!strcmp(var, "http://jabber.org/protocol/bytestreams")) | |
| 238 | capabilities |= JABBER_CAP_BYTESTREAMS; | |
| 11675 | 239 | else if(!strcmp(var, "jabber:iq:search")) |
| 240 | capabilities |= JABBER_CAP_IQ_SEARCH; | |
| 241 | else if(!strcmp(var, "jabber:iq:register")) | |
| 242 | capabilities |= JABBER_CAP_IQ_REGISTER; | |
|
26688
e036a4d105c1
Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
243 | else if(!strcmp(var, "urn:xmpp:ping")) |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
244 | capabilities |= JABBER_CAP_PING; |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
245 | else if(!strcmp(var, "http://jabber.org/protocol/commands")) { |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
246 | capabilities |= JABBER_CAP_ADHOC; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
247 | } |
|
24372
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
248 | else if(!strcmp(var, "http://jabber.org/protocol/ibb")) { |
|
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
249 | purple_debug_info("jabber", "remote supports IBB\n"); |
|
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
250 | capabilities |= JABBER_CAP_IBB; |
|
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
251 | } |
| 8312 | 252 | } |
| 253 | } | |
| 254 | ||
| 255 | capabilities |= JABBER_CAP_RETRIEVED; | |
| 256 | ||
| 257 | if(jbr) | |
| 258 | jbr->capabilities = capabilities; | |
| 259 | ||
| 260 | if((jdicd = g_hash_table_lookup(js->disco_callbacks, from))) { | |
| 261 | jdicd->callback(js, from, capabilities, jdicd->data); | |
| 262 | g_hash_table_remove(js->disco_callbacks, from); | |
| 263 | } | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
264 | } else if(type == JABBER_IQ_ERROR) { |
| 8312 | 265 | JabberID *jid; |
| 266 | JabberBuddy *jb; | |
| 267 | JabberBuddyResource *jbr = NULL; | |
| 268 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 269 | struct _jabber_disco_info_cb_data *jdicd; | |
| 270 | ||
| 271 | if(!(jdicd = g_hash_table_lookup(js->disco_callbacks, from))) | |
| 272 | return; | |
| 273 | ||
| 274 | if((jid = jabber_id_new(from))) { | |
| 275 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 276 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 277 | jabber_id_free(jid); | |
| 278 | } | |
| 279 | ||
| 280 | if(jbr) | |
| 281 | capabilities = jbr->capabilities; | |
| 282 | ||
| 283 | jdicd->callback(js, from, capabilities, jdicd->data); | |
| 284 | g_hash_table_remove(js->disco_callbacks, from); | |
| 285 | } | |
| 286 | } | |
| 287 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
288 | void jabber_disco_items_parse(JabberStream *js, const char *from, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
289 | JabberIqType type, const char *id, |
|
26707
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
290 | xmlnode *query) |
|
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
291 | { |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
292 | if(type == JABBER_IQ_GET) { |
| 8312 | 293 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, |
| 294 | "http://jabber.org/protocol/disco#items"); | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26026
diff
changeset
|
295 | |
|
17826
8f31a68b1d70
Now preserving the node on the (empty) disco#items replies. This is required for apps to add items on the correct nodes using signals.
Andreas Monitzer <am@adiumx.com>
parents:
17817
diff
changeset
|
296 | /* preserve node */ |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
297 | xmlnode *iq_query = xmlnode_get_child(iq->node, "query"); |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
298 | const char *node = xmlnode_get_attrib(query, "node"); |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
299 | if(node) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
300 | xmlnode_set_attrib(iq_query,"node",node); |
| 8312 | 301 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
302 | jabber_iq_set_id(iq, id); |
| 8312 | 303 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
304 | if (from) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
305 | xmlnode_set_attrib(iq->node, "to", from); |
| 8312 | 306 | jabber_iq_send(iq); |
| 307 | } | |
| 308 | } | |
| 309 | ||
| 310 | static void | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
311 | jabber_disco_finish_server_info_result_cb(JabberStream *js) |
| 15197 | 312 | { |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
313 | const char *ft_proxies; |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18225
diff
changeset
|
314 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18225
diff
changeset
|
315 | jabber_vcard_fetch_mine(js); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18225
diff
changeset
|
316 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
317 | if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
318 | /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */ |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
319 | jabber_roster_request(js); |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
320 | } |
| 17421 | 321 | |
|
17817
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
322 | if (js->server_caps & JABBER_CAP_ADHOC) { |
|
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
323 | /* The server supports ad-hoc commands, so let's request the list */ |
|
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
324 | jabber_adhoc_server_get_list(js); |
|
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
325 | } |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
326 | |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
327 | /* If the server supports blocking, request the block list */ |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
328 | if (js->server_caps & JABBER_CAP_BLOCKING) { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
329 | jabber_request_block_list(js); |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
330 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
331 | |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
332 | /* If there are manually specified bytestream proxies, query them */ |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
333 | ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
334 | if (ft_proxies) { |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
335 | JabberIq *iq; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
336 | JabberBytestreamsStreamhost *sh; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
337 | int i; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
338 | char *tmp; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
339 | gchar **ft_proxy_list = g_strsplit(ft_proxies, ",", 0); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
340 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
341 | for(i = 0; ft_proxy_list[i]; i++) { |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
342 | g_strstrip(ft_proxy_list[i]); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
343 | if(!(*ft_proxy_list[i])) |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
344 | continue; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
345 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
346 | /* We used to allow specifying a port directly here; get rid of it */ |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
347 | if((tmp = strchr(ft_proxy_list[i], ':'))) |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
348 | *tmp = '\0'; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
349 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
350 | sh = g_new0(JabberBytestreamsStreamhost, 1); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
351 | sh->jid = g_strdup(ft_proxy_list[i]); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
352 | js->bs_proxies = g_list_prepend(js->bs_proxies, sh); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
353 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
354 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
355 | "http://jabber.org/protocol/bytestreams"); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
356 | xmlnode_set_attrib(iq->node, "to", sh->jid); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
357 | jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
358 | jabber_iq_send(iq); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
359 | } |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
360 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
361 | g_strfreev(ft_proxy_list); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
362 | } |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
363 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
364 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
365 | |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
366 | static void |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
367 | jabber_disco_server_info_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
368 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
369 | xmlnode *packet, gpointer data) |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
370 | { |
| 17421 | 371 | xmlnode *query, *child; |
| 15197 | 372 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
373 | if (!from || strcmp(from, js->user->domain)) { |
|
15358
c8179e0a5483
[gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents:
15355
diff
changeset
|
374 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 375 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
376 | } |
| 15197 | 377 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
378 | if (type == JABBER_IQ_ERROR) { |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
379 | /* A common way to get here is for the server not to support xmlns http://jabber.org/protocol/disco#info */ |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
380 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 381 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
382 | } |
| 15197 | 383 | |
| 384 | query = xmlnode_get_child(packet, "query"); | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
385 | |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
386 | if (!query) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
387 | jabber_disco_finish_server_info_result_cb(js); |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
388 | return; |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
389 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
390 | |
| 17421 | 391 | for (child = xmlnode_get_child(query, "identity"); child; |
| 15197 | 392 | child = xmlnode_get_next_twin(child)) { |
| 393 | const char *category, *type, *name; | |
| 394 | category = xmlnode_get_attrib(child, "category"); | |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17423
diff
changeset
|
395 | type = xmlnode_get_attrib(child, "type"); |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
396 | if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
397 | js->pep = TRUE; |
| 15197 | 398 | if (!category || strcmp(category, "server")) |
| 399 | continue; | |
| 400 | if (!type || strcmp(type, "im")) | |
| 401 | continue; | |
| 17421 | 402 | |
| 15197 | 403 | name = xmlnode_get_attrib(child, "name"); |
| 404 | if (!name) | |
| 405 | continue; | |
| 406 | ||
| 407 | g_free(js->server_name); | |
| 408 | js->server_name = g_strdup(name); | |
|
15587
cbedd543bfae
Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
409 | if (!strcmp(name, "Google Talk")) { |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
410 | purple_debug_info("jabber", "Google Talk!\n"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
411 | js->googletalk = TRUE; |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
412 | |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
413 | /* autodiscover stun and relays */ |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
414 | jabber_google_send_jingle_info(js); |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
415 | } else { |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
416 | /* TODO: add external service discovery here... */ |
|
26482
72d16a73cf12
Get rid of the rest of the extraneous changes.
Michael Ruprecht <maiku@pidgin.im>
parents:
26337
diff
changeset
|
417 | } |
| 15197 | 418 | } |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
419 | |
| 17421 | 420 | for (child = xmlnode_get_child(query, "feature"); child; |
| 15225 | 421 | child = xmlnode_get_next_twin(child)) { |
| 422 | const char *var; | |
| 423 | var = xmlnode_get_attrib(child, "var"); | |
| 424 | if (!var) | |
| 425 | continue; | |
| 426 | ||
| 427 | if (!strcmp("google:mail:notify", var)) { | |
| 428 | js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; | |
| 429 | jabber_gmail_init(js); | |
| 15265 | 430 | } else if (!strcmp("google:roster", var)) { |
| 431 | js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; | |
| 432 | jabber_google_roster_init(js); | |
|
17817
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
433 | } else if (!strcmp("http://jabber.org/protocol/commands", var)) { |
|
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
434 | js->server_caps |= JABBER_CAP_ADHOC; |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
435 | } else if (!strcmp("urn:xmpp:blocking", var)) { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
436 | js->server_caps |= JABBER_CAP_BLOCKING; |
| 15225 | 437 | } |
| 438 | } | |
| 15265 | 439 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
440 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 441 | } |
| 442 | ||
| 443 | static void | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
444 | jabber_disco_server_items_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
445 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
446 | xmlnode *packet, gpointer data) |
| 8312 | 447 | { |
| 448 | xmlnode *query, *child; | |
| 449 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
450 | if (!from || strcmp(from, js->user->domain) != 0) |
| 8312 | 451 | return; |
| 452 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
453 | if (type == JABBER_IQ_ERROR) |
| 8312 | 454 | return; |
| 455 | ||
| 456 | while(js->chat_servers) { | |
| 457 | g_free(js->chat_servers->data); | |
| 458 | js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); | |
| 459 | } | |
| 460 | ||
| 461 | query = xmlnode_get_child(packet, "query"); | |
| 462 | ||
| 463 | for(child = xmlnode_get_child(query, "item"); child; | |
| 464 | child = xmlnode_get_next_twin(child)) { | |
| 465 | JabberIq *iq; | |
|
17423
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
466 | const char *jid, *node; |
| 8312 | 467 | |
| 468 | if(!(jid = xmlnode_get_attrib(child, "jid"))) | |
| 469 | continue; | |
| 470 | ||
|
17423
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
471 | /* we don't actually care about the specific nodes, |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
472 | * so we won't query them */ |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
473 | if((node = xmlnode_get_attrib(child, "node"))) |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
474 | continue; |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
475 | |
| 8312 | 476 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
| 477 | xmlnode_set_attrib(iq->node, "to", jid); | |
| 478 | jabber_iq_send(iq); | |
| 479 | } | |
| 480 | } | |
| 481 | ||
| 482 | void jabber_disco_items_server(JabberStream *js) | |
| 483 | { | |
| 484 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, | |
| 485 | "http://jabber.org/protocol/disco#items"); | |
| 486 | ||
| 487 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 488 | ||
| 15197 | 489 | jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL); |
| 490 | jabber_iq_send(iq); | |
| 491 | ||
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
492 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
| 15197 | 493 | xmlnode_set_attrib(iq->node, "to", js->user->domain); |
| 494 | jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL); | |
| 8312 | 495 | jabber_iq_send(iq); |
| 496 | } | |
| 497 | ||
| 498 | void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data) | |
| 499 | { | |
| 500 | JabberID *jid; | |
| 501 | JabberBuddy *jb; | |
| 502 | JabberBuddyResource *jbr = NULL; | |
| 503 | struct _jabber_disco_info_cb_data *jdicd; | |
| 504 | JabberIq *iq; | |
| 505 | ||
| 506 | if((jid = jabber_id_new(who))) { | |
| 507 | if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE))) | |
| 508 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 509 | jabber_id_free(jid); | |
| 510 | } | |
| 511 | ||
| 512 | if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) { | |
| 513 | callback(js, who, jbr->capabilities, data); | |
| 514 | return; | |
| 515 | } | |
| 516 | ||
| 517 | jdicd = g_new0(struct _jabber_disco_info_cb_data, 1); | |
| 518 | jdicd->data = data; | |
| 519 | jdicd->callback = callback; | |
| 520 | ||
| 521 | g_hash_table_insert(js->disco_callbacks, g_strdup(who), jdicd); | |
| 522 | ||
| 523 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); | |
| 524 | xmlnode_set_attrib(iq->node, "to", who); | |
| 525 | ||
| 526 | jabber_iq_send(iq); | |
| 527 | } |