Mercurial > pidgin
annotate libpurple/protocols/jabber/jingle.c @ 23869:551a462b346a
Changed PurpleMediaStreamType to PurpleMediaSessionType.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sat, 09 Aug 2008 03:51:42 +0000 |
parents | 97f3a3409a1d |
children | aaf11cffe2b2 |
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 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
|
463 } |
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 static xmlnode * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
466 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
|
467 xmlnode *content) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
468 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
469 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
|
470 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
|
471 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
|
472 |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
473 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
|
474 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
|
475 else |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
476 return description; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
477 } |
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 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
480 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
|
481 FsCandidate *c, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
482 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
|
483 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
484 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
|
485 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
|
486 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
|
487 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
|
488 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
489 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
|
490 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
|
491 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
|
492 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 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
|
502 "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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
508 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
|
509 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
|
510 "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 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
|
512 "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 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
|
514 "relay" : |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
515 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
|
516 "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
|
517 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
518 /* relay */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
519 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
|
520 /* 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
|
521 } |
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 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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 } |
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 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
|
531 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
532 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
533 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
534 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
|
535 xmlnode *content) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
536 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
537 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
|
538 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
|
539 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
|
540 return transport; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
541 } |
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 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
544 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
|
545 xmlnode *jingle) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
546 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
547 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
|
548 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
|
549 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
|
550 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
|
551 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
|
552 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
|
553 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
|
554 return content; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
555 } |
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 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
559 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
|
560 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
|
561 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
562 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
|
563 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
|
564 xmlnode_set_namespace(jingle, JINGLE); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
565 xmlnode_set_attrib(jingle, "action", action); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
566 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
|
567 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
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 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
|
577 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
|
578 } |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
579 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
|
580 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
581 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
582 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
583 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
584 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
|
585 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
|
586 { |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
587 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
|
588 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
|
589 JABBER_IQ_RESULT); |
23850
84c7bb2ca41f
Added xmlnode_get_parent.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23849
diff
changeset
|
590 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
|
591 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
|
592 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
|
593 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
|
594 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
|
595 } |
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 static JabberIq * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
598 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
|
599 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
600 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
|
601 JABBER_IQ_SET); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
602 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
|
603 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
|
604 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
|
605 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
|
606 g_free(from); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
607 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
|
608 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
|
609 return result; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
610 } |
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
|
611 #if 0 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
612 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
|
613 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
|
614 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
615 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
|
616 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
|
617 |
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 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
|
619 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
|
620 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
621 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
622 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
623 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
|
624 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
625 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
|
626 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
627 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
628 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
629 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
630 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
631 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
|
632 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
|
633 FsCandidate *remote_candidate) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
634 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 xmlnode *jingle = |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
636 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
|
637 xmlnode *content = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 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
|
639 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
640 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
|
641 ", 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
|
642 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
|
643 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 content = xmlnode_new_child(jingle, "content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 /* 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
|
650 /* 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
|
651 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
652 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
|
653 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
654 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
|
655 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
|
656 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
|
657 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
|
658 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
659 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
|
660 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
661 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
662 } |
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
|
663 #endif |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
664 |
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
|
665 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
|
666 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
|
667 { |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
668 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
|
669 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
|
670 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
|
671 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
|
672 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
|
673 "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
|
674 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
|
675 |
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 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
|
677 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
|
678 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
|
679 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
|
680 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
|
681 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
|
682 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
|
683 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
|
684 content_name); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
685 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
|
686 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
|
687 } |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
688 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
|
689 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
|
690 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
|
691 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
|
692 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
|
693 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
|
694 } |
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
|
695 } |
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 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
|
698 } |
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 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
|
701 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
|
702 const gchar *type) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
703 { |
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
|
704 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
|
705 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
|
706 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
|
707 "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
|
708 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
|
709 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
|
710 return request; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
711 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
712 |
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
|
713 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
|
714 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
|
715 { |
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 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
|
717 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
|
718 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
|
719 "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
|
720 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
|
721 |
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 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
|
723 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
|
724 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
|
725 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
|
726 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 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
|
732 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
|
733 } |
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
|
734 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
|
735 } |
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 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
|
738 } |
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 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
|
741 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
|
742 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
|
743 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
|
744 { |
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 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
|
746 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
|
747 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
|
748 "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
|
749 xmlnode *reason = xmlnode_new_child(jingle, "reason"); |
23864
97f3a3409a1d
Update Jingle implementation per recent standard changes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23862
diff
changeset
|
750 xmlnode_new_child(reason, reasoncode); |
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
|
751 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
|
752 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
|
753 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
|
754 } |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
755 |
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
|
756 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
|
757 } |
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 |
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 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
|
760 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
|
761 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
|
762 { |
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 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
|
764 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
|
765 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
|
766 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
|
767 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
|
768 "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
|
769 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
|
770 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
|
771 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
|
772 return request; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
773 } |
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
|
774 #if 0 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
775 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
776 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
|
777 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
778 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
|
779 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
780 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
|
781 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
|
782 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
|
783 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
784 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
|
785 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
|
786 } |
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
|
787 #endif |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
788 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
789 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
|
790 { |
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
|
791 /* 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
|
792 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
|
793 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
|
794 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
|
795 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
|
796 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
|
797 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
|
798 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
|
799 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
|
800 remote_jid); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
801 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
|
802 "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
|
803 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
|
804 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
|
805 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
|
806 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
|
807 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
|
808 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
|
809 } |
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 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
|
811 |
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
|
812 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
|
813 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
|
814 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
|
815 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
816 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
817 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
|
818 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
|
819 |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
820 purple_debug_info("jingle", "Sent session accept.\n"); |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
821 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
|
822 } else |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
823 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
|
824 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
825 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
826 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
827 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
|
828 { |
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
|
829 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
|
830 "decline", NULL)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
831 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
|
832 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
833 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
834 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
835 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
|
836 { |
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
|
837 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
|
838 "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
|
839 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
|
840 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
841 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
842 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
843 jabber_jingle_session_content_create_media(JingleSession *session, |
23869
551a462b346a
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23864
diff
changeset
|
844 PurpleMediaSessionType type) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
845 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
846 gchar sender[10] = ""; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
847 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
848 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
|
849 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
|
850 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
|
851 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
|
852 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
853 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
854 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
855 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
|
856 "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
|
857 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
|
858 } |
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
|
859 if (type & PURPLE_MEDIA_VIDEO) { |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
860 if (type == PURPLE_MEDIA_SEND_VIDEO) |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
861 strcpy(sender, "initiator"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
862 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
|
863 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
864 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
865 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
866 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
|
867 "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
|
868 TRANSPORT_ICEUDP, JINGLE_RTP, "video"); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
869 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
870 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
871 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
872 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
873 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
|
874 xmlnode *content) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
875 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
876 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
|
877 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
|
878 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
879 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
|
880 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
|
881 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
|
882 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
883 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
|
884 xmlnode_get_attrib(content, "name"), |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
885 creator ? creator : "initiator", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
886 sender ? sender : "both", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
887 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
|
888 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
|
889 subtype); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
890 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
891 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
892 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
|
893 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
|
894 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
|
895 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
|
896 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
|
897 JingleSession *session) |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
898 { |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
899 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
|
900 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
|
901 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
|
902 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
|
903 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
|
904 candidate)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
905 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
906 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
907 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
908 /* 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
|
909 has been established */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
910 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
|
911 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
|
912 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
|
913 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
|
914 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
|
915 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
916 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
|
917 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
|
918 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
|
919 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
|
920 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
|
921 |
23856
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23852
diff
changeset
|
922 purple_debug_info("jingle", "Sent session accept.\n"); |
23830
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_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
|
924 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
925 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
926 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
927 static gboolean |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
928 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
|
929 const char *initiator, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
930 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
|
931 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
932 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
|
933 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
|
934 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
935 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
|
936 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
|
937 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
938 if (!media) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
939 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
|
940 return FALSE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
941 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
942 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
943 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
|
944 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
|
945 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
|
946 |
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
|
947 /* 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
|
948 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
|
949 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
|
950 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
|
951 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
|
952 } |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
953 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
|
954 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
|
955 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
|
956 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
|
957 } |
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
|
958 |
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 if (!result) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
960 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
|
961 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
|
962 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
|
963 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
964 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
965 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
966 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
|
967 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
|
968 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
|
969 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
970 /* connect callbacks */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
971 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
|
972 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
|
973 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
|
974 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
|
975 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
|
976 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
|
977 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
|
978 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
|
979 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
|
980 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
|
981 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
982 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
|
983 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
984 return TRUE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
985 } |
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 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
988 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
|
989 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
990 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
|
991 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
|
992 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
|
993 GList *contents; |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
994 |
23833
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
995 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
|
996 /* 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
|
997 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
|
998 " 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
|
999 return; |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1000 } |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1001 |
ee028c73d3e2
Fix crash when receiving a session-initiate ack for a nonexistent session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23832
diff
changeset
|
1002 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
|
1003 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1004 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
|
1005 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
|
1006 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1007 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1008 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1009 /* catch errors */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1010 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
|
1011 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
|
1012 return; |
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 |
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
|
1015 /* 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
|
1016 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
|
1017 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
|
1018 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
|
1019 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
|
1020 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
|
1021 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
|
1022 jabber_jingle_session_get_remote_jid(session)); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1023 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
|
1024 "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
|
1025 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
|
1026 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
|
1027 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
|
1028 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
|
1029 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
|
1030 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
|
1031 } |
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 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
|
1033 } |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
1034 |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
1035 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
|
1036 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1037 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1038 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
|
1039 jabber_jingle_session_initiate_media(JabberStream *js, const char *who, |
23869
551a462b346a
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23864
diff
changeset
|
1040 PurpleMediaSessionType type) |
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 /* 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
|
1043 JabberIq *request; |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1044 JingleSession *session; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1045 JabberBuddy *jb; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1046 JabberBuddyResource *jbr; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1047 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1048 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
|
1049 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1050 /* 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
|
1051 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
|
1052 if (!jb) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1053 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
|
1054 return NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1055 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1056 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
|
1057 if (!jbr) { |
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 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
|
1059 } |
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 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
|
1062 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
|
1063 } else { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1064 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
|
1065 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1066 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1067 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
|
1068 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
|
1069 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1070 /* 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
|
1071 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
|
1072 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1073 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
|
1074 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1075 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1076 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
|
1077 return NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1078 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1079 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1080 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1081 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1082 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1083 /* 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
|
1084 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
|
1085 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
|
1086 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1087 /* 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
|
1088 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
|
1089 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1090 return session->media; |
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 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1093 void |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1094 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
|
1095 { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1096 JingleSession *session; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1097 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1098 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
|
1099 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1100 if (session) |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1101 purple_media_hangup(session->media); |
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 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1104 void |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1105 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
|
1106 { |
23835 | 1107 GList *values = js->sessions ? |
1108 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
|
1109 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
1110 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
|
1111 JingleSession *session = (JingleSession *)values->data; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1112 purple_media_hangup(session->media); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1113 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1114 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1115 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1116 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
|
1117 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
|
1118 { |
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
|
1119 #if 0 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1120 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
|
1121 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
|
1122 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
|
1123 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1124 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
|
1125 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
|
1126 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
|
1127 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
|
1128 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1129 /* send acknowledement */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1130 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
|
1131 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
|
1132 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
|
1133 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1134 /* send content-accept */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1135 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
|
1136 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
|
1137 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
|
1138 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
|
1139 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1140 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
|
1141 } |
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
|
1142 #endif |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1143 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1144 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1145 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
|
1146 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
|
1147 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1148 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
|
1149 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
|
1150 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
|
1151 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
|
1152 GList *codec_intersection; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1153 FsCodec *top = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1154 xmlnode *description = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1155 xmlnode *transport = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1156 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1157 /* 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
|
1158 |
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
|
1159 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
|
1160 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
|
1161 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
|
1162 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
|
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 /* fetch codecs from remote party */ |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1165 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
|
1166 remote_codecs = jabber_jingle_get_codecs(description); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1167 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
|
1168 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
|
1169 |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1170 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
|
1171 g_list_length(remote_codecs)); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1172 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
|
1173 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
|
1174 |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1175 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
|
1176 |
23845
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1177 if (!purple_media_set_remote_codecs(session->media, |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1178 xmlnode_get_attrib(content, "name"), |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1179 jabber_jingle_session_get_remote_jid(session), |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1180 remote_codecs)) { |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1181 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
|
1182 return; |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1183 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1184 |
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
|
1185 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
|
1186 xmlnode_get_attrib(content, "name")); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1187 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
|
1188 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
|
1189 /* 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
|
1190 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
|
1191 top = (FsCodec *) codec_intersection->data; |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1192 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
|
1193 top->id); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1194 |
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
|
1195 /* 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
|
1196 just yet, wait for transport negotiation to complete... */ |
23862
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1197 purple_media_set_send_codec( |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1198 jabber_jingle_session_get_media(session), |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1199 xmlnode_get_attrib(content, "name"), |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1200 codec_intersection->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
|
1201 } |
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 /* 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
|
1203 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
|
1204 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
|
1205 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
|
1206 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
|
1207 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
|
1208 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
|
1209 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
|
1210 } |
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 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
|
1212 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
|
1213 /* 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
|
1214 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
|
1215 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
|
1216 |
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 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
|
1220 |
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 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
|
1224 purple_media_got_accept(jabber_jingle_session_get_media(session)); |
23858
23a156abcb2a
Add two missed newlines for debug messages.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
1225 purple_debug_info("jingle", "Got session-accept\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1226 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1227 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1228 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
|
1229 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
1230 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
|
1231 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1232 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1233 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
|
1234 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
|
1235 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1236 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
|
1237 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
|
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 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1240 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
|
1241 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
|
1242 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1243 xmlnode *content = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1244 xmlnode *description = NULL; |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1245 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
|
1246 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
|
1247 GList *codecs = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1248 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1249 if (!jingle) { |
23858
23a156abcb2a
Add two missed newlines for debug messages.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
1250 purple_debug_error("jingle", "Malformed request\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1251 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1252 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1253 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1254 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
|
1255 |
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
|
1256 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
|
1257 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
|
1258 /* 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
|
1259 if (!content) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1260 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
|
1261 /* 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
|
1262 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
|
1263 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1264 |
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
|
1265 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
|
1266 |
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
|
1267 if (!description) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1268 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
|
1269 /* 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
|
1270 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
|
1271 } |
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 |
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 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
|
1274 |
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
|
1275 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
|
1276 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
|
1277 /* 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
|
1278 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
|
1279 } |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1280 |
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
|
1281 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
|
1282 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1283 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1284 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
|
1285 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
|
1286 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
|
1287 /* 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
|
1288 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1289 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1290 |
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
|
1291 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
|
1292 content = xmlnode_get_next_twin(content)) { |
23862
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1293 GList *codec_intersection = NULL; |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1294 |
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
|
1295 /* 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
|
1296 if (!content) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1297 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
|
1298 /* 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
|
1299 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
|
1300 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1301 |
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
|
1302 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
|
1303 |
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
|
1304 if (!description) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1305 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
|
1306 /* 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
|
1307 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
|
1308 } |
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 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
|
1310 |
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
|
1311 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
|
1312 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
|
1313 initiator, codecs); |
23862
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1314 |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1315 codec_intersection = purple_media_get_negotiated_codecs(session->media, |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1316 xmlnode_get_attrib(content, "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
|
1317 purple_debug_info("jingle", "codec intersection: %i\n", |
23862
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1318 g_list_length(codec_intersection)); |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1319 |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1320 if (g_list_length(codec_intersection) > 0) { |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1321 purple_media_set_send_codec( |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1322 jabber_jingle_session_get_media(session), |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1323 xmlnode_get_attrib(content, "name"), |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1324 codec_intersection->data); |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1325 } |
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
|
1326 } |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1327 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
|
1328 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
|
1329 |
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
|
1330 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
|
1331 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1332 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1333 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
|
1334 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
|
1335 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1336 if (!session) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1337 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
|
1338 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1339 } |
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 /* 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
|
1342 a hangup or a reject, and call different callbacks to purple_media */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1343 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
|
1344 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
|
1345 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
|
1346 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1347 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1348 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
|
1349 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
|
1350 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1351 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
|
1352 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
|
1353 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
|
1354 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1355 if (!session) |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1356 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
|
1357 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1358 /* 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
|
1359 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
|
1360 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1361 /* 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
|
1362 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
|
1363 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
|
1364 xmlnode_get_attrib(content, "name"), |
23850
84c7bb2ca41f
Added xmlnode_get_parent.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23849
diff
changeset
|
1365 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
|
1366 remote_candidates); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1367 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
|
1368 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1369 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1370 |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1371 void |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1372 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
|
1373 { |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1374 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
|
1375 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
|
1376 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
|
1377 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
|
1378 JingleSession *session; |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1379 |
23849
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 (!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
|
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 /* 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
|
1386 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
|
1387 /* 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
|
1388 return; |
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 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1391 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
|
1392 /* 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
|
1393 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1394 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1395 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1396 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
|
1397 action); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1398 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1399 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
|
1400 /* 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
|
1401 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1402 } |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1403 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1404 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
|
1405 && 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 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
|
1407 /* 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
|
1408 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1409 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1410 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1411 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
|
1412 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
|
1413 /* 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
|
1414 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
|
1415 "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
|
1416 /* 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
|
1417 } else { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1418 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
|
1419 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
|
1420 } |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1421 } 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
|
1422 || !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
|
1423 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
|
1424 } 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
|
1425 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
|
1426 } 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
|
1427 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
|
1428 } 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
|
1429 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
|
1430 } 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
|
1431 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
|
1432 } |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1433 } |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1434 |
23804
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23798
diff
changeset
|
1435 #endif /* USE_VV */ |
23824
bfaad8393463
Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23823
diff
changeset
|
1436 |