Mon, 13 Apr 2009 04:34:17 +0000
Split the jabber_disco_info_do IQ callback from the IQ handler and use the IQ callback semantics.
How often do we get to remove something from the JabberStream?
| 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 | * |
| 4 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8312 | 19 | * |
| 20 | */ | |
| 21 | ||
| 22 | #include "internal.h" | |
| 23 | #include "prefs.h" | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
24 | #include "debug.h" |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
25 | #include "request.h" |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
26 | #include "notify.h" |
|
26741
3e50f27057d5
propagate from branch 'im.pidgin.pidgin' (head e715fa3fa4fa07f71af6b63a50988c85144a8e9e)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
27 | #include "libpurple/disco.h" |
| 8312 | 28 | |
| 29 | #include "buddy.h" | |
| 15225 | 30 | #include "google.h" |
| 8312 | 31 | #include "iq.h" |
| 32 | #include "disco.h" | |
| 13385 | 33 | #include "jabber.h" |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
34 | #include "jingle/jingle.h" |
|
15344
34b7f4e55861
[gaim-migrate @ 18072]
Evan Schoenberg <evands@pidgin.im>
parents:
15323
diff
changeset
|
35 | #include "presence.h" |
| 15265 | 36 | #include "roster.h" |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17423
diff
changeset
|
37 | #include "pep.h" |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
38 | #include "adhoccommands.h" |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
39 | #include "xdata.h" |
| 8312 | 40 | |
| 41 | struct _jabber_disco_info_cb_data { | |
| 42 | gpointer data; | |
| 43 | JabberDiscoInfoCallback *callback; | |
| 44 | }; | |
| 45 | ||
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
46 | 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
|
47 | gpointer data; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
48 | JabberDiscoItemsCallback *callback; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
49 | }; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
50 | |
|
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
|
51 | #define SUPPORT_FEATURE(x) { \ |
| 8312 | 52 | 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
|
53 | 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
|
54 | } |
| 8312 | 55 | |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
56 | struct jabber_disco_list_data { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
57 | JabberStream *js; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
58 | PurpleDiscoList *list; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
59 | char *server; |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
60 | int fetch_count; |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
61 | }; |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
62 | |
|
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
|
63 | 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
|
64 | 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
|
65 | 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
|
66 | 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
|
67 | { |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
68 | 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
|
69 | xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
70 | "http://jabber.org/protocol/bytestreams"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
71 | |
|
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 | if (from && !strcmp(from, sh->jid) && query != NULL) { |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
73 | 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
|
74 | 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
|
75 | 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
|
76 | 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
|
77 | |
|
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 | 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
|
80 | 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
|
81 | 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
|
82 | |
|
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 | 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
|
84 | 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
|
85 | 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
|
86 | 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
|
87 | } |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
88 | } |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
89 | |
|
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
|
90 | 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
|
91 | "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
|
92 | 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
|
93 | 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
|
94 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
95 | /* 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
|
96 | if (!(sh->jid && sh->host && sh->port > 0)) { |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
97 | 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
|
98 | 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
|
99 | 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
|
100 | 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
|
101 | js->bs_proxies = g_list_remove(js->bs_proxies, sh); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
102 | } |
|
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
|
103 | } |
|
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
|
104 | |
| 8312 | 105 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
106 | 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
|
107 | JabberIqType type, const char *id, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
108 | xmlnode *in_query) { |
| 8312 | 109 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
110 | if(!from) |
| 8312 | 111 | return; |
| 112 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
113 | if(type == JABBER_IQ_GET) { |
| 8312 | 114 | xmlnode *query, *identity, *feature; |
| 13385 | 115 | JabberIq *iq; |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
116 | const char *node = xmlnode_get_attrib(in_query, "node"); |
| 13385 | 117 | |
| 118 | iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, | |
| 8312 | 119 | "http://jabber.org/protocol/disco#info"); |
| 120 | ||
|
26593
338e4056ac4c
Don't match in the disco callbacks hashtable on remote JID. Use IQ id instead.
Paul Aurich <darkrain42@pidgin.im>
parents:
26592
diff
changeset
|
121 | jabber_iq_set_id(iq, id); |
| 8312 | 122 | |
| 123 | xmlnode_set_attrib(iq->node, "to", from); | |
| 124 | query = xmlnode_get_child(iq->node, "query"); | |
| 125 | ||
| 13385 | 126 | if(node) |
| 127 | xmlnode_set_attrib(query, "node", node); | |
| 128 | ||
| 129 | if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) { | |
| 130 | identity = xmlnode_new_child(query, "identity"); | |
| 131 | xmlnode_set_attrib(identity, "category", "client"); | |
| 132 | xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console, | |
| 133 | * handheld, pc, phone, | |
| 134 | * web */ | |
| 13704 | 135 | xmlnode_set_attrib(identity, "name", PACKAGE); |
| 8312 | 136 | |
| 13385 | 137 | SUPPORT_FEATURE("jabber:iq:last") |
| 138 | SUPPORT_FEATURE("jabber:iq:oob") | |
| 139 | SUPPORT_FEATURE("jabber:iq:time") | |
|
25553
c88d576c7005
Marcus' eagle eyes noticed 'xmpp:urn:time', which is bogus.
Paul Aurich <darkrain42@pidgin.im>
parents:
25290
diff
changeset
|
140 | SUPPORT_FEATURE("urn:xmpp:time") |
| 13385 | 141 | SUPPORT_FEATURE("jabber:iq:version") |
| 142 | SUPPORT_FEATURE("jabber:x:conference") | |
| 143 | SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams") | |
| 144 | SUPPORT_FEATURE("http://jabber.org/protocol/disco#info") | |
| 145 | SUPPORT_FEATURE("http://jabber.org/protocol/disco#items") | |
|
24372
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
146 | SUPPORT_FEATURE("http://jabber.org/protocol/ibb"); |
| 13385 | 147 | SUPPORT_FEATURE("http://jabber.org/protocol/muc") |
| 148 | SUPPORT_FEATURE("http://jabber.org/protocol/muc#user") | |
| 149 | SUPPORT_FEATURE("http://jabber.org/protocol/si") | |
| 150 | SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer") | |
| 151 | SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im") | |
|
18181
736c6abf62f4
respond to XEP-0199 queries (XMPP ping)
Nathan Walp <nwalp@pidgin.im>
parents:
17423
diff
changeset
|
152 | SUPPORT_FEATURE("urn:xmpp:ping") |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26026
diff
changeset
|
153 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
154 | if(!node) { /* non-caps disco#info, add all enabled extensions */ |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
155 | GList *features; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
156 | for(features = jabber_features; features; features = features->next) { |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
157 | JabberFeature *feat = (JabberFeature*)features->data; |
|
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
|
158 | if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE) |
|
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
|
159 | SUPPORT_FEATURE(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
|
160 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
161 | } |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
22648
diff
changeset
|
162 | #ifdef USE_VV |
|
19882
d8c2a2fc1fbf
Basic Google Talk voice call support. No UI; receiving a call auto-accepts it.
Sean Egan <seanegan@pidgin.im>
parents:
18317
diff
changeset
|
163 | } else if (node && !strcmp(node, CAPS0115_NODE "#voice-v1")) { |
| 26165 | 164 | SUPPORT_FEATURE("http://www.google.com/xmpp/protocol/session"); |
| 165 | SUPPORT_FEATURE("http://www.google.com/xmpp/protocol/voice/v1"); | |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
166 | SUPPORT_FEATURE(JINGLE); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
167 | SUPPORT_FEATURE(JINGLE_APP_RTP_SUPPORT_AUDIO); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
168 | SUPPORT_FEATURE(JINGLE_APP_RTP_SUPPORT_VIDEO); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26106
diff
changeset
|
169 | SUPPORT_FEATURE(JINGLE_TRANSPORT_RAWUDP); |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26165
diff
changeset
|
170 | SUPPORT_FEATURE(JINGLE_TRANSPORT_ICEUDP); |
|
23714
a08cf0090382
Check remote JID's capabilities for audio and video XEP support.
Michael Ruprecht <maiku@pidgin.im>
parents:
22648
diff
changeset
|
171 | #endif |
| 13385 | 172 | } else { |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
173 | const char *ext = NULL; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
174 | unsigned pos; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
175 | unsigned nodelen = strlen(node); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
176 | unsigned capslen = strlen(CAPS0115_NODE); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
177 | /* do a basic plausability check */ |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
178 | if(nodelen > capslen+1) { |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
179 | /* verify that the string is CAPS0115#<ext> and get the pointer to the ext part */ |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
180 | for(pos = 0; pos < capslen+1; ++pos) { |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
181 | if(pos == capslen) { |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
182 | if(node[pos] == '#') |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
183 | ext = &node[pos+1]; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
184 | else |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
185 | break; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
186 | } else if(node[pos] != CAPS0115_NODE[pos]) |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
187 | break; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
188 | } |
|
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 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
190 | if(ext != NULL) { |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
191 | /* look for that ext */ |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
192 | GList *features; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
193 | for(features = jabber_features; features; features = features->next) { |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
194 | JabberFeature *feat = (JabberFeature*)features->data; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
195 | if(!strcmp(feat->shortname, ext)) { |
|
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
|
196 | SUPPORT_FEATURE(feat->namespace); |
|
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
|
197 | break; |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
198 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
199 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
200 | if(features == NULL) |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
201 | ext = NULL; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
202 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
203 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26026
diff
changeset
|
204 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
205 | if(ext == NULL) { |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
206 | xmlnode *error, *inf; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26026
diff
changeset
|
207 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
208 | /* XXX: gross hack, implement jabber_iq_set_type or something */ |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
209 | xmlnode_set_attrib(iq->node, "type", "error"); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
210 | 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
|
211 | |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
212 | error = xmlnode_new_child(query, "error"); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
213 | xmlnode_set_attrib(error, "code", "404"); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
214 | xmlnode_set_attrib(error, "type", "cancel"); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
215 | inf = xmlnode_new_child(error, "item-not-found"); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
216 | xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
217 | } |
| 13385 | 218 | } |
| 8312 | 219 | |
| 220 | 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
|
221 | } 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
|
222 | /* 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
|
223 | 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
|
224 | 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
|
225 | |
|
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
|
226 | /* 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
|
227 | 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
|
228 | /* 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
|
229 | 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
|
230 | 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
|
231 | bad_request = xmlnode_new_child(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
|
232 | xmlnode_set_namespace(bad_request, "urn:ietf:params:xml:ns:xmpp-stanzas"); |
|
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
|
233 | |
|
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
|
234 | jabber_iq_set_id(iq, 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
|
235 | xmlnode_set_attrib(iq->node, "to", 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
|
236 | |
|
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
|
237 | 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
|
238 | } |
|
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
|
239 | } |
|
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
|
240 | |
|
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
|
241 | 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
|
242 | 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
|
243 | 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
|
244 | { |
|
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
|
245 | 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
|
246 | 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
|
247 | |
|
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
|
248 | query = xmlnode_get_child_with_namespace(packet, "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
|
249 | "http://jabber.org/protocol/disco#info"); |
|
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
|
250 | |
|
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
|
251 | if (type == JABBER_IQ_RESULT && query) { |
| 8312 | 252 | xmlnode *child; |
| 253 | JabberID *jid; | |
| 254 | JabberBuddy *jb; | |
| 255 | JabberBuddyResource *jbr = NULL; | |
| 256 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 257 | ||
| 258 | if((jid = jabber_id_new(from))) { | |
| 259 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 260 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 261 | jabber_id_free(jid); | |
| 262 | } | |
| 263 | ||
| 264 | if(jbr) | |
| 265 | capabilities = jbr->capabilities; | |
| 266 | ||
|
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
|
267 | for(child = query->child; child; child = child->next) { |
| 8312 | 268 | if(child->type != XMLNODE_TYPE_TAG) |
| 269 | continue; | |
| 270 | ||
| 271 | if(!strcmp(child->name, "identity")) { | |
| 272 | const char *category = xmlnode_get_attrib(child, "category"); | |
| 273 | const char *type = xmlnode_get_attrib(child, "type"); | |
| 274 | if(!category || !type) | |
| 275 | continue; | |
| 276 | ||
| 11675 | 277 | if(!strcmp(category, "conference") && !strcmp(type, "text")) { |
| 278 | /* we found a groupchat or MUC server, add it to the list */ | |
| 279 | /* 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
|
280 | js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from)); |
| 11675 | 281 | } else if(!strcmp(category, "directory") && !strcmp(type, "user")) { |
| 282 | /* 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
|
283 | js->user_directories = g_list_prepend(js->user_directories, g_strdup(from)); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
284 | } else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) { |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
285 | /* 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
|
286 | 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
|
287 | 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
|
288 | |
|
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
|
289 | 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
|
290 | |
|
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
|
291 | 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
|
292 | 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
|
293 | 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
|
294 | |
|
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
|
295 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
296 | "http://jabber.org/protocol/bytestreams"); |
|
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
297 | 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
|
298 | 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
|
299 | jabber_iq_send(iq); |
| 11675 | 300 | } |
| 8312 | 301 | |
| 302 | } else if(!strcmp(child->name, "feature")) { | |
| 303 | const char *var = xmlnode_get_attrib(child, "var"); | |
| 304 | if(!var) | |
| 305 | continue; | |
| 306 | ||
| 307 | if(!strcmp(var, "http://jabber.org/protocol/si")) | |
| 308 | capabilities |= JABBER_CAP_SI; | |
| 309 | else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer")) | |
| 310 | capabilities |= JABBER_CAP_SI_FILE_XFER; | |
| 311 | else if(!strcmp(var, "http://jabber.org/protocol/bytestreams")) | |
| 312 | capabilities |= JABBER_CAP_BYTESTREAMS; | |
| 11675 | 313 | else if(!strcmp(var, "jabber:iq:search")) |
| 314 | capabilities |= JABBER_CAP_IQ_SEARCH; | |
| 315 | else if(!strcmp(var, "jabber:iq:register")) | |
| 316 | capabilities |= JABBER_CAP_IQ_REGISTER; | |
|
26688
e036a4d105c1
Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
317 | else if(!strcmp(var, "urn:xmpp:ping")) |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
318 | capabilities |= JABBER_CAP_PING; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
319 | else if(!strcmp(var, "http://jabber.org/protocol/disco#items")) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
320 | capabilities |= JABBER_CAP_ITEMS; |
|
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
|
321 | else if(!strcmp(var, "http://jabber.org/protocol/commands")) { |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
322 | 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
|
323 | } |
|
24372
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
324 | else if(!strcmp(var, "http://jabber.org/protocol/ibb")) { |
|
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
325 | 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
|
326 | capabilities |= JABBER_CAP_IBB; |
|
830701cec96f
Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <malu@pidgin.im>
parents:
23912
diff
changeset
|
327 | } |
| 8312 | 328 | } |
| 329 | } | |
| 330 | ||
| 331 | capabilities |= JABBER_CAP_RETRIEVED; | |
| 332 | ||
| 333 | if(jbr) | |
| 334 | jbr->capabilities = capabilities; | |
| 335 | ||
|
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
|
336 | jdicd->callback(js, from, capabilities, 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
|
337 | } else { /* type == JABBER_IQ_ERROR or query == NULL */ |
| 8312 | 338 | JabberID *jid; |
| 339 | JabberBuddy *jb; | |
| 340 | JabberBuddyResource *jbr = NULL; | |
| 341 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 342 | ||
| 343 | if((jid = jabber_id_new(from))) { | |
| 344 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 345 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 346 | jabber_id_free(jid); | |
| 347 | } | |
| 348 | ||
| 349 | if(jbr) | |
| 350 | capabilities = jbr->capabilities; | |
| 351 | ||
| 352 | jdicd->callback(js, from, capabilities, jdicd->data); | |
| 353 | } | |
| 354 | } | |
| 355 | ||
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
356 | 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
|
357 | JabberIqType type, const char *id, |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
358 | xmlnode *query) { |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
359 | if(type == JABBER_IQ_GET) { |
| 8312 | 360 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, |
| 361 | "http://jabber.org/protocol/disco#items"); | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26026
diff
changeset
|
362 | |
|
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
|
363 | /* preserve node */ |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
364 | 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
|
365 | 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
|
366 | if(node) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
367 | xmlnode_set_attrib(iq_query,"node",node); |
| 8312 | 368 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
369 | jabber_iq_set_id(iq, id); |
| 8312 | 370 | |
|
25817
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
371 | if (from) |
|
09d6a40a341d
Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents:
25553
diff
changeset
|
372 | xmlnode_set_attrib(iq->node, "to", from); |
| 8312 | 373 | jabber_iq_send(iq); |
| 374 | } | |
| 375 | } | |
| 376 | ||
| 377 | static void | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
378 | jabber_disco_finish_server_info_result_cb(JabberStream *js) |
| 15197 | 379 | { |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
380 | 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
|
381 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18225
diff
changeset
|
382 | 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
|
383 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
384 | if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
385 | /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */ |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
386 | jabber_roster_request(js); |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
387 | } |
| 17421 | 388 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
389 | /* Send initial presence; this will trigger receipt of presence for contacts on the roster */ |
|
18719
7a0465381cea
Fixed errors created by merge conflict resolve mistakes.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
390 | jabber_presence_send(js->gc->account, NULL); |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
391 | |
|
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
|
392 | 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
|
393 | /* 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
|
394 | 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
|
395 | } |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
396 | |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
397 | /* 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
|
398 | 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
|
399 | 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
|
400 | } |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
401 | |
|
23912
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
402 | /* 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
|
403 | 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
|
404 | 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
|
405 | JabberIq *iq; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
406 | JabberBytestreamsStreamhost *sh; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
407 | int i; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
408 | char *tmp; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
409 | 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
|
410 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
411 | 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
|
412 | 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
|
413 | 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
|
414 | continue; |
|
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 | /* 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
|
417 | 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
|
418 | *tmp = '\0'; |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
419 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
420 | 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
|
421 | 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
|
422 | 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
|
423 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
424 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
425 | "http://jabber.org/protocol/bytestreams"); |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
426 | 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
|
427 | 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
|
428 | 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
|
429 | } |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
430 | |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
431 | 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
|
432 | } |
|
8169bfe82e47
Use Service Discovery to look up information about the manually specified FT
Daniel Atallah <datallah@pidgin.im>
parents:
21688
diff
changeset
|
433 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
434 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
435 | |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
436 | struct _disco_data { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
437 | struct jabber_disco_list_data *list_data; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
438 | PurpleDiscoService *parent; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
439 | char *node; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
440 | }; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
441 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
442 | 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
|
443 | 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
|
444 | 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
|
445 | xmlnode *packet, gpointer data) |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
446 | { |
| 17421 | 447 | xmlnode *query, *child; |
| 15197 | 448 | |
|
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
|
449 | if (!from || strcmp(from, js->user->domain)) { |
|
15358
c8179e0a5483
[gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents:
15355
diff
changeset
|
450 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 451 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
452 | } |
| 15197 | 453 | |
|
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
|
454 | if (type == JABBER_IQ_ERROR) { |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
455 | /* 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
|
456 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 457 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
458 | } |
| 15197 | 459 | |
| 460 | query = xmlnode_get_child(packet, "query"); | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
461 | |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
462 | if (!query) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
463 | jabber_disco_finish_server_info_result_cb(js); |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
464 | return; |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
465 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
466 | |
| 17421 | 467 | for (child = xmlnode_get_child(query, "identity"); child; |
| 15197 | 468 | child = xmlnode_get_next_twin(child)) { |
| 469 | const char *category, *type, *name; | |
| 470 | category = xmlnode_get_attrib(child, "category"); | |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17423
diff
changeset
|
471 | type = xmlnode_get_attrib(child, "type"); |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
472 | if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
473 | js->pep = TRUE; |
| 15197 | 474 | if (!category || strcmp(category, "server")) |
| 475 | continue; | |
| 476 | if (!type || strcmp(type, "im")) | |
| 477 | continue; | |
| 17421 | 478 | |
| 15197 | 479 | name = xmlnode_get_attrib(child, "name"); |
| 480 | if (!name) | |
| 481 | continue; | |
| 482 | ||
| 483 | g_free(js->server_name); | |
| 484 | js->server_name = g_strdup(name); | |
|
15587
cbedd543bfae
Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
485 | if (!strcmp(name, "Google Talk")) { |
|
21688
a16385b34219
Implement more of XEP-0065 to support sending files through a proxy. To avoid adding strings this close to a release, it only supports using a proxy that is discovered from the server, but we'll include an account option to manually specify a ft proxy in the next release. Lots of this is based on a patch from galt - Fixes #3730, #116, #1768
Daniel Atallah <datallah@pidgin.im>
parents:
19897
diff
changeset
|
486 | 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
|
487 | 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
|
488 | |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
489 | /* autodiscover stun and relays */ |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
490 | jabber_google_send_jingle_info(js); |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
491 | } else { |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26186
diff
changeset
|
492 | /* TODO: add external service discovery here... */ |
|
15587
cbedd543bfae
Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
493 | } |
| 15197 | 494 | } |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
495 | |
| 17421 | 496 | for (child = xmlnode_get_child(query, "feature"); child; |
| 15225 | 497 | child = xmlnode_get_next_twin(child)) { |
| 498 | const char *var; | |
| 499 | var = xmlnode_get_attrib(child, "var"); | |
| 500 | if (!var) | |
| 501 | continue; | |
| 502 | ||
| 503 | if (!strcmp("google:mail:notify", var)) { | |
| 504 | js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; | |
| 505 | jabber_gmail_init(js); | |
| 15265 | 506 | } else if (!strcmp("google:roster", var)) { |
| 507 | js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; | |
| 508 | jabber_google_roster_init(js); | |
|
17817
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
509 | } else if (!strcmp("http://jabber.org/protocol/commands", var)) { |
|
8e0f271aab78
The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
Andreas Monitzer <am@adiumx.com>
parents:
17816
diff
changeset
|
510 | js->server_caps |= JABBER_CAP_ADHOC; |
|
25290
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
511 | } else if (!strcmp("urn:xmpp:blocking", var)) { |
|
033942580f51
Commit patch #7670: Implement xep-0191 (simple blocking) for jabber protocols
Mark Doliner <markdoliner@pidgin.im>
parents:
23912
diff
changeset
|
512 | js->server_caps |= JABBER_CAP_BLOCKING; |
| 15225 | 513 | } |
| 514 | } | |
| 15265 | 515 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
516 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 517 | } |
| 518 | ||
| 519 | 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
|
520 | 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
|
521 | 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
|
522 | xmlnode *packet, gpointer data) |
| 8312 | 523 | { |
| 524 | xmlnode *query, *child; | |
| 525 | ||
|
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
|
526 | if (!from || strcmp(from, js->user->domain) != 0) |
| 8312 | 527 | return; |
| 528 | ||
|
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
|
529 | if (type == JABBER_IQ_ERROR) |
| 8312 | 530 | return; |
| 531 | ||
| 532 | while(js->chat_servers) { | |
| 533 | g_free(js->chat_servers->data); | |
| 534 | js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); | |
| 535 | } | |
| 536 | ||
| 537 | query = xmlnode_get_child(packet, "query"); | |
| 538 | ||
| 539 | for(child = xmlnode_get_child(query, "item"); child; | |
| 540 | child = xmlnode_get_next_twin(child)) { | |
| 541 | JabberIq *iq; | |
|
17423
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
542 | const char *jid, *node; |
| 8312 | 543 | |
| 544 | if(!(jid = xmlnode_get_attrib(child, "jid"))) | |
| 545 | continue; | |
| 546 | ||
|
17423
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
547 | /* 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
|
548 | * so we won't query them */ |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
549 | if((node = xmlnode_get_attrib(child, "node"))) |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
550 | continue; |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
551 | |
| 8312 | 552 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
| 553 | xmlnode_set_attrib(iq->node, "to", jid); | |
| 554 | jabber_iq_send(iq); | |
| 555 | } | |
| 556 | } | |
| 557 | ||
| 558 | void jabber_disco_items_server(JabberStream *js) | |
| 559 | { | |
| 560 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, | |
| 561 | "http://jabber.org/protocol/disco#items"); | |
| 562 | ||
| 563 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 564 | ||
| 15197 | 565 | jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL); |
| 566 | jabber_iq_send(iq); | |
| 567 | ||
|
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
|
568 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
| 15197 | 569 | xmlnode_set_attrib(iq->node, "to", js->user->domain); |
| 570 | jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL); | |
| 8312 | 571 | jabber_iq_send(iq); |
| 572 | } | |
| 573 | ||
| 574 | void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data) | |
| 575 | { | |
| 576 | JabberID *jid; | |
| 577 | JabberBuddy *jb; | |
| 578 | JabberBuddyResource *jbr = NULL; | |
| 579 | struct _jabber_disco_info_cb_data *jdicd; | |
| 580 | JabberIq *iq; | |
| 581 | ||
| 582 | if((jid = jabber_id_new(who))) { | |
| 583 | if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE))) | |
| 584 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 585 | jabber_id_free(jid); | |
| 586 | } | |
| 587 | ||
| 588 | if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) { | |
| 589 | callback(js, who, jbr->capabilities, data); | |
| 590 | return; | |
| 591 | } | |
| 592 | ||
| 593 | jdicd = g_new0(struct _jabber_disco_info_cb_data, 1); | |
| 594 | jdicd->data = data; | |
| 595 | jdicd->callback = callback; | |
| 596 | ||
| 597 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); | |
| 598 | xmlnode_set_attrib(iq->node, "to", who); | |
| 599 | ||
|
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
|
600 | jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd); |
| 8312 | 601 | jabber_iq_send(iq); |
| 602 | } | |
| 603 | ||
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
604 | static void |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
605 | jabber_disco_list_data_destroy(struct jabber_disco_list_data *data) |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
606 | { |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
607 | g_free(data->server); |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
608 | g_free(data); |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
609 | } |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
610 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
611 | static void |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
612 | disco_proto_data_destroy_cb(PurpleDiscoList *list) |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
613 | { |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
614 | struct jabber_disco_list_data *data; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
615 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
616 | data = purple_disco_list_get_protocol_data(list); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
617 | jabber_disco_list_data_destroy(data); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
618 | } |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
619 | |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
620 | static PurpleDiscoServiceType |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
621 | jabber_disco_category_from_string(const gchar *str) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
622 | { |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
623 | if (!g_ascii_strcasecmp(str, "gateway")) |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
624 | return PURPLE_DISCO_SERVICE_TYPE_GATEWAY; |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
625 | else if (!g_ascii_strcasecmp(str, "directory")) |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
626 | return PURPLE_DISCO_SERVICE_TYPE_DIRECTORY; |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
627 | else if (!g_ascii_strcasecmp(str, "conference")) |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
628 | return PURPLE_DISCO_SERVICE_TYPE_CHAT; |
| 8312 | 629 | |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
630 | return PURPLE_DISCO_SERVICE_TYPE_OTHER; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
631 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
632 | |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
633 | static const gchar * |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
634 | jabber_disco_type_from_string(const gchar *str) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
635 | { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
636 | if (!strcasecmp(str, "xmpp")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
637 | return "jabber"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
638 | else if (!strcasecmp(str, "icq")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
639 | return "icq"; |
|
26584
15b6fba6b2f7
'mrim' is the mail.ru IM service. 'smtp' is an XMPP<>email gateway
Paul Aurich <darkrain42@pidgin.im>
parents:
26583
diff
changeset
|
640 | else if (!strcasecmp(str, "smtp")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
641 | return "smtp"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
642 | else if (!strcasecmp(str, "yahoo")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
643 | return "yahoo"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
644 | else if (!strcasecmp(str, "irc")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
645 | return "irc"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
646 | else if (!strcasecmp(str, "gadu-gadu")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
647 | return "gg"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
648 | else if (!strcasecmp(str, "aim")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
649 | return "aim"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
650 | else if (!strcasecmp(str, "qq")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
651 | return "qq"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
652 | else if (!strcasecmp(str, "msn")) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
653 | return "msn"; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
654 | |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
655 | /* fallback to the string itself */ |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
656 | return str; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
657 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
658 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
659 | static void |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
660 | jabber_disco_service_info_cb(JabberStream *js, const char *from, |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
661 | JabberIqType type, const char *id, |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
662 | xmlnode *packet, gpointer data); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
663 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
664 | static void |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
665 | jabber_disco_service_items_cb(JabberStream *js, const char *who, const char *node, |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
666 | GSList *items, gpointer data) |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
667 | { |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
668 | GSList *l; |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
669 | struct _disco_data *disco_data; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
670 | struct jabber_disco_list_data *list_data; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
671 | PurpleDiscoList *list; |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
672 | PurpleDiscoService *parent; |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
673 | const char *parent_node; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
674 | gboolean has_items = FALSE; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
675 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
676 | disco_data = data; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
677 | list_data = disco_data->list_data; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
678 | list = list_data->list; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
679 | |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
680 | --list_data->fetch_count; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
681 | |
|
26592
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
682 | if (list_data->list == NULL) { |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
683 | if (list_data->fetch_count == 0) |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
684 | jabber_disco_list_data_destroy(list_data); |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
685 | |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
686 | return; |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
687 | } |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
688 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
689 | if (items == NULL) { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
690 | if (list_data->fetch_count == 0) |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
691 | purple_disco_list_set_in_progress(list, FALSE); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
692 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
693 | purple_disco_list_unref(list); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
694 | return; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
695 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
696 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
697 | parent = disco_data->parent; |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
698 | parent_node = disco_data->node; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
699 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
700 | for (l = items; l; l = l->next) { |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
701 | JabberDiscoItem *item = l->data; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
702 | JabberIq *iq; |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
703 | struct _disco_data *req_data; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
704 | char *full_node; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
705 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
706 | if (parent_node) { |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
707 | if (item->node) { |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
708 | full_node = g_strdup_printf("%s/%s", parent_node, item->node); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
709 | } else { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
710 | continue; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
711 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
712 | } else { |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
713 | full_node = g_strdup(item->node); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
714 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
715 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
716 | req_data = g_new0(struct _disco_data, 1); |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
717 | req_data->list_data = list_data; |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
718 | req_data->parent = parent; |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
719 | req_data->node = full_node; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
720 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
721 | has_items = TRUE; |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
722 | |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
723 | ++list_data->fetch_count; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
724 | purple_disco_list_ref(list); |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
725 | |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
726 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
727 | xmlnode_set_attrib(iq->node, "to", item->jid); |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
728 | if (full_node) |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
729 | xmlnode_set_attrib(xmlnode_get_child(iq->node, "query"), |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
730 | "node", full_node); |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
731 | jabber_iq_set_callback(iq, jabber_disco_service_info_cb, req_data); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
732 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
733 | jabber_iq_send(iq); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
734 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
735 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
736 | g_slist_foreach(items, (GFunc)jabber_disco_item_free, NULL); |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
737 | g_slist_free(items); |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
738 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
739 | if (list_data->fetch_count == 0) |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
740 | purple_disco_list_set_in_progress(list, FALSE); |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
741 | |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
742 | purple_disco_list_unref(list); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
743 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
744 | g_free(disco_data->node); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
745 | g_free(disco_data); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
746 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
747 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
748 | static void |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
749 | jabber_disco_service_info_cb(JabberStream *js, const char *from, |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
750 | JabberIqType type, const char *id, |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
751 | xmlnode *packet, gpointer data) |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
752 | { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
753 | struct _disco_data *disco_data = data; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
754 | struct jabber_disco_list_data *list_data; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
755 | PurpleDiscoList *list; |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
756 | PurpleDiscoService *parent; |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
757 | char *node; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
758 | xmlnode *query, *ident, *child; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
759 | const char *acat, *atype, *adesc, *anode; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
760 | char *aname; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
761 | PurpleDiscoService *s; |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
762 | PurpleDiscoServiceType service_type; |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
763 | const char *gateway_type = NULL; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
764 | PurpleDiscoServiceFlags flags = PURPLE_DISCO_ADD; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
765 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
766 | list_data = disco_data->list_data; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
767 | list = list_data->list; |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
768 | parent = disco_data->parent; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
769 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
770 | node = disco_data->node; |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
771 | disco_data->node = NULL; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
772 | g_free(disco_data); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
773 | |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
774 | --list_data->fetch_count; |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
775 | |
|
26592
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
776 | if (list_data->list == NULL) { |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
777 | if (list_data->fetch_count == 0) |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
778 | jabber_disco_list_data_destroy(list_data); |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
779 | |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
780 | return; |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
781 | } |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
782 | |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
783 | if (!from || type == JABBER_IQ_ERROR |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
784 | || (!(query = xmlnode_get_child(packet, "query"))) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
785 | || (!(ident = xmlnode_get_child(query, "identity")))) { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
786 | if (list_data->fetch_count == 0) |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
787 | purple_disco_list_set_in_progress(list, FALSE); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
788 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
789 | purple_disco_list_unref(list); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
790 | return; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
791 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
792 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
793 | acat = xmlnode_get_attrib(ident, "category"); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
794 | atype = xmlnode_get_attrib(ident, "type"); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
795 | adesc = xmlnode_get_attrib(ident, "name"); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
796 | anode = xmlnode_get_attrib(query, "node"); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
797 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
798 | if (anode) { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
799 | aname = g_new0(char, strlen(from) + strlen(anode) + 1); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
800 | strcat(aname, from); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
801 | strcat(aname, anode); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
802 | } else { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
803 | aname = g_strdup(from); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
804 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
805 | |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
806 | service_type = jabber_disco_category_from_string(acat); |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
807 | if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
808 | gateway_type = jabber_disco_type_from_string(atype); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
809 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
810 | for (child = xmlnode_get_child(query, "feature"); child; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
811 | child = xmlnode_get_next_twin(child)) { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
812 | const char *var; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
813 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
814 | if (!(var = xmlnode_get_attrib(child, "var"))) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
815 | continue; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
816 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
817 | if (!strcmp(var, "jabber:iq:register")) |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
818 | flags |= PURPLE_DISCO_REGISTER; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
819 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
820 | if (!strcmp(var, "http://jabber.org/protocol/disco#items")) |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
821 | flags |= PURPLE_DISCO_BROWSE; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
822 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
823 | if (!strcmp(var, "http://jabber.org/protocol/muc")) |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
824 | service_type = PURPLE_DISCO_SERVICE_TYPE_CHAT; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
825 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
826 | |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
827 | purple_debug_info("disco", "service %s, category %s (%d), type %s (%s), description %s, flags %04x\n", |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
828 | aname, |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
829 | acat, service_type, |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
830 | atype, gateway_type ? gateway_type : "(null)", |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
831 | adesc, flags); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
832 | |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
833 | s = purple_disco_list_service_new(service_type, aname, adesc, flags); |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
834 | if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY) |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
835 | purple_disco_service_set_gateway_type(s, gateway_type); |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26595
diff
changeset
|
836 | |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
837 | purple_disco_list_service_add(list, s, parent); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
838 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
839 | /* if (flags & PURPLE_DISCO_FLAG_BROWSE) - not all browsable services has this future */ |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
840 | { |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
841 | ++list_data->fetch_count; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
842 | purple_disco_list_ref(list); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
843 | disco_data = g_new0(struct _disco_data, 1); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
844 | disco_data->list_data = list_data; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
845 | disco_data->parent = s; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
846 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
847 | jabber_disco_items_do(js, from, node, jabber_disco_service_items_cb, |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
848 | disco_data); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
849 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
850 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
851 | if (list_data->fetch_count == 0) |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
852 | purple_disco_list_set_in_progress(list, FALSE); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
853 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
854 | purple_disco_list_unref(list); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
855 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
856 | g_free(aname); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
857 | g_free(node); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
858 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
859 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
860 | static void |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
861 | jabber_disco_server_items_cb(JabberStream *js, const char *from, |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
862 | JabberIqType type, const char *id, |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
863 | xmlnode *packet, gpointer data) |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
864 | { |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
865 | struct jabber_disco_list_data *list_data; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
866 | xmlnode *query, *child; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
867 | gboolean has_items = FALSE; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
868 | |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
869 | if (!from || type == JABBER_IQ_ERROR) |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
870 | return; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
871 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
872 | list_data = data; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
873 | --list_data->fetch_count; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
874 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
875 | if (list_data->list == NULL) { |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
876 | if (list_data->fetch_count == 0) |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
877 | jabber_disco_list_data_destroy(list_data); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
878 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
879 | return; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
880 | } |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
881 | |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
882 | query = xmlnode_get_child(packet, "query"); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
883 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
884 | for(child = xmlnode_get_child(query, "item"); child; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
885 | child = xmlnode_get_next_twin(child)) { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
886 | JabberIq *iq; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
887 | const char *jid; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
888 | struct _disco_data *disco_data; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
889 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
890 | if(!(jid = xmlnode_get_attrib(child, "jid"))) |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
891 | continue; |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
892 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
893 | disco_data = g_new0(struct _disco_data, 1); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
894 | disco_data->list_data = list_data; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
895 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
896 | has_items = TRUE; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
897 | ++list_data->fetch_count; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
898 | purple_disco_list_ref(list_data->list); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
899 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
900 | xmlnode_set_attrib(iq->node, "to", jid); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
901 | jabber_iq_set_callback(iq, jabber_disco_service_info_cb, disco_data); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
902 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
903 | jabber_iq_send(iq); |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
904 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
905 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
906 | if (!has_items) |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
907 | purple_disco_list_set_in_progress(list_data->list, FALSE); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
908 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
909 | purple_disco_list_unref(list_data->list); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
910 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
911 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
912 | static void |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
913 | jabber_disco_server_info_cb(JabberStream *js, const char *who, JabberCapabilities caps, gpointer data) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
914 | { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
915 | struct jabber_disco_list_data *list_data; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
916 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
917 | list_data = data; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
918 | --list_data->fetch_count; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
919 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
920 | if (!list_data->list) { |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
921 | purple_disco_list_unref(list_data->list); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
922 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
923 | if (list_data->fetch_count == 0) |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
924 | jabber_disco_list_data_destroy(list_data); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
925 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
926 | return; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
927 | } |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
928 | |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
929 | if (caps & JABBER_CAP_ITEMS) { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
930 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items"); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
931 | xmlnode_set_attrib(iq->node, "to", who); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
932 | jabber_iq_set_callback(iq, jabber_disco_server_items_cb, list_data); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
933 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
934 | ++list_data->fetch_count; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
935 | purple_disco_list_ref(list_data->list); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
936 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
937 | jabber_iq_send(iq); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
938 | } else { |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
939 | purple_notify_error(NULL, _("Error"), _("Server doesn't support service discovery"), NULL); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
940 | purple_disco_list_set_in_progress(list_data->list, FALSE); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
941 | } |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
942 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
943 | purple_disco_list_unref(list_data->list); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
944 | } |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
945 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
946 | static void discolist_cancel_cb(struct jabber_disco_list_data *list_data, const char *server) |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
947 | { |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
948 | purple_disco_list_set_in_progress(list_data->list, FALSE); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
949 | purple_disco_list_unref(list_data->list); |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
950 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
951 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
952 | static void discolist_ok_cb(struct jabber_disco_list_data *list_data, const char *server) |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
953 | { |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
954 | JabberStream *js; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
955 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
956 | js = list_data->js; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
957 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
958 | if (!server || !*server) { |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
959 | purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
960 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
961 | purple_disco_list_set_in_progress(list_data->list, FALSE); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
962 | purple_disco_list_unref(list_data->list); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
963 | return; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
964 | } |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
965 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
966 | list_data->server = g_strdup(server); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
967 | if (js->last_disco_server) |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
968 | g_free(js->last_disco_server); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
969 | js->last_disco_server = g_strdup(server); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
970 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
971 | purple_disco_list_set_in_progress(list_data->list, TRUE); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
972 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
973 | ++list_data->fetch_count; |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
974 | jabber_disco_info_do(js, list_data->server, jabber_disco_server_info_cb, list_data); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
975 | } |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
976 | |
|
26908
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
977 | static void |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
978 | jabber_disco_cancel(PurpleDiscoList *list) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
979 | { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
980 | struct jabber_disco_list_data *list_data = purple_disco_list_get_protocol_data(list); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
981 | purple_disco_list_set_protocol_data(list, NULL, NULL); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
982 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
983 | if (list_data->fetch_count == 0) { |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
984 | /* Nothing outstanding, just free it now... */ |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
985 | jabber_disco_list_data_destroy(list_data); |
|
26592
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
986 | } else { |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
987 | int i; |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
988 | /* Lose all our references to the PurpleDiscoList */ |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
989 | for (i = 0; i < list_data->fetch_count; ++i) { |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
990 | purple_disco_list_unref(list); |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
991 | } |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
992 | |
|
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
993 | /* We'll free list_data when fetch_count is down to 0 */ |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26589
diff
changeset
|
994 | list_data->list = NULL; |
|
26592
2ffecd246bfb
Clean up Jabber's references and protocol_data if the window is closed
Paul Aurich <darkrain42@pidgin.im>
parents:
26591
diff
changeset
|
995 | } |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
996 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
997 | |
|
26908
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
998 | static void |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
999 | jabber_disco_service_register(PurpleConnection *gc, PurpleDiscoService *service) |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1000 | { |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
1001 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
1002 | |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26586
diff
changeset
|
1003 | jabber_register_gateway(js, purple_disco_service_get_name(service)); |
|
26908
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1004 | } |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1005 | |
|
26908
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1006 | |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1007 | PurpleDiscoList * |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1008 | jabber_disco_get_list(PurpleConnection *gc) |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1009 | { |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1010 | PurpleAccount *account; |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1011 | PurpleDiscoList *list; |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1012 | JabberStream *js; |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1013 | struct jabber_disco_list_data *disco_list_data; |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1014 | |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1015 | account = purple_connection_get_account(gc); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1016 | js = purple_connection_get_protocol_data(gc); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1017 | |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1018 | /* We start with a ref */ |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1019 | list = purple_disco_list_new(account); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1020 | |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1021 | disco_list_data = g_new0(struct jabber_disco_list_data, 1); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1022 | disco_list_data->list = list; |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1023 | disco_list_data->js = js; |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1024 | purple_disco_list_set_protocol_data(list, disco_list_data, disco_proto_data_destroy_cb); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1025 | purple_disco_list_set_cancel_func(list, jabber_disco_cancel); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1026 | purple_disco_list_set_register_func(list, jabber_disco_service_register); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1027 | |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1028 | purple_request_input(gc, _("Server name request"), _("Enter an XMPP Server"), |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1029 | _("Select an XMPP server to query"), |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1030 | js->last_disco_server ? js->last_disco_server : js->user->domain, |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1031 | FALSE, FALSE, NULL, |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1032 | _("Find Services"), PURPLE_CALLBACK(discolist_ok_cb), |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1033 | _("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb), |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1034 | account, NULL, NULL, disco_list_data); |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1035 | |
|
e292ff5a9311
Use per-PurpleDiscoList ops for canceling a disco and registering.
Paul Aurich <darkrain42@pidgin.im>
parents:
26907
diff
changeset
|
1036 | return list; |
|
26583
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1037 | } |
|
e115c7ef2fcf
Applied disco-2.patch from nops with some modifications:
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1038 | |
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1039 | static void |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
1040 | jabber_disco_items_cb(JabberStream *js, const char *from, JabberIqType type, |
|
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
1041 | const char *id, xmlnode *packet, gpointer data) |
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1042 | { |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1043 | struct _jabber_disco_items_cb_data *jdicd; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1044 | xmlnode *query, *child; |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1045 | const char *node = NULL; |
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1046 | GSList *items = NULL; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1047 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1048 | jdicd = data; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1049 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1050 | query = xmlnode_get_child(packet, "query"); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1051 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1052 | if (query) |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1053 | node = xmlnode_get_attrib(query, "node"); |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1054 | |
|
26907
82a97da31ee2
Fix merge (convert to IQ-handlers syntax)
Paul Aurich <darkrain42@pidgin.im>
parents:
26741
diff
changeset
|
1055 | if (!from || !query || type == JABBER_IQ_ERROR) { |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1056 | jdicd->callback(js, from, node, NULL, jdicd->data); |
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1057 | g_free(jdicd); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1058 | return; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1059 | } |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1060 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1061 | for (child = xmlnode_get_child(query, "item"); child; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1062 | child = xmlnode_get_next_twin(child)) { |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1063 | JabberDiscoItem *item; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1064 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1065 | item = g_new0(JabberDiscoItem, 1); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1066 | item->jid = g_strdup(xmlnode_get_attrib(child, "jid")); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1067 | item->node = g_strdup(xmlnode_get_attrib(child, "node")); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1068 | item->name = g_strdup(xmlnode_get_attrib(child, "name")); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1069 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1070 | items = g_slist_prepend(items, item); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1071 | } |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1072 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1073 | items = g_slist_reverse(items); |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1074 | jdicd->callback(js, from, node, items, jdicd->data); |
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1075 | g_free(jdicd); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1076 | } |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1077 | |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1078 | void jabber_disco_items_do(JabberStream *js, const char *who, const char *node, |
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1079 | JabberDiscoItemsCallback *callback, gpointer data) |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1080 | { |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1081 | struct _jabber_disco_items_cb_data *jdicd; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1082 | JabberIq *iq; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1083 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1084 | jdicd = g_new0(struct _jabber_disco_items_cb_data, 1); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1085 | jdicd->data = data; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1086 | jdicd->callback = callback; |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1087 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1088 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items"); |
|
26595
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1089 | if (node) |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1090 | xmlnode_set_attrib(xmlnode_get_child(iq->node, "query"), "node", node); |
|
f306ea83cb90
Add a node parameter to jabber_disco_items_do and use it in the new disco-listing code.
Paul Aurich <darkrain42@pidgin.im>
parents:
26594
diff
changeset
|
1091 | |
|
26594
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1092 | xmlnode_set_attrib(iq->node, "to", who); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1093 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1094 | jabber_iq_set_callback(iq, jabber_disco_items_cb, jdicd); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1095 | jabber_iq_send(iq); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1096 | } |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1097 | |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1098 | void jabber_disco_item_free(JabberDiscoItem *item) |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1099 | { |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1100 | g_free((char *)item->jid); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1101 | g_free((char *)item->node); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1102 | g_free((char *)item->name); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1103 | g_free(item); |
|
73f09a0501f4
jabber_disco_items_do(), which functions like jabber_disco_info_do.
Paul Aurich <darkrain42@pidgin.im>
parents:
26593
diff
changeset
|
1104 | } |