comparison libpurple/protocols/jabber/disco.c @ 25982:7e020fbe2cdb

propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819) to branch 'im.pidgin.cpw.darkrain42.xmpp.avatars' (head 11e989f3ac36a0f958f031d55245db093923ea76)
author Paul Aurich <paul@darkrain42.org>
date Sat, 07 Mar 2009 01:32:29 +0000
parents 0fa91206cf5a 5f9a24d1c25e
children 242a8c97270b
comparison
equal deleted inserted replaced
25832:2d92bbe6807b 25982:7e020fbe2cdb
130 SUPPORT_FEATURE("jabber:iq:version") 130 SUPPORT_FEATURE("jabber:iq:version")
131 SUPPORT_FEATURE("jabber:x:conference") 131 SUPPORT_FEATURE("jabber:x:conference")
132 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams") 132 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams")
133 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info") 133 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info")
134 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items") 134 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items")
135 #if 0 135 SUPPORT_FEATURE("http://jabber.org/protocol/ibb");
136 SUPPORT_FEATURE("http://jabber.org/protocol/ibb")
137 #endif
138 SUPPORT_FEATURE("http://jabber.org/protocol/muc") 136 SUPPORT_FEATURE("http://jabber.org/protocol/muc")
139 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user") 137 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user")
140 SUPPORT_FEATURE("http://jabber.org/protocol/si") 138 SUPPORT_FEATURE("http://jabber.org/protocol/si")
141 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer") 139 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer")
142 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im") 140 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im")
143 SUPPORT_FEATURE("urn:xmpp:ping") 141 SUPPORT_FEATURE("urn:xmpp:ping")
144 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns") 142 SUPPORT_FEATURE("http://www.xmpp.org/extensions/xep-0199.html#ns")
145 143
146 if(!node) { /* non-caps disco#info, add all enabled extensions */ 144 if(!node) { /* non-caps disco#info, add all enabled extensions */
147 GList *features; 145 GList *features;
148 for(features = jabber_features; features; features = features->next) { 146 for(features = jabber_features; features; features = features->next) {
149 JabberFeature *feat = (JabberFeature*)features->data; 147 JabberFeature *feat = (JabberFeature*)features->data;
150 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE) 148 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE)
166 else 164 else
167 break; 165 break;
168 } else if(node[pos] != CAPS0115_NODE[pos]) 166 } else if(node[pos] != CAPS0115_NODE[pos])
169 break; 167 break;
170 } 168 }
171 169
172 if(ext != NULL) { 170 if(ext != NULL) {
173 /* look for that ext */ 171 /* look for that ext */
174 GList *features; 172 GList *features;
175 for(features = jabber_features; features; features = features->next) { 173 for(features = jabber_features; features; features = features->next) {
176 JabberFeature *feat = (JabberFeature*)features->data; 174 JabberFeature *feat = (JabberFeature*)features->data;
181 } 179 }
182 if(features == NULL) 180 if(features == NULL)
183 ext = NULL; 181 ext = NULL;
184 } 182 }
185 } 183 }
186 184
187 if(ext == NULL) { 185 if(ext == NULL) {
188 xmlnode *error, *inf; 186 xmlnode *error, *inf;
189 187
190 /* XXX: gross hack, implement jabber_iq_set_type or something */ 188 /* XXX: gross hack, implement jabber_iq_set_type or something */
191 xmlnode_set_attrib(iq->node, "type", "error"); 189 xmlnode_set_attrib(iq->node, "type", "error");
192 iq->type = JABBER_IQ_ERROR; 190 iq->type = JABBER_IQ_ERROR;
193 191
194 error = xmlnode_new_child(query, "error"); 192 error = xmlnode_new_child(query, "error");
195 xmlnode_set_attrib(error, "code", "404"); 193 xmlnode_set_attrib(error, "code", "404");
196 xmlnode_set_attrib(error, "type", "cancel"); 194 xmlnode_set_attrib(error, "type", "cancel");
197 inf = xmlnode_new_child(error, "item-not-found"); 195 inf = xmlnode_new_child(error, "item-not-found");
198 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas"); 196 xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
271 else if(!strcmp(var, "http://www.xmpp.org/extensions/xep-0199.html#ns")) 269 else if(!strcmp(var, "http://www.xmpp.org/extensions/xep-0199.html#ns"))
272 capabilities |= JABBER_CAP_PING; 270 capabilities |= JABBER_CAP_PING;
273 else if(!strcmp(var, "http://jabber.org/protocol/commands")) { 271 else if(!strcmp(var, "http://jabber.org/protocol/commands")) {
274 capabilities |= JABBER_CAP_ADHOC; 272 capabilities |= JABBER_CAP_ADHOC;
275 } 273 }
274 else if(!strcmp(var, "http://jabber.org/protocol/ibb")) {
275 purple_debug_info("jabber", "remote supports IBB\n");
276 capabilities |= JABBER_CAP_IBB;
277 }
276 } 278 }
277 } 279 }
278 280
279 capabilities |= JABBER_CAP_RETRIEVED; 281 capabilities |= JABBER_CAP_RETRIEVED;
280 282
314 const char *type = xmlnode_get_attrib(packet, "type"); 316 const char *type = xmlnode_get_attrib(packet, "type");
315 317
316 if(type && !strcmp(type, "get")) { 318 if(type && !strcmp(type, "get")) {
317 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, 319 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
318 "http://jabber.org/protocol/disco#items"); 320 "http://jabber.org/protocol/disco#items");
319 321
320 /* preserve node */ 322 /* preserve node */
321 xmlnode *iq_query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items"); 323 xmlnode *iq_query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
322 if(iq_query) { 324 if(iq_query) {
323 xmlnode *query = xmlnode_get_child_with_namespace(packet,"query","http://jabber.org/protocol/disco#items"); 325 xmlnode *query = xmlnode_get_child_with_namespace(packet,"query","http://jabber.org/protocol/disco#items");
324 if(query) { 326 if(query) {