comparison libpurple/protocols/jabber/disco.c @ 26213:ff4212a5268f

propagate from branch 'im.pidgin.pidgin' (head 431618de0f30a6938f7e14d2d61ee5d7738acd59) to branch 'im.pidgin.pidgin.vv' (head 8df00cb1a28baa69d0a68e0e96af201ec7d87c09)
author Marcus Lundblad <ml@update.uu.se>
date Mon, 02 Mar 2009 18:47:27 +0000
parents 5f9a24d1c25e 88f183f7dfc7
children e23a74d7c97c
comparison
equal deleted inserted replaced
25446:52fbda23e398 26213:ff4212a5268f
26 #include "buddy.h" 26 #include "buddy.h"
27 #include "google.h" 27 #include "google.h"
28 #include "iq.h" 28 #include "iq.h"
29 #include "disco.h" 29 #include "disco.h"
30 #include "jabber.h" 30 #include "jabber.h"
31 #include "jingle/jingle.h"
31 #include "presence.h" 32 #include "presence.h"
32 #include "roster.h" 33 #include "roster.h"
33 #include "pep.h" 34 #include "pep.h"
34 #include "adhoccommands.h" 35 #include "adhoccommands.h"
35 36
86 87
87 88
88 void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) { 89 void jabber_disco_info_parse(JabberStream *js, xmlnode *packet) {
89 const char *from = xmlnode_get_attrib(packet, "from"); 90 const char *from = xmlnode_get_attrib(packet, "from");
90 const char *type = xmlnode_get_attrib(packet, "type"); 91 const char *type = xmlnode_get_attrib(packet, "type");
91 92
92 if(!from || !type) 93 if(!from || !type)
93 return; 94 return;
94 95
95 if(!strcmp(type, "get")) { 96 if(!strcmp(type, "get")) {
96 xmlnode *query, *identity, *feature; 97 xmlnode *query, *identity, *feature;
112 xmlnode_set_attrib(iq->node, "to", from); 113 xmlnode_set_attrib(iq->node, "to", from);
113 query = xmlnode_get_child(iq->node, "query"); 114 query = xmlnode_get_child(iq->node, "query");
114 115
115 if(node) 116 if(node)
116 xmlnode_set_attrib(query, "node", node); 117 xmlnode_set_attrib(query, "node", node);
117 118
118 if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) { 119 if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) {
119 identity = xmlnode_new_child(query, "identity"); 120 identity = xmlnode_new_child(query, "identity");
120 xmlnode_set_attrib(identity, "category", "client"); 121 xmlnode_set_attrib(identity, "category", "client");
121 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console, 122 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console,
122 * handheld, pc, phone, 123 * handheld, pc, phone,
147 JabberFeature *feat = (JabberFeature*)features->data; 148 JabberFeature *feat = (JabberFeature*)features->data;
148 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE) 149 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->shortname, feat->namespace) == TRUE)
149 SUPPORT_FEATURE(feat->namespace); 150 SUPPORT_FEATURE(feat->namespace);
150 } 151 }
151 } 152 }
153 #ifdef USE_VV
154 } else if (node && !strcmp(node, CAPS0115_NODE "#voice-v1")) {
155 SUPPORT_FEATURE("http://www.google.com/xmpp/protocol/session");
156 SUPPORT_FEATURE("http://www.google.com/xmpp/protocol/voice/v1");
157 SUPPORT_FEATURE(JINGLE);
158 SUPPORT_FEATURE(JINGLE_APP_RTP_SUPPORT_AUDIO);
159 SUPPORT_FEATURE(JINGLE_APP_RTP_SUPPORT_VIDEO);
160 SUPPORT_FEATURE(JINGLE_TRANSPORT_RAWUDP);
161 SUPPORT_FEATURE(JINGLE_TRANSPORT_ICEUDP);
162 #endif
152 } else { 163 } else {
153 const char *ext = NULL; 164 const char *ext = NULL;
154 unsigned pos; 165 unsigned pos;
155 unsigned nodelen = strlen(node); 166 unsigned nodelen = strlen(node);
156 unsigned capslen = strlen(CAPS0115_NODE); 167 unsigned capslen = strlen(CAPS0115_NODE);
441 g_free(js->server_name); 452 g_free(js->server_name);
442 js->server_name = g_strdup(name); 453 js->server_name = g_strdup(name);
443 if (!strcmp(name, "Google Talk")) { 454 if (!strcmp(name, "Google Talk")) {
444 purple_debug_info("jabber", "Google Talk!\n"); 455 purple_debug_info("jabber", "Google Talk!\n");
445 js->googletalk = TRUE; 456 js->googletalk = TRUE;
446 } 457
458 /* autodiscover stun and relays */
459 jabber_google_send_jingle_info(js);
460 } else {
461 /* TODO: add external service discovery here... */
462 }
447 } 463 }
448 464
449 for (child = xmlnode_get_child(query, "feature"); child; 465 for (child = xmlnode_get_child(query, "feature"); child;
450 child = xmlnode_get_next_twin(child)) { 466 child = xmlnode_get_next_twin(child)) {
451 const char *var; 467 const char *var;