Mon, 10 Sep 2007 13:57:15 +0000
merge of 'b0586b3697e8044ccd62a369b0c0f9125b2ef732'
and 'dcb0081acd70c340b0592fcf855418558338af99'
| 8312 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 8312 | 3 | * |
| 4 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8312 | 19 | * |
| 20 | */ | |
| 21 | ||
| 22 | #include "internal.h" | |
| 23 | #include "prefs.h" | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
24 | #include "debug.h" |
| 8312 | 25 | |
| 26 | #include "buddy.h" | |
| 15225 | 27 | #include "google.h" |
| 8312 | 28 | #include "iq.h" |
| 29 | #include "disco.h" | |
| 13385 | 30 | #include "jabber.h" |
|
15344
34b7f4e55861
[gaim-migrate @ 18072]
Evan Schoenberg <evands@pidgin.im>
parents:
15323
diff
changeset
|
31 | #include "presence.h" |
| 15265 | 32 | #include "roster.h" |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17423
diff
changeset
|
33 | #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
|
34 | #include "adhoccommands.h" |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
35 | |
| 8312 | 36 | |
| 37 | struct _jabber_disco_info_cb_data { | |
| 38 | gpointer data; | |
| 39 | JabberDiscoInfoCallback *callback; | |
| 40 | }; | |
| 41 | ||
|
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
|
42 | #define SUPPORT_FEATURE(x) { \ |
| 8312 | 43 | 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
|
44 | 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
|
45 | } |
| 8312 | 46 | |
| 47 | ||
| 48 | void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) { | |
| 49 | const char *from = xmlnode_get_attrib(packet, "from"); | |
| 50 | const char *type = xmlnode_get_attrib(packet, "type"); | |
| 51 | ||
| 52 | if(!from || !type) | |
| 53 | return; | |
| 54 | ||
| 55 | if(!strcmp(type, "get")) { | |
| 56 | xmlnode *query, *identity, *feature; | |
| 13385 | 57 | JabberIq *iq; |
| 58 | ||
| 59 | xmlnode *in_query; | |
| 60 | const char *node = NULL; | |
| 61 | ||
| 62 | if((in_query = xmlnode_get_child(packet, "query"))) { | |
| 63 | node = xmlnode_get_attrib(in_query, "node"); | |
| 64 | } | |
| 65 | ||
| 66 | ||
| 67 | iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, | |
| 8312 | 68 | "http://jabber.org/protocol/disco#info"); |
| 69 | ||
| 70 | jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id")); | |
| 71 | ||
| 72 | xmlnode_set_attrib(iq->node, "to", from); | |
| 73 | query = xmlnode_get_child(iq->node, "query"); | |
| 74 | ||
| 13385 | 75 | if(node) |
| 76 | xmlnode_set_attrib(query, "node", node); | |
| 77 | ||
| 78 | if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) { | |
| 79 | identity = xmlnode_new_child(query, "identity"); | |
| 80 | xmlnode_set_attrib(identity, "category", "client"); | |
| 81 | xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console, | |
| 82 | * handheld, pc, phone, | |
| 83 | * web */ | |
| 13704 | 84 | xmlnode_set_attrib(identity, "name", PACKAGE); |
| 8312 | 85 | |
| 13385 | 86 | SUPPORT_FEATURE("jabber:iq:last") |
| 87 | SUPPORT_FEATURE("jabber:iq:oob") | |
| 88 | SUPPORT_FEATURE("jabber:iq:time") | |
|
18317
6c814e134e56
support replying to XEP-0202 queries
Nathan Walp <nwalp@pidgin.im>
parents:
18235
diff
changeset
|
89 | SUPPORT_FEATURE("xmpp:urn:time") |
| 13385 | 90 | SUPPORT_FEATURE("jabber:iq:version") |
| 91 | SUPPORT_FEATURE("jabber:x:conference") | |
| 92 | SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams") | |
| 93 | SUPPORT_FEATURE("http://jabber.org/protocol/disco#info") | |
| 94 | SUPPORT_FEATURE("http://jabber.org/protocol/disco#items") | |
| 8312 | 95 | #if 0 |
| 13385 | 96 | SUPPORT_FEATURE("http://jabber.org/protocol/ibb") |
| 8312 | 97 | #endif |
| 13385 | 98 | SUPPORT_FEATURE("http://jabber.org/protocol/muc") |
| 99 | SUPPORT_FEATURE("http://jabber.org/protocol/muc#user") | |
| 100 | SUPPORT_FEATURE("http://jabber.org/protocol/si") | |
| 101 | SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer") | |
| 102 | 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
|
103 | SUPPORT_FEATURE("urn:xmpp:ping") |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
104 | SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns") |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
105 | |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
106 | 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
|
107 | 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
|
108 | 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
|
109 | 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
|
110 | 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
|
111 | 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
|
112 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
113 | } |
| 13385 | 114 | } 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
|
115 | 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
|
116 | 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
|
117 | 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
|
118 | 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
|
119 | /* 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
|
120 | 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
|
121 | /* 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
|
122 | 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
|
123 | 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
|
124 | 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
|
125 | 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
|
126 | else |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
127 | break; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
128 | } 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
|
129 | break; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
130 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
131 | |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
132 | 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
|
133 | /* 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
|
134 | 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
|
135 | 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
|
136 | 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
|
137 | 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
|
138 | 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
|
139 | 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
|
140 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
141 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
142 | 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
|
143 | 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
|
144 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
145 | } |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
146 | |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
147 | 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
|
148 | xmlnode *error, *inf; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
149 | |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
150 | /* 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
|
151 | 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
|
152 | iq->type = JABBER_IQ_ERROR; |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
153 | |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18719
diff
changeset
|
154 | 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
|
155 | 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
|
156 | 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
|
157 | 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
|
158 | 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
|
159 | } |
| 13385 | 160 | } |
| 8312 | 161 | |
| 162 | jabber_iq_send(iq); | |
| 163 | } else if(!strcmp(type, "result")) { | |
| 164 | xmlnode *query = xmlnode_get_child(packet, "query"); | |
| 165 | xmlnode *child; | |
| 166 | JabberID *jid; | |
| 167 | JabberBuddy *jb; | |
| 168 | JabberBuddyResource *jbr = NULL; | |
| 169 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 170 | struct _jabber_disco_info_cb_data *jdicd; | |
| 171 | ||
| 172 | if((jid = jabber_id_new(from))) { | |
| 173 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 174 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 175 | jabber_id_free(jid); | |
| 176 | } | |
| 177 | ||
| 178 | if(jbr) | |
| 179 | capabilities = jbr->capabilities; | |
| 180 | ||
| 181 | for(child = query->child; child; child = child->next) { | |
| 182 | if(child->type != XMLNODE_TYPE_TAG) | |
| 183 | continue; | |
| 184 | ||
| 185 | if(!strcmp(child->name, "identity")) { | |
| 186 | const char *category = xmlnode_get_attrib(child, "category"); | |
| 187 | const char *type = xmlnode_get_attrib(child, "type"); | |
| 188 | if(!category || !type) | |
| 189 | continue; | |
| 190 | ||
| 11675 | 191 | if(!strcmp(category, "conference") && !strcmp(type, "text")) { |
| 192 | /* we found a groupchat or MUC server, add it to the list */ | |
| 193 | /* XXX: actually check for protocol/muc or gc-1.0 support */ | |
| 8312 | 194 | js->chat_servers = g_list_append(js->chat_servers, g_strdup(from)); |
| 11675 | 195 | } else if(!strcmp(category, "directory") && !strcmp(type, "user")) { |
| 196 | /* we found a JUD */ | |
| 197 | js->user_directories = g_list_append(js->user_directories, g_strdup(from)); | |
| 198 | } | |
| 8312 | 199 | |
| 200 | } else if(!strcmp(child->name, "feature")) { | |
| 201 | const char *var = xmlnode_get_attrib(child, "var"); | |
| 202 | if(!var) | |
| 203 | continue; | |
| 204 | ||
| 205 | if(!strcmp(var, "http://jabber.org/protocol/si")) | |
| 206 | capabilities |= JABBER_CAP_SI; | |
| 207 | else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer")) | |
| 208 | capabilities |= JABBER_CAP_SI_FILE_XFER; | |
| 209 | else if(!strcmp(var, "http://jabber.org/protocol/bytestreams")) | |
| 210 | capabilities |= JABBER_CAP_BYTESTREAMS; | |
| 11675 | 211 | else if(!strcmp(var, "jabber:iq:search")) |
| 212 | capabilities |= JABBER_CAP_IQ_SEARCH; | |
| 213 | else if(!strcmp(var, "jabber:iq:register")) | |
| 214 | capabilities |= JABBER_CAP_IQ_REGISTER; | |
|
17769
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
215 | else if(!strcmp(var, "http://www.xmpp.org/extensions/xep-0199.html#ns")) |
|
69d98a4da006
applied patch for supporting XEP-0199: XMPP Ping
Andreas Monitzer <am@adiumx.com>
parents:
17768
diff
changeset
|
216 | capabilities |= JABBER_CAP_PING; |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17783
diff
changeset
|
217 | 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
|
218 | 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
|
219 | } |
| 8312 | 220 | } |
| 221 | } | |
| 222 | ||
| 223 | capabilities |= JABBER_CAP_RETRIEVED; | |
| 224 | ||
| 225 | if(jbr) | |
| 226 | jbr->capabilities = capabilities; | |
| 227 | ||
| 228 | if((jdicd = g_hash_table_lookup(js->disco_callbacks, from))) { | |
| 229 | jdicd->callback(js, from, capabilities, jdicd->data); | |
| 230 | g_hash_table_remove(js->disco_callbacks, from); | |
| 231 | } | |
| 232 | } else if(!strcmp(type, "error")) { | |
| 233 | JabberID *jid; | |
| 234 | JabberBuddy *jb; | |
| 235 | JabberBuddyResource *jbr = NULL; | |
| 236 | JabberCapabilities capabilities = JABBER_CAP_NONE; | |
| 237 | struct _jabber_disco_info_cb_data *jdicd; | |
| 238 | ||
| 239 | if(!(jdicd = g_hash_table_lookup(js->disco_callbacks, from))) | |
| 240 | return; | |
| 241 | ||
| 242 | if((jid = jabber_id_new(from))) { | |
| 243 | if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) | |
| 244 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 245 | jabber_id_free(jid); | |
| 246 | } | |
| 247 | ||
| 248 | if(jbr) | |
| 249 | capabilities = jbr->capabilities; | |
| 250 | ||
| 251 | jdicd->callback(js, from, capabilities, jdicd->data); | |
| 252 | g_hash_table_remove(js->disco_callbacks, from); | |
| 253 | } | |
| 254 | } | |
| 255 | ||
| 256 | void jabber_disco_items_parse(JabberStream *js, xmlnode *packet) { | |
| 257 | const char *from = xmlnode_get_attrib(packet, "from"); | |
| 258 | const char *type = xmlnode_get_attrib(packet, "type"); | |
| 259 | ||
| 14356 | 260 | if(type && !strcmp(type, "get")) { |
| 8312 | 261 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, |
| 262 | "http://jabber.org/protocol/disco#items"); | |
|
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
|
263 | |
|
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
|
264 | /* preserve node */ |
|
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
|
265 | xmlnode *iq_query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items"); |
|
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
|
266 | if(iq_query) { |
|
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
|
267 | xmlnode *query = xmlnode_get_child_with_namespace(packet,"query","http://jabber.org/protocol/disco#items"); |
|
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
|
268 | if(query) { |
|
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
|
269 | const char *node = xmlnode_get_attrib(query,"node"); |
|
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
|
270 | if(node) |
|
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
|
271 | xmlnode_set_attrib(iq_query,"node",node); |
|
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
|
272 | } |
|
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
|
273 | } |
| 8312 | 274 | |
| 275 | jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id")); | |
| 276 | ||
| 277 | xmlnode_set_attrib(iq->node, "to", from); | |
| 278 | jabber_iq_send(iq); | |
| 279 | } | |
| 280 | } | |
| 281 | ||
| 282 | static void | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
283 | jabber_disco_finish_server_info_result_cb(JabberStream *js) |
| 15197 | 284 | { |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18225
diff
changeset
|
285 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18225
diff
changeset
|
286 | 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
|
287 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
288 | if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
289 | /* 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
|
290 | jabber_roster_request(js); |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
291 | } |
| 17421 | 292 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
293 | /* 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
|
294 | jabber_presence_send(js->gc->account, NULL); |
|
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
|
295 | |
|
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
|
296 | 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
|
297 | /* 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
|
298 | 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
|
299 | } |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
300 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
301 | |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
302 | static void |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
303 | jabber_disco_server_info_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
304 | { |
| 17421 | 305 | xmlnode *query, *child; |
| 15197 | 306 | const char *from = xmlnode_get_attrib(packet, "from"); |
| 307 | const char *type = xmlnode_get_attrib(packet, "type"); | |
| 308 | ||
|
15358
c8179e0a5483
[gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents:
15355
diff
changeset
|
309 | if((!from || !type) || |
|
c8179e0a5483
[gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents:
15355
diff
changeset
|
310 | (strcmp(from, js->user->domain))) { |
|
c8179e0a5483
[gaim-migrate @ 18087]
Evan Schoenberg <evands@pidgin.im>
parents:
15355
diff
changeset
|
311 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 312 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
313 | } |
| 15197 | 314 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
315 | if(strcmp(type, "result")) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
316 | /* 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
|
317 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 318 | return; |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
319 | } |
| 15197 | 320 | |
| 321 | query = xmlnode_get_child(packet, "query"); | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
322 | |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
323 | if (!query) { |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
324 | jabber_disco_finish_server_info_result_cb(js); |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
325 | return; |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
326 | } |
|
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
327 | |
| 17421 | 328 | for (child = xmlnode_get_child(query, "identity"); child; |
| 15197 | 329 | child = xmlnode_get_next_twin(child)) { |
| 330 | const char *category, *type, *name; | |
| 331 | category = xmlnode_get_attrib(child, "category"); | |
|
17768
7be011945a1b
added preliminary frame for pep-support
Andreas Monitzer <am@adiumx.com>
parents:
17423
diff
changeset
|
332 | 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
|
333 | 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
|
334 | js->pep = TRUE; |
| 15197 | 335 | if (!category || strcmp(category, "server")) |
| 336 | continue; | |
| 337 | if (!type || strcmp(type, "im")) | |
| 338 | continue; | |
| 17421 | 339 | |
| 15197 | 340 | name = xmlnode_get_attrib(child, "name"); |
| 341 | if (!name) | |
| 342 | continue; | |
| 343 | ||
| 344 | g_free(js->server_name); | |
| 345 | 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
|
346 | if (!strcmp(name, "Google Talk")) { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18317
diff
changeset
|
347 | purple_debug_info("jabber", "Google Talk!\n"); |
|
15587
cbedd543bfae
Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
348 | js->googletalk = TRUE; |
|
cbedd543bfae
Google Talk uses structured text formatting where *this* is bold
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
349 | } |
| 15197 | 350 | } |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
351 | |
| 17421 | 352 | for (child = xmlnode_get_child(query, "feature"); child; |
| 15225 | 353 | child = xmlnode_get_next_twin(child)) { |
| 354 | const char *var; | |
| 355 | var = xmlnode_get_attrib(child, "var"); | |
| 356 | if (!var) | |
| 357 | continue; | |
| 358 | ||
| 359 | if (!strcmp("google:mail:notify", var)) { | |
| 360 | js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; | |
| 361 | jabber_gmail_init(js); | |
| 15265 | 362 | } else if (!strcmp("google:roster", var)) { |
| 363 | js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; | |
| 364 | 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
|
365 | } 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
|
366 | js->server_caps |= JABBER_CAP_ADHOC; |
| 15225 | 367 | } |
| 368 | } | |
| 15265 | 369 | |
|
15355
1ce281d16071
[gaim-migrate @ 18084]
Evan Schoenberg <evands@pidgin.im>
parents:
15344
diff
changeset
|
370 | jabber_disco_finish_server_info_result_cb(js); |
| 15197 | 371 | } |
| 372 | ||
| 373 | static void | |
| 374 | jabber_disco_server_items_result_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
| 8312 | 375 | { |
| 376 | xmlnode *query, *child; | |
| 377 | const char *from = xmlnode_get_attrib(packet, "from"); | |
| 378 | const char *type = xmlnode_get_attrib(packet, "type"); | |
| 379 | ||
| 380 | if(!from || !type) | |
| 381 | return; | |
| 382 | ||
| 383 | if(strcmp(from, js->user->domain)) | |
| 384 | return; | |
| 385 | ||
| 386 | if(strcmp(type, "result")) | |
| 387 | return; | |
| 388 | ||
| 389 | while(js->chat_servers) { | |
| 390 | g_free(js->chat_servers->data); | |
| 391 | js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); | |
| 392 | } | |
| 393 | ||
| 394 | query = xmlnode_get_child(packet, "query"); | |
| 395 | ||
| 396 | for(child = xmlnode_get_child(query, "item"); child; | |
| 397 | child = xmlnode_get_next_twin(child)) { | |
| 398 | 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
|
399 | const char *jid, *node; |
| 8312 | 400 | |
| 401 | if(!(jid = xmlnode_get_attrib(child, "jid"))) | |
| 402 | continue; | |
| 403 | ||
|
17423
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
404 | /* 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
|
405 | * 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
|
406 | 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
|
407 | continue; |
|
1f3a88fda48e
skip some unneeded queries that we don't particularly need or want
Nathan Walp <nwalp@pidgin.im>
parents:
17421
diff
changeset
|
408 | |
| 8312 | 409 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
| 410 | xmlnode_set_attrib(iq->node, "to", jid); | |
| 411 | jabber_iq_send(iq); | |
| 412 | } | |
| 413 | } | |
| 414 | ||
| 415 | void jabber_disco_items_server(JabberStream *js) | |
| 416 | { | |
| 417 | JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, | |
| 418 | "http://jabber.org/protocol/disco#items"); | |
| 419 | ||
| 420 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 421 | ||
| 15197 | 422 | jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL); |
| 423 | jabber_iq_send(iq); | |
| 424 | ||
| 425 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, | |
| 426 | "http://jabber.org/protocol/disco#info"); | |
| 427 | xmlnode_set_attrib(iq->node, "to", js->user->domain); | |
| 428 | jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL); | |
| 8312 | 429 | jabber_iq_send(iq); |
| 430 | } | |
| 431 | ||
| 432 | void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data) | |
| 433 | { | |
| 434 | JabberID *jid; | |
| 435 | JabberBuddy *jb; | |
| 436 | JabberBuddyResource *jbr = NULL; | |
| 437 | struct _jabber_disco_info_cb_data *jdicd; | |
| 438 | JabberIq *iq; | |
| 439 | ||
| 440 | if((jid = jabber_id_new(who))) { | |
| 441 | if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE))) | |
| 442 | jbr = jabber_buddy_find_resource(jb, jid->resource); | |
| 443 | jabber_id_free(jid); | |
| 444 | } | |
| 445 | ||
| 446 | if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) { | |
| 447 | callback(js, who, jbr->capabilities, data); | |
| 448 | return; | |
| 449 | } | |
| 450 | ||
| 451 | jdicd = g_new0(struct _jabber_disco_info_cb_data, 1); | |
| 452 | jdicd->data = data; | |
| 453 | jdicd->callback = callback; | |
| 454 | ||
| 455 | g_hash_table_insert(js->disco_callbacks, g_strdup(who), jdicd); | |
| 456 | ||
| 457 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); | |
| 458 | xmlnode_set_attrib(iq->node, "to", who); | |
| 459 | ||
| 460 | jabber_iq_send(iq); | |
| 461 | } | |
| 462 | ||
| 463 |