Mercurial > pidgin
annotate libpurple/protocols/jabber/jingle.c @ 23818:2ebe89114923
Added JingleSessionContent structure to store content information
in preparation for handling multiple simultaneous content types.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Tue, 03 Jun 2008 02:59:48 +0000 |
parents | 41d6d4217d21 |
children | d61b0c8aaca1 |
rev | line source |
---|---|
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /* |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 * purple - Jabber Protocol Plugin |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 * |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 * (at your option) any later version. |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 * |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 * |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 * along with this program; if not, write to the Free Software |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 * |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 */ |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 #include "config.h" |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 #include "purple.h" |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 #include "jingle.h" |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 #include "xmlnode.h" |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
24 #include "iq.h" |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include <stdlib.h> |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 #include <string.h> |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 #include <glib.h> |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 |
23804
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23798
diff
changeset
|
30 #ifdef USE_VV |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
32 #include <gst/farsight/fs-candidate.h> |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
34 typedef struct { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
35 char *id; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
36 JabberStream *js; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
37 PurpleMedia *media; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
38 char *remote_jid; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
39 char *initiator; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
40 gboolean is_initiator; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
41 gboolean session_started; |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
42 GHashTable *contents; /* JingleSessionContent table */ |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
43 } JingleSession; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
44 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
45 typedef struct { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
46 gchar *name; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
47 JingleSession *session; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
48 gchar *creator; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
49 gchar *sender; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
50 gchar *transport_type; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
51 gchar *type; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
52 } JingleSessionContent; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
53 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
54 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
55 jabber_jingle_session_content_create_internal(JingleSession *session, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
56 const gchar *name, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
57 const gchar *creator, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
58 const gchar *sender, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
59 const gchar *transport_type, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
60 const gchar *type) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
61 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
62 JingleSessionContent *content = g_new0(JingleSessionContent, 1); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
63 content->session = session; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
64 content->name = g_strdup(name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
65 content->creator = g_strdup(creator); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
66 content->sender = g_strdup(sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
67 content->transport_type = g_strdup(transport_type); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
68 content->type = g_strdup(type); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
69 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
70 if (!session->contents) { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
71 purple_debug_info("jingle", "Creating hash table for contents\n"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
72 session->contents = g_hash_table_new(g_str_hash, g_str_equal); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
73 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
74 purple_debug_info("jingle", "inserting content with name == \"%s\" into table\n", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
75 content->name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
76 g_hash_table_insert(session->contents, content->name, content); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
77 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
78 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
79 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
80 jabber_jingle_session_destroy_content(JingleSessionContent *content) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
81 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
82 purple_debug_info("jingle", "destroying content with name == \"%s\"\n", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
83 content->name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
84 g_hash_table_remove(content->session->contents, content->name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
85 g_free(content->name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
86 g_free(content->creator); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
87 g_free(content->sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
88 g_free(content->transport_type); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
89 g_free(content->type); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
90 g_free(content); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
91 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
92 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
93 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
94 jabber_jingle_session_content_get_name(const JingleSessionContent *jsc) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
95 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
96 return jsc->name; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
97 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
98 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
99 static JingleSession * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
100 jabber_jingle_session_content_get_session(const JingleSessionContent *jsc) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
101 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
102 return jsc->session; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
103 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
104 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
105 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
106 jabber_jingle_session_content_get_creator(const JingleSessionContent *jsc) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
107 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
108 return jsc->creator; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
109 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
110 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
111 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
112 jabber_jingle_session_content_get_sender(const JingleSessionContent *jsc) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
113 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
114 return jsc->sender; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
115 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
116 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
117 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
118 jabber_jingle_session_content_get_transport_type(const JingleSessionContent *jsc) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
119 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
120 return jsc->transport_type; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
121 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
122 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
123 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
124 jabber_jingle_session_content_get_type(const JingleSessionContent *jsc) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
125 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
126 return jsc->type; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
127 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
128 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
129 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
130 jabber_jingle_session_content_set_sender(JingleSessionContent *jsc, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
131 const char *sender) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
132 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
133 if (jsc->sender) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
134 g_free(jsc->sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
135 jsc->sender = g_strdup(sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
136 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
137 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 static gboolean |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 jabber_jingle_session_equal(gconstpointer a, gconstpointer b) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 purple_debug_info("jingle", |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 "jabber_jingle_session_equal, comparing %s and %s\n", |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 ((JingleSession *)a)->id, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 ((JingleSession *)b)->id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 return !strcmp(((JingleSession *) a)->id, ((JingleSession *) b)->id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 static JingleSession * |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 jabber_jingle_session_create_internal(JabberStream *js, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 const char *id) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 JingleSession *sess = g_new0(JingleSession, 1); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 sess->js = js; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 if (id) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 sess->id = g_strdup(id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 } else if (js) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 /* init the session ID... */ |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 sess->id = jabber_get_next_id(js); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 /* insert it into the hash table */ |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
163 if (!js->sessions) { |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 purple_debug_info("jingle", "Creating hash table for sessions\n"); |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
165 js->sessions = g_hash_table_new(g_str_hash, g_str_equal); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 purple_debug_info("jingle", "inserting session with key: %s into table\n", |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 sess->id); |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
169 g_hash_table_insert(js->sessions, sess->id, sess); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
170 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
171 sess->session_started = FALSE; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
172 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 return sess; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
176 static JabberStream * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 jabber_jingle_session_get_js(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 return sess->js; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
182 static JingleSession * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 jabber_jingle_session_create(JabberStream *js) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 JingleSession *sess = jabber_jingle_session_create_internal(js, NULL); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 sess->is_initiator = TRUE; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 return sess; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
190 static JingleSession * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 jabber_jingle_session_create_by_id(JabberStream *js, const char *id) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 JingleSession *sess = jabber_jingle_session_create_internal(js, id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 sess->is_initiator = FALSE; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 return sess; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
198 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 jabber_jingle_session_get_id(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 return sess->id; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
204 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 jabber_jingle_session_destroy(JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 { |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
207 GList *contents = g_hash_table_get_values(sess->contents); |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
208 g_hash_table_remove(sess->js->sessions, sess->id); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 g_free(sess->id); |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
210 g_object_unref(sess->media); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
211 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
212 for (; contents; contents = contents->next) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
213 jabber_jingle_session_destroy_content(contents->data); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
214 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
215 g_list_free(contents); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 g_free(sess); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
218 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
219 static JingleSession * |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
220 jabber_jingle_session_find_by_id(JabberStream *js, const char *id) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 purple_debug_info("jingle", "find_by_id %s\n", id); |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
223 purple_debug_info("jingle", "hash table: %p\n", js->sessions); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 purple_debug_info("jingle", "hash table size %d\n", |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
225 g_hash_table_size(js->sessions)); |
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
226 purple_debug_info("jingle", "lookup: %p\n", g_hash_table_lookup(js->sessions, id)); |
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
227 return (JingleSession *) g_hash_table_lookup(js->sessions, id); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
228 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
229 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
230 static JingleSession * |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
231 jabber_jingle_session_find_by_jid(JabberStream *js, const char *jid) |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
232 { |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
233 GList *values = g_hash_table_get_values(js->sessions); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
234 GList *iter = values; |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
235 gboolean use_bare = strchr(jid, '/') == NULL; |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
236 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
237 for (; iter; iter = iter->next) { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
238 JingleSession *session = (JingleSession *)iter->data; |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
239 gchar *cmp_jid = use_bare ? jabber_get_bare_jid(session->remote_jid) |
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
240 : g_strdup(session->remote_jid); |
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
241 if (!strcmp(jid, cmp_jid)) { |
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
242 g_free(cmp_jid); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
243 g_list_free(values); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
244 return session; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
245 } |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
246 g_free(cmp_jid); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
247 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
248 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
249 g_list_free(values); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
250 return NULL; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
251 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
252 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
253 static GList * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
254 jabber_jingle_get_codecs(const xmlnode *description) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
256 GList *codecs = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
257 xmlnode *codec_element = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
258 const char *encoding_name,*id, *clock_rate; |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
259 FsCodec *codec; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
260 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 for (codec_element = xmlnode_get_child(description, "payload-type") ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
262 codec_element ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
263 codec_element = xmlnode_get_next_twin(codec_element)) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 encoding_name = xmlnode_get_attrib(codec_element, "name"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 id = xmlnode_get_attrib(codec_element, "id"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 clock_rate = xmlnode_get_attrib(codec_element, "clockrate"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
268 codec = fs_codec_new(atoi(id), encoding_name, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
269 FS_MEDIA_TYPE_AUDIO, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
270 clock_rate ? atoi(clock_rate) : 0); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
271 codecs = g_list_append(codecs, codec); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 return codecs; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
276 static GList * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 jabber_jingle_get_candidates(const xmlnode *transport) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
279 GList *candidates = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 xmlnode *candidate = NULL; |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
281 FsCandidate *c; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 for (candidate = xmlnode_get_child(transport, "candidate") ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 candidate ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 candidate = xmlnode_get_next_twin(candidate)) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 const char *type = xmlnode_get_attrib(candidate, "type"); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
287 c = fs_candidate_new(xmlnode_get_attrib(candidate, "component"), |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
288 atoi(xmlnode_get_attrib(candidate, "component")), |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
289 strcmp(type, "host") == 0 ? |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
290 FS_CANDIDATE_TYPE_HOST : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
291 strcmp(type, "prflx") == 0 ? |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
292 FS_CANDIDATE_TYPE_PRFLX : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
293 FS_CANDIDATE_TYPE_RELAY, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
294 strcmp(xmlnode_get_attrib(candidate, "protocol"), |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 "udp") == 0 ? |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
296 FS_NETWORK_PROTOCOL_UDP : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
297 FS_NETWORK_PROTOCOL_TCP, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
298 xmlnode_get_attrib(candidate, "ip"), |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
299 atoi(xmlnode_get_attrib(candidate, "port"))); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
300 candidates = g_list_append(candidates, c); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 return candidates; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
306 static JingleSessionContent * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
307 jabber_jingle_session_get_content(JingleSession *session, const char *name) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
308 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
309 return (JingleSession *) name ? g_hash_table_lookup(session->contents, name) : NULL; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
310 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
311 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
312 static PurpleMedia * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 jabber_jingle_session_get_media(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 return sess->media; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
317 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
318 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 jabber_jingle_session_set_media(JingleSession *sess, PurpleMedia *media) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 sess->media = media; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
324 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 jabber_jingle_session_get_remote_jid(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 return sess->remote_jid; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
329 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
330 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 jabber_jingle_session_set_remote_jid(JingleSession *sess, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 const char *remote_jid) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 sess->remote_jid = strdup(remote_jid); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
337 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 jabber_jingle_session_get_initiator(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 return sess->initiator; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
343 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 jabber_jingle_session_set_initiator(JingleSession *sess, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 const char *initiator) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
347 sess->initiator = g_strdup(initiator); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
348 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
350 static gboolean |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 jabber_jingle_session_is_initiator(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
353 return sess->is_initiator; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
354 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
355 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
356 static xmlnode * |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
357 jabber_jingle_session_create_jingle_element(const JingleSession *sess, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 const char *action) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 xmlnode *jingle = xmlnode_new("jingle"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 xmlnode_set_namespace(jingle, "urn:xmpp:tmp:jingle"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 xmlnode_set_attrib(jingle, "action", action); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 xmlnode_set_attrib(jingle, "initiator", |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 jabber_jingle_session_get_initiator(sess)); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 xmlnode_set_attrib(jingle, "responder", |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 jabber_jingle_session_is_initiator(sess) ? |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
367 jabber_jingle_session_get_remote_jid(sess) : |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
368 jabber_jingle_session_get_initiator(sess)); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 xmlnode_set_attrib(jingle, "sid", sess->id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
373 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
374 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
375 jabber_jingle_session_create_terminate(const JingleSession *sess, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
376 const char *reasoncode, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
377 const char *reasontext) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
379 xmlnode *jingle = |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
380 jabber_jingle_session_create_jingle_element(sess, "session-terminate"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
381 xmlnode_set_attrib(jingle, "resoncode", reasoncode); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 if (reasontext) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
383 xmlnode_set_attrib(jingle, "reasontext", reasontext); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
385 xmlnode_set_attrib(jingle, "sid", sess->id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
389 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
390 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
391 jabber_jingle_session_create_description(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 { |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
393 GList *codecs = purple_media_get_local_audio_codecs(sess->media); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 xmlnode *description = xmlnode_new("description"); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
395 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 xmlnode_set_namespace(description, "urn:xmpp:tmp:jingle:apps:audio-rtp"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 /* get codecs */ |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 for (; codecs ; codecs = codecs->next) { |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
400 FsCodec *codec = (FsCodec*)codecs->data; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
401 char id[8], clockrate[10], channels[10]; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 xmlnode *payload = xmlnode_new_child(description, "payload-type"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 g_snprintf(id, sizeof(id), "%d", codec->id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 g_snprintf(clockrate, sizeof(clockrate), "%d", codec->clock_rate); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
406 g_snprintf(channels, sizeof(channels), "%d", codec->channels); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
407 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 xmlnode_set_attrib(payload, "name", codec->encoding_name); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
409 xmlnode_set_attrib(payload, "id", id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 xmlnode_set_attrib(payload, "clockrate", clockrate); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
411 xmlnode_set_attrib(payload, "channels", channels); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
412 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
414 fs_codec_list_destroy(codecs); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 return description; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
416 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
417 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
418 static guint |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
419 jabber_jingle_get_priority(guint type, guint network) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
420 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
421 switch (type) { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
422 case FS_CANDIDATE_TYPE_HOST: |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
423 return network == 0 ? 4096 : network == 1 ? 2048 : 1024; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
424 break; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
425 case FS_CANDIDATE_TYPE_PRFLX: |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
426 return 126; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
427 break; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
428 case FS_CANDIDATE_TYPE_RELAY: |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
429 return 100; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
430 break; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
431 default: |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
432 return 0; /* unknown type, should not happen */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
433 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
434 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
435 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
436 static xmlnode * |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
437 jabber_jingle_session_create_candidate_info(FsCandidate *c, FsCandidate *remote) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
438 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
439 char port[8]; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
440 char prio[8]; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
441 char component[8]; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
442 xmlnode *candidate = NULL; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
443 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
444 candidate = xmlnode_new("candidate"); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
445 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
446 g_snprintf(port, sizeof(port), "%d", c->port); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
447 g_snprintf(prio, sizeof(prio), "%d", |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
448 jabber_jingle_get_priority(c->type, 0)); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
449 g_snprintf(component, sizeof(component), "%d", c->component_id); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
450 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
451 xmlnode_set_attrib(candidate, "component", component); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
452 xmlnode_set_attrib(candidate, "foundation", "1"); /* what about this? */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
453 xmlnode_set_attrib(candidate, "generation", "0"); /* ? */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
454 xmlnode_set_attrib(candidate, "ip", c->ip); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
455 xmlnode_set_attrib(candidate, "network", "0"); /* ? */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
456 xmlnode_set_attrib(candidate, "port", port); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
457 xmlnode_set_attrib(candidate, "priority", prio); /* Is this correct? */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
458 xmlnode_set_attrib(candidate, "protocol", |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
459 c->proto == FS_NETWORK_PROTOCOL_UDP ? |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
460 "udp" : "tcp"); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
461 if (c->username) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
462 xmlnode_set_attrib(candidate, "ufrag", c->username); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
463 if (c->password) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
464 xmlnode_set_attrib(candidate, "pwd", c->password); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
465 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
466 xmlnode_set_attrib(candidate, "type", |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
467 c->type == FS_CANDIDATE_TYPE_HOST ? |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
468 "host" : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
469 c->type == FS_CANDIDATE_TYPE_PRFLX ? |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
470 "prflx" : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
471 c->type == FS_CANDIDATE_TYPE_RELAY ? |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
472 "relay" : NULL); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
473 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
474 /* relay */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
475 if (c->type == FS_CANDIDATE_TYPE_RELAY) { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
476 /* set rel-addr and rel-port? How? */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
477 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
478 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
479 if (remote) { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
480 char remote_port[8]; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
481 g_snprintf(remote_port, sizeof(remote_port), "%d", remote->port); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
482 xmlnode_set_attrib(candidate, "rem-addr", remote->ip); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
483 xmlnode_set_attrib(candidate, "rem-port", remote_port); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
484 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
485 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
486 return candidate; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
487 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
488 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
489 /* split into two separate methods, one to generate session-accept |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
490 (includes codecs) and one to generate transport-info (includes transports |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
491 candidates) */ |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
492 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
493 jabber_jingle_session_create_session_accept(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
494 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
495 xmlnode *jingle = |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
496 jabber_jingle_session_create_jingle_element(sess, "session-accept"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
497 xmlnode *content = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
498 xmlnode *description = NULL; |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
499 xmlnode *transport = NULL; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
500 xmlnode *candidate = NULL; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
501 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
502 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
503 content = xmlnode_new_child(jingle, "content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
505 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
506 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
507 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 description = jabber_jingle_session_create_description(sess); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
509 xmlnode_insert_child(content, description); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
510 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
511 transport = xmlnode_new_child(content, "transport"); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
512 xmlnode_set_namespace(transport, "urn:xmpp:tmp:jingle:transports:ice-udp"); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
513 candidate = jabber_jingle_session_create_candidate_info( |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
514 purple_media_get_local_candidate(sess->media), |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
515 purple_media_get_remote_candidate(sess->media)); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
516 xmlnode_insert_child(transport, candidate); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
517 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
519 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
520 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
521 static xmlnode * |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
522 jabber_jingle_session_create_transport_info(const JingleSession *sess) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 xmlnode *jingle = |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 jabber_jingle_session_create_jingle_element(sess, "transport-info"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 xmlnode *content = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 xmlnode *transport = NULL; |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
528 GList *candidates = purple_media_get_local_audio_candidates(sess->media); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
529 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 content = xmlnode_new_child(jingle, "content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
533 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
535 transport = xmlnode_new_child(content, "transport"); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
536 xmlnode_set_namespace(transport, "urn:xmpp:tmp:jingle:transports:ice-udp"); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
537 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
538 /* get transport candidate */ |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
539 for (; candidates ; candidates = candidates->next) { |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
540 FsCandidate *c = (FsCandidate *) candidates->data; |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
541 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
542 if (!strcmp(c->ip, "127.0.0.1")) { |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
543 continue; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
544 } |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
545 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
546 xmlnode_insert_child(transport, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
547 jabber_jingle_session_create_candidate_info(c, NULL)); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 } |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
549 fs_candidate_list_destroy(candidates); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
550 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
551 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
552 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
553 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
554 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
555 jabber_jingle_session_create_content_replace(const JingleSession *sess, |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
556 FsCandidate *native_candidate, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
557 FsCandidate *remote_candidate) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
559 xmlnode *jingle = |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
560 jabber_jingle_session_create_jingle_element(sess, "content-replace"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
561 xmlnode *content = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
562 xmlnode *transport = NULL; |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
563 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
564 purple_debug_info("jingle", "creating content-modify for native candidate %s " \ |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
565 ", remote candidate %s\n", native_candidate->candidate_id, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
566 remote_candidate->candidate_id); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
567 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
568 content = xmlnode_new_child(jingle, "content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
569 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
570 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
571 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
572 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
573 /* get top codec from codec_intersection to put here... */ |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
574 /* later on this should probably handle changing codec */ |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
575 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
576 xmlnode_insert_child(content, jabber_jingle_session_create_description(sess)); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
577 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
578 transport = xmlnode_new_child(content, "transport"); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
579 xmlnode_set_namespace(transport, "urn:xmpp:tmp:jingle:transports:ice-udp"); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
580 xmlnode_insert_child(transport, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
581 jabber_jingle_session_create_candidate_info(native_candidate, |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
582 remote_candidate)); |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
583 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
584 purple_debug_info("jingle", "End create content modify\n"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
585 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
586 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
587 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
588 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
589 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
590 jabber_jingle_session_create_content_accept(const JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
591 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
592 xmlnode *jingle = |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
593 jabber_jingle_session_create_jingle_element(sess, "content-accept"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
594 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
595 xmlnode *content = xmlnode_new_child(jingle, "content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
596 xmlnode *description = jabber_jingle_session_create_description(sess); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
597 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
598 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
599 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
600 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
601 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
602 xmlnode_insert_child(content, description); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
603 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
604 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
605 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
606 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
607 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
608 jabber_jingle_session_send_content_accept(JingleSession *session) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
609 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
610 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
611 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
612 xmlnode *jingle = jabber_jingle_session_create_content_accept(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
613 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
614 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
615 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
616 xmlnode_insert_child(result->node, jingle); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
617 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
618 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
619 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
620 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
621 jabber_jingle_session_send_session_accept(JingleSession *session) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
622 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
623 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
624 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
625 xmlnode *jingle = jabber_jingle_session_create_session_accept(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
626 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
627 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
628 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
629 xmlnode_insert_child(result->node, jingle); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
630 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
631 purple_debug_info("jabber", "Sent session accept, starting stream\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
632 gst_element_set_state(purple_media_get_audio_pipeline(session->media), GST_STATE_PLAYING); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
633 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
634 session->session_started = TRUE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
635 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
636 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
637 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
638 jabber_jingle_session_send_session_reject(JingleSession *session) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
639 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
640 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
641 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
642 xmlnode *jingle = jabber_jingle_session_create_terminate(session, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
643 "decline", NULL); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
644 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
645 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
646 xmlnode_insert_child(result->node, jingle); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
647 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
648 jabber_jingle_session_destroy(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
649 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
650 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
651 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
652 jabber_jingle_session_send_session_terminate(JingleSession *session) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
653 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
654 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
655 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
656 xmlnode *jingle = jabber_jingle_session_create_terminate(session, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
657 "no-error", NULL); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
658 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
659 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
660 xmlnode_insert_child(result->node, jingle); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
661 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
662 jabber_jingle_session_destroy(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
663 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
664 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
665 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
666 jabber_jingle_session_content_create_media(JingleSession *session, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
667 PurpleMediaStreamType type) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
668 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
669 gchar sender[10] = ""; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
670 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
671 if (type & PURPLE_MEDIA_AUDIO) { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
672 if (type & PURPLE_MEDIA_SEND_AUDIO) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
673 strcpy(sender, "initiator"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
674 else if (type & PURPLE_MEDIA_RECV_AUDIO) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
675 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
676 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
677 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
678 jabber_jingle_session_content_create_internal(session, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
679 "audio-content", "initiator", sender, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
680 "urn:xmpp:tmp:jingle:transports:ice-udp", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
681 "urn:xmpp:tmp:jingle:apps:audio-rtp"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
682 } else if (type & PURPLE_MEDIA_VIDEO) { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
683 if (type == PURPLE_MEDIA_SEND_VIDEO) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
684 strcpy(sender, "initiator"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
685 else if (type == PURPLE_MEDIA_RECV_VIDEO) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
686 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
687 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
688 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
689 jabber_jingle_session_content_create_internal(session, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
690 "video-content", "initiator", sender, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
691 "urn:xmpp:tmp:jingle:transports:ice-udp", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
692 "urn:xmpp:tmp:jingle:apps:video-rtp"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
693 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
694 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
695 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
696 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
697 jabber_jingle_session_content_create_parse(JingleSession *session, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
698 xmlnode *jingle) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
699 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
700 xmlnode *content = xmlnode_get_child(jingle, "content"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
701 xmlnode *description = xmlnode_get_child(content, "description"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
702 xmlnode *transport = xmlnode_get_child(content, "transport"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
703 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
704 const gchar *creator = xmlnode_get_attrib(content, "creator"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
705 const gchar *sender = xmlnode_get_attrib(content, "sender"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
706 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
707 jabber_jingle_session_content_create_internal(session, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
708 xmlnode_get_attrib(content, "name"), |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
709 creator ? creator : "initiator", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
710 sender ? sender : "both", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
711 xmlnode_get_namespace(transport), |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
712 xmlnode_get_namespace(description)); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
713 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
714 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
715 /* callback called when new local transport candidate(s) are available on the |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
716 Farsight stream */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
717 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
718 jabber_jingle_session_candidates_prepared(PurpleMedia *media, JingleSession *session) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
719 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
720 if (!jabber_jingle_session_is_initiator(session)) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
721 /* create transport-info package */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
722 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
723 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
724 xmlnode *jingle = jabber_jingle_session_create_transport_info(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
725 purple_debug_info("jabber", "jabber_session_candidates_prepared: %d candidates\n", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
726 g_list_length(purple_media_get_local_audio_candidates(session->media))); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
727 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
728 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
729 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
730 xmlnode_insert_child(result->node, jingle); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
731 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
732 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
733 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
734 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
735 /* callback called when a pair of transport candidates (local and remote) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
736 has been established */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
737 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
738 jabber_jingle_session_candidate_pair_established(PurpleMedia *media, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
739 FsCandidate *native_candidate, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
740 FsCandidate *remote_candidate, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
741 JingleSession *session) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
742 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
743 purple_debug_info("jabber", "jabber_candidate_pair_established called\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
744 /* if we are the initiator, we should send a content-modify message */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
745 if (jabber_jingle_session_is_initiator(session)) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
746 JabberIq *result; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
747 xmlnode *jingle; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
748 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
749 purple_debug_info("jabber", "we are the initiator, let's send content-modify\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
750 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
751 result = jabber_iq_new(jabber_jingle_session_get_js(session), JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
752 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
753 /* shall change this to a "content-replace" */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
754 jingle = jabber_jingle_session_create_content_replace(session, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
755 native_candidate, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
756 remote_candidate); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
757 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
758 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
759 xmlnode_insert_child(result->node, jingle); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
760 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
761 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
762 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
763 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
764 static gboolean |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
765 jabber_jingle_session_initiate_media_internal(JingleSession *session, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
766 const char *initiator, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
767 const char *remote_jid) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
768 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
769 PurpleMedia *media = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
770 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
771 media = purple_media_manager_create_media(purple_media_manager_get(), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
772 session->js->gc, "fsrtpconference", remote_jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
773 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
774 if (!media) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
775 purple_debug_error("jabber", "Couldn't create fsrtpconference\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
776 return FALSE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
777 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
778 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
779 /* this will need to be changed to "nice" once the libnice transmitter is finished */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
780 if (!purple_media_add_stream(media, remote_jid, PURPLE_MEDIA_AUDIO, "rawudp")) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
781 purple_debug_error("jabber", "Couldn't create audio stream\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
782 purple_media_reject(media); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
783 return FALSE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
784 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
785 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
786 jabber_jingle_session_set_remote_jid(session, remote_jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
787 jabber_jingle_session_set_initiator(session, initiator); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
788 jabber_jingle_session_set_media(session, media); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
789 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
790 /* connect callbacks */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
791 g_signal_connect_swapped(G_OBJECT(media), "accepted", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
792 G_CALLBACK(jabber_jingle_session_send_session_accept), session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
793 g_signal_connect_swapped(G_OBJECT(media), "reject", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
794 G_CALLBACK(jabber_jingle_session_send_session_reject), session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
795 g_signal_connect_swapped(G_OBJECT(media), "hangup", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
796 G_CALLBACK(jabber_jingle_session_send_session_terminate), session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
797 g_signal_connect(G_OBJECT(media), "candidates-prepared", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
798 G_CALLBACK(jabber_jingle_session_candidates_prepared), session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
799 g_signal_connect(G_OBJECT(media), "candidate-pair", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
800 G_CALLBACK(jabber_jingle_session_candidate_pair_established), session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
801 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
802 purple_media_ready(media); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
803 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
804 return TRUE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
805 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
806 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
807 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
808 jabber_jingle_session_initiate_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
809 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
810 const char *from = xmlnode_get_attrib(packet, "from"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
811 JingleSession *session = jabber_jingle_session_find_by_jid(js, from); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
812 PurpleMedia *media = session->media; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
813 JabberIq *result; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
814 xmlnode *jingle; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
815 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
816 if (!strcmp(xmlnode_get_attrib(packet, "type"), "error")) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
817 purple_media_got_hangup(media); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
818 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
819 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
820 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
821 /* catch errors */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
822 if (xmlnode_get_child(packet, "error")) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
823 purple_media_got_hangup(media); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
824 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
825 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
826 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
827 /* create transport-info package */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
828 result = jabber_iq_new(jabber_jingle_session_get_js(session), JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
829 jingle = jabber_jingle_session_create_transport_info(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
830 purple_debug_info("jabber", "jabber_session_candidates_prepared: %d candidates\n", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
831 g_list_length(purple_media_get_local_audio_candidates(session->media))); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
832 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
833 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
834 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
835 xmlnode_insert_child(result->node, jingle); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
836 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
837 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
838 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
839 PurpleMedia * |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
840 jabber_jingle_session_initiate_media(PurpleConnection *gc, const char *who, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
841 PurpleMediaStreamType type) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
842 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
843 /* create content negotiation */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
844 JabberStream *js = gc->proto_data; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
845 JabberIq *request = jabber_iq_new(js, JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
846 xmlnode *jingle, *content, *description, *transport; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
847 GList *codecs; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
848 JingleSession *session; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
849 JabberBuddy *jb; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
850 JabberBuddyResource *jbr; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
851 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
852 char *jid = NULL, *me = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
853 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
854 /* construct JID to send to */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
855 jb = jabber_buddy_find(js, who, FALSE); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
856 if (!jb) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
857 purple_debug_error("jabber", "Could not find Jabber buddy\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
858 return NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
859 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
860 jbr = jabber_buddy_find_resource(jb, NULL); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
861 if (!jbr) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
862 purple_debug_error("jabber", "Could not find buddy's resource\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
863 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
864 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
865 if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
866 jid = g_strdup_printf("%s/%s", who, jbr->name); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
867 } else { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
868 jid = g_strdup(who); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
869 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
870 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
871 session = jabber_jingle_session_create(js); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
872 /* set ourselves as initiator */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
873 me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
874 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
875 if (!jabber_jingle_session_initiate_media_internal(session, me, jid)) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
876 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
877 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
878 jabber_jingle_session_destroy(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
879 return NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
880 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
881 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
882 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
883 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
884 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
885 jabber_jingle_session_content_create_media(session, type); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
886 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
887 codecs = purple_media_get_local_audio_codecs(session->media); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
888 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
889 /* create request */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
890 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
891 xmlnode_set_attrib(request->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
892 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
893 jingle = xmlnode_new_child(request->node, "jingle"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
894 xmlnode_set_namespace(jingle, "urn:xmpp:tmp:jingle"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
895 xmlnode_set_attrib(jingle, "action", "session-initiate"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
896 /* get our JID and a session id... */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
897 xmlnode_set_attrib(jingle, "initiator", jabber_jingle_session_get_initiator(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
898 xmlnode_set_attrib(jingle, "sid", jabber_jingle_session_get_id(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
899 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
900 content = xmlnode_new_child(jingle, "content"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
901 xmlnode_set_attrib(content, "name", "audio-content"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
902 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
903 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
904 description = jabber_jingle_session_create_description(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
905 xmlnode_insert_child(content, description); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
906 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
907 transport = xmlnode_new_child(content, "transport"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
908 xmlnode_set_namespace(transport, "urn:xmpp:tmp:jingle:transports:ice-udp"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
909 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
910 jabber_iq_set_callback(request, jabber_jingle_session_initiate_result_cb, NULL); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
911 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
912 /* send request to other part */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
913 jabber_iq_send(request); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
914 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
915 fs_codec_list_destroy(codecs); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
916 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
917 return session->media; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
918 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
919 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
920 void |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
921 jabber_jingle_session_terminate_session_media(JabberStream *js, const gchar *who) |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
922 { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
923 JingleSession *session; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
924 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
925 session = jabber_jingle_session_find_by_jid(js, who); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
926 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
927 if (session) |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
928 purple_media_hangup(session->media); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
929 } |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
930 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
931 void |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
932 jabber_jingle_session_terminate_sessions(JabberStream *js) |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
933 { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
934 GList *values = g_hash_table_get_values(js->sessions); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
935 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
936 for (; values; values = values->next) { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
937 JingleSession *session = (JingleSession *)values->data; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
938 purple_media_hangup(session->media); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
939 } |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
940 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
941 g_list_free(values); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
942 } |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
943 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
944 void |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
945 jabber_jingle_session_handle_content_replace(JabberStream *js, xmlnode *packet) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
946 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
947 xmlnode *jingle = xmlnode_get_child(packet, "jingle"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
948 const char *sid = xmlnode_get_attrib(jingle, "sid"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
949 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
950 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
951 if (!jabber_jingle_session_is_initiator(session) && session->session_started) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
952 JabberIq *result = jabber_iq_new(js, JABBER_IQ_RESULT); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
953 JabberIq *accept = jabber_iq_new(js, JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
954 xmlnode *content_accept = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
955 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
956 /* send acknowledement */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
957 xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
958 xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
959 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
960 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
961 /* send content-accept */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
962 content_accept = jabber_jingle_session_create_content_accept(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
963 xmlnode_set_attrib(accept->node, "id", xmlnode_get_attrib(packet, "id")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
964 xmlnode_set_attrib(accept->node, "to", xmlnode_get_attrib(packet, "from")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
965 xmlnode_insert_child(accept->node, content_accept); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
966 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
967 jabber_iq_send(accept); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
968 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
969 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
970 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
971 void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
972 jabber_jingle_session_handle_session_accept(JabberStream *js, xmlnode *packet) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
973 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
974 JabberIq *result = jabber_iq_new(js, JABBER_IQ_RESULT); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
975 xmlnode *jingle = xmlnode_get_child(packet, "jingle"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
976 xmlnode *content = xmlnode_get_child(jingle, "content"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
977 const char *sid = xmlnode_get_attrib(jingle, "sid"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
978 const char *action = xmlnode_get_attrib(jingle, "action"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
979 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
980 GList *remote_codecs = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
981 GList *remote_transports = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
982 GList *codec_intersection; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
983 FsCodec *top = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
984 xmlnode *description = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
985 xmlnode *transport = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
986 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
987 /* We should probably check validity of the incoming XML... */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
988 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
989 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
990 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
991 jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
992 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
993 description = xmlnode_get_child(content, "description"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
994 transport = xmlnode_get_child(content, "transport"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
995 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
996 /* fetch codecs from remote party */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
997 purple_debug_info("jabber", "get codecs from session-accept\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
998 remote_codecs = jabber_jingle_get_codecs(description); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
999 purple_debug_info("jabber", "get transport candidates from session accept\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1000 remote_transports = jabber_jingle_get_candidates(transport); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1001 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1002 purple_debug_info("jabber", "Got %d codecs from responder\n", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1003 g_list_length(remote_codecs)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1004 purple_debug_info("jabber", "Got %d transport candidates from responder\n", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1005 g_list_length(remote_transports)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1006 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1007 purple_debug_info("jabber", "Setting remote codecs on stream\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1008 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1009 purple_media_set_remote_audio_codecs(session->media, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1010 jabber_jingle_session_get_remote_jid(session), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1011 remote_codecs); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1012 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1013 codec_intersection = purple_media_get_negotiated_audio_codecs(session->media); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1014 purple_debug_info("jabber", "codec_intersection contains %d elems\n", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1015 g_list_length(codec_intersection)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1016 /* get the top codec */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1017 if (g_list_length(codec_intersection) > 0) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1018 top = (FsCodec *) codec_intersection->data; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1019 purple_debug_info("jabber", "Found a suitable codec on stream = %d\n", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1020 top->id); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1021 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1022 /* we have found a suitable codec, but we will not start the stream |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1023 just yet, wait for transport negotiation to complete... */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1024 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1025 /* if we also got transport candidates, add them to our streams |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1026 list of known remote candidates */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1027 if (g_list_length(remote_transports) > 0) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1028 purple_media_add_remote_audio_candidates(session->media, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1029 jabber_jingle_session_get_remote_jid(session), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1030 remote_transports); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1031 fs_candidate_list_destroy(remote_transports); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1032 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1033 if (g_list_length(codec_intersection) == 0 && |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1034 g_list_length(remote_transports)) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1035 /* we didn't get any candidates and the codec intersection is empty, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1036 this means this was not a content-accept message and we couldn't |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1037 find any suitable codecs, should return error and hang up */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1038 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1039 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1040 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1041 g_list_free(codec_intersection); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1042 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1043 if (!strcmp(action, "session-accept")) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1044 purple_media_got_accept(jabber_jingle_session_get_media(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1045 purple_debug_info("jabber", "Got session-accept, starting stream\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1046 gst_element_set_state(purple_media_get_audio_pipeline(session->media), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1047 GST_STATE_PLAYING); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1048 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1049 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1050 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1051 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1052 session->session_started = TRUE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1053 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1054 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1055 void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1056 jabber_jingle_session_handle_session_initiate(JabberStream *js, xmlnode *packet) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1057 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1058 JingleSession *session = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1059 xmlnode *jingle = xmlnode_get_child(packet, "jingle"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1060 xmlnode *content = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1061 xmlnode *description = NULL; |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1062 xmlnode *transport = NULL; |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1063 const char *sid = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1064 const char *initiator = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1065 GList *codecs = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1066 JabberIq *result = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1067 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1068 if (!jingle) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1069 purple_debug_error("jabber", "Malformed request"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1070 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1071 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1072 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1073 sid = xmlnode_get_attrib(jingle, "sid"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1074 initiator = xmlnode_get_attrib(jingle, "initiator"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1075 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1076 if (jabber_jingle_session_find_by_id(js, sid)) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1077 /* This should only happen if you start a session with yourself */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1078 purple_debug_error("jabber", "Jingle session with id={%s} already exists\n", sid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1079 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1080 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1081 session = jabber_jingle_session_create_by_id(js, sid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1082 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1083 /* init media */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1084 content = xmlnode_get_child(jingle, "content"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1085 if (!content) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1086 purple_debug_error("jabber", "jingle tag must contain content tag\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1087 /* should send error here */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1088 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1089 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1090 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1091 description = xmlnode_get_child(content, "description"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1092 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1093 if (!description) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1094 purple_debug_error("jabber", "content tag must contain description tag\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1095 /* we should create an error iq here */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1096 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1097 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1098 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1099 transport = xmlnode_get_child(content, "transport"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1100 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1101 if (!transport) { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1102 purple_debug_error("jingle", "content tag must contain transport tag\n"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1103 /* we should create an error iq here */ |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1104 return; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1105 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1106 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1107 if (!jabber_jingle_session_initiate_media_internal(session, initiator, initiator)) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1108 purple_debug_error("jabber", "Couldn't start media session with %s\n", initiator); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1109 jabber_jingle_session_destroy(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1110 /* we should create an error iq here */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1111 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1112 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1113 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1114 jabber_jingle_session_content_create_parse(session, jingle); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1115 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1116 codecs = jabber_jingle_get_codecs(description); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1117 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1118 purple_media_set_remote_audio_codecs(session->media, initiator, codecs); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1119 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1120 result = jabber_iq_new(js, JABBER_IQ_RESULT); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1121 jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1122 xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1123 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1124 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1125 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1126 void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1127 jabber_jingle_session_handle_session_terminate(JabberStream *js, xmlnode *packet) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1128 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1129 JabberIq *result = jabber_iq_new(js, JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1130 xmlnode *jingle = xmlnode_get_child(packet, "jingle"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1131 const char *sid = xmlnode_get_attrib(jingle, "sid"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1132 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1133 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1134 if (!session) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1135 purple_debug_error("jabber", "jabber_handle_session_terminate couldn't find session\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1136 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1137 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1138 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1139 xmlnode_set_attrib(result->node, "to", |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1140 jabber_jingle_session_get_remote_jid(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1141 xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1142 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1143 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1144 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1145 /* maybe we should look at the reasoncode to determine if it was |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1146 a hangup or a reject, and call different callbacks to purple_media */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1147 gst_element_set_state(purple_media_get_audio_pipeline(session->media), GST_STATE_NULL); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1148 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1149 purple_media_got_hangup(jabber_jingle_session_get_media(session)); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1150 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1151 jabber_jingle_session_destroy(session); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1152 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1153 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1154 void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1155 jabber_jingle_session_handle_transport_info(JabberStream *js, xmlnode *packet) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1156 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1157 JabberIq *result = jabber_iq_new(js, JABBER_IQ_RESULT); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1158 xmlnode *jingle = xmlnode_get_child(packet, "jingle"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1159 xmlnode *content = xmlnode_get_child(jingle, "content"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1160 xmlnode *transport = xmlnode_get_child(content, "transport"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1161 GList *remote_candidates = jabber_jingle_get_candidates(transport); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1162 const char *sid = xmlnode_get_attrib(jingle, "sid"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1163 JingleSession *session = jabber_jingle_session_find_by_id(js, sid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1164 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1165 if (!session) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1166 purple_debug_error("jabber", "jabber_handle_session_candidates couldn't find session\n"); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1167 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1168 /* send acknowledement */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1169 xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1170 xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1171 jabber_iq_send(result); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1172 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1173 /* add candidates to our list of remote candidates */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1174 if (g_list_length(remote_candidates) > 0) { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1175 purple_media_add_remote_audio_candidates(session->media, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1176 xmlnode_get_attrib(packet, "from"), |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1177 remote_candidates); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1178 fs_candidate_list_destroy(remote_candidates); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1179 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1180 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1181 |
23804
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23798
diff
changeset
|
1182 #endif /* USE_VV */ |