Mercurial > pidgin
annotate libpurple/protocols/jabber/google/jingleinfo.c @ 32013:f22bc8b5b9dc
Replace purple_dnsquery_a_account with purple_dnsquery_a.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 02 Sep 2011 01:57:25 +0000 |
parents | b671728e6ee9 |
children |
rev | line source |
---|---|
30473
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
1 /** |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
2 * Purple is the legal property of its developers, whose names are too numerous |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
3 * to list here. Please refer to the COPYRIGHT file distributed with this |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
4 * source distribution. |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
5 * |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
9 * (at your option) any later version. |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
10 * |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
15 * |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
19 */ |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
20 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
21 #include "internal.h" |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
22 #include "debug.h" |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
23 #include "jingleinfo.h" |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
24 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
25 static void |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
26 jabber_google_stun_lookup_cb(GSList *hosts, gpointer data, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
27 const char *error_message) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
28 { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
29 JabberStream *js = (JabberStream *) data; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
30 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
31 if (error_message) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
32 purple_debug_error("jabber", "Google STUN lookup failed: %s\n", |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
33 error_message); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
34 g_slist_free(hosts); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
35 js->stun_query = NULL; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
36 return; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
37 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
38 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
39 if (hosts && g_slist_next(hosts)) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
40 struct sockaddr *addr = g_slist_next(hosts)->data; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
41 char dst[INET6_ADDRSTRLEN]; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
42 int port; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
43 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
44 if (addr->sa_family == AF_INET6) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
45 inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
46 dst, sizeof(dst)); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
47 port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
48 } else { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
49 inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
50 dst, sizeof(dst)); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
51 port = ntohs(((struct sockaddr_in *) addr)->sin_port); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
52 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
53 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
54 if (js->stun_ip) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
55 g_free(js->stun_ip); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
56 js->stun_ip = g_strdup(dst); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
57 js->stun_port = port; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
58 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
59 purple_debug_info("jabber", "set Google STUN IP/port address: " |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
60 "%s:%d\n", dst, port); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
61 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
62 /* unmark ongoing query */ |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
63 js->stun_query = NULL; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
64 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
65 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
66 while (hosts != NULL) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
67 hosts = g_slist_delete_link(hosts, hosts); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
68 /* Free the address */ |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
69 g_free(hosts->data); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
70 hosts = g_slist_delete_link(hosts, hosts); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
71 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
72 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
73 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
74 static void |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
75 jabber_google_jingle_info_common(JabberStream *js, const char *from, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
76 JabberIqType type, xmlnode *query) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
77 { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
78 const xmlnode *stun = xmlnode_get_child(query, "stun"); |
30530
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
79 const xmlnode *relay = xmlnode_get_child(query, "relay"); |
30473
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
80 gchar *my_bare_jid; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
81 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
82 /* |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
83 * Make sure that random people aren't sending us STUN servers. Per |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
84 * http://code.google.com/apis/talk/jep_extensions/jingleinfo.html, these |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
85 * stanzas are stamped from our bare JID. |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
86 */ |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
87 if (from) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
88 my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
89 if (!purple_strequal(from, my_bare_jid)) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
90 purple_debug_warning("jabber", "got google:jingleinfo with invalid from (%s)\n", |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
91 from); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
92 g_free(my_bare_jid); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
93 return; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
94 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
95 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
96 g_free(my_bare_jid); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
97 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
98 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
99 if (type == JABBER_IQ_ERROR || type == JABBER_IQ_GET) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
100 return; |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
101 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
102 purple_debug_info("jabber", "got google:jingleinfo\n"); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
103 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
104 if (stun) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
105 xmlnode *server = xmlnode_get_child(stun, "server"); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
106 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
107 if (server) { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
108 const gchar *host = xmlnode_get_attrib(server, "host"); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
109 const gchar *udp = xmlnode_get_attrib(server, "udp"); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
110 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
111 if (host && udp) { |
31481
b671728e6ee9
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31086
diff
changeset
|
112 PurpleAccount *account; |
30473
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
113 int port = atoi(udp); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
114 /* if there, would already be an ongoing query, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
115 cancel it */ |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
116 if (js->stun_query) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
117 purple_dnsquery_destroy(js->stun_query); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
118 |
31481
b671728e6ee9
Use the new account-contextual DNS API everywhere. Refs #11110
Daniel Atallah <daniel.atallah@gmail.com>
parents:
31086
diff
changeset
|
119 account = purple_connection_get_account(js->gc); |
32013
f22bc8b5b9dc
Replace purple_dnsquery_a_account with purple_dnsquery_a.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31481
diff
changeset
|
120 js->stun_query = purple_dnsquery_a(account, host, port, |
30473
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
121 jabber_google_stun_lookup_cb, js); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
122 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
123 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
124 } |
30530
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
125 |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
126 if (relay) { |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
127 xmlnode *token = xmlnode_get_child(relay, "token"); |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
128 xmlnode *server = xmlnode_get_child(relay, "server"); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30530
diff
changeset
|
129 |
30530
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
130 if (token) { |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
131 gchar *relay_token = xmlnode_get_data(token); |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
132 |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
133 /* we let js own the string returned from xmlnode_get_data */ |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
134 js->google_relay_token = relay_token; |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
135 } |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
136 |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
137 if (server) { |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
30530
diff
changeset
|
138 js->google_relay_host = |
30530
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
139 g_strdup(xmlnode_get_attrib(server, "host")); |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
140 } |
2e26b90a28dd
Now it compiles again...
Marcus Lundblad <ml@update.uu.se>
parents:
30473
diff
changeset
|
141 } |
30473
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
142 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
143 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
144 static void |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
145 jabber_google_jingle_info_cb(JabberStream *js, const char *from, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
146 JabberIqType type, const char *id, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
147 xmlnode *packet, gpointer data) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
148 { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
149 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
150 NS_GOOGLE_JINGLE_INFO); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
151 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
152 if (query) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
153 jabber_google_jingle_info_common(js, from, type, query); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
154 else |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
155 purple_debug_warning("jabber", "Got invalid google:jingleinfo\n"); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
156 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
157 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
158 void |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
159 jabber_google_handle_jingle_info(JabberStream *js, const char *from, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
160 JabberIqType type, const char *id, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
161 xmlnode *child) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
162 { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
163 jabber_google_jingle_info_common(js, from, type, child); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
164 } |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
165 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
166 void |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
167 jabber_google_send_jingle_info(JabberStream *js) |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
168 { |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
169 JabberIq *jingle_info = |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
170 jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_JINGLE_INFO); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
171 |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
172 jabber_iq_set_callback(jingle_info, jabber_google_jingle_info_cb, |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
173 NULL); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
174 purple_debug_info("jabber", "sending google:jingleinfo query\n"); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
175 jabber_iq_send(jingle_info); |
34f586bffe4e
Added new files in sub directory google
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
176 } |