Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/jingle/jingle.c @ 31582:bb91133708fe
jabber: Make the BOSH parsing a little more resilient and add more diagnostic output
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 10 Jan 2011 03:34:00 +0000 |
parents | 4b101cad58e7 |
children |
rev | line source |
---|---|
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
1 /* |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
2 * @file jingle.c |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
4 * purple - Jabber Protocol Plugin |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
5 * |
28398
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26554
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26554
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26554
diff
changeset
|
8 * source distribution. |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26554
diff
changeset
|
9 * |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
13 * (at your option) any later version. |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
14 * |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
19 * |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
23 * |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
24 */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
25 |
26092
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
26 #include "internal.h" |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
27 #include "network.h" |
26092
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
28 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
29 #include "content.h" |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
30 #include "debug.h" |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
31 #include "jingle.h" |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
32 #include "session.h" |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
33 #include "iceudp.h" |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
34 #include "rawudp.h" |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
35 #include "rtp.h" |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
36 |
30951
090e141a5214
Some merge-resolving...
Marcus Lundblad <ml@update.uu.se>
parents:
30942
diff
changeset
|
37 #include <string.h> |
30953
025fe823a921
Fix merge and a compilation error
Marcus Lundblad <ml@update.uu.se>
parents:
30952
diff
changeset
|
38 #ifdef USE_VV |
025fe823a921
Fix merge and a compilation error
Marcus Lundblad <ml@update.uu.se>
parents:
30952
diff
changeset
|
39 #include <gst/gst.h> |
025fe823a921
Fix merge and a compilation error
Marcus Lundblad <ml@update.uu.se>
parents:
30952
diff
changeset
|
40 #endif |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
41 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
42 GType |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
43 jingle_get_type(const gchar *type) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
44 { |
31556
4b101cad58e7
Don't crash on invalid/unexpected jingle transport types. Fixes #13136.
nikita@beem-project.com
parents:
31534
diff
changeset
|
45 if (type == NULL) |
4b101cad58e7
Don't crash on invalid/unexpected jingle transport types. Fixes #13136.
nikita@beem-project.com
parents:
31534
diff
changeset
|
46 return G_TYPE_NONE; |
4b101cad58e7
Don't crash on invalid/unexpected jingle transport types. Fixes #13136.
nikita@beem-project.com
parents:
31534
diff
changeset
|
47 |
26091
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
48 if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
49 return JINGLE_TYPE_RAWUDP; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
50 else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
51 return JINGLE_TYPE_ICEUDP; |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
52 #if 0 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
53 else if (!strcmp(type, JINGLE_TRANSPORT_SOCKS)) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
54 return JINGLE_TYPE_SOCKS; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
55 else if (!strcmp(type, JINGLE_TRANSPORT_IBB)) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
56 return JINGLE_TYPE_IBB; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
57 #endif |
26091
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
58 #ifdef USE_VV |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
59 else if (!strcmp(type, JINGLE_APP_RTP)) |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
60 return JINGLE_TYPE_RTP; |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
61 #endif |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
62 #if 0 |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
63 else if (!strcmp(type, JINGLE_APP_FT)) |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
64 return JINGLE_TYPE_FT; |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
65 else if (!strcmp(type, JINGLE_APP_XML)) |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
66 return JINGLE_TYPE_XML; |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
67 #endif |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
68 else |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
69 return G_TYPE_NONE; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
70 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
71 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
72 static void |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
73 jingle_handle_unknown_type(JingleSession *session, xmlnode *jingle) |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
74 { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
75 /* Send error */ |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
76 } |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
77 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
78 static void |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
79 jingle_handle_content_accept(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
80 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
81 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
82 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
83 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
84 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
85 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
86 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
87 jingle_session_accept_content(session, name, creator); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
88 /* signal here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
89 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
90 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
91 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
92 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
93 jingle_handle_content_add(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
94 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
95 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
96 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
97 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
98 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
99 JingleContent *pending_content = |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
100 jingle_content_parse(content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
101 if (pending_content == NULL) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
102 purple_debug_error("jingle", |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
103 "Error parsing \"content-add\" content.\n"); |
31456
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
104 jabber_iq_send(jingle_session_terminate_packet(session, |
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
105 "unsupported-applications")); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
106 } else { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
107 jingle_session_add_pending_content(session, |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
108 pending_content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
109 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
110 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
111 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
112 /* XXX: signal here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
113 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
114 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
115 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
116 jingle_handle_content_modify(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
117 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
118 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
119 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
120 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
121 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
122 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
123 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
124 JingleContent *local_content = jingle_session_find_content(session, name, creator); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
125 |
28652
e0a9b3e18c9d
Fix a crash when content modify contains unknown content.
maiku@pidgin.im
parents:
28398
diff
changeset
|
126 if (local_content != NULL) { |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
127 const gchar *senders = xmlnode_get_attrib(content, "senders"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
128 gchar *local_senders = jingle_content_get_senders(local_content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
129 if (strcmp(senders, local_senders)) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
130 jingle_content_modify(local_content, senders); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
131 g_free(local_senders); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
132 } else { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
133 purple_debug_error("jingle", "content_modify: unknown content\n"); |
31456
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
134 jabber_iq_send(jingle_session_terminate_packet(session, |
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
135 "unknown-applications")); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
136 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
137 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
138 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
139 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
140 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
141 jingle_handle_content_reject(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
142 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
143 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
144 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
145 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
146 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
147 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
148 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
149 jingle_session_remove_pending_content(session, name, creator); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
150 /* signal here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
151 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
152 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
153 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
154 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
155 jingle_handle_content_remove(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
156 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
157 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
158 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
159 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
160 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
161 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
162 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
163 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
164 jingle_session_remove_content(session, name, creator); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
165 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
166 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
167 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
168 static void |
26169
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
169 jingle_handle_description_info(JingleSession *session, xmlnode *jingle) |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
170 { |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
171 xmlnode *content = xmlnode_get_child(jingle, "content"); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
172 |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
173 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
174 |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
175 jingle_session_accept_session(session); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
176 |
26169
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
177 for (; content; content = xmlnode_get_next_twin(content)) { |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
178 const gchar *name = xmlnode_get_attrib(content, "name"); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
179 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
180 JingleContent *parsed_content = |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
181 jingle_session_find_content(session, name, creator); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
182 if (parsed_content == NULL) { |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
183 purple_debug_error("jingle", "Error parsing content\n"); |
31456
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
184 jabber_iq_send(jingle_session_terminate_packet(session, |
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
185 "unsupported-applications")); |
26169
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
186 } else { |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
187 jingle_content_handle_action(parsed_content, content, |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
188 JINGLE_DESCRIPTION_INFO); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
189 } |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
190 } |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
191 } |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
192 |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
193 static void |
26365
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
194 jingle_handle_security_info(JingleSession *session, xmlnode *jingle) |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
195 { |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
196 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
197 } |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
198 |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
199 static void |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
200 jingle_handle_session_accept(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
201 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
202 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
203 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
204 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
205 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
206 jingle_session_accept_session(session); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
207 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
208 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
209 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
210 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
211 JingleContent *parsed_content = |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
212 jingle_session_find_content(session, name, creator); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
213 if (parsed_content == NULL) { |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
214 purple_debug_error("jingle", "Error parsing content\n"); |
31456
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
215 jabber_iq_send(jingle_session_terminate_packet(session, |
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
216 "unsupported-applications")); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
217 } else { |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
218 jingle_content_handle_action(parsed_content, content, |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
219 JINGLE_SESSION_ACCEPT); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
220 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
221 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
222 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
223 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
224 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
225 jingle_handle_session_info(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
226 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
227 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
228 /* XXX: call signal */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
229 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
230 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
231 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
232 jingle_handle_session_initiate(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
233 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
234 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
235 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
236 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
237 JingleContent *parsed_content = jingle_content_parse(content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
238 if (parsed_content == NULL) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
239 purple_debug_error("jingle", "Error parsing content\n"); |
31456
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
240 jabber_iq_send(jingle_session_terminate_packet(session, |
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
241 "unsupported-applications")); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
242 } else { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
243 jingle_session_add_content(session, parsed_content); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
244 jingle_content_handle_action(parsed_content, content, |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
245 JINGLE_SESSION_INITIATE); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
246 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
247 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
248 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
249 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
250 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
251 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
252 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
253 jingle_handle_session_terminate(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
254 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
255 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
256 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
257 jingle_session_handle_action(session, jingle, |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
258 JINGLE_SESSION_TERMINATE); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
259 /* display reason? */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
260 g_object_unref(session); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
261 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
262 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
263 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
264 jingle_handle_transport_accept(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
265 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
266 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
267 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
268 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
269 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
270 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
271 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
272 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
273 JingleContent *content = jingle_session_find_content(session, name, creator); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
274 jingle_content_accept_transport(content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
275 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
276 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
277 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
278 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
279 jingle_handle_transport_info(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
280 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
281 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
282 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
283 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
284 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
285 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
286 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
287 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
288 JingleContent *parsed_content = |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
289 jingle_session_find_content(session, name, creator); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
290 if (parsed_content == NULL) { |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
291 purple_debug_error("jingle", "Error parsing content\n"); |
31456
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
292 jabber_iq_send(jingle_session_terminate_packet(session, |
ba69a8d1cd9a
jingle: termininate the sesion with reason unsupported-applications if we get an unsupported content type
Marcus Lundblad <ml@update.uu.se>
parents:
30953
diff
changeset
|
293 "unsupported-applications")); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
294 } else { |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
295 jingle_content_handle_action(parsed_content, content, |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
296 JINGLE_TRANSPORT_INFO); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
297 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
298 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
299 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
300 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
301 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
302 jingle_handle_transport_reject(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
303 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
304 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
305 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
306 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
307 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
308 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
309 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
310 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
311 JingleContent *content = jingle_session_find_content(session, name, creator); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
312 jingle_content_remove_pending_transport(content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
313 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
314 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
315 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
316 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
317 jingle_handle_transport_replace(JingleSession *session, xmlnode *jingle) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
318 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
319 xmlnode *content = xmlnode_get_child(jingle, "content"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
320 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
321 jabber_iq_send(jingle_session_create_ack(session, jingle)); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
322 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
323 for (; content; content = xmlnode_get_next_twin(content)) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
324 const gchar *name = xmlnode_get_attrib(content, "name"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
325 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
326 xmlnode *xmltransport = xmlnode_get_child(content, "transport"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
327 JingleTransport *transport = jingle_transport_parse(xmltransport); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
328 JingleContent *content = jingle_session_find_content(session, name, creator); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
329 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
330 jingle_content_set_pending_transport(content, transport); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
331 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
332 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
333 |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
334 typedef struct { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
335 const char *name; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
336 void (*handler)(JingleSession*, xmlnode*); |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
337 } JingleAction; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
338 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
339 static const JingleAction jingle_actions[] = { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
340 {"unknown-type", jingle_handle_unknown_type}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
341 {"content-accept", jingle_handle_content_accept}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
342 {"content-add", jingle_handle_content_add}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
343 {"content-modify", jingle_handle_content_modify}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
344 {"content-reject", jingle_handle_content_reject}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
345 {"content-remove", jingle_handle_content_remove}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
346 {"description-info", jingle_handle_description_info}, |
26365
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
347 {"security-info", jingle_handle_security_info}, |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
348 {"session-accept", jingle_handle_session_accept}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
349 {"session-info", jingle_handle_session_info}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
350 {"session-initiate", jingle_handle_session_initiate}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
351 {"session-terminate", jingle_handle_session_terminate}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
352 {"transport-accept", jingle_handle_transport_accept}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
353 {"transport-info", jingle_handle_transport_info}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
354 {"transport-reject", jingle_handle_transport_reject}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
355 {"transport-replace", jingle_handle_transport_replace}, |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
356 }; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
357 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
358 const gchar * |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
359 jingle_get_action_name(JingleActionType action) |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
360 { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
361 return jingle_actions[action].name; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
362 } |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
363 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
364 JingleActionType |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
365 jingle_get_action_type(const gchar *action) |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
366 { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
367 static const int num_actions = |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
368 sizeof(jingle_actions)/sizeof(JingleAction); |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
369 /* Start at 1 to skip the unknown-action type */ |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
370 int i = 1; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
371 for (; i < num_actions; ++i) { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
372 if (!strcmp(action, jingle_actions[i].name)) |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
373 return i; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
374 } |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
375 return JINGLE_UNKNOWN_TYPE; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
376 } |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
377 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
378 void |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
379 jingle_parse(JabberStream *js, const char *from, JabberIqType type, |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
380 const char *id, xmlnode *jingle) |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
381 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
382 const gchar *action; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
383 const gchar *sid; |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
384 JingleActionType action_type; |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
385 JingleSession *session; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
386 |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
387 if (type != JABBER_IQ_SET) { |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
388 /* TODO: send iq error here */ |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
389 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
390 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
391 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
392 if (!(action = xmlnode_get_attrib(jingle, "action"))) { |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
393 /* TODO: send iq error here */ |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
394 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
395 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
396 |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
397 action_type = jingle_get_action_type(action); |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
398 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
399 purple_debug_info("jabber", "got Jingle package action = %s\n", |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
400 action); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
401 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
402 if (!(sid = xmlnode_get_attrib(jingle, "sid"))) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
403 /* send iq error here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
404 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
405 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
406 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
407 if (!(session = jingle_session_find_by_sid(js, sid)) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
408 && strcmp(action, "session-initiate")) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
409 purple_debug_error("jingle", "jabber_jingle_session_parse couldn't find session\n"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
410 /* send iq error here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
411 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
412 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
413 |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
414 if (action_type == JINGLE_SESSION_INITIATE) { |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
415 if (session) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
416 /* This should only happen if you start a session with yourself */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
417 purple_debug_error("jingle", "Jingle session with " |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
418 "id={%s} already exists\n", sid); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
419 /* send iq error */ |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
420 return; |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
421 } else { |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
422 char *own_jid = g_strdup_printf("%s@%s/%s", js->user->node, |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
423 js->user->domain, js->user->resource); |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
424 session = jingle_session_create(js, sid, own_jid, from, FALSE); |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
425 g_free(own_jid); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
426 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
427 } |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
428 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
429 jingle_actions[action_type].handler(session, jingle); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
430 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
431 |
26092
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
432 static void |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
433 jingle_terminate_sessions_gh(gpointer key, gpointer value, gpointer user_data) |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
434 { |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
435 g_object_unref(value); |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
436 } |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
437 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
438 void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
439 jingle_terminate_sessions(JabberStream *js) |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
440 { |
26092
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
441 if (js->sessions) |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
442 g_hash_table_foreach(js->sessions, |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
443 jingle_terminate_sessions_gh, NULL); |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
444 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
445 |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
446 #ifdef USE_VV |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
447 static GValueArray * |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
448 jingle_create_relay_info(const gchar *ip, guint port, const gchar *username, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
449 const gchar *password, const gchar *relay_type, GValueArray *relay_info) |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
450 { |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
451 GValue value; |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
452 GstStructure *turn_setup = gst_structure_new("relay-info", |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
453 "ip", G_TYPE_STRING, ip, |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
454 "port", G_TYPE_UINT, port, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
455 "username", G_TYPE_STRING, username, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
456 "password", G_TYPE_STRING, password, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
457 "relay-type", G_TYPE_STRING, relay_type, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
458 NULL); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
459 purple_debug_info("jabber", "created gst_structure %" GST_PTR_FORMAT "\n", |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
460 turn_setup); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
461 if (turn_setup) { |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
462 memset(&value, 0, sizeof(GValue)); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
463 g_value_init(&value, GST_TYPE_STRUCTURE); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
464 gst_value_set_structure(&value, turn_setup); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
465 relay_info = g_value_array_append(relay_info, &value); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
466 gst_structure_free(turn_setup); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
467 } |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
468 return relay_info; |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
469 } |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
470 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
471 GParameter * |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
472 jingle_get_params(JabberStream *js, const gchar *relay_ip, guint relay_udp, |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
473 guint relay_tcp, guint relay_ssltcp, const gchar *relay_username, |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
474 const gchar *relay_password, guint *num) |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
475 { |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
476 /* don't set a STUN server if one is set globally in prefs, in that case |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
477 this will be handled in media.c */ |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
478 gboolean has_account_stun = js->stun_ip && !purple_network_get_stun_ip(); |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
479 guint num_params = has_account_stun ? |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
480 (relay_ip ? 3 : 2) : (relay_ip ? 1 : 0); |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
481 GParameter *params = NULL; |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
482 int next_index = 0; |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
483 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
484 if (num_params > 0) { |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
485 params = g_new0(GParameter, num_params); |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
486 |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
487 if (has_account_stun) { |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
488 purple_debug_info("jabber", |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
489 "setting param stun-ip for stream using Google auto-config: %s\n", |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
490 js->stun_ip); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
491 params[next_index].name = "stun-ip"; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
492 g_value_init(¶ms[next_index].value, G_TYPE_STRING); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
493 g_value_set_string(¶ms[next_index].value, js->stun_ip); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
494 purple_debug_info("jabber", |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
495 "setting param stun-port for stream using Google auto-config: %d\n", |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
496 js->stun_port); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
497 next_index++; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
498 params[next_index].name = "stun-port"; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
499 g_value_init(¶ms[next_index].value, G_TYPE_UINT); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
500 g_value_set_uint(¶ms[next_index].value, js->stun_port); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
501 next_index++; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
502 } |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
503 |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
504 if (relay_ip) { |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
505 GValueArray *relay_info = g_value_array_new(0); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
506 |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
507 if (relay_udp) { |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
508 relay_info = |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
509 jingle_create_relay_info(relay_ip, relay_udp, relay_username, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
510 relay_password, "udp", relay_info); |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
511 } |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
512 if (relay_tcp) { |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
513 relay_info = |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
514 jingle_create_relay_info(relay_ip, relay_tcp, relay_username, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
515 relay_password, "tcp", relay_info); |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
516 } |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
517 if (relay_ssltcp) { |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31456
diff
changeset
|
518 relay_info = |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
519 jingle_create_relay_info(relay_ip, relay_ssltcp, relay_username, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
520 relay_password, "tls", relay_info); |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
521 } |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
522 params[next_index].name = "relay-info"; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
523 g_value_init(¶ms[next_index].value, G_TYPE_VALUE_ARRAY); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
524 g_value_set_boxed(¶ms[next_index].value, relay_info); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
525 g_value_array_free(relay_info); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
526 } |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
527 } |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
528 |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
529 *num = num_params; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
530 return params; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
531 } |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
532 #endif |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
533 |