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