libpurple/protocols/jabber/google/jingleinfo.c

branch
cpw.malu.xmpp.google_relay
changeset 30771
66a23a6494bf
parent 29914
a4ed5999f6d0
child 31294
73607ab89c6f
equal deleted inserted replaced
30770:ab58dd68c949 30771:66a23a6494bf
74 static void 74 static void
75 jabber_google_jingle_info_common(JabberStream *js, const char *from, 75 jabber_google_jingle_info_common(JabberStream *js, const char *from,
76 JabberIqType type, xmlnode *query) 76 JabberIqType type, xmlnode *query)
77 { 77 {
78 const xmlnode *stun = xmlnode_get_child(query, "stun"); 78 const xmlnode *stun = xmlnode_get_child(query, "stun");
79 const xmlnode *relay = xmlnode_get_child(query, "relay");
79 gchar *my_bare_jid; 80 gchar *my_bare_jid;
80 81
81 /* 82 /*
82 * Make sure that random people aren't sending us STUN servers. Per 83 * Make sure that random people aren't sending us STUN servers. Per
83 * http://code.google.com/apis/talk/jep_extensions/jingleinfo.html, these 84 * http://code.google.com/apis/talk/jep_extensions/jingleinfo.html, these
117 js->stun_query = purple_dnsquery_a(host, port, 118 js->stun_query = purple_dnsquery_a(host, port,
118 jabber_google_stun_lookup_cb, js); 119 jabber_google_stun_lookup_cb, js);
119 } 120 }
120 } 121 }
121 } 122 }
122 /* should perhaps handle relays later on, or maybe wait until 123
123 Google supports a common standard... */ 124 if (relay) {
125 xmlnode *token = xmlnode_get_child(relay, "token");
126 xmlnode *server = xmlnode_get_child(relay, "server");
127
128 if (token) {
129 gchar *relay_token = xmlnode_get_data(token);
130
131 /* we let js own the string returned from xmlnode_get_data */
132 js->google_relay_token = relay_token;
133 }
134
135 if (server) {
136 js->google_relay_host =
137 g_strdup(xmlnode_get_attrib(server, "host"));
138 }
139 }
124 } 140 }
125 141
126 static void 142 static void
127 jabber_google_jingle_info_cb(JabberStream *js, const char *from, 143 jabber_google_jingle_info_cb(JabberStream *js, const char *from,
128 JabberIqType type, const char *id, 144 JabberIqType type, const char *id,

mercurial