Thu, 23 Mar 2017 21:01:15 +0300
Replace !strcmp() with purple_strequal()
Didn't touch finch/libgnt files
| 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 | ||
| 24 | #include "internal.h" | |
|
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
|
25 | #include "network.h" |
| 8312 | 26 | #include "prefs.h" |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
27 | #include "debug.h" |
| 27212 | 28 | #include "request.h" |
| 8312 | 29 | |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25290
diff
changeset
|
30 | #include "adhoccommands.h" |
| 8312 | 31 | #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
|
32 | #include "disco.h" |
|
29913
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29814
diff
changeset
|
33 | #include "google/google.h" |
|
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29814
diff
changeset
|
34 | #include "google/gmail.h" |
|
58f5122fbcd3
First shot at refactoring the Google-specific XMPP code.
Marcus Lundblad <malu@pidgin.im>
parents:
29814
diff
changeset
|
35 | #include "google/jingleinfo.h" |
| 8312 | 36 | #include "iq.h" |
| 13385 | 37 | #include "jabber.h" |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
38 | #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
|
39 | #include "pep.h" |
|
15344
34b7f4e55861
[gaim-migrate @ 18072]
Evan Schoenberg <evands@pidgin.im>
parents:
15323
diff
changeset
|
40 | #include "presence.h" |
| 15265 | 41 | #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
|
42 | #include "useravatar.h" |
| 8312 | 43 | |
| 44 | struct _jabber_disco_info_cb_data { | |
| 45 | gpointer data; | |
| 46 | JabberDiscoInfoCallback *callback; | |
| 47 | }; | |
| 48 | ||
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
49 | 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
|
50 | gpointer data; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
51 | JabberDiscoItemsCallback *callback; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
52 | }; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
53 | |
|
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
|
54 | #define SUPPORT_FEATURE(x) { \ |
| 8312 | 55 | feature = xmlnode_new_child(query, "feature"); \ |
|
17783
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
56 | xmlnode_set_attrib(feature, "var", x); \ |
|
2687df1ca202
PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents:
17773
diff
changeset
|
57 | } |
| 8312 | 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 | 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
|
60 | 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
|
61 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
62 | xmlnode *packet, gpointer data) |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
63 | { |
|
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
|
64 | JabberBytestreamsStreamhost *sh = data; |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
65 | xmlnode *query = 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
|
66 | 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
|
67 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
68 | if (from && purple_strequal(from, sh->jid) && query != NULL) { |
|
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
|
69 | xmlnode *sh_node = xmlnode_get_child(query, "streamhost"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
70 | if (sh_node) { |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
71 | const char *jid = xmlnode_get_attrib(sh_node, "jid"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
72 | const char *port = xmlnode_get_attrib(sh_node, "port"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
73 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
74 | |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
75 | if (jid == NULL || strcmp(jid, from) != 0) |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
76 | 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
|
77 | 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
|
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 | sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host")); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
80 | sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf")); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
81 | 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
|
82 | 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
|
83 | } |
|
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 | } |
|
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
|
85 | |
|
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
|
86 | 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
|
87 | "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
|
88 | 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
|
89 | 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
|
90 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
91 | /* 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
|
92 | 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
|
93 | js->bs_proxies = g_list_remove(js->bs_proxies, sh); |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
94 | g_free(sh->jid); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
95 | g_free(sh->host); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
96 | g_free(sh->zeroconf); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
97 | g_free(sh); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
98 | } |
|
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
|
99 | } |
|
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
|
100 | |
| 8312 | 101 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
102 | 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
|
103 | JabberIqType type, const char *id, |
|
26707
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
104 | xmlnode *in_query) |
|
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
105 | { |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
106 | if(type == JABBER_IQ_GET) { |
| 8312 | 107 | xmlnode *query, *identity, *feature; |
| 13385 | 108 | JabberIq *iq; |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
109 | const char *node = xmlnode_get_attrib(in_query, "node"); |
|
26707
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
110 | char *node_uri = NULL; |
| 13385 | 111 | |
|
24734
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
112 | /* create custom caps node URI */ |
|
24716
047f5075ca58
Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents:
24715
diff
changeset
|
113 | node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL); |
| 13385 | 114 | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
115 | iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_INFO); |
| 8312 | 116 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
117 | jabber_iq_set_id(iq, id); |
| 8312 | 118 | |
|
28047
0f280c9653d2
jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <darkrain42@pidgin.im>
parents:
28028
diff
changeset
|
119 | if (from) |
|
0f280c9653d2
jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <darkrain42@pidgin.im>
parents:
28028
diff
changeset
|
120 | xmlnode_set_attrib(iq->node, "to", from); |
| 8312 | 121 | query = xmlnode_get_child(iq->node, "query"); |
| 122 | ||
| 13385 | 123 | if(node) |
| 124 | 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
|
125 | |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31680
diff
changeset
|
126 | if(!node || purple_strequal(node, node_uri)) { |
|
24715
69aaae59e205
Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents:
23954
diff
changeset
|
127 | 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
|
128 | 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
|
129 | JabberIdentity *ident = (JabberIdentity*)identities->data; |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
130 | identity = xmlnode_new_child(query, "identity"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
131 | xmlnode_set_attrib(identity, "category", ident->category); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
132 | 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
|
133 | if (ident->lang) |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
134 | xmlnode_set_attrib(identity, "xml:lang", ident->lang); |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
135 | if (ident->name) |
|
780b8ad67c22
Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents:
24717
diff
changeset
|
136 | 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
|
137 | } |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
138 | 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
|
139 | 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
|
140 | if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
141 | feature = xmlnode_new_child(query, "feature"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
142 | 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
|
143 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
144 | } |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
22648
diff
changeset
|
145 | #ifdef USE_VV |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31680
diff
changeset
|
146 | } 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
|
147 | /* |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
148 | * 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
|
149 | * 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
|
150 | * 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
|
151 | * |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
152 | * 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
|
153 | * 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
|
154 | * 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
|
155 | */ |
|
ef06285f3b64
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <darkrain42@pidgin.im>
parents:
26659
diff
changeset
|
156 | xmlnode *feature = xmlnode_new_child(query, "feature"); |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28812
diff
changeset
|
157 | 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
|
158 | } else if (purple_strequal(node, CAPS0115_NODE "#" "video-v1")) { |
|
27202
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
26991
diff
changeset
|
159 | /* |
|
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
26991
diff
changeset
|
160 | * 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
|
161 | * 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
|
162 | * clients that don't actually check disco#info features. |
|
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
26991
diff
changeset
|
163 | * |
|
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
26991
diff
changeset
|
164 | * This specific feature is redundant but is what |
|
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
26991
diff
changeset
|
165 | * 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
|
166 | * advertises as 'video-v1'. |
|
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
26991
diff
changeset
|
167 | */ |
|
5244a5510e0e
Add Gmail video support.
Michael Ruprecht <maiku@pidgin.im>
parents:
26991
diff
changeset
|
168 | xmlnode *feature = xmlnode_new_child(query, "feature"); |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28812
diff
changeset
|
169 | 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
|
170 | } 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
|
171 | /* |
|
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
|
172 | * 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
|
173 | * 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
|
174 | * 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
|
175 | * |
|
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
|
176 | * 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
|
177 | * 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
|
178 | * 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
|
179 | */ |
|
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
|
180 | xmlnode *feature = xmlnode_new_child(query, "feature"); |
|
28979
191942cc7747
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <darkrain42@pidgin.im>
parents:
28812
diff
changeset
|
181 | 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
|
182 | #endif |
| 13385 | 183 | } else { |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
184 | xmlnode *error, *inf; |
|
27211
68a7be484fe1
propagate from branch 'im.pidgin.pidgin' (head feb6f844abcd8e7add3c986f3010f642838533e8)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
185 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
186 | /* XXX: gross hack, implement jabber_iq_set_type or something */ |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
187 | xmlnode_set_attrib(iq->node, "type", "error"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
188 | 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
|
189 | |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
190 | error = xmlnode_new_child(query, "error"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
191 | xmlnode_set_attrib(error, "code", "404"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
192 | xmlnode_set_attrib(error, "type", "cancel"); |
|
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
193 | inf = xmlnode_new_child(error, "item-not-found"); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
194 | xmlnode_set_namespace(inf, NS_XMPP_STANZAS); |
| 13385 | 195 | } |
|
23586
e495a4623f76
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
196 | g_free(node_uri); |
| 8312 | 197 | 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
|
198 | } 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
|
199 | /* 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
|
200 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); |
|
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
|
201 | xmlnode *error, *bad_request; |
|
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 | /* Free the <query/> */ |
|
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
|
204 | xmlnode_free(xmlnode_get_child(iq->node, "query")); |
|
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
|
205 | /* Add an error */ |
|
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 | error = xmlnode_new_child(iq->node, "error"); |
|
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 | xmlnode_set_attrib(error, "type", "modify"); |
|
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 | bad_request = xmlnode_new_child(error, "bad-request"); |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
209 | 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
|
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 | 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
|
212 | if (from) |
|
0f280c9653d2
jabber: disco#info queries with no 'from' are from the server; valid.
Paul Aurich <darkrain42@pidgin.im>
parents:
28028
diff
changeset
|
213 | 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
|
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 | 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
|
216 | } |
|
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 | } |
|
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
|
218 | |
|
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 | 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
|
220 | JabberIqType type, const char *id, |
|
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
|
221 | xmlnode *packet, gpointer data) |
|
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
|
222 | { |
|
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
|
223 | struct _jabber_disco_info_cb_data *jdicd = data; |
|
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
|
224 | xmlnode *query; |
|
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
|
225 | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
226 | query = 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
|
227 | |
|
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
|
228 | if (type == JABBER_IQ_RESULT && query) { |
| 8312 | 229 | xmlnode *child; |
| 230 | JabberID *jid; | |
| 231 | JabberBuddy *jb; | |
| 232 | JabberBuddyResource *jbr = NULL; | |
| 233 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 234 | ||
| 235 | if((jid = jabber_id_new(from))) { | |
| 236 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 237 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 238 | jabber_id_free(jid); | |
| 239 | } | |
| 240 | ||
| 241 | if(jbr) | |
| 242 | capabilities = jbr->capabilities; | |
| 243 | ||
|
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
|
244 | for(child = query->child; child; child = child->next) { |
| 8312 | 245 | if(child->type != XMLNODE_TYPE_TAG) |
| 246 | continue; | |
| 247 | ||
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
248 | if(purple_strequal(child->name, "identity")) { |
| 8312 | 249 | const char *category = xmlnode_get_attrib(child, "category"); |
| 250 | const char *type = xmlnode_get_attrib(child, "type"); | |
| 251 | if(!category || !type) | |
| 252 | continue; | |
| 253 | ||
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
254 | if(purple_strequal(category, "conference") && purple_strequal(type, "text")) { |
| 11675 | 255 | /* we found a groupchat or MUC server, add it to the list */ |
| 256 | /* 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
|
257 | 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
|
258 | } else if(purple_strequal(category, "directory") && purple_strequal(type, "user")) { |
| 11675 | 259 | /* 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
|
260 | 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
|
261 | } 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
|
262 | /* 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
|
263 | 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
|
264 | 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
|
265 | |
|
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
|
266 | 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
|
267 | |
|
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 | 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
|
269 | 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
|
270 | 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
|
271 | |
|
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
|
272 | 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
|
273 | 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
|
274 | xmlnode_set_attrib(iq->node, "to", sh->jid); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
275 | 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
|
276 | jabber_iq_send(iq); |
| 11675 | 277 | } |
| 8312 | 278 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
279 | } else if(purple_strequal(child->name, "feature")) { |
| 8312 | 280 | const char *var = xmlnode_get_attrib(child, "var"); |
| 281 | if(!var) | |
| 282 | continue; | |
| 283 | ||
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
284 | if(purple_strequal(var, "http://jabber.org/protocol/si")) |
| 8312 | 285 | capabilities |= JABBER_CAP_SI; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
286 | else if(purple_strequal(var, "http://jabber.org/protocol/si/profile/file-transfer")) |
| 8312 | 287 | capabilities |= JABBER_CAP_SI_FILE_XFER; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
288 | else if(purple_strequal(var, NS_BYTESTREAMS)) |
| 8312 | 289 | capabilities |= JABBER_CAP_BYTESTREAMS; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
290 | else if(purple_strequal(var, "jabber:iq:search")) |
| 11675 | 291 | capabilities |= JABBER_CAP_IQ_SEARCH; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
292 | else if(purple_strequal(var, "jabber:iq:register")) |
| 11675 | 293 | capabilities |= JABBER_CAP_IQ_REGISTER; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
294 | 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
|
295 | capabilities |= JABBER_CAP_PING; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
296 | 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
|
297 | capabilities |= JABBER_CAP_ITEMS; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
298 | 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
|
299 | 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
|
300 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
301 | 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
|
302 | 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
|
303 | capabilities |= JABBER_CAP_IBB; |
|
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
304 | } |
| 8312 | 305 | } |
| 306 | } | |
| 307 | ||
|
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
|
308 | 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
|
309 | |
| 8312 | 310 | capabilities |= JABBER_CAP_RETRIEVED; |
| 311 | ||
| 312 | if(jbr) | |
| 313 | jbr->capabilities = capabilities; | |
| 314 | ||
|
27790
b2f4880d4e96
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents:
27292
diff
changeset
|
315 | 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
|
316 | 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
|
317 | } else { /* type == JABBER_IQ_ERROR or query == NULL */ |
| 8312 | 318 | JabberID *jid; |
| 319 | JabberBuddy *jb; | |
| 320 | JabberBuddyResource *jbr = NULL; | |
| 321 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 322 | ||
| 323 | if((jid = jabber_id_new(from))) { | |
| 324 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 325 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 326 | jabber_id_free(jid); | |
| 327 | } | |
| 328 | ||
| 329 | if(jbr) | |
| 330 | capabilities = jbr->capabilities; | |
| 331 | ||
|
27790
b2f4880d4e96
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents:
27292
diff
changeset
|
332 | 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
|
333 | jdicd->callback(js, from, capabilities, jdicd->data); |
| 8312 | 334 | } |
|
27790
b2f4880d4e96
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents:
27292
diff
changeset
|
335 | |
|
b2f4880d4e96
Fix picking up SI streamhosts from login server and plug a leak.
Paul Aurich <darkrain42@pidgin.im>
parents:
27292
diff
changeset
|
336 | g_free(jdicd); |
| 8312 | 337 | } |
| 338 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
339 | 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
|
340 | JabberIqType type, const char *id, |
|
26707
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
341 | xmlnode *query) |
|
a4f7c5d5e5ae
propagate from branch 'im.pidgin.pidgin' (head beb862745aa7b61bf9942e731fdef09bf0bba641)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
342 | { |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
343 | if(type == JABBER_IQ_GET) { |
| 8312 | 344 | 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
|
345 | 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
|
346 | |
|
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
|
347 | /* preserve node */ |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
348 | xmlnode *iq_query = xmlnode_get_child(iq->node, "query"); |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
349 | const char *node = xmlnode_get_attrib(query, "node"); |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
350 | if(node) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
351 | xmlnode_set_attrib(iq_query,"node",node); |
| 8312 | 352 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
353 | jabber_iq_set_id(iq, id); |
| 8312 | 354 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
355 | if (from) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
356 | xmlnode_set_attrib(iq->node, "to", from); |
| 8312 | 357 | jabber_iq_send(iq); |
| 358 | } | |
| 359 | } | |
| 360 | ||
| 361 | static void | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
362 | jabber_disco_finish_server_info_result_cb(JabberStream *js) |
| 15197 | 363 | { |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
364 | 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
|
365 | |
|
25810
5cf3c22e52df
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents:
25477
diff
changeset
|
366 | /* |
|
5cf3c22e52df
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <darkrain42@pidgin.im>
parents:
25477
diff
changeset
|
367 | * 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
|
368 | * 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
|
369 | * 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
|
370 | */ |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18225
diff
changeset
|
371 | 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
|
372 | |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25290
diff
changeset
|
373 | 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
|
374 | 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
|
375 | |
|
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
|
376 | /* 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
|
377 | jabber_roster_request(js); |
| 17421 | 378 | |
|
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
|
379 | 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
|
380 | /* 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
|
381 | 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
|
382 | } |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
383 | |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
384 | /* 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
|
385 | 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
|
386 | 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
|
387 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
388 | |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
389 | /* If there are manually specified bytestream proxies, query them */ |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
390 | ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
391 | 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
|
392 | JabberIq *iq; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
393 | JabberBytestreamsStreamhost *sh; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
394 | int i; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
395 | char *tmp; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
396 | 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
|
397 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
398 | 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
|
399 | 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
|
400 | 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
|
401 | continue; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
402 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
403 | /* 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
|
404 | 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
|
405 | *tmp = '\0'; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
406 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
407 | 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
|
408 | 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
|
409 | 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
|
410 | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
411 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS); |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
412 | xmlnode_set_attrib(iq->node, "to", sh->jid); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
413 | 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
|
414 | 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
|
415 | } |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
416 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
417 | 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
|
418 | } |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
419 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
420 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
421 | |
|
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
|
422 | /* should probably share this code with google.c, or maybe from 2.7.0 |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
423 | introduce an abstracted hostname -> IP function in dns.c */ |
|
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 |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
425 | jabber_disco_stun_lookup_cb(GSList *hosts, gpointer data, |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
426 | const char *error_message) |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
427 | { |
|
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; |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
429 | |
|
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 | if (error_message) { |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
431 | purple_debug_error("jabber", "STUN lookup failed: %s\n", |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
432 | error_message); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
433 | g_slist_free(hosts); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
434 | js->stun_query = NULL; |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
435 | 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
|
436 | } |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
437 | |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
438 | if (hosts && g_slist_next(hosts)) { |
|
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 | struct sockaddr *addr = g_slist_next(hosts)->data; |
|
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 | char dst[INET6_ADDRSTRLEN]; |
|
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 | int port; |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
442 | |
|
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 | if (addr->sa_family == AF_INET6) { |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
444 | inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, |
|
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 | dst, sizeof(dst)); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
446 | port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
447 | } else { |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
448 | inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, |
|
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 | dst, sizeof(dst)); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
450 | port = ntohs(((struct sockaddr_in *) addr)->sin_port); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
451 | } |
|
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 | |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
453 | if (js->stun_ip) |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
454 | g_free(js->stun_ip); |
|
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 | js->stun_ip = g_strdup(dst); |
|
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 | js->stun_port = port; |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
457 | |
|
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 | purple_debug_info("jabber", "set STUN IP/port address: " |
|
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 | "%s:%d\n", dst, port); |
|
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 | |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
461 | /* unmark ongoing query */ |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
462 | js->stun_query = NULL; |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
463 | } |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
464 | |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
465 | while (hosts != NULL) { |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
466 | hosts = g_slist_delete_link(hosts, hosts); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
467 | /* Free the address */ |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
468 | g_free(hosts->data); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
469 | hosts = g_slist_delete_link(hosts, hosts); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
470 | } |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
471 | } |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
472 | |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
473 | |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
474 | static void |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
475 | jabber_disco_stun_srv_resolve_cb(PurpleSrvResponse *resp, int results, gpointer data) |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
476 | { |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
477 | JabberStream *js = (JabberStream *) data; |
|
28812
bac973724057
Removed a couple of stray whitespaces...
Marcus Lundblad <malu@pidgin.im>
parents:
28811
diff
changeset
|
478 | |
|
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
|
479 | purple_debug_info("jabber", "got %d SRV responses for STUN.\n", results); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
480 | js->srv_query_data = NULL; |
|
28812
bac973724057
Removed a couple of stray whitespaces...
Marcus Lundblad <malu@pidgin.im>
parents:
28811
diff
changeset
|
481 | |
|
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
|
482 | if (results > 0) { |
|
31680
d3902c687705
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <datallah@pidgin.im>
parents:
31294
diff
changeset
|
483 | PurpleAccount *account; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30790
diff
changeset
|
484 | purple_debug_info("jabber", "looking up IP for %s:%d\n", |
|
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
|
485 | resp[0].hostname, resp[0].port); |
|
31680
d3902c687705
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <datallah@pidgin.im>
parents:
31294
diff
changeset
|
486 | account = purple_connection_get_account(js->gc); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30790
diff
changeset
|
487 | js->stun_query = |
|
31680
d3902c687705
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <datallah@pidgin.im>
parents:
31294
diff
changeset
|
488 | purple_dnsquery_a_account(account, resp[0].hostname, resp[0].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
|
489 | jabber_disco_stun_lookup_cb, js); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
490 | } |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
491 | } |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
492 | |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
493 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
494 | 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
|
495 | 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
|
496 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
497 | xmlnode *packet, gpointer data) |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
498 | { |
| 17421 | 499 | xmlnode *query, *child; |
| 15197 | 500 | |
|
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
|
501 | if (!from || strcmp(from, js->user->domain)) { |
|
15358
c8179e0a5483
[gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents:
15355
diff
changeset
|
502 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 503 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
504 | } |
| 15197 | 505 | |
|
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
|
506 | if (type == JABBER_IQ_ERROR) { |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
507 | /* 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
|
508 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 509 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
510 | } |
| 15197 | 511 | |
| 512 | query = xmlnode_get_child(packet, "query"); | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
513 | |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
514 | if (!query) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
515 | jabber_disco_finish_server_info_result_cb(js); |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
516 | return; |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
517 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
518 | |
| 17421 | 519 | for (child = xmlnode_get_child(query, "identity"); child; |
| 15197 | 520 | child = xmlnode_get_next_twin(child)) { |
| 521 | const char *category, *type, *name; | |
| 522 | category = xmlnode_get_attrib(child, "category"); | |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17423
diff
changeset
|
523 | type = xmlnode_get_attrib(child, "type"); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
524 | if(category && type && 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
|
525 | 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
|
526 | js->pep = TRUE; |
|
29814
ad92005bcdcf
Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <malu@pidgin.im>
parents:
29247
diff
changeset
|
527 | gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS | |
|
ad92005bcdcf
Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <malu@pidgin.im>
parents:
29247
diff
changeset
|
528 | PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES; |
|
ad92005bcdcf
Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <malu@pidgin.im>
parents:
29247
diff
changeset
|
529 | } |
| 15197 | 530 | if (!category || strcmp(category, "server")) |
| 531 | continue; | |
| 532 | if (!type || strcmp(type, "im")) | |
| 533 | continue; | |
| 17421 | 534 | |
| 15197 | 535 | name = xmlnode_get_attrib(child, "name"); |
| 536 | if (!name) | |
| 537 | continue; | |
| 538 | ||
| 539 | g_free(js->server_name); | |
| 540 | js->server_name = g_strdup(name); | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
541 | 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
|
542 | 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
|
543 | 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
|
544 | |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
545 | /* autodiscover stun and relays */ |
|
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
|
546 | if (purple_network_get_stun_ip() == NULL || |
|
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
|
547 | purple_strequal(purple_network_get_stun_ip(), "")) { |
|
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
|
548 | 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
|
549 | } |
|
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
|
550 | } else if (purple_network_get_stun_ip() == NULL || |
|
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
|
551 | purple_strequal(purple_network_get_stun_ip(), "")) { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30790
diff
changeset
|
552 | js->srv_query_data = |
|
31680
d3902c687705
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <datallah@pidgin.im>
parents:
31294
diff
changeset
|
553 | purple_srv_resolve_account( |
|
d3902c687705
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <datallah@pidgin.im>
parents:
31294
diff
changeset
|
554 | purple_connection_get_account(js->gc), "stun", "udp", |
|
d3902c687705
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <datallah@pidgin.im>
parents:
31294
diff
changeset
|
555 | js->user->domain, |
|
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
|
556 | jabber_disco_stun_srv_resolve_cb, js); |
|
a6b47f7de931
jabber: Automatically find a STUN server by SRV lookup on the account's domain
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
557 | /* 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
|
558 | } |
| 15197 | 559 | } |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
560 | |
| 17421 | 561 | for (child = xmlnode_get_child(query, "feature"); child; |
| 15225 | 562 | child = xmlnode_get_next_twin(child)) { |
| 563 | const char *var; | |
| 564 | var = xmlnode_get_attrib(child, "var"); | |
| 565 | if (!var) | |
| 566 | continue; | |
| 567 | ||
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
568 | if (purple_strequal(NS_GOOGLE_MAIL_NOTIFY, var)) { |
| 15225 | 569 | js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; |
| 570 | jabber_gmail_init(js); | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
571 | } else if (purple_strequal(NS_GOOGLE_ROSTER, var)) { |
| 15265 | 572 | js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
573 | } 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
|
574 | js->server_caps |= JABBER_CAP_ADHOC; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
575 | } 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
|
576 | js->server_caps |= JABBER_CAP_BLOCKING; |
| 15225 | 577 | } |
| 578 | } | |
| 15265 | 579 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
580 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 581 | } |
| 582 | ||
| 583 | 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
|
584 | 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
|
585 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
586 | xmlnode *packet, gpointer data) |
| 8312 | 587 | { |
| 588 | xmlnode *query, *child; | |
| 589 | ||
|
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
|
590 | if (!from || strcmp(from, js->user->domain) != 0) |
| 8312 | 591 | return; |
| 592 | ||
|
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
|
593 | if (type == JABBER_IQ_ERROR) |
| 8312 | 594 | return; |
| 595 | ||
| 596 | while(js->chat_servers) { | |
| 597 | g_free(js->chat_servers->data); | |
| 598 | js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); | |
| 599 | } | |
| 600 | ||
| 601 | query = xmlnode_get_child(packet, "query"); | |
| 602 | ||
| 603 | for(child = xmlnode_get_child(query, "item"); child; | |
| 604 | child = xmlnode_get_next_twin(child)) { | |
| 605 | JabberIq *iq; | |
|
30784
35c4f2c99a81
Fix this inconsequential compile warning:
Mark Doliner <markdoliner@pidgin.im>
parents:
30744
diff
changeset
|
606 | const char *jid; |
| 8312 | 607 | |
| 608 | if(!(jid = xmlnode_get_attrib(child, "jid"))) | |
| 609 | continue; | |
| 610 | ||
|
17423
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
611 | /* 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
|
612 | * so we won't query them */ |
|
30626
bec413ce77c7
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29814
diff
changeset
|
613 | if(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
|
614 | continue; |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
615 | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
616 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); |
| 8312 | 617 | 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
|
618 | jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL); |
| 8312 | 619 | jabber_iq_send(iq); |
| 620 | } | |
| 621 | } | |
| 622 | ||
| 623 | void jabber_disco_items_server(JabberStream *js) | |
| 624 | { | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
625 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); |
| 8312 | 626 | |
| 627 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 628 | ||
| 15197 | 629 | jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL); |
| 630 | jabber_iq_send(iq); | |
| 631 | ||
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
632 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); |
| 15197 | 633 | xmlnode_set_attrib(iq->node, "to", js->user->domain); |
| 634 | jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL); | |
| 8312 | 635 | jabber_iq_send(iq); |
| 636 | } | |
| 637 | ||
| 638 | void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data) | |
| 639 | { | |
| 640 | JabberID *jid; | |
| 641 | JabberBuddy *jb; | |
| 642 | JabberBuddyResource *jbr = NULL; | |
| 643 | struct _jabber_disco_info_cb_data *jdicd; | |
| 644 | JabberIq *iq; | |
| 645 | ||
| 646 | if((jid = jabber_id_new(who))) { | |
| 647 | if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE))) | |
| 648 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 649 | jabber_id_free(jid); | |
| 650 | } | |
| 651 | ||
| 652 | if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) { | |
| 653 | callback(js, who, jbr->capabilities, data); | |
| 654 | return; | |
| 655 | } | |
| 656 | ||
| 657 | jdicd = g_new0(struct _jabber_disco_info_cb_data, 1); | |
| 658 | jdicd->data = data; | |
| 659 | jdicd->callback = callback; | |
| 660 | ||
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28979
diff
changeset
|
661 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); |
| 8312 | 662 | xmlnode_set_attrib(iq->node, "to", who); |
| 663 | ||
|
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
|
664 | jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd); |
| 8312 | 665 | jabber_iq_send(iq); |
| 666 | } | |
| 667 |