Mercurial > pidgin
annotate libpurple/protocols/jabber/jingle.c @ 24942:097b3f23dc01
These should not be fatal debug messages.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Fri, 05 Sep 2008 05:51:41 +0000 |
parents | a9715607c9f4 |
children |
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); |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
256 g_free(sess->remote_jid); |
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
257 g_free(sess->initiator); |
23845
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
258 |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
259 if (sess->media) |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
260 g_object_unref(sess->media); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
261 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
262 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
|
263 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
|
264 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
|
265 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 g_free(sess); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
269 static JingleSession * |
23798
16543025aed1
Moved jingle.c global variable "sessions" into JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23797
diff
changeset
|
270 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
|
271 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 purple_debug_info("jingle", "find_by_id %s\n", id); |
23832 | 273 purple_debug_info("jingle", "lookup: %p\n", (js->sessions) ? |
274 g_hash_table_lookup(js->sessions, id) : NULL); | |
275 return (JingleSession *) (js->sessions) ? | |
276 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
|
277 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
278 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
279 static JingleSession * |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
280 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
|
281 { |
23871 | 282 GList *values = (js->sessions) ? |
283 g_hash_table_get_values(js->sessions) : NULL; | |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
284 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
|
285 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
286 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
|
287 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
|
288 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
|
289 : 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 } |
23811
d048100a43ab
Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23804
diff
changeset
|
295 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
|
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 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
298 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
|
299 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
300 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
301 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
|
302 jabber_jingle_get_codecs(xmlnode *description) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 GList *codecs = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 xmlnode *codec_element = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 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
|
307 FsCodec *codec; |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
308 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
|
309 FsMediaType type = !strcmp(media, "video") ? FS_MEDIA_TYPE_VIDEO : |
23915
9632027d3b50
Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23877
diff
changeset
|
310 !strcmp(media, "audio") ? FS_MEDIA_TYPE_AUDIO : 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
|
311 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 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
|
313 codec_element ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 codec_element = xmlnode_get_next_twin(codec_element)) { |
24936
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
315 xmlnode *param; |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
316 gchar *codec_str; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
317 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
|
318 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 id = xmlnode_get_attrib(codec_element, "id"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 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
|
321 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
322 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
|
323 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
|
324 clock_rate ? atoi(clock_rate) : 0); |
24936
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
325 |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
326 for (param = xmlnode_get_child(codec_element, "parameter"); |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
327 param; param = xmlnode_get_next_twin(param)) { |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
328 fs_codec_add_optional_parameter(codec, |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
329 xmlnode_get_attrib(param, "name"), |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
330 xmlnode_get_attrib(param, "value")); |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
331 } |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
332 |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
333 codec_str = fs_codec_to_string(codec); |
24942
097b3f23dc01
These should not be fatal debug messages.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24941
diff
changeset
|
334 purple_debug_info("jingle", "received codec: %s\n", codec_str); |
24936
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
335 g_free(codec_str); |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
336 |
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
|
337 codecs = g_list_append(codecs, codec); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 return codecs; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
342 static GList * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 jabber_jingle_get_candidates(const xmlnode *transport) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 GList *candidates = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 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
|
347 FsCandidate *c; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
348 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 for (candidate = xmlnode_get_child(transport, "candidate") ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 candidate ; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 candidate = xmlnode_get_next_twin(candidate)) { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 strcmp(xmlnode_get_attrib(candidate, "protocol"), |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 "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
|
365 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
|
366 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
|
367 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
|
368 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
|
369 candidates = g_list_append(candidates, c); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 return candidates; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
373 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
374 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
375 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
|
376 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
|
377 const char *name) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
378 { |
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
|
379 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
|
380 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
|
381 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
382 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
383 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
|
384 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
|
385 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
386 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
|
387 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
388 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
389 static PurpleMedia * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 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
|
391 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 return sess->media; |
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_media(JingleSession *sess, PurpleMedia *media) |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 sess->media = media; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
401 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 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
|
403 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 return sess->remote_jid; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
407 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 jabber_jingle_session_set_remote_jid(JingleSession *sess, |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
409 const char *remote_jid) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 { |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
411 if (sess->remote_jid) |
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
412 g_free(sess->remote_jid); |
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
413 sess->remote_jid = g_strdup(remote_jid); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
416 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
|
417 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
|
418 { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
419 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
|
420 } |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
421 |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
422 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
|
423 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
|
424 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
|
425 { |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
426 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
|
427 } |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
428 |
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
429 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
430 static const char * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
431 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
|
432 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
433 return sess->initiator; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
434 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
435 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
436 static void |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
437 jabber_jingle_session_set_initiator(JingleSession *sess, |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
438 const char *initiator) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
439 { |
23877
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
440 if (sess->initiator) |
c48f5c9600c3
Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23874
diff
changeset
|
441 g_free(sess->initiator); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 sess->initiator = g_strdup(initiator); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
443 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
444 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
445 static gboolean |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
446 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
|
447 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
448 return sess->is_initiator; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
449 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
450 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
451 static void |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
452 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
|
453 xmlnode *description, |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
454 GList *codecs) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
455 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
456 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
|
457 FsCodec *codec = (FsCodec*)codecs->data; |
24936
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
458 GList *iter = codec->optional_params; |
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 char id[8], clockrate[10], channels[10]; |
24936
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
460 gchar *codec_str; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
461 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
|
462 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
463 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
|
464 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
|
465 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
|
466 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
467 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
|
468 xmlnode_set_attrib(payload, "id", id); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
469 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
|
470 xmlnode_set_attrib(payload, "channels", channels); |
24936
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
471 |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
472 for (; iter; iter = g_list_next(iter)) { |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
473 FsCodecParameter *fsparam = iter->data; |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
474 xmlnode *param = xmlnode_new_child(payload, "parameter"); |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
475 xmlnode_set_attrib(param, "name", fsparam->name); |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
476 xmlnode_set_attrib(param, "value", fsparam->value); |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
477 } |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
478 |
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
479 codec_str = fs_codec_to_string(codec); |
24942
097b3f23dc01
These should not be fatal debug messages.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24941
diff
changeset
|
480 purple_debug_info("jingle", "adding codec: %s\n", codec_str); |
24936
ef161c8f14df
Send and receive optional codec parameters in Jingle RTP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24933
diff
changeset
|
481 g_free(codec_str); |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
482 } |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
483 } |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
484 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
485 static xmlnode * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
486 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
|
487 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
|
488 { |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
489 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
|
490 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
|
491 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
|
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 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
494 static xmlnode * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
495 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
|
496 xmlnode *content) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
497 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
498 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
|
499 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
|
500 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
|
501 |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
502 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
|
503 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
|
504 else |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
505 return description; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
506 } |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
507 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
508 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
509 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
|
510 FsCandidate *c, |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
511 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
|
512 { |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
513 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
|
514 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
|
515 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
|
516 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
|
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 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
|
519 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
|
520 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
|
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 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
|
523 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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 "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
|
532 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
|
533 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
|
534 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
|
535 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
|
536 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
537 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
|
538 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
|
539 "host" : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
540 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
|
541 "prflx" : |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
542 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
|
543 "relay" : |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
544 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
|
545 "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
|
546 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
547 /* relay */ |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
548 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
|
549 /* 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
|
550 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
551 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
552 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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
558 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
559 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
|
560 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
561 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
562 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
563 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
|
564 xmlnode *content) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
565 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
566 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
|
567 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
|
568 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
|
569 return transport; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
570 } |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
571 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
572 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
573 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
|
574 xmlnode *jingle) |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
575 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
576 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
|
577 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
|
578 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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 return content; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
584 } |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
585 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
586 |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
587 static xmlnode * |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
588 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
|
589 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
|
590 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
591 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
|
592 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
|
593 xmlnode_set_namespace(jingle, JINGLE); |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
594 xmlnode_set_attrib(jingle, "action", action); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
595 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
|
596 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
|
597 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
|
598 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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 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
|
605 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
|
606 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
|
607 } |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
608 xmlnode_set_attrib(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
|
609 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
610 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
611 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
612 |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
613 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
|
614 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
|
615 { |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
616 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
|
617 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
|
618 JABBER_IQ_RESULT); |
23850
84c7bb2ca41f
Added xmlnode_get_parent.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23849
diff
changeset
|
619 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
|
620 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
|
621 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
|
622 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
|
623 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
|
624 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
625 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
626 static JabberIq * |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
627 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
|
628 { |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
629 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
|
630 JABBER_IQ_SET); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
631 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
|
632 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
|
633 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
|
634 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
|
635 g_free(from); |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
636 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
|
637 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
|
638 return result; |
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
639 } |
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
|
640 #if 0 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
641 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
|
642 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
|
643 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 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
|
645 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
|
646 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
647 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
|
648 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
|
649 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
650 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
651 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
652 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
|
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 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
|
655 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
656 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
657 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
658 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
659 static xmlnode * |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
660 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
|
661 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
|
662 FsCandidate *remote_candidate) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
663 { |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
664 xmlnode *jingle = |
23819
d61b0c8aaca1
Added functions to help with the creation of Jingle packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23818
diff
changeset
|
665 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
|
666 xmlnode *content = NULL; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
667 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
|
668 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
669 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
|
670 ", 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
|
671 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
|
672 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
673 content = xmlnode_new_child(jingle, "content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
674 xmlnode_set_attrib(content, "creator", "initiator"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
675 xmlnode_set_attrib(content, "name", "audio-content"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
676 xmlnode_set_attrib(content, "profile", "RTP/AVP"); |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
677 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
678 /* 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
|
679 /* 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
|
680 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
681 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
|
682 |
23797
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23788
diff
changeset
|
683 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
|
684 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
|
685 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
|
686 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
|
687 |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
688 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
|
689 |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
690 return jingle; |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
691 } |
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
|
692 #endif |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
693 |
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
|
694 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
|
695 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
|
696 { |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 "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
|
703 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
|
704 |
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 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
|
706 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
|
707 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
|
708 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
|
709 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
|
710 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
|
711 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
|
712 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
|
713 content_name); |
6268758d029a
Send negotiated codecs in session-accept opposed to all local codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23830
diff
changeset
|
714 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
|
715 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
|
716 } |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
717 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
|
718 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
|
719 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
|
720 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
|
721 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
|
722 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
|
723 } |
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
|
724 } |
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 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
726 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
|
727 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
728 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
729 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
|
730 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
|
731 const gchar *type) |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
732 { |
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
|
733 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
|
734 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
|
735 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
|
736 "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
|
737 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
|
738 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
|
739 return request; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
740 } |
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
741 |
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
|
742 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
|
743 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
|
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(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
|
746 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
|
747 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
|
748 "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
|
749 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
|
750 |
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 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
|
752 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
|
753 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
|
754 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
|
755 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
|
756 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
|
757 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
|
758 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
|
759 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
|
760 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
|
761 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
|
762 } |
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
|
763 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
|
764 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
765 |
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 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
|
767 } |
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 |
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 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
|
770 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
|
771 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
|
772 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
|
773 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
774 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
|
775 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
|
776 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
|
777 "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
|
778 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
|
779 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
|
780 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
|
781 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
|
782 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
|
783 } |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
784 |
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
|
785 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
|
786 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
787 |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
788 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
|
789 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
|
790 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
|
791 { |
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 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
|
793 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
|
794 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
|
795 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
|
796 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
|
797 "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
|
798 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
|
799 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
|
800 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
|
801 return request; |
23788
9f36ed35615e
Add the new jingle.c/h files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
802 } |
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
|
803 #if 0 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
804 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
805 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
|
806 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
807 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
|
808 JABBER_IQ_SET); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
809 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
|
810 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
|
811 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
|
812 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
813 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
|
814 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
|
815 } |
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
|
816 #endif |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
817 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
818 static void |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
819 jabber_jingle_session_accept(JingleSession *session) |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
820 { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
821 if (jabber_jingle_session_get_state(session) == ACCEPTED && |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
822 purple_media_candidates_prepared( |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
823 jabber_jingle_session_get_media(session), |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
824 jabber_jingle_session_get_remote_jid(session))) { |
24941
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
825 GList *contents = jabber_jingle_session_get_contents(session); |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
826 for (; contents; contents = contents->next) { |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
827 JingleSessionContent *jsc = contents->data; |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
828 GList *codec_intersection = |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
829 purple_media_get_negotiated_codecs(session->media, |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
830 jabber_jingle_session_content_get_name(jsc)); |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
831 purple_debug_info("jingle", "codec intersection: %i\n", |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
832 g_list_length(codec_intersection)); |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
833 |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
834 if (codec_intersection != NULL) { |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
835 gchar *codec_str = fs_codec_to_string(codec_intersection->data); |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
836 purple_debug_info("jingle", "Setting send codec: %s\n", codec_str); |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
837 g_free(codec_str); |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
838 purple_media_set_send_codec( |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
839 jabber_jingle_session_get_media(session), |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
840 jabber_jingle_session_content_get_name(jsc), |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
841 codec_intersection->data); |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
842 } |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
843 } |
a9715607c9f4
Have the responder wait to set the send codec until codecs are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24937
diff
changeset
|
844 |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
845 jabber_iq_send(jabber_jingle_session_create_session_accept(session)); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
846 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
847 purple_debug_info("jingle", "Sent session accept.\n"); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
848 jabber_jingle_session_set_state(session, ACTIVE); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
849 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
850 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
851 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
852 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
853 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
|
854 { |
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
|
855 /* 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
|
856 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
|
857 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
|
858 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
|
859 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
|
860 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
|
861 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
|
862 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
|
863 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
|
864 remote_jid); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
865 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
|
866 "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
|
867 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
|
868 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
|
869 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
|
870 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
|
871 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
|
872 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
|
873 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
874 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
|
875 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
876 |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
877 jabber_jingle_session_set_state(session, ACCEPTED); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
878 jabber_jingle_session_accept(session); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
879 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
880 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
881 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
882 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
|
883 { |
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
|
884 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
|
885 "decline", NULL)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
886 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
|
887 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
888 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
889 static void |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
890 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
|
891 { |
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
|
892 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
|
893 "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
|
894 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
|
895 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
896 |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
897 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
898 jabber_jingle_session_content_create_media(JingleSession *session, |
23869
551a462b346a
Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23864
diff
changeset
|
899 PurpleMediaSessionType type) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
900 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
901 gchar sender[10] = ""; |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
902 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
903 if (type & PURPLE_MEDIA_AUDIO) { |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
904 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_SEND_AUDIO) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
905 strcpy(sender, "initiator"); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
906 else if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_RECV_AUDIO) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
907 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
908 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
909 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
910 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
|
911 "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
|
912 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
|
913 } |
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
|
914 if (type & PURPLE_MEDIA_VIDEO) { |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
915 if ((type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_SEND_VIDEO) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
916 strcpy(sender, "initiator"); |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
917 else if ((type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_RECV_VIDEO) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
918 strcpy(sender, "responder"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
919 else |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
920 strcpy(sender, "both"); |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
921 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
|
922 "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
|
923 TRANSPORT_ICEUDP, JINGLE_RTP, "video"); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
924 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
925 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
926 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
927 static void |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
928 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
|
929 xmlnode *content) |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
930 { |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
931 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
|
932 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
|
933 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
934 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
|
935 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
|
936 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
|
937 |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
938 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
|
939 xmlnode_get_attrib(content, "name"), |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
940 creator ? creator : "initiator", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
941 sender ? sender : "both", |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
942 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
|
943 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
|
944 subtype); |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
945 } |
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
946 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
947 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
|
948 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
|
949 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
|
950 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
|
951 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
|
952 JingleSession *session) |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
953 { |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
954 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
|
955 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
|
956 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
|
957 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
|
958 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
|
959 candidate)); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
960 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
961 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
962 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
963 /* 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
|
964 has been established */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
965 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
|
966 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
|
967 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
|
968 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
|
969 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
|
970 { |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
971 if (!jabber_jingle_session_is_initiator(session)) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
972 jabber_jingle_session_accept(session); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
973 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
974 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
975 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
976 static void |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
977 jabber_jingle_session_initiate_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
978 { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
979 const char *from = xmlnode_get_attrib(packet, "from"); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
980 JingleSession *session = jabber_jingle_session_find_by_jid(js, from); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
981 PurpleMedia *media; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
982 GList *contents; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
983 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
984 if (!session) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
985 /* respond with an error here */ |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
986 purple_debug_error("jingle", "Received session-initiate ack" |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
987 " to nonexistent session\n"); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
988 return; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
989 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
990 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
991 media = session->media; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
992 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
993 if (!strcmp(xmlnode_get_attrib(packet, "type"), "error")) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
994 purple_media_got_hangup(media); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
995 return; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
996 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
997 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
998 /* catch errors */ |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
999 if (xmlnode_get_child(packet, "error")) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1000 purple_media_got_hangup(media); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1001 return; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1002 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1003 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1004 /* create transport-info packages */ |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1005 contents = jabber_jingle_session_get_contents(session); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1006 for (; contents; contents = contents->next) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1007 JingleSessionContent *jsc = contents->data; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1008 GList *candidates = purple_media_get_local_candidates( |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1009 jabber_jingle_session_get_media(session), |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1010 jabber_jingle_session_content_get_name(jsc), |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1011 jabber_jingle_session_get_remote_jid(session)); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1012 purple_debug_info("jingle", |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1013 "jabber_session_candidates_prepared: %d candidates\n", |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1014 g_list_length(candidates)); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1015 for (; candidates; candidates = candidates->next) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1016 FsCandidate *candidate = candidates->data; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1017 JabberIq *result = jabber_jingle_session_create_transport_info(jsc, |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1018 candidate); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1019 jabber_iq_send(result); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1020 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1021 fs_candidate_list_destroy(candidates); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1022 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1023 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1024 jabber_jingle_session_set_state(session, GOT_ACK); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1025 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1026 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1027 static void |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1028 jabber_jingle_session_codecs_ready_cb(PurpleMedia *media, |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1029 const gchar *sess_id, |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1030 JingleSession *session) |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1031 { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1032 GList *contents = jabber_jingle_session_get_contents(session); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1033 for (; contents; contents = g_list_delete_link(contents, contents)) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1034 JingleSessionContent *jsc = contents->data; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1035 if (!purple_media_codecs_ready(media, |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1036 jabber_jingle_session_content_get_name(jsc))) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1037 break; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1038 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1039 } |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1040 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1041 if (contents != NULL) |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1042 g_list_free(contents); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1043 else if (jabber_jingle_session_is_initiator(session) |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1044 && jabber_jingle_session_get_state(session) == PENDING) { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1045 JabberIq *request; |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1046 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1047 /* create request */ |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1048 request = jabber_jingle_session_create_session_initiate(session); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1049 jabber_iq_set_callback(request, jabber_jingle_session_initiate_result_cb, NULL); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1050 |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1051 /* send request to other part */ |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1052 jabber_iq_send(request); |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1053 } else { |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1054 jabber_jingle_session_accept(session); |
23816
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 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1057 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1058 static gboolean |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1059 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
|
1060 const char *initiator, |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1061 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
|
1062 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1063 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
|
1064 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
|
1065 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1066 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
|
1067 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
|
1068 |
23872
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23871
diff
changeset
|
1069 jabber_jingle_session_set_remote_jid(session, remote_jid); |
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23871
diff
changeset
|
1070 jabber_jingle_session_set_initiator(session, initiator); |
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23871
diff
changeset
|
1071 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1072 if (!media) { |
23872
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23871
diff
changeset
|
1073 purple_debug_error("jingle", "Couldn't create media session\n"); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1074 return FALSE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1075 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1076 |
24929
5c30047f960e
Properly free PurpleMedia when there's an error creating an FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23915
diff
changeset
|
1077 jabber_jingle_session_set_media(session, media); |
5c30047f960e
Properly free PurpleMedia when there's an error creating an FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23915
diff
changeset
|
1078 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
1079 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
|
1080 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
|
1081 gboolean result = FALSE; |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1082 const gchar *sender = jabber_jingle_session_content_get_sender(jsc); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1083 FsStreamDirection direction = FS_DIRECTION_NONE; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1084 |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1085 if (!strcmp(sender, "initiator")) |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1086 direction = FS_DIRECTION_SEND; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1087 else if(!strcmp(sender, "responder")) |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1088 direction = FS_DIRECTION_RECV; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1089 else |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1090 direction = FS_DIRECTION_BOTH; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1091 |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1092 if (!jabber_jingle_session_is_initiator(session) |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1093 && direction != FS_DIRECTION_BOTH) { |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1094 if (direction == FS_DIRECTION_SEND) |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1095 direction = FS_DIRECTION_RECV; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1096 else |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1097 direction = FS_DIRECTION_SEND; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1098 } |
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
|
1099 |
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
|
1100 /* 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
|
1101 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
|
1102 result = purple_media_add_stream(media, "audio-content", remote_jid, |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1103 purple_media_from_fs(FS_MEDIA_TYPE_AUDIO, direction), |
24933
6ab96d5d8ac6
Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24929
diff
changeset
|
1104 "rawudp", 0, 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
|
1105 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
|
1106 } |
23825
c984acc6c392
Added the "media" attribute to the Jingle description element according
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23824
diff
changeset
|
1107 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
|
1108 result = purple_media_add_stream(media, "video-content", remote_jid, |
23874
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23872
diff
changeset
|
1109 purple_media_from_fs(FS_MEDIA_TYPE_VIDEO, direction), |
24933
6ab96d5d8ac6
Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24929
diff
changeset
|
1110 "rawudp", 0, 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
|
1111 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
|
1112 } |
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
|
1113 |
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
|
1114 if (!result) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1115 purple_debug_error("jingle", "Couldn't create stream\n"); |
24929
5c30047f960e
Properly free PurpleMedia when there's an error creating an FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23915
diff
changeset
|
1116 purple_media_hangup(media); |
23821
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1117 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
|
1118 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1119 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1120 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1121 /* connect callbacks */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1122 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
|
1123 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
|
1124 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
|
1125 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
|
1126 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
|
1127 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
|
1128 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
|
1129 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
|
1130 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
|
1131 G_CALLBACK(jabber_jingle_session_candidate_pair_established_cb), session); |
24937
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1132 g_signal_connect(G_OBJECT(media), "codecs-ready", |
5a774d0817d8
Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24936
diff
changeset
|
1133 G_CALLBACK(jabber_jingle_session_codecs_ready_cb), session); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1134 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1135 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
|
1136 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1137 return TRUE; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1138 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1139 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1140 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
|
1141 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
|
1142 PurpleMediaSessionType type) |
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 /* create content negotiation */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1145 JingleSession *session; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1146 JabberBuddy *jb; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1147 JabberBuddyResource *jbr; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1148 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1149 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
|
1150 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1151 /* 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
|
1152 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
|
1153 if (!jb) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1154 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
|
1155 return 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 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
|
1158 if (!jbr) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1159 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
|
1160 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1161 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1162 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
|
1163 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
|
1164 } else { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1165 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
|
1166 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1167 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1168 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
|
1169 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
|
1170 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1171 /* 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
|
1172 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
|
1173 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1174 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
|
1175 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1176 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1177 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
|
1178 return NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1179 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1180 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1181 g_free(jid); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1182 g_free(me); |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1183 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1184 return session->media; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1185 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1186 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1187 void |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1188 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
|
1189 { |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1190 JingleSession *session; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1191 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1192 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
|
1193 |
23817
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1194 if (session) |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1195 purple_media_hangup(session->media); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1196 } |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1197 |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1198 void |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1199 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
|
1200 { |
23835 | 1201 GList *values = js->sessions ? |
1202 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
|
1203 |
23852
a1a1f44cdecc
Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23850
diff
changeset
|
1204 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
|
1205 JingleSession *session = (JingleSession *)values->data; |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1206 purple_media_hangup(session->media); |
41d6d4217d21
Further decoupled Jingle code from jabber.c:
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1207 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1208 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1209 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1210 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
|
1211 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
|
1212 { |
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
|
1213 #if 0 |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1214 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
|
1215 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
|
1216 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
|
1217 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1218 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
|
1219 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
|
1220 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
|
1221 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
|
1222 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1223 /* send acknowledement */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1224 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
|
1225 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
|
1226 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
|
1227 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1228 /* send content-accept */ |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1229 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
|
1230 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
|
1231 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
|
1232 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
|
1233 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1234 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
|
1235 } |
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
|
1236 #endif |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1237 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1238 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1239 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
|
1240 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
|
1241 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1242 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
|
1243 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
|
1244 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
|
1245 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
|
1246 GList *codec_intersection; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1247 FsCodec *top = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1248 xmlnode *description = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1249 xmlnode *transport = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1250 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1251 /* 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
|
1252 |
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
|
1253 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
|
1254 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
|
1255 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
|
1256 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
|
1257 |
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
|
1258 /* fetch codecs from remote party */ |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1259 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
|
1260 remote_codecs = jabber_jingle_get_codecs(description); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1261 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
|
1262 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
|
1263 |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1264 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
|
1265 g_list_length(remote_codecs)); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1266 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
|
1267 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
|
1268 |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1269 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
|
1270 |
23845
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1271 if (!purple_media_set_remote_codecs(session->media, |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1272 xmlnode_get_attrib(content, "name"), |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1273 jabber_jingle_session_get_remote_jid(session), |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1274 remote_codecs)) { |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1275 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
|
1276 return; |
13936e4405b7
Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23837
diff
changeset
|
1277 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1278 |
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
|
1279 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
|
1280 xmlnode_get_attrib(content, "name")); |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1281 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
|
1282 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
|
1283 /* 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
|
1284 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
|
1285 top = (FsCodec *) codec_intersection->data; |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1286 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
|
1287 top->id); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1288 |
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
|
1289 /* 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
|
1290 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
|
1291 purple_media_set_send_codec( |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1292 jabber_jingle_session_get_media(session), |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1293 xmlnode_get_attrib(content, "name"), |
3ffe166a355e
Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23858
diff
changeset
|
1294 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
|
1295 } |
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 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
|
1297 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
|
1298 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
|
1299 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
|
1300 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
|
1301 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
|
1302 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
|
1303 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
|
1304 } |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1305 if (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
|
1306 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
|
1307 /* 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
|
1308 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
|
1309 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
|
1310 |
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 } |
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 |
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 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
|
1314 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1315 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1316 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1317 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
|
1318 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
|
1319 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
|
1320 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1321 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1322 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
|
1323 |
23830
b5a00ddb7077
Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23825
diff
changeset
|
1324 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
|
1325 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1326 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1327 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
|
1328 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
|
1329 { |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1330 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
|
1331 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
|
1332 } |
42e17cc5b6d2
Added functions to help create Jingle packets. Revised some of the Jingle flow.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23819
diff
changeset
|
1333 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1334 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
|
1335 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
|
1336 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1337 xmlnode *content = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1338 xmlnode *description = NULL; |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1339 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
|
1340 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
|
1341 GList *codecs = NULL; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1342 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1343 if (!jingle) { |
23858
23a156abcb2a
Add two missed newlines for debug messages.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23856
diff
changeset
|
1344 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
|
1345 return; |
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 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1348 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
|
1349 |
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
|
1350 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
|
1351 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
|
1352 /* 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
|
1353 if (!content) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1354 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
|
1355 /* 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
|
1356 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
|
1357 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1358 |
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
|
1359 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
|
1360 |
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
|
1361 if (!description) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1362 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
|
1363 /* 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
|
1364 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
|
1365 } |
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 |
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
|
1367 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
|
1368 |
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
|
1369 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
|
1370 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
|
1371 /* 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
|
1372 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
|
1373 } |
23818
2ebe89114923
Added JingleSessionContent structure to store content information
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23817
diff
changeset
|
1374 |
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
|
1375 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
|
1376 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1377 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1378 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
|
1379 purple_debug_error("jingle", "Couldn't start media session with %s\n", initiator); |
23872
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23871
diff
changeset
|
1380 jabber_jingle_session_send_session_reject(session); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1381 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1382 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1383 |
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
|
1384 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
|
1385 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
|
1386 /* 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
|
1387 if (!content) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1388 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
|
1389 /* 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
|
1390 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
|
1391 } |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1392 |
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
|
1393 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
|
1394 |
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
|
1395 if (!description) { |
23823
9983353706b8
merge of '3969ff3f40069748728f9ee2376a4bab3f089d04'
Mike Ruprecht <maiku@soc.pidgin.im>
diff
changeset
|
1396 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
|
1397 /* 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
|
1398 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
|
1399 } |
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
|
1400 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
|
1401 |
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
|
1402 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
|
1403 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
|
1404 initiator, codecs); |
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23820
diff
changeset
|
1405 } |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1406 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
|
1407 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
|
1408 |
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
|
1409 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
|
1410 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1411 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1412 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
|
1413 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
|
1414 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1415 if (!session) { |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1416 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
|
1417 return; |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1418 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1419 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1420 /* 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
|
1421 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
|
1422 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
|
1423 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
|
1424 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
|
1425 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1426 |
23848
dfa7c7f676b2
Hide unnecessarily exposed Jingle handler functions
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23847
diff
changeset
|
1427 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
|
1428 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
|
1429 { |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1430 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
|
1431 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
|
1432 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
|
1433 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1434 if (!session) |
23822
a7be3074923b
Corrected debug labels s/"jabber"/"jingle"/
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23816
diff
changeset
|
1435 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
|
1436 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1437 /* 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
|
1438 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
|
1439 |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1440 /* 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
|
1441 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
|
1442 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
|
1443 xmlnode_get_attrib(content, "name"), |
23850
84c7bb2ca41f
Added xmlnode_get_parent.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23849
diff
changeset
|
1444 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
|
1445 remote_candidates); |
23816
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1446 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
|
1447 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1448 } |
e73b03097664
Moved Jingle message handlers from jabber.c to jingle.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23811
diff
changeset
|
1449 |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1450 void |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1451 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
|
1452 { |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1453 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
|
1454 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
|
1455 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
|
1456 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
|
1457 JingleSession *session; |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1458 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1459 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
|
1460 /* 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
|
1461 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1462 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1463 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1464 /* 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
|
1465 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
|
1466 /* 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
|
1467 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1468 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1469 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1470 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
|
1471 /* 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
|
1472 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1473 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1474 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1475 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
|
1476 action); |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1477 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1478 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
|
1479 /* 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
|
1480 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1481 } |
23847
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1482 |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1483 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
|
1484 && 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
|
1485 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
|
1486 /* 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
|
1487 return; |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1488 } |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1489 |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1490 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
|
1491 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
|
1492 /* 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
|
1493 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
|
1494 "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
|
1495 /* send iq error */ |
23870
aaf11cffe2b2
Prevent multiple voice and video sessions within the same conversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
1496 } else if ((session = jabber_jingle_session_find_by_jid(js, |
aaf11cffe2b2
Prevent multiple voice and video sessions within the same conversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
1497 xmlnode_get_attrib(packet, "from")))) { |
24942
097b3f23dc01
These should not be fatal debug messages.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24941
diff
changeset
|
1498 purple_debug_error("jingle", "Jingle session with " |
23870
aaf11cffe2b2
Prevent multiple voice and video sessions within the same conversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
1499 "jid={%s} already exists\n", |
aaf11cffe2b2
Prevent multiple voice and video sessions within the same conversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
1500 xmlnode_get_attrib(packet, "from")); |
aaf11cffe2b2
Prevent multiple voice and video sessions within the same conversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
1501 /* send jingle redirect packet */ |
aaf11cffe2b2
Prevent multiple voice and video sessions within the same conversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23869
diff
changeset
|
1502 return; |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1503 } else { |
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1504 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
|
1505 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
|
1506 } |
23849
301bb7478f74
Simplify the Jingle handlers by moving repetitive code into the parse function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23848
diff
changeset
|
1507 } 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
|
1508 || !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
|
1509 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
|
1510 } 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
|
1511 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
|
1512 } 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
|
1513 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
|
1514 } 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
|
1515 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
|
1516 } 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
|
1517 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
|
1518 } |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1519 } |
4e3cc48cdace
Further decouple Jingle from iq.c
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23845
diff
changeset
|
1520 |
23804
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23798
diff
changeset
|
1521 #endif /* USE_VV */ |
23824
bfaad8393463
Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
23823
diff
changeset
|
1522 |