libpurple/protocols/jabber/jingle/content.c

Thu, 03 Oct 2019 11:16:08 +0200

author
Fabrice Bellet <fabrice@bellet.info>
date
Thu, 03 Oct 2019 11:16:08 +0200
branch
port-changes-from-branch-2.x.y-to-default
changeset 40269
334fd0d7c7e6
parent 40195
fb4b0ae193c0
child 40358
e6fe6fc1f516
permissions
-rw-r--r--

React only to the first stream info signal

26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1 /**
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
2 * @file content.c
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
3 *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
4 * purple
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
5 *
28322
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26823
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26823
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26823
diff changeset
8 * source distribution.
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26823
diff changeset
9 *
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
13 * (at your option) any later version.
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
14 *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
18 * GNU General Public License for more details.
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
19 *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
23 */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
24
26221
bc5d5d3fe4de Make it compile in Windows with the equivalent of --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
25 #include "internal.h"
bc5d5d3fe4de Make it compile in Windows with the equivalent of --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
26
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
27 #include "debug.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
28 #include "content.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
29 #include "jingle.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
30
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
31 #include <string.h>
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
32
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
33 typedef struct
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
34 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
35 JingleSession *session;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
36 gchar *description_type;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
37 gchar *creator;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
38 gchar *disposition;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
39 gchar *name;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
40 gchar *senders;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
41 JingleTransport *transport;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
42 JingleTransport *pending_transport;
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
43 } JingleContentPrivate;
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
44
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
45 enum {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
46 PROP_0,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
47 PROP_SESSION,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
48 PROP_CREATOR,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
49 PROP_DISPOSITION,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
50 PROP_NAME,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
51 PROP_SENDERS,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
52 PROP_TRANSPORT,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
53 PROP_PENDING_TRANSPORT,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
54 PROP_LAST
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
55 };
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
56
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
57 static GParamSpec *properties[PROP_LAST];
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
58
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
59 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
60 JingleContent,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
61 jingle_content,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
62 G_TYPE_OBJECT,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
63 0,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
64 G_ADD_PRIVATE_DYNAMIC(JingleContent)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
65 );
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
66
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
67 /******************************************************************************
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
68 * JingleContent Implementation
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
69 *****************************************************************************/
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
70 static JingleContent *
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
71 jingle_content_parse_internal(PurpleXmlNode *content)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
72 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
73 PurpleXmlNode *description = purple_xmlnode_get_child(content, "description");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
74 const gchar *type = purple_xmlnode_get_namespace(description);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
75 const gchar *creator = purple_xmlnode_get_attrib(content, "creator");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
76 const gchar *disposition = purple_xmlnode_get_attrib(content, "disposition");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
77 const gchar *senders = purple_xmlnode_get_attrib(content, "senders");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
78 const gchar *name = purple_xmlnode_get_attrib(content, "name");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
79 JingleTransport *transport =
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
80 jingle_transport_parse(purple_xmlnode_get_child(content, "transport"));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
81 if (transport == NULL)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
82 return NULL;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
83
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
84 if (senders == NULL)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
85 senders = "both";
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
86
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
87 return jingle_content_create(type, creator, disposition, name, senders, transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
88 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
89
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
90 static PurpleXmlNode *
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
91 jingle_content_to_xml_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
92 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
93 PurpleXmlNode *node = purple_xmlnode_new_child(jingle, "content");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
94 gchar *creator = jingle_content_get_creator(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
95 gchar *name = jingle_content_get_name(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
96 gchar *senders = jingle_content_get_senders(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
97 gchar *disposition = jingle_content_get_disposition(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
98
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
99 purple_xmlnode_set_attrib(node, "creator", creator);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
100 purple_xmlnode_set_attrib(node, "name", name);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
101 purple_xmlnode_set_attrib(node, "senders", senders);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
102 if (!purple_strequal("session", disposition))
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
103 purple_xmlnode_set_attrib(node, "disposition", disposition);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
104
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
105 g_free(disposition);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
106 g_free(senders);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
107 g_free(name);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
108 g_free(creator);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
109
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
110 if (action != JINGLE_CONTENT_REMOVE) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
111 JingleTransport *transport;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
112
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
113 if (action != JINGLE_TRANSPORT_ACCEPT &&
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
114 action != JINGLE_TRANSPORT_INFO &&
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
115 action != JINGLE_TRANSPORT_REJECT &&
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
116 action != JINGLE_TRANSPORT_REPLACE) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
117 PurpleXmlNode *description = purple_xmlnode_new_child(node, "description");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
118
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
119 purple_xmlnode_set_namespace(description,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
120 jingle_content_get_description_type(content));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
121 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
122
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
123 if (action != JINGLE_TRANSPORT_REJECT && action == JINGLE_TRANSPORT_REPLACE)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
124 transport = jingle_content_get_pending_transport(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
125 else
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
126 transport = jingle_content_get_transport(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
127
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
128 jingle_transport_to_xml(transport, node, action);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
129 g_object_unref(transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
130 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
131
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
132 return node;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
133 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
134
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
135 /******************************************************************************
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
136 * GObject Stuff
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
137 *****************************************************************************/
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
138 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
139 jingle_content_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
140 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
141 JingleContent *content = JINGLE_CONTENT(object);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
142 JingleContentPrivate *priv = jingle_content_get_instance_private(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
143
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
144 switch (prop_id) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
145 case PROP_SESSION:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
146 priv->session = g_value_get_object(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
147 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
148 case PROP_CREATOR:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
149 g_free(priv->creator);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
150 priv->creator = g_value_dup_string(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
151 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
152 case PROP_DISPOSITION:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
153 g_free(priv->disposition);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
154 priv->disposition = g_value_dup_string(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
155 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
156 case PROP_NAME:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
157 g_free(priv->name);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
158 priv->name = g_value_dup_string(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
159 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
160 case PROP_SENDERS:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
161 g_free(priv->senders);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
162 priv->senders = g_value_dup_string(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
163 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
164 case PROP_TRANSPORT:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
165 if (priv->transport)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
166 g_object_unref(priv->transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
167 priv->transport = g_value_get_object(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
168 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
169 case PROP_PENDING_TRANSPORT:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
170 if (priv->pending_transport)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
171 g_object_unref(priv->pending_transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
172 priv->pending_transport = g_value_get_object(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
173 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
174 default:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
175 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
176 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
177 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
178 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
179
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
180 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
181 jingle_content_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
182 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
183 JingleContent *content = JINGLE_CONTENT(object);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
184 JingleContentPrivate *priv = jingle_content_get_instance_private(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
185
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
186 switch (prop_id) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
187 case PROP_SESSION:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
188 g_value_set_object(value, priv->session);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
189 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
190 case PROP_CREATOR:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
191 g_value_set_string(value, priv->creator);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
192 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
193 case PROP_DISPOSITION:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
194 g_value_set_string(value, priv->disposition);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
195 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
196 case PROP_NAME:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
197 g_value_set_string(value, priv->name);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
198 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
199 case PROP_SENDERS:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
200 g_value_set_string(value, priv->senders);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
201 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
202 case PROP_TRANSPORT:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
203 g_value_set_object(value, priv->transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
204 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
205 case PROP_PENDING_TRANSPORT:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
206 g_value_set_object(value, priv->pending_transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
207 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
208 default:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
209 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
210 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
211 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
212 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
213
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
214 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
215 jingle_content_init (JingleContent *content)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
216 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
217 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
218
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
219 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
220 jingle_content_finalize (GObject *content)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
221 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
222 JingleContentPrivate *priv = jingle_content_get_instance_private(JINGLE_CONTENT(content));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
223
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
224 purple_debug_info("jingle","jingle_content_finalize\n");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
225
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
226 g_free(priv->description_type);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
227 g_free(priv->creator);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
228 g_free(priv->disposition);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
229 g_free(priv->name);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
230 g_free(priv->senders);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
231 g_object_unref(priv->transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
232 if (priv->pending_transport)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
233 g_object_unref(priv->pending_transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
234
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
235 G_OBJECT_CLASS(jingle_content_parent_class)->finalize(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
236 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
237
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
238
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
239 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
240 jingle_content_class_finalize (JingleContentClass *klass)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
241 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
242 }
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
243
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
244 static void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
245 jingle_content_class_init (JingleContentClass *klass)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
246 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
247 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 28600
diff changeset
248
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
249 obj_class->finalize = jingle_content_finalize;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
250 obj_class->set_property = jingle_content_set_property;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
251 obj_class->get_property = jingle_content_get_property;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
252
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
253 klass->to_xml = jingle_content_to_xml_internal;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
254 klass->parse = jingle_content_parse_internal;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
255
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
256 properties[PROP_SESSION] = g_param_spec_object("session",
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
257 "Jingle Session",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
258 "The jingle session parent of this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
259 JINGLE_TYPE_SESSION,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
260 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
261
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
262 properties[PROP_CREATOR] = g_param_spec_string("creator",
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
263 "Creator",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
264 "The participant that created this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
265 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
266 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
267
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
268 properties[PROP_DISPOSITION] = g_param_spec_string("disposition",
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
269 "Disposition",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
270 "The disposition of the content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
271 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
272 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
273
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
274 properties[PROP_NAME] = g_param_spec_string("name",
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
275 "Name",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
276 "The name of this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
277 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
278 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
279
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
280 properties[PROP_SENDERS] = g_param_spec_string("senders",
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
281 "Senders",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
282 "The sender of this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
283 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
284 G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
285
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
286 properties[PROP_TRANSPORT] = g_param_spec_object("transport",
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
287 "transport",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
288 "The transport of this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
289 JINGLE_TYPE_TRANSPORT,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
290 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
291
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
292 properties[PROP_PENDING_TRANSPORT] = g_param_spec_object("pending-transport",
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
293 "Pending transport",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
294 "The pending transport contained within this content",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
295 JINGLE_TYPE_TRANSPORT,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
296 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
297
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
298 g_object_class_install_properties(obj_class, PROP_LAST, properties);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
299 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
300
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
301 /******************************************************************************
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
302 * Public API
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
303 *****************************************************************************/
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
304 void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
305 jingle_content_register(PurplePlugin *plugin)
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
306 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
307 jingle_content_register_type(G_TYPE_MODULE(plugin));
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
308 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
309
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
310 JingleContent *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
311 jingle_content_create(const gchar *type, const gchar *creator,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
312 const gchar *disposition, const gchar *name,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
313 const gchar *senders, JingleTransport *transport)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
314 {
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 28600
diff changeset
315
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
316
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
317 JingleContent *content = g_object_new(jingle_get_type(type),
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
318 "creator", creator,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
319 "disposition", disposition != NULL ? disposition : "session",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
320 "name", name,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
321 "senders", senders != NULL ? senders : "both",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
322 "transport", transport,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
323 NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
324 return content;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
325 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
326
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
327 JingleSession *jingle_content_get_session(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
328 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
329 JingleSession *session;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
330 g_object_get(content, "session", &session, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
331 return session;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
332 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
333
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
334 const gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
335 jingle_content_get_description_type(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
336 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
337 return JINGLE_CONTENT_GET_CLASS(content)->description_type;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
338 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
339
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
340 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
341 jingle_content_get_creator(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
342 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
343 gchar *creator;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
344 g_object_get(content, "creator", &creator, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
345 return creator;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
346 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
347
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
348 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
349 jingle_content_get_disposition(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
350 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
351 gchar *disposition;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
352 g_object_get(content, "disposition", &disposition, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
353 return disposition;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
354 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
355
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
356 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
357 jingle_content_get_name(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
358 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
359 gchar *name;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
360 g_object_get(content, "name", &name, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
361 return name;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
362 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
363
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
364 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
365 jingle_content_get_senders(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
366 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
367 gchar *senders;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
368 g_object_get(content, "senders", &senders, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
369 return senders;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
370 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
371
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
372 JingleTransport *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
373 jingle_content_get_transport(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
374 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
375 JingleTransport *transport;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
376 g_object_get(content, "transport", &transport, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
377 return transport;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
378 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
379
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
380 JingleTransport *
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
381 jingle_content_get_pending_transport(JingleContent *content)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
382 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
383 JingleTransport *pending_transport;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
384 g_object_get(content, "pending-transport", &pending_transport, NULL);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
385 return pending_transport;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
386 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
387
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
388 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
389 jingle_content_set_session(JingleContent *content, JingleSession *session)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
390 {
28600
861068f003ce Typo fix (thanks to clang-analyzer).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28322
diff changeset
391 g_return_if_fail(JINGLE_IS_CONTENT(content));
861068f003ce Typo fix (thanks to clang-analyzer).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28322
diff changeset
392 g_return_if_fail(JINGLE_IS_SESSION(session));
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
393 g_object_set(content, "session", session, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
394 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
395
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
396 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
397 jingle_content_set_pending_transport(JingleContent *content, JingleTransport *transport)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
398 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
399 g_object_set(content, "pending-transport", transport, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
400 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
401
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
402 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
403 jingle_content_accept_transport(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
404 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
405 JingleContentPrivate *priv = NULL;
35066
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35061
diff changeset
406 GObject *obj;
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35061
diff changeset
407
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
408 g_return_if_fail(JINGLE_IS_CONTENT(content));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
409
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
410 priv = jingle_content_get_instance_private(content);
35061
307195f879f3 gtalk: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34935
diff changeset
411
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
412 if (priv->transport)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
413 g_object_unref(priv->transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
414
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
415 priv->transport = priv->pending_transport;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
416 priv->pending_transport = NULL;
35061
307195f879f3 gtalk: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34935
diff changeset
417
35066
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35061
diff changeset
418 obj = G_OBJECT(content);
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35061
diff changeset
419 g_object_freeze_notify(obj);
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
420 g_object_notify_by_pspec(obj, properties[PROP_TRANSPORT]);
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
421 g_object_notify_by_pspec(obj, properties[PROP_PENDING_TRANSPORT]);
35066
f997e5384f79 libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 35061
diff changeset
422 g_object_thaw_notify(obj);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
423 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
424
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
425 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
426 jingle_content_remove_pending_transport(JingleContent *content)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
427 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
428 JingleContentPrivate *priv = NULL;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
429
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
430 g_return_if_fail(JINGLE_IS_CONTENT(content));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
431
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
432 priv = jingle_content_get_instance_private(content);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
433
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
434 if (priv->pending_transport) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
435 g_object_unref(priv->pending_transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 38358
diff changeset
436 priv->pending_transport = NULL;
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
437 }
35061
307195f879f3 gtalk: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34935
diff changeset
438
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
439 g_object_notify_by_pspec(G_OBJECT(content), properties[PROP_PENDING_TRANSPORT]);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
440 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
441
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
442 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
443 jingle_content_modify(JingleContent *content, const gchar *senders)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
444 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
445 g_object_set(content, "senders", senders, NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
446 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
447
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
448 JingleContent *
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
449 jingle_content_parse(PurpleXmlNode *content)
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
450 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
451 const gchar *type = purple_xmlnode_get_namespace(purple_xmlnode_get_child(content, "description"));
26823
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
452 GType jingle_type = jingle_get_type(type);
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
453
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
454 if (jingle_type != G_TYPE_NONE) {
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
455 return JINGLE_CONTENT_CLASS(g_type_class_ref(jingle_type))->parse(content);
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
456 } else {
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
457 return NULL;
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
458 }
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
459 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
460
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
461 PurpleXmlNode *
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
462 jingle_content_to_xml(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action)
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
463 {
32053
e11a51dcd2d8 jabber: Add a few extra g_return_if_fails to the Jingle code
Paul Aurich <darkrain42@pidgin.im>
parents: 31316
diff changeset
464 g_return_val_if_fail(content != NULL, NULL);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
465 g_return_val_if_fail(JINGLE_IS_CONTENT(content), NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
466 return JINGLE_CONTENT_GET_CLASS(content)->to_xml(content, jingle, action);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
467 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
468
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
469 void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
470 jingle_content_handle_action(JingleContent *content, PurpleXmlNode *xmlcontent, JingleActionType action)
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
471 {
32053
e11a51dcd2d8 jabber: Add a few extra g_return_if_fails to the Jingle code
Paul Aurich <darkrain42@pidgin.im>
parents: 31316
diff changeset
472 g_return_if_fail(content != NULL);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
473 g_return_if_fail(JINGLE_IS_CONTENT(content));
26149
92b095c37277 Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
474 JINGLE_CONTENT_GET_CLASS(content)->handle_action(content, xmlcontent, action);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
475 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
476

mercurial