Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/jingle/jingle.c @ 30952:d873eeaccfc2
merge of '0e796ed7d94b3fa776ecd40ce0da65ae3f6b3242'
and 'ceed48b0e66b4c3d505f6403da76076d6ee203a5'
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Fri, 08 Jan 2010 23:33:51 +0000 |
parents | 105437d8253f 090e141a5214 |
children | 025fe823a921 |
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> |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
38 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
39 GType |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
40 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
|
41 { |
26091
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
42 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
|
43 return JINGLE_TYPE_RAWUDP; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
44 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
|
45 return JINGLE_TYPE_ICEUDP; |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
46 #if 0 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
47 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
|
48 return JINGLE_TYPE_SOCKS; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
49 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
|
50 return JINGLE_TYPE_IBB; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
51 #endif |
26091
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
52 #ifdef USE_VV |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
53 else if (!strcmp(type, JINGLE_APP_RTP)) |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
54 return JINGLE_TYPE_RTP; |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
55 #endif |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
56 #if 0 |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
57 else if (!strcmp(type, JINGLE_APP_FT)) |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
58 return JINGLE_TYPE_FT; |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
59 else if (!strcmp(type, JINGLE_APP_XML)) |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
60 return JINGLE_TYPE_XML; |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
61 #endif |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
62 else |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
63 return G_TYPE_NONE; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
64 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
65 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
66 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
|
67 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
|
68 { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
69 /* Send error */ |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
70 } |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
71 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
72 static void |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
73 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
|
74 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
75 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
|
76 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
|
77 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
78 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
|
79 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
|
80 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
|
81 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
|
82 /* signal here */ |
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 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
85 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
86 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
87 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
|
88 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
89 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
|
90 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
|
91 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
92 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
|
93 JingleContent *pending_content = |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
94 jingle_content_parse(content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
95 if (pending_content == NULL) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
96 purple_debug_error("jingle", |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
97 "Error parsing \"content-add\" content.\n"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
98 /* XXX: send error here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
99 } else { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
100 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
|
101 pending_content); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
102 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
103 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
104 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
105 /* XXX: signal here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
106 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
107 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
108 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
109 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
|
110 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
111 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
|
112 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
|
113 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
114 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
|
115 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
|
116 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
|
117 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
|
118 |
28652
e0a9b3e18c9d
Fix a crash when content modify contains unknown content.
maiku@pidgin.im
parents:
28398
diff
changeset
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 g_free(local_senders); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
125 } else { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
126 purple_debug_error("jingle", "content_modify: unknown content\n"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
127 /* XXX: send error */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
128 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
129 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
130 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
131 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
132 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
133 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
|
134 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
135 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
|
136 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
|
137 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
138 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
|
139 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
|
140 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
|
141 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
|
142 /* signal here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
143 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
144 } |
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 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
147 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
|
148 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
149 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
|
150 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
151 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
|
152 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
153 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
|
154 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
|
155 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
|
156 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
|
157 } |
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 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
160 static void |
26169
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
161 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
|
162 { |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
163 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
|
164 |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
165 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
|
166 |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
167 jingle_session_accept_session(session); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
168 |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
169 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
|
170 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
|
171 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
|
172 JingleContent *parsed_content = |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
173 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
|
174 if (parsed_content == NULL) { |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
175 purple_debug_error("jingle", "Error parsing content\n"); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
176 /* XXX: send error */ |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
177 } else { |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
178 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
|
179 JINGLE_DESCRIPTION_INFO); |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
180 } |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
181 } |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
182 } |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
183 |
0a5737e1e969
Update to newest XEP-0166 Jingle spec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
184 static void |
26365
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
185 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
|
186 { |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
187 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
|
188 } |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
189 |
abcc94ace5ea
Update to be closer to the current Jingle XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26364
diff
changeset
|
190 static void |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
191 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
|
192 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
193 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
|
194 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
195 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
|
196 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
197 jingle_session_accept_session(session); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
198 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 purple_debug_error("jingle", "Error parsing content\n"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
206 /* XXX: send error */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
207 } else { |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
208 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
|
209 JINGLE_SESSION_ACCEPT); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
210 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
211 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
212 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
213 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
214 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
215 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
|
216 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
217 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
|
218 /* XXX: call signal */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
219 } |
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 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
222 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
|
223 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
224 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
|
225 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
226 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
|
227 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
|
228 if (parsed_content == NULL) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
229 purple_debug_error("jingle", "Error parsing content\n"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
230 /* XXX: send error */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
231 } else { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
232 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
|
233 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
|
234 JINGLE_SESSION_INITIATE); |
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 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
237 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
238 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
|
239 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
240 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
241 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
242 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
|
243 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
244 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
|
245 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
246 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
|
247 JINGLE_SESSION_TERMINATE); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
248 /* display reason? */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
249 g_object_unref(session); |
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_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
|
254 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
255 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
|
256 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
257 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
|
258 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 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
|
263 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
|
264 } |
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 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
267 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
268 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
|
269 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
270 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
|
271 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
272 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
|
273 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
274 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
|
275 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
|
276 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
|
277 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
|
278 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
|
279 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
|
280 purple_debug_error("jingle", "Error parsing content\n"); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
281 /* XXX: send error */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
282 } else { |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
283 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
|
284 JINGLE_TRANSPORT_INFO); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
285 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
286 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
287 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
288 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
289 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
290 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
|
291 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
292 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
|
293 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
294 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
|
295 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
296 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
|
297 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
|
298 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
|
299 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
|
300 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
|
301 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
302 } |
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 static void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
305 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
|
306 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
307 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
|
308 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
309 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
|
310 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 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
|
315 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
|
316 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
|
317 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
318 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
|
319 } |
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 |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
322 typedef struct { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
323 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
|
324 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
|
325 } JingleAction; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
326 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
327 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
|
328 {"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
|
329 {"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
|
330 {"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
|
331 {"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
|
332 {"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
|
333 {"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
|
334 {"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
|
335 {"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
|
336 {"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
|
337 {"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
|
338 {"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
|
339 {"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
|
340 {"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
|
341 {"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
|
342 {"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
|
343 {"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
|
344 }; |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
345 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
346 const gchar * |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
347 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
|
348 { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
349 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
|
350 } |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
351 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
352 JingleActionType |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
353 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
|
354 { |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
355 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
|
356 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
|
357 /* 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
|
358 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
|
359 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
|
360 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
|
361 return i; |
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 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
|
364 } |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
365 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
366 void |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
367 jingle_parse(JabberStream *js, const char *from, JabberIqType type, |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
368 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
|
369 { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
370 const gchar *action; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
371 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
|
372 JingleActionType action_type; |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
373 JingleSession *session; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
374 |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
375 if (type != JABBER_IQ_SET) { |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
376 /* 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
|
377 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
378 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
379 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
380 if (!(action = xmlnode_get_attrib(jingle, "action"))) { |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
381 /* 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
|
382 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
383 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
384 |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
385 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
|
386 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
387 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
|
388 action); |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
389 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
390 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
|
391 /* send iq error here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
392 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
393 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
394 |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
395 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
|
396 && strcmp(action, "session-initiate")) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
397 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
|
398 /* send iq error here */ |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
399 return; |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
400 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
401 |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
402 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
|
403 if (session) { |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
404 /* 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
|
405 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
|
406 "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
|
407 /* 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
|
408 return; |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
409 } else { |
26554
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
410 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
|
411 js->user->domain, js->user->resource); |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
412 session = jingle_session_create(js, sid, own_jid, from, FALSE); |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26365
diff
changeset
|
413 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
|
414 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
415 } |
26363
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
416 |
925af7142249
Restructure Jingle action handlers to only require modification in one place.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26169
diff
changeset
|
417 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
|
418 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
419 |
26092
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
420 static void |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
421 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
|
422 { |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
423 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
|
424 } |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
425 |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
426 void |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
427 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
|
428 { |
26092
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
429 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
|
430 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
|
431 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
|
432 } |
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
433 |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
434 #ifdef USE_VV |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
435 static GValueArray * |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
436 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
|
437 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
|
438 { |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
439 GValue value; |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
440 GstStructure *turn_setup = gst_structure_new("relay-info", |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
441 "ip", G_TYPE_STRING, ip, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
442 "port", G_TYPE_UINT, port, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
443 "username", G_TYPE_STRING, username, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
444 "password", G_TYPE_STRING, password, |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
445 "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
|
446 NULL); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
447 purple_debug_info("jabber", "created gst_structure %" GST_PTR_FORMAT "\n", |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
448 turn_setup); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
449 if (turn_setup) { |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
450 memset(&value, 0, sizeof(GValue)); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
451 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
|
452 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
|
453 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
|
454 gst_structure_free(turn_setup); |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
455 } |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
456 return relay_info; |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
457 } |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
458 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
459 GParameter * |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
460 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
|
461 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
|
462 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
|
463 { |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
464 /* 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
|
465 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
|
466 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
|
467 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
|
468 (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
|
469 GParameter *params = NULL; |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
470 int next_index = 0; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
471 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
472 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
|
473 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
|
474 |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
475 if (has_account_stun) { |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
476 purple_debug_info("jabber", |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
477 "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
|
478 js->stun_ip); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
479 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
|
480 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
|
481 g_value_set_string(¶ms[next_index].value, js->stun_ip); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
482 purple_debug_info("jabber", |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
483 "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
|
484 js->stun_port); |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
485 next_index++; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
486 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
|
487 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
|
488 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
|
489 next_index++; |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
490 } |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
491 |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
492 if (relay_ip) { |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
493 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
|
494 |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
495 if (relay_udp) { |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
496 relay_info = |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
497 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
|
498 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
|
499 } |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
500 if (relay_tcp) { |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
501 relay_info = |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
502 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
|
503 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
|
504 } |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
505 if (relay_ssltcp) { |
30937
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
506 relay_info = |
5de3eccf4cf3
Rearranged some code to remove some duplication.
Marcus Lundblad <ml@update.uu.se>
parents:
30936
diff
changeset
|
507 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
|
508 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
|
509 } |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
510 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
|
511 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
|
512 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
|
513 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
|
514 } |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
515 } |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
516 |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26092
diff
changeset
|
517 *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
|
518 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
|
519 } |
30932
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
520 #endif |
f858b53dfbf0
Can now generate a relayed candidate for the initiator
Marcus Lundblad <ml@update.uu.se>
parents:
28398
diff
changeset
|
521 |