annotate src/protocols/jabber/disco.c @ 13702:782ad942092d

[gaim-migrate @ 16105] i like code that compiles committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 29 Apr 2006 14:51:36 +0000
parents d7ace957fcf8
children 25e63008d3bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /*
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * gaim - Jabber Protocol Plugin
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * (at your option) any later version.
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 *
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 */
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 #include "internal.h"
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 #include "prefs.h"
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 #include "buddy.h"
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include "iq.h"
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 #include "disco.h"
13384
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
28 #include "jabber.h"
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 struct _jabber_disco_info_cb_data {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 gpointer data;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33 JabberDiscoInfoCallback *callback;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 };
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36 #define SUPPORT_FEATURE(x) \
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 feature = xmlnode_new_child(query, "feature"); \
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 xmlnode_set_attrib(feature, "var", x);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 const char *from = xmlnode_get_attrib(packet, "from");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43 const char *type = xmlnode_get_attrib(packet, "type");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 if(!from || !type)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 return;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 if(!strcmp(type, "get")) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49 xmlnode *query, *identity, *feature;
13384
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
50 JabberIq *iq;
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
51
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
52 xmlnode *in_query;
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
53 const char *node = NULL;
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
54
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
55 if((in_query = xmlnode_get_child(packet, "query"))) {
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
56 node = xmlnode_get_attrib(in_query, "node");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
57 }
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
58
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
59
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
60 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61 "http://jabber.org/protocol/disco#info");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
62
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
63 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id"));
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
64
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
65 xmlnode_set_attrib(iq->node, "to", from);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
66 query = xmlnode_get_child(iq->node, "query");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
67
13384
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
68 if(node)
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
69 xmlnode_set_attrib(query, "node", node);
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
70
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
71 if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) {
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
72
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
73 identity = xmlnode_new_child(query, "identity");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
74 xmlnode_set_attrib(identity, "category", "client");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
75 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console,
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
76 * handheld, pc, phone,
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
77 * web */
13702
782ad942092d [gaim-migrate @ 16105]
Nathan Walp <nwalp@pidgin.im>
parents: 13701
diff changeset
78 xmlnode_set_attrib(identity, "name", PACKAGE);
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
79
13384
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
80 SUPPORT_FEATURE("jabber:iq:last")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
81 SUPPORT_FEATURE("jabber:iq:oob")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
82 SUPPORT_FEATURE("jabber:iq:time")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
83 SUPPORT_FEATURE("jabber:iq:version")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
84 SUPPORT_FEATURE("jabber:x:conference")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
85 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
86 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
87 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items")
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 #if 0
13384
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
89 SUPPORT_FEATURE("http://jabber.org/protocol/ibb")
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90 #endif
13384
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
91 SUPPORT_FEATURE("http://jabber.org/protocol/muc")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
92 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
93 SUPPORT_FEATURE("http://jabber.org/protocol/si")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
94 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
95 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im")
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
96 } else {
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
97 xmlnode *error, *inf;
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
98
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
99 /* XXX: gross hack, implement jabber_iq_set_type or something */
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
100 xmlnode_set_attrib(iq->node, "type", "error");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
101 iq->type = JABBER_IQ_ERROR;
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
102
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
103 error = xmlnode_new_child(query, "error");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
104 xmlnode_set_attrib(error, "code", "404");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
105 xmlnode_set_attrib(error, "type", "cancel");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
106 inf = xmlnode_new_child(error, "item-not-found");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
107 xmlnode_set_attrib(inf, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas");
a580ffe73314 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 11675
diff changeset
108 }
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110 jabber_iq_send(iq);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
111 } else if(!strcmp(type, "result")) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
112 xmlnode *query = xmlnode_get_child(packet, "query");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
113 xmlnode *child;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
114 JabberID *jid;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
115 JabberBuddy *jb;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
116 JabberBuddyResource *jbr = NULL;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
117 JabberCapabilities capabilities = JABBER_CAP_NONE;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
118 struct _jabber_disco_info_cb_data *jdicd;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
119
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120 if((jid = jabber_id_new(from))) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
122 jbr = jabber_buddy_find_resource(jb, jid->resource);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
123 jabber_id_free(jid);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
124 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
125
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
126 if(jbr)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
127 capabilities = jbr->capabilities;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
128
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
129 for(child = query->child; child; child = child->next) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
130 if(child->type != XMLNODE_TYPE_TAG)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
131 continue;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
132
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
133 if(!strcmp(child->name, "identity")) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
134 const char *category = xmlnode_get_attrib(child, "category");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 const char *type = xmlnode_get_attrib(child, "type");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
136 if(!category || !type)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 continue;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
138
11675
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
139 if(!strcmp(category, "conference") && !strcmp(type, "text")) {
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
140 /* we found a groupchat or MUC server, add it to the list */
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
141 /* XXX: actually check for protocol/muc or gc-1.0 support */
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
142 js->chat_servers = g_list_append(js->chat_servers, g_strdup(from));
11675
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
143 } else if(!strcmp(category, "directory") && !strcmp(type, "user")) {
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
144 /* we found a JUD */
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
145 js->user_directories = g_list_append(js->user_directories, g_strdup(from));
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
146 }
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
147
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
148 } else if(!strcmp(child->name, "feature")) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
149 const char *var = xmlnode_get_attrib(child, "var");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
150 if(!var)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
151 continue;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153 if(!strcmp(var, "http://jabber.org/protocol/si"))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154 capabilities |= JABBER_CAP_SI;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
155 else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer"))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
156 capabilities |= JABBER_CAP_SI_FILE_XFER;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
157 else if(!strcmp(var, "http://jabber.org/protocol/bytestreams"))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
158 capabilities |= JABBER_CAP_BYTESTREAMS;
11675
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
159 else if(!strcmp(var, "jabber:iq:search"))
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
160 capabilities |= JABBER_CAP_IQ_SEARCH;
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
161 else if(!strcmp(var, "jabber:iq:register"))
828802f2251b [gaim-migrate @ 13961]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
162 capabilities |= JABBER_CAP_IQ_REGISTER;
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
163 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
164 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
165
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
166 capabilities |= JABBER_CAP_RETRIEVED;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
167
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
168 if(jbr)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
169 jbr->capabilities = capabilities;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
170
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
171 if((jdicd = g_hash_table_lookup(js->disco_callbacks, from))) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
172 jdicd->callback(js, from, capabilities, jdicd->data);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
173 g_hash_table_remove(js->disco_callbacks, from);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
174 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
175 } else if(!strcmp(type, "error")) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
176 JabberID *jid;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
177 JabberBuddy *jb;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
178 JabberBuddyResource *jbr = NULL;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
179 JabberCapabilities capabilities = JABBER_CAP_NONE;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
180 struct _jabber_disco_info_cb_data *jdicd;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
181
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
182 if(!(jdicd = g_hash_table_lookup(js->disco_callbacks, from)))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
183 return;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
184
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
185 if((jid = jabber_id_new(from))) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
186 if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE)))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
187 jbr = jabber_buddy_find_resource(jb, jid->resource);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
188 jabber_id_free(jid);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
189 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
190
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
191 if(jbr)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
192 capabilities = jbr->capabilities;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
193
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
194 jdicd->callback(js, from, capabilities, jdicd->data);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
195 g_hash_table_remove(js->disco_callbacks, from);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
196 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
197 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
198
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
199 void jabber_disco_items_parse(JabberStream *js, xmlnode *packet) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
200 const char *from = xmlnode_get_attrib(packet, "from");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
201 const char *type = xmlnode_get_attrib(packet, "type");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
202
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 if(!strcmp(type, "get")) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205 "http://jabber.org/protocol/disco#items");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
207 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id"));
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
208
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209 xmlnode_set_attrib(iq->node, "to", from);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
210 jabber_iq_send(iq);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
211 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
214 static void
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
215 jabber_disco_server_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 xmlnode *query, *child;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218 const char *from = xmlnode_get_attrib(packet, "from");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 const char *type = xmlnode_get_attrib(packet, "type");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221 if(!from || !type)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 return;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224 if(strcmp(from, js->user->domain))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225 return;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227 if(strcmp(type, "result"))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 return;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
230 while(js->chat_servers) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
231 g_free(js->chat_servers->data);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
232 js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
233 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
234
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
235 query = xmlnode_get_child(packet, "query");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
236
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
237 for(child = xmlnode_get_child(query, "item"); child;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
238 child = xmlnode_get_next_twin(child)) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
239 JabberIq *iq;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
240 const char *jid;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
242 if(!(jid = xmlnode_get_attrib(child, "jid")))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
243 continue;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
245 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
246 xmlnode_set_attrib(iq->node, "to", jid);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
247 jabber_iq_send(iq);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
248 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
249 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
250
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
251 void jabber_disco_items_server(JabberStream *js)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
252 {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
253 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
254 "http://jabber.org/protocol/disco#items");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
255
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
256 xmlnode_set_attrib(iq->node, "to", js->user->domain);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
257
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
258 jabber_iq_set_callback(iq, jabber_disco_server_result_cb, NULL);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
259 jabber_iq_send(iq);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
260 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
261
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
262 void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data)
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263 {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264 JabberID *jid;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265 JabberBuddy *jb;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266 JabberBuddyResource *jbr = NULL;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
267 struct _jabber_disco_info_cb_data *jdicd;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
268 JabberIq *iq;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
269
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
270 if((jid = jabber_id_new(who))) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
271 if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE)))
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
272 jbr = jabber_buddy_find_resource(jb, jid->resource);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
273 jabber_id_free(jid);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
274 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
275
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
276 if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) {
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
277 callback(js, who, jbr->capabilities, data);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
278 return;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
280
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
281 jdicd = g_new0(struct _jabber_disco_info_cb_data, 1);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
282 jdicd->data = data;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
283 jdicd->callback = callback;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
284
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
285 g_hash_table_insert(js->disco_callbacks, g_strdup(who), jdicd);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
286
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
287 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
288 xmlnode_set_attrib(iq->node, "to", who);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
289
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
290 jabber_iq_send(iq);
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
291 }
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
292
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
293