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