Mercurial > pidgin
annotate libpurple/protocols/jabber/jingle.c @ 23852:a1a1f44cdecc
Fixed some memory leak issues involving GLists.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Fri, 11 Jul 2008 02:10:04 +0000 |
parents | 84c7bb2ca41f |
children | 1c68f78414b7 |
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 |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
34 #define JINGLE "urn:xmpp:tmp:jingle" |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
35 #define JINGLE_RTP "urn:xmpp:tmp:jingle:apps:rtp" |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
36 #define JINGLE_RTP_INFO "urn:xmpp:tmp:jingle:apps:rtp:info" |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
37 #define TRANSPORT_ICEUDP "urn:xmpp:tmp:jingle:transports:ice-udp" |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
38 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
39 typedef enum { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
40 PENDING, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
41 GOT_ACK, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
42 ACCEPTED, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
43 ACTIVE |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
44 } JingleSessionState; |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
45 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
46 typedef struct { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
47 char *id; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
48 JabberStream *js; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
49 PurpleMedia *media; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
50 char *remote_jid; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
51 char *initiator; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
52 gboolean is_initiator; |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
53 JingleSessionState state; |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
54 GHashTable *contents; /* JingleSessionContent table */ |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
55 } JingleSession; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
56 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
57 typedef struct { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
58 gchar *name; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
59 JingleSession *session; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
60 gchar *creator; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
61 gchar *sender; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
62 gchar *transport_type; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
63 gchar *type; |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
64 gchar *subtype; |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
65 } JingleSessionContent; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
66 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
67 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
68 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
|
69 const gchar *name, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
70 const gchar *creator, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
71 const gchar *sender, |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
72 const gchar *transport_type, |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
73 const gchar *type, |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
74 const gchar *subtype) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
75 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
76 JingleSessionContent *content = g_new0(JingleSessionContent, 1); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
77 content->session = session; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
78 content->name = g_strdup(name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
79 content->creator = g_strdup(creator); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
80 content->sender = g_strdup(sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
81 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
|
82 content->type = g_strdup(type); |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
83 content->subtype = g_strdup(subtype); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
84 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
85 if (!session->contents) { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
86 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
|
87 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
|
88 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
89 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
|
90 content->name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
91 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
|
92 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
93 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
94 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
95 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
|
96 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
97 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
|
98 content->name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
99 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
|
100 g_free(content->name); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
101 g_free(content->creator); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
102 g_free(content->sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
103 g_free(content->transport_type); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
104 g_free(content->type); |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
105 g_free(content->subtype); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
106 g_free(content); |
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 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
109 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
110 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
|
111 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
112 return jsc->name; |
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 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
115 static JingleSession * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
116 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
|
117 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
118 return jsc->session; |
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 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
121 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
122 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
|
123 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
124 return jsc->creator; |
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 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
127 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
128 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
|
129 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
130 return jsc->sender; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
131 } |
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 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
134 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
|
135 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
136 return jsc->transport_type; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
137 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
138 |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
139 static gboolean |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
140 jabber_jingle_session_content_is_transport_type(const JingleSessionContent *jsc, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
141 const gchar *transport_type) |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
142 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
143 return !strcmp(jabber_jingle_session_content_get_transport_type(jsc), |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
144 transport_type); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
145 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
146 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
147 static const gchar * |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
148 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
|
149 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
150 return jsc->type; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
151 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
152 |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
153 static gboolean |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
154 jabber_jingle_session_content_is_type(const JingleSessionContent *jsc, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
155 const gchar *type) |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
156 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
157 return !strcmp(jabber_jingle_session_content_get_type(jsc), type); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
158 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
159 |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
160 static gchar * |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
161 jabber_jingle_session_content_get_subtype(const JingleSessionContent *jsc) |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
162 { |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
163 return jsc->subtype; |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
164 } |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
165 |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
166 static gboolean |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
167 jabber_jingle_session_content_is_vv_type(const JingleSessionContent *jsc, |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
168 const gchar *media_type) |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
169 { |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
170 return jabber_jingle_session_content_is_type(jsc, JINGLE_RTP) && |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
171 !strcmp(jabber_jingle_session_content_get_subtype(jsc), |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
172 media_type); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
173 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
174 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
175 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
176 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
|
177 const char *sender) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
178 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
179 if (jsc->sender) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
180 g_free(jsc->sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
181 jsc->sender = g_strdup(sender); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
182 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
183 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 static gboolean |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 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
|
186 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 purple_debug_info("jingle", |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 "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
|
189 ((JingleSession *)a)->id, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 ((JingleSession *)b)->id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 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
|
192 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 static JingleSession * |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 jabber_jingle_session_create_internal(JabberStream *js, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 const char *id) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 JingleSession *sess = g_new0(JingleSession, 1); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 sess->js = js; |
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 if (id) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 sess->id = g_strdup(id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 } else if (js) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 /* init the session ID... */ |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 sess->id = jabber_get_next_id(js); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 /* 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
|
209 if (!js->sessions) { |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 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
|
211 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
|
212 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 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
|
214 sess->id); |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
215 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
|
216 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
217 sess->state = PENDING; |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
218 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 return sess; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
222 static JabberStream * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 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
|
224 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 return sess->js; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
228 static JingleSession * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 jabber_jingle_session_create(JabberStream *js) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 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
|
232 sess->is_initiator = TRUE; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
233 return sess; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
236 static JingleSession * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 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
|
238 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
239 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
|
240 sess->is_initiator = FALSE; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 return sess; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
242 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
243 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
244 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
245 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
|
246 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 return sess->id; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
248 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
249 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
250 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
251 jabber_jingle_session_destroy(JingleSession *sess) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
252 { |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
253 GList *contents; |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
254 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
|
255 g_free(sess->id); |
23845
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
256 |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
257 if (sess->media) |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
258 g_object_unref(sess->media); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
259 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
260 for (contents = g_hash_table_get_values(sess->contents); contents; |
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
261 contents = g_list_delete_link(contents, contents)) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
262 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
|
263 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 g_free(sess); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
267 static JingleSession * |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
268 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
|
269 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 purple_debug_info("jingle", "find_by_id %s\n", id); |
23832 | 271 purple_debug_info("jingle", "lookup: %p\n", (js->sessions) ? |
272 g_hash_table_lookup(js->sessions, id) : NULL); | |
273 return (JingleSession *) (js->sessions) ? | |
274 g_hash_table_lookup(js->sessions, id) : 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
|
275 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
276 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
277 static JingleSession * |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
278 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
|
279 { |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
280 GList *values = g_hash_table_get_values(js->sessions); |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
281 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
|
282 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
283 for (; values; values = g_list_delete_link(values, values)) { |
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
284 JingleSession *session = (JingleSession *)values->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
|
285 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
|
286 : 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 } |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
292 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
|
293 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
294 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
295 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
|
296 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
297 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
298 static GList * |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
299 jabber_jingle_get_codecs(xmlnode *description) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 GList *codecs = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 xmlnode *codec_element = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 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
|
304 FsCodec *codec; |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
305 const gchar *media = xmlnode_get_attrib(description, "media"); |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
306 FsMediaType type = !strcmp(media, "video") ? FS_MEDIA_TYPE_VIDEO : |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
307 !strcmp(media, "audio") ? FS_MEDIA_TYPE_AUDIO : |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
308 FS_MEDIA_TYPE_APPLICATION; |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
309 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 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
|
311 codec_element ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 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
|
313 encoding_name = xmlnode_get_attrib(codec_element, "name"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
314 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 id = xmlnode_get_attrib(codec_element, "id"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 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
|
317 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
318 codec = fs_codec_new(atoi(id), encoding_name, |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
319 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
|
320 clock_rate ? atoi(clock_rate) : 0); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
321 purple_debug_info("jingle", "codec: %i, %s, %s, %i\n", codec->id, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
322 codec->encoding_name, codec->media_type == FS_MEDIA_TYPE_AUDIO ? |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
323 "FS_MEDIA_TYPE_AUDIO" : codec->media_type == FS_MEDIA_TYPE_VIDEO ? |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
324 "FS_MEDIA_TYPE_VIDEO" : "FS_MEDIA_TYPE_NONE", codec->clock_rate); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
325 codecs = g_list_append(codecs, codec); |
23788
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 codecs; |
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 GList * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 jabber_jingle_get_candidates(const xmlnode *transport) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 GList *candidates = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 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
|
335 FsCandidate *c; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
337 for (candidate = xmlnode_get_child(transport, "candidate") ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 candidate ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 candidate = xmlnode_get_next_twin(candidate)) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 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
|
341 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
|
342 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
|
343 strcmp(type, "host") == 0 ? |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
344 FS_CANDIDATE_TYPE_HOST : |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
345 strcmp(type, "prflx") == 0 ? |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
346 FS_CANDIDATE_TYPE_PRFLX : |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
347 strcmp(type, "relay") == 0 ? |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
348 FS_CANDIDATE_TYPE_RELAY : |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
349 strcmp(type, "srflx") == 0 ? |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
350 FS_CANDIDATE_TYPE_SRFLX : 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
|
351 strcmp(xmlnode_get_attrib(candidate, "protocol"), |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 "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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 candidates = g_list_append(candidates, c); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 } |
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 return candidates; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
363 static JingleSessionContent * |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
364 jabber_jingle_session_get_content(const JingleSession *session, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
365 const char *name) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
366 { |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
367 return (JingleSession *) name ? |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
368 g_hash_table_lookup(session->contents, name) : NULL; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
369 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
370 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
371 static GList * |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
372 jabber_jingle_session_get_contents(const JingleSession *session) |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
373 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
374 return g_hash_table_get_values(session->contents); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
375 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
376 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
377 static PurpleMedia * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 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
|
379 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
380 return sess->media; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
381 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
383 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 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
|
385 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 sess->media = media; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
389 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 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
|
391 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 return sess->remote_jid; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
395 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 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
|
397 const char *remote_jid) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 sess->remote_jid = strdup(remote_jid); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
401 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
402 static JingleSessionState |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
403 jabber_jingle_session_get_state(JingleSession *sess) |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
404 { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
405 return sess->state; |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
406 } |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
407 |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
408 static void |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
409 jabber_jingle_session_set_state(JingleSession *sess, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
410 JingleSessionState state) |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
411 { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
412 sess->state = state; |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
413 } |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
414 |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
415 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
416 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
417 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
|
418 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
419 return sess->initiator; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
420 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
421 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
422 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
423 jabber_jingle_session_set_initiator(JingleSession *sess, |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
424 const char *initiator) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
425 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
426 sess->initiator = g_strdup(initiator); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
427 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
428 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
429 static gboolean |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
430 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
|
431 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
432 return sess->is_initiator; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
433 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
434 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
435 static void |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
436 jabber_jingle_session_add_payload_types(const JingleSessionContent *jsc, |
23831
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
437 xmlnode *description, |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
438 GList *codecs) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
439 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
440 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
|
441 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
|
442 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
|
443 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
|
444 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
445 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
|
446 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
|
447 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
|
448 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
449 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
|
450 xmlnode_set_attrib(payload, "id", id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
451 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
|
452 xmlnode_set_attrib(payload, "channels", channels); |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
453 } |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
454 } |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
455 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
456 static xmlnode * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
457 jabber_jingle_session_add_description_vv(const JingleSessionContent *jsc, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
458 xmlnode *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
|
459 { |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
460 xmlnode_set_attrib(description, "media", |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
461 jabber_jingle_session_content_get_subtype(jsc)); |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
462 xmlnode_set_attrib(description, "profile", "RTP/AVP"); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
463 return 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
|
464 } |
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 static xmlnode * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
467 jabber_jingle_session_add_description(const JingleSessionContent *jsc, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
468 xmlnode *content) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
469 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
470 xmlnode *description = xmlnode_new_child(content, "description"); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
471 xmlnode_set_namespace(description, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
472 jabber_jingle_session_content_get_type(jsc)); |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
473 |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
474 if (jabber_jingle_session_content_is_type(jsc, JINGLE_RTP)) |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
475 return jabber_jingle_session_add_description_vv(jsc, description); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
476 else |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
477 return description; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
478 } |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
479 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
480 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
481 jabber_jingle_session_add_candidate_iceudp(xmlnode *transport, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
482 FsCandidate *c, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
483 FsCandidate *remote) |
23797
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 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
|
486 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
|
487 char component[8]; |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
488 xmlnode *candidate = xmlnode_new_child(transport, "candidate"); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
489 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
490 g_snprintf(port, sizeof(port), "%d", c->port); |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
491 g_snprintf(prio, sizeof(prio), "%d", c->priority); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
492 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
|
493 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 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
|
502 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
|
503 "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
|
504 if (c->username) |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
505 xmlnode_set_attrib(transport, "ufrag", c->username); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
506 if (c->password) |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
507 xmlnode_set_attrib(transport, "pwd", c->password); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
508 |
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_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
|
510 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
|
511 "host" : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
512 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
|
513 "prflx" : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
514 c->type == FS_CANDIDATE_TYPE_RELAY ? |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
515 "relay" : |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
516 c->type == FS_CANDIDATE_TYPE_SRFLX ? |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
517 "srflx" : 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
|
518 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
519 /* relay */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
520 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
|
521 /* 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
|
522 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
523 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
524 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
530 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
531 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
|
532 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
533 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
534 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
535 jabber_jingle_session_add_transport(const JingleSessionContent *jsc, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
536 xmlnode *content) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
537 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
538 xmlnode *transport = xmlnode_new_child(content, "transport"); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
539 const gchar *transport_type = jabber_jingle_session_content_get_transport_type(jsc); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
540 xmlnode_set_namespace(transport, transport_type); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
541 return transport; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
542 } |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
543 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
544 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
545 jabber_jingle_session_add_content(const JingleSessionContent *jsc, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
546 xmlnode *jingle) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
547 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
548 xmlnode *content = xmlnode_new_child(jingle, "content"); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
549 xmlnode_set_attrib(content, "creator", |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
550 jabber_jingle_session_content_get_creator(jsc)); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
551 xmlnode_set_attrib(content, "name", |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
552 jabber_jingle_session_content_get_name(jsc)); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
553 xmlnode_set_attrib(content, "sender", |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
554 jabber_jingle_session_content_get_sender(jsc)); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
555 return content; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
556 } |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
557 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
558 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
559 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
560 jabber_jingle_session_add_jingle(const JingleSession *sess, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
561 JabberIq *iq, const char *action) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
562 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
563 xmlnode *jingle = iq ? xmlnode_new_child(iq->node, "jingle") : |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
564 xmlnode_new("jingle"); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
565 xmlnode_set_namespace(jingle, JINGLE); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
566 xmlnode_set_attrib(jingle, "action", action); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
567 xmlnode_set_attrib(jingle, "initiator", |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
568 jabber_jingle_session_get_initiator(sess)); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
569 if (jabber_jingle_session_is_initiator(sess)) |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
570 xmlnode_set_attrib(jingle, "responder", |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
571 jabber_jingle_session_get_remote_jid(sess)); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
572 else { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
573 gchar *responder = g_strdup_printf("%s@%s/%s", |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
574 sess->js->user->node, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
575 sess->js->user->domain, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
576 sess->js->user->resource); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
577 xmlnode_set_attrib(jingle, "responder", responder); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
578 g_free(responder); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
579 } |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
580 xmlnode_set_attrib(jingle, "sid", jabber_jingle_session_get_id(sess)); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
581 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
582 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
583 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
584 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
585 static JabberIq * |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
586 jabber_jingle_session_create_ack(JingleSession *session, xmlnode *jingle) |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
587 { |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
588 JabberIq *result = jabber_iq_new( |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
589 jabber_jingle_session_get_js(session), |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
590 JABBER_IQ_RESULT); |
23850
84c7bb2ca41f
Added xmlnode_get_parent.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23849
diff
changeset
|
591 xmlnode *packet = xmlnode_get_parent(jingle); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
592 jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id")); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
593 xmlnode_set_attrib(result->node, "from", xmlnode_get_attrib(packet, "to")); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
594 xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
595 return result; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
596 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
597 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
598 static JabberIq * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
599 jabber_jingle_session_create_iq(const JingleSession *session) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
600 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
601 JabberIq *result = jabber_iq_new(jabber_jingle_session_get_js(session), |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
602 JABBER_IQ_SET); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
603 gchar *from = g_strdup_printf("%s@%s/%s", session->js->user->node, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
604 session->js->user->domain, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
605 session->js->user->resource); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
606 xmlnode_set_attrib(result->node, "from", from); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
607 g_free(from); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
608 xmlnode_set_attrib(result->node, "to", |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
609 jabber_jingle_session_get_remote_jid(session)); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
610 return result; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
611 } |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
612 #if 0 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
613 static xmlnode * |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
614 jabber_jingle_session_create_content_accept(const JingleSession *sess) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
615 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
616 xmlnode *jingle = |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
617 jabber_jingle_session_add_jingle(sess, NULL, "content-accept"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
618 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
619 xmlnode *content = xmlnode_new_child(jingle, "content"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
620 xmlnode *description = jabber_jingle_session_create_description(sess); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
621 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
622 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
623 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
624 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
625 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
626 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
|
627 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
628 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
629 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
630 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
631 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
632 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
|
633 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
|
634 FsCandidate *remote_candidate) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
636 xmlnode *jingle = |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
637 jabber_jingle_session_add_jingle(sess, NULL, "content-replace"); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 xmlnode *content = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
639 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
|
640 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
641 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
|
642 ", 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
|
643 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
|
644 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 content = xmlnode_new_child(jingle, "content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
650 /* 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
|
651 /* 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
|
652 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
653 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
|
654 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
655 transport = xmlnode_new_child(content, "transport"); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
656 xmlnode_set_namespace(transport, TRANSPORT_ICEUDP); |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
657 jabber_jingle_session_add_candidate_iceudp(transport, native_candidate, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
658 remote_candidate); |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
659 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
660 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
|
661 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
662 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
663 } |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
664 #endif |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
665 |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
666 static JabberIq * |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
667 jabber_jingle_session_create_session_accept(const JingleSession *session) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
668 { |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
669 PurpleMedia *media = jabber_jingle_session_get_media(session); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
670 const gchar *remote_jid = jabber_jingle_session_get_remote_jid(session); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
671 JabberIq *request = jabber_jingle_session_create_iq(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
672 xmlnode *jingle = |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
673 jabber_jingle_session_add_jingle(session, request, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
674 "session-accept"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
675 GList *contents = jabber_jingle_session_get_contents(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
676 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
677 for (; contents; contents = contents->next) { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
678 JingleSessionContent *jsc = contents->data; |
23831
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
679 const gchar *content_name = jabber_jingle_session_content_get_name(jsc); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
680 xmlnode *content = jabber_jingle_session_add_content(jsc, jingle); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
681 xmlnode *description = jabber_jingle_session_add_description(jsc, content); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
682 xmlnode *transport = jabber_jingle_session_add_transport(jsc, content); |
23831
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
683 if (jabber_jingle_session_content_is_type(jsc, JINGLE_RTP)) { |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
684 GList *codecs = purple_media_get_negotiated_codecs(media, |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
685 content_name); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
686 jabber_jingle_session_add_payload_types(jsc, description, codecs); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
687 fs_codec_list_destroy(codecs); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
688 } |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
689 if (jabber_jingle_session_content_is_transport_type(jsc, TRANSPORT_ICEUDP)) { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
690 jabber_jingle_session_add_candidate_iceudp(transport, |
23831
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
691 purple_media_get_local_candidate(media, content_name, |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
692 remote_jid), |
23831
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
693 purple_media_get_remote_candidate(media, content_name, |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
694 remote_jid)); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
695 } |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
696 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
697 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
698 return request; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
699 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
700 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
701 static JabberIq * |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
702 jabber_jingle_session_create_session_info(const JingleSession *session, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
703 const gchar *type) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
704 { |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
705 JabberIq *request = jabber_jingle_session_create_iq(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
706 xmlnode *jingle = |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
707 jabber_jingle_session_add_jingle(session, request, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
708 "session-info"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
709 xmlnode *info = xmlnode_new_child(jingle, type); |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
710 xmlnode_set_namespace(info, JINGLE_RTP_INFO); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
711 return request; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
712 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
713 |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
714 static JabberIq * |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
715 jabber_jingle_session_create_session_initiate(const JingleSession *session) |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
716 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
717 JabberIq *request = jabber_jingle_session_create_iq(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
718 xmlnode *jingle = |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
719 jabber_jingle_session_add_jingle(session, request, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
720 "session-initiate"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
721 GList *contents = jabber_jingle_session_get_contents(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
722 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
723 for (; contents; contents = contents->next) { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
724 JingleSessionContent *jsc = contents->data; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
725 xmlnode *content = jabber_jingle_session_add_content(jsc, jingle); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
726 xmlnode *description = jabber_jingle_session_add_description(jsc, content); |
23831
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
727 if (jabber_jingle_session_content_is_type(jsc, JINGLE_RTP)) { |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
728 PurpleMedia *media = jabber_jingle_session_get_media(session); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
729 const gchar *content_name = |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
730 jabber_jingle_session_content_get_name(jsc); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
731 GList *codecs = purple_media_get_local_codecs(media, content_name); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
732 jabber_jingle_session_add_payload_types(jsc, description, codecs); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
733 fs_codec_list_destroy(codecs); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
734 } |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
735 jabber_jingle_session_add_transport(jsc, content); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
736 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
737 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
738 return request; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
739 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
740 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
741 static JabberIq * |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
742 jabber_jingle_session_create_session_terminate(const JingleSession *sess, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
743 const char *reasoncode, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
744 const char *reasontext) |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
745 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
746 JabberIq *request = jabber_jingle_session_create_iq(sess); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
747 xmlnode *jingle = |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
748 jabber_jingle_session_add_jingle(sess, request, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
749 "session-terminate"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
750 xmlnode *reason = xmlnode_new_child(jingle, "reason"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
751 xmlnode *condition = xmlnode_new_child(reason, "condition"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
752 xmlnode_new_child(condition, reasoncode); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
753 if (reasontext) { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
754 xmlnode *text = xmlnode_new_child(reason, "text"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
755 xmlnode_insert_data(text, reasontext, strlen(reasontext)); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
756 } |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
757 |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
758 return request; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
759 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
760 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
761 static JabberIq * |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
762 jabber_jingle_session_create_transport_info(const JingleSessionContent *jsc, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
763 FsCandidate *candidate) |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
764 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
765 JingleSession *session = |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
766 jabber_jingle_session_content_get_session(jsc); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
767 JabberIq *request = jabber_jingle_session_create_iq(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
768 xmlnode *jingle = |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
769 jabber_jingle_session_add_jingle(session, request, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
770 "transport-info"); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
771 xmlnode *content = jabber_jingle_session_add_content(jsc, jingle); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
772 xmlnode *transport = jabber_jingle_session_add_transport(jsc, content); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
773 jabber_jingle_session_add_candidate_iceudp(transport, candidate, NULL); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
774 return request; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
775 } |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
776 #if 0 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
777 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
778 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
|
779 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
780 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
|
781 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
782 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
|
783 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
|
784 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
|
785 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
786 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
|
787 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
|
788 } |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
789 #endif |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
790 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
791 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
|
792 { |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
793 /* create transport-info packages */ |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
794 PurpleMedia *media = jabber_jingle_session_get_media(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
795 GList *contents = jabber_jingle_session_get_contents(session); |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
796 const gchar *remote_jid = jabber_jingle_session_get_remote_jid(session); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
797 for (; contents; contents = contents->next) { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
798 JingleSessionContent *jsc = contents->data; |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
799 GList *candidates = purple_media_get_local_candidates( |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
800 media, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
801 jabber_jingle_session_content_get_name(jsc), |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
802 remote_jid); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
803 purple_debug_info("jingle", |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
804 "jabber_session_candidates_prepared: %d candidates\n", |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
805 g_list_length(candidates)); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
806 for (; candidates; candidates = candidates->next) { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
807 FsCandidate *candidate = candidates->data; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
808 JabberIq *result = jabber_jingle_session_create_transport_info(jsc, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
809 candidate); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
810 jabber_iq_send(result); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
811 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
812 fs_candidate_list_destroy(candidates); |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
813 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
814 purple_debug_info("jingle", "codec intersection: %i\n", |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
815 g_list_length(purple_media_get_negotiated_codecs(media, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
816 jabber_jingle_session_content_get_name(jsc)))); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
817 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
818 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
819 if (purple_media_candidates_prepared(media, remote_jid)) { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
820 jabber_iq_send(jabber_jingle_session_create_session_accept(session)); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
821 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
822 purple_debug_info("jingle", "Sent session accept, starting stream\n"); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
823 gst_element_set_state(purple_media_get_pipeline(session->media), GST_STATE_PLAYING); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
824 jabber_jingle_session_set_state(session, ACTIVE); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
825 } else |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
826 jabber_jingle_session_set_state(session, ACCEPTED); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
827 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
828 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
829 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
830 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
|
831 { |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
832 jabber_iq_send(jabber_jingle_session_create_session_terminate(session, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
833 "decline", NULL)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
834 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
|
835 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
836 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
837 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
838 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
|
839 { |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
840 jabber_iq_send(jabber_jingle_session_create_session_terminate(session, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
841 "no-error", NULL)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
842 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
|
843 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
844 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
845 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
846 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
|
847 PurpleMediaStreamType type) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
848 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
849 gchar sender[10] = ""; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
850 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
851 if (type & PURPLE_MEDIA_AUDIO) { |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
852 if (type == PURPLE_MEDIA_SEND_AUDIO) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
853 strcpy(sender, "initiator"); |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
854 else if (type == PURPLE_MEDIA_RECV_AUDIO) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
855 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
856 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
857 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
858 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
|
859 "audio-content", "initiator", sender, |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
860 TRANSPORT_ICEUDP, JINGLE_RTP, "audio"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
861 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
862 if (type & PURPLE_MEDIA_VIDEO) { |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
863 if (type == PURPLE_MEDIA_SEND_VIDEO) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
864 strcpy(sender, "initiator"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
865 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
|
866 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
867 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
868 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
869 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
|
870 "video-content", "initiator", sender, |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
871 TRANSPORT_ICEUDP, JINGLE_RTP, "video"); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
872 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
873 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
874 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
875 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
876 jabber_jingle_session_content_create_parse(JingleSession *session, |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
877 xmlnode *content) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
878 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
879 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
|
880 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
|
881 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
882 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
|
883 const gchar *sender = xmlnode_get_attrib(content, "sender"); |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
884 const gchar *subtype = xmlnode_get_attrib(description, "media"); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
885 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
886 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
|
887 xmlnode_get_attrib(content, "name"), |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
888 creator ? creator : "initiator", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
889 sender ? sender : "both", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
890 xmlnode_get_namespace(transport), |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
891 xmlnode_get_namespace(description), |
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
892 subtype); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
893 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
894 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
895 static void |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
896 jabber_jingle_session_new_candidate_cb(PurpleMedia *media, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
897 const gchar *session_id, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
898 const gchar *name, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
899 FsCandidate *candidate, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
900 JingleSession *session) |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
901 { |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
902 if (jabber_jingle_session_get_state(session) == GOT_ACK || |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
903 jabber_jingle_session_get_state(session) == ACTIVE) { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
904 JingleSessionContent *jsc = jabber_jingle_session_get_content(session, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
905 session_id); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
906 jabber_iq_send(jabber_jingle_session_create_transport_info(jsc, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
907 candidate)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
908 } |
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 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
911 /* 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
|
912 has been established */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
913 static void |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
914 jabber_jingle_session_candidate_pair_established_cb(PurpleMedia *media, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
915 FsCandidate *native_candidate, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
916 FsCandidate *remote_candidate, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
917 JingleSession *session) |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
918 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
919 if (!jabber_jingle_session_is_initiator(session) && |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
920 jabber_jingle_session_get_state(session) == ACCEPTED && |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
921 purple_media_candidates_prepared(media, |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
922 jabber_jingle_session_get_remote_jid(session))) { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
923 jabber_iq_send(jabber_jingle_session_create_session_accept(session)); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
924 |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
925 purple_debug_info("jingle", "Sent session accept, starting stream\n"); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
926 gst_element_set_state(purple_media_get_pipeline(session->media), |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
927 GST_STATE_PLAYING); |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
928 jabber_jingle_session_set_state(session, ACTIVE); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
929 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
930 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
931 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
932 static gboolean |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
933 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
|
934 const char *initiator, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
935 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
|
936 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
937 PurpleMedia *media = NULL; |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
938 GList *contents = jabber_jingle_session_get_contents(session); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
939 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
940 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
|
941 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
|
942 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
943 if (!media) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
944 purple_debug_error("jingle", "Couldn't create fsrtpconference\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
945 return FALSE; |
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 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
948 for (; contents; contents = g_list_delete_link(contents, contents)) { |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
949 JingleSessionContent *jsc = contents->data; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
950 gboolean result = FALSE; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
951 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
952 /* these will need to be changed to "nice" once the libnice transmitter is finished */ |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
953 if (jabber_jingle_session_content_is_vv_type(jsc, "audio")) { |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
954 result = purple_media_add_stream(media, "audio-content", remote_jid, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
955 PURPLE_MEDIA_AUDIO, "rawudp"); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
956 purple_debug_info("jingle", "Created Jingle audio session\n"); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
957 } |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
958 else if (jabber_jingle_session_content_is_vv_type(jsc, "video")) { |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
959 result = purple_media_add_stream(media, "video-content", remote_jid, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
960 PURPLE_MEDIA_VIDEO, "rawudp"); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
961 purple_debug_info("jingle", "Created Jingle video session\n"); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
962 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
963 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
964 if (!result) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
965 purple_debug_error("jingle", "Couldn't create stream\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
966 purple_media_reject(media); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
967 return FALSE; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
968 } |
23816
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 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
|
972 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
|
973 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
|
974 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
975 /* connect callbacks */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
976 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
|
977 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
|
978 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
|
979 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
|
980 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
|
981 G_CALLBACK(jabber_jingle_session_send_session_terminate), session); |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
982 g_signal_connect(G_OBJECT(media), "new-candidate", |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
983 G_CALLBACK(jabber_jingle_session_new_candidate_cb), session); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
984 g_signal_connect(G_OBJECT(media), "candidate-pair", |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
985 G_CALLBACK(jabber_jingle_session_candidate_pair_established_cb), session); |
23816
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 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
|
988 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
989 return TRUE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
990 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
991 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
992 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
993 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
|
994 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
995 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
|
996 JingleSession *session = jabber_jingle_session_find_by_jid(js, from); |
23833
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
997 PurpleMedia *media; |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
998 GList *contents; |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
999 |
23833
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1000 if (!session) { |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1001 /* respond with an error here */ |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1002 purple_debug_error("jingle", "Received session-initiate ack" |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1003 " to nonexistent session\n"); |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1004 return; |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1005 } |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1006 |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1007 media = session->media; |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1008 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1009 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
|
1010 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
|
1011 return; |
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 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1014 /* catch errors */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1015 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
|
1016 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
|
1017 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1018 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1019 |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1020 /* create transport-info packages */ |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1021 contents = jabber_jingle_session_get_contents(session); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1022 for (; contents; contents = contents->next) { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1023 JingleSessionContent *jsc = contents->data; |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1024 GList *candidates = purple_media_get_local_candidates( |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1025 jabber_jingle_session_get_media(session), |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1026 jabber_jingle_session_content_get_name(jsc), |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1027 jabber_jingle_session_get_remote_jid(session)); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1028 purple_debug_info("jingle", |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1029 "jabber_session_candidates_prepared: %d candidates\n", |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1030 g_list_length(candidates)); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1031 for (; candidates; candidates = candidates->next) { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1032 FsCandidate *candidate = candidates->data; |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1033 JabberIq *result = jabber_jingle_session_create_transport_info(jsc, |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1034 candidate); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1035 jabber_iq_send(result); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1036 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1037 fs_candidate_list_destroy(candidates); |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1038 } |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
1039 |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
1040 jabber_jingle_session_set_state(session, GOT_ACK); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1041 } |
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 PurpleMedia * |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1044 jabber_jingle_session_initiate_media(JabberStream *js, const char *who, |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1045 PurpleMediaStreamType type) |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1046 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1047 /* create content negotiation */ |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1048 JabberIq *request; |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1049 JingleSession *session; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1050 JabberBuddy *jb; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1051 JabberBuddyResource *jbr; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1052 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1053 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
|
1054 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1055 /* 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
|
1056 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
|
1057 if (!jb) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1058 purple_debug_error("jingle", "Could not find Jabber buddy\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1059 return NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1060 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1061 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
|
1062 if (!jbr) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1063 purple_debug_error("jingle", "Could not find buddy's resource\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1064 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1065 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1066 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
|
1067 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
|
1068 } else { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1069 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
|
1070 } |
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 session = jabber_jingle_session_create(js); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1073 jabber_jingle_session_content_create_media(session, type); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1074 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1075 /* 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
|
1076 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
|
1077 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1078 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
|
1079 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1080 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1081 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
|
1082 return NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1083 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1084 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1085 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1086 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1087 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1088 /* create request */ |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1089 request = jabber_jingle_session_create_session_initiate(session); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1090 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
|
1091 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1092 /* 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
|
1093 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
|
1094 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1095 return session->media; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1096 } |
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 void |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1099 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
|
1100 { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1101 JingleSession *session; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1102 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1103 session = jabber_jingle_session_find_by_jid(js, who); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1104 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1105 if (session) |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1106 purple_media_hangup(session->media); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1107 } |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1108 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1109 void |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1110 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
|
1111 { |
23835 | 1112 GList *values = js->sessions ? |
1113 g_hash_table_get_values(js->sessions) : NULL; | |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1114 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
1115 for (; values; values = g_list_delete_link(values, values)) { |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1116 JingleSession *session = (JingleSession *)values->data; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1117 purple_media_hangup(session->media); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1118 } |
23816
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 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1121 static void |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1122 jabber_jingle_session_handle_content_replace(JingleSession *session, xmlnode *jingle) |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1123 { |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1124 #if 0 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1125 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
|
1126 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
|
1127 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
|
1128 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1129 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
|
1130 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
|
1131 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
|
1132 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
|
1133 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1134 /* send acknowledement */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1135 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
|
1136 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
|
1137 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
|
1138 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1139 /* send content-accept */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1140 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
|
1141 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
|
1142 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
|
1143 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
|
1144 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1145 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
|
1146 } |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1147 #endif |
23816
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 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1150 static void |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1151 jabber_jingle_session_handle_session_accept(JingleSession *session, xmlnode *jingle) |
23816
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 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
|
1154 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
|
1155 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
|
1156 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
|
1157 GList *codec_intersection; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1158 FsCodec *top = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1159 xmlnode *description = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1160 xmlnode *transport = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1161 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1162 /* 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
|
1163 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1164 for (content = xmlnode_get_child(jingle, "content"); content; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1165 content = xmlnode_get_next_twin(content)) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1166 description = xmlnode_get_child(content, "description"); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1167 transport = xmlnode_get_child(content, "transport"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1168 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1169 /* fetch codecs from remote party */ |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1170 purple_debug_info("jingle", "get codecs from session-accept\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1171 remote_codecs = jabber_jingle_get_codecs(description); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1172 purple_debug_info("jingle", "get transport candidates from session accept\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1173 remote_transports = jabber_jingle_get_candidates(transport); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1174 |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1175 purple_debug_info("jingle", "Got %d codecs from responder\n", |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1176 g_list_length(remote_codecs)); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1177 purple_debug_info("jingle", "Got %d transport candidates from responder\n", |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1178 g_list_length(remote_transports)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1179 |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1180 purple_debug_info("jingle", "Setting remote codecs on stream\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1181 |
23845
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1182 if (!purple_media_set_remote_codecs(session->media, |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1183 xmlnode_get_attrib(content, "name"), |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1184 jabber_jingle_session_get_remote_jid(session), |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1185 remote_codecs)) { |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1186 purple_media_reject(jabber_jingle_session_get_media(session)); |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1187 return; |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1188 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1189 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1190 codec_intersection = purple_media_get_negotiated_codecs(session->media, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1191 xmlnode_get_attrib(content, "name")); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1192 purple_debug_info("jingle", "codec_intersection contains %d elems\n", |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1193 g_list_length(codec_intersection)); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1194 /* get the top codec */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1195 if (g_list_length(codec_intersection) > 0) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1196 top = (FsCodec *) codec_intersection->data; |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1197 purple_debug_info("jingle", "Found a suitable codec on stream = %d\n", |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1198 top->id); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1199 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1200 /* we have found a suitable codec, but we will not start the stream |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1201 just yet, wait for transport negotiation to complete... */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1202 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1203 /* if we also got transport candidates, add them to our streams |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1204 list of known remote candidates */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1205 if (g_list_length(remote_transports) > 0) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1206 purple_media_add_remote_candidates(session->media, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1207 xmlnode_get_attrib(content, "name"), |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1208 jabber_jingle_session_get_remote_jid(session), |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1209 remote_transports); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1210 fs_candidate_list_destroy(remote_transports); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1211 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1212 if (g_list_length(codec_intersection) == 0 && |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1213 g_list_length(remote_transports)) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1214 /* we didn't get any candidates and the codec intersection is empty, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1215 this means this was not a content-accept message and we couldn't |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1216 find any suitable codecs, should return error and hang up */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1217 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1218 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1219 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1220 fs_codec_list_destroy(codec_intersection); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1221 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1222 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1223 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1224 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
|
1225 purple_media_got_accept(jabber_jingle_session_get_media(session)); |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1226 purple_debug_info("jingle", "Got session-accept, starting stream\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1227 gst_element_set_state(purple_media_get_pipeline(session->media), |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1228 GST_STATE_PLAYING); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1229 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1230 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1231 jabber_iq_send(jabber_jingle_session_create_ack(session, jingle)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1232 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
1233 jabber_jingle_session_set_state(session, ACTIVE); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1234 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1235 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1236 static void |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1237 jabber_jingle_session_handle_session_info(JingleSession *session, xmlnode *jingle) |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1238 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1239 purple_debug_info("jingle", "got session-info\n"); |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1240 jabber_iq_send(jabber_jingle_session_create_ack(session, jingle)); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1241 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1242 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1243 static void |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1244 jabber_jingle_session_handle_session_initiate(JingleSession *session, xmlnode *jingle) |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1245 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1246 xmlnode *content = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1247 xmlnode *description = NULL; |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1248 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
|
1249 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
|
1250 GList *codecs = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1251 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1252 if (!jingle) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1253 purple_debug_error("jingle", "Malformed request"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1254 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1255 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1256 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1257 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
|
1258 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1259 for (content = xmlnode_get_child(jingle, "content"); content; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1260 content = xmlnode_get_next_twin(content)) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1261 /* init media */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1262 if (!content) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1263 purple_debug_error("jingle", "jingle tag must contain content tag\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1264 /* should send error here */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1265 return; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1266 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1267 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1268 description = xmlnode_get_child(content, "description"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1269 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1270 if (!description) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1271 purple_debug_error("jingle", "content tag must contain description tag\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1272 /* we should create an error iq here */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1273 return; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1274 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1275 |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1276 transport = xmlnode_get_child(content, "transport"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1277 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1278 if (!transport) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1279 purple_debug_error("jingle", "content tag must contain transport tag\n"); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1280 /* we should create an error iq here */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1281 return; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1282 } |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1283 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1284 jabber_jingle_session_content_create_parse(session, content); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1285 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1286 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1287 if (!jabber_jingle_session_initiate_media_internal(session, initiator, initiator)) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1288 purple_debug_error("jingle", "Couldn't start media session with %s\n", initiator); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1289 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
|
1290 /* 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
|
1291 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1292 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1293 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1294 for (content = xmlnode_get_child(jingle, "content"); content; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1295 content = xmlnode_get_next_twin(content)) { |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1296 /* init media */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1297 if (!content) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1298 purple_debug_error("jingle", "jingle tag must contain content tag\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1299 /* should send error here */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1300 return; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1301 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1302 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1303 description = xmlnode_get_child(content, "description"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1304 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1305 if (!description) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1306 purple_debug_error("jingle", "content tag must contain description tag\n"); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1307 /* we should create an error iq here */ |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1308 return; |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1309 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1310 codecs = jabber_jingle_get_codecs(description); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1311 |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1312 purple_media_set_remote_codecs(session->media, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1313 xmlnode_get_attrib(content, "name"), |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1314 initiator, codecs); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1315 purple_debug_info("jingle", "codec intersection: %i\n", |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1316 g_list_length(purple_media_get_negotiated_codecs(session->media, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1317 xmlnode_get_attrib(content, "name")))); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1318 } |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1319 jabber_iq_send(jabber_jingle_session_create_ack(session, jingle)); |
23820
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1320 jabber_iq_send(jabber_jingle_session_create_session_info(session, "ringing")); |
23837
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23835
diff
changeset
|
1321 |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23835
diff
changeset
|
1322 purple_media_got_request(jabber_jingle_session_get_media(session)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1323 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1324 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1325 static void |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1326 jabber_jingle_session_handle_session_terminate(JingleSession *session, xmlnode *jingle) |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1327 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1328 if (!session) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1329 purple_debug_error("jingle", "jabber_handle_session_terminate couldn't find session\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1330 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1331 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1332 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1333 /* 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
|
1334 a hangup or a reject, and call different callbacks to purple_media */ |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1335 gst_element_set_state(purple_media_get_pipeline(session->media), GST_STATE_NULL); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1336 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1337 purple_media_got_hangup(jabber_jingle_session_get_media(session)); |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1338 jabber_iq_send(jabber_jingle_session_create_ack(session, jingle)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1339 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
|
1340 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1341 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1342 static void |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1343 jabber_jingle_session_handle_transport_info(JingleSession *session, xmlnode *jingle) |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1344 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1345 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
|
1346 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
|
1347 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
|
1348 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1349 if (!session) |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1350 purple_debug_error("jingle", "jabber_handle_session_candidates couldn't find session\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1351 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1352 /* send acknowledement */ |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1353 jabber_iq_send(jabber_jingle_session_create_ack(session, jingle)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1354 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1355 /* 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
|
1356 if (g_list_length(remote_candidates) > 0) { |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1357 purple_media_add_remote_candidates(session->media, |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1358 xmlnode_get_attrib(content, "name"), |
23850
84c7bb2ca41f
Added xmlnode_get_parent.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23849
diff
changeset
|
1359 xmlnode_get_attrib(xmlnode_get_parent(jingle), "from"), |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1360 remote_candidates); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1361 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
|
1362 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1363 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1364 |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1365 void |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1366 jabber_jingle_session_parse(JabberStream *js, xmlnode *packet) |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1367 { |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1368 const gchar *type = xmlnode_get_attrib(packet, "type"); |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1369 xmlnode *jingle; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1370 const gchar *action; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1371 const char *sid; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1372 JingleSession *session; |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1373 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1374 if (!type || strcmp(type, "set")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1375 /* send iq error here */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1376 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1377 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1378 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1379 /* is this a Jingle package? */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1380 if (!(jingle = xmlnode_get_child(packet, "jingle"))) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1381 /* send iq error here */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1382 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1383 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1384 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1385 if (!(action = xmlnode_get_attrib(jingle, "action"))) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1386 /* send iq error here */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1387 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1388 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1389 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1390 purple_debug_info("jabber", "got Jingle package action = %s\n", |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1391 action); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1392 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1393 if (!(sid = xmlnode_get_attrib(jingle, "sid"))) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1394 /* send iq error here */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1395 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1396 } |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1397 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1398 if (!(session = jabber_jingle_session_find_by_id(js, sid)) |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1399 && strcmp(action, "session-initiate")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1400 purple_debug_error("jingle", "jabber_jingle_session_parse couldn't find session\n"); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1401 /* send iq error here */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1402 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1403 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1404 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1405 if (!strcmp(action, "session-initiate")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1406 if (session) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1407 /* This should only happen if you start a session with yourself */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1408 purple_debug_error("jingle", "Jingle session with " |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1409 "id={%s} already exists\n", sid); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1410 /* send iq error */ |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1411 } else { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1412 session = jabber_jingle_session_create_by_id(js, sid); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1413 jabber_jingle_session_handle_session_initiate(session, jingle); |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1414 } |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1415 } else if (!strcmp(action, "session-accept") |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1416 || !strcmp(action, "content-accept")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1417 jabber_jingle_session_handle_session_accept(session, jingle); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1418 } else if (!strcmp(action, "session-info")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1419 jabber_jingle_session_handle_session_info(session, jingle); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1420 } else if (!strcmp(action, "session-terminate")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1421 jabber_jingle_session_handle_session_terminate(session, jingle); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1422 } else if (!strcmp(action, "transport-info")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1423 jabber_jingle_session_handle_transport_info(session, jingle); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1424 } else if (!strcmp(action, "content-replace")) { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1425 jabber_jingle_session_handle_content_replace(session, jingle); |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1426 } |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1427 } |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1428 |
23804
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23798
diff
changeset
|
1429 #endif /* USE_VV */ |
23824
bfaad8393463
Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23823
diff
changeset
|
1430 |