annotate libpurple/protocols/jabber/jingle/jingle.c @ 31534:a8cc50c2279f

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