libpurple/protocols/jabber/jingle/content.c

Wed, 20 Mar 2019 00:32:08 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 20 Mar 2019 00:32:08 -0500
changeset 39494
f68a311bc10d
parent 38358
30ba44276e74
child 40195
fb4b0ae193c0
permissions
-rw-r--r--

Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates

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"
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
26 #include "glibcompat.h"
26221
bc5d5d3fe4de Make it compile in Windows with the equivalent of --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
27
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
28 #include "debug.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
29 #include "content.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
30 #include "jingle.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
31
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
32 #include <string.h>
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
33
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
34 typedef struct
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
35 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
36 JingleSession *session;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
37 gchar *description_type;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
38 gchar *creator;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
39 gchar *disposition;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
40 gchar *name;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
41 gchar *senders;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
42 JingleTransport *transport;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
43 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
44 } JingleContentPrivate;
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
45
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
46 enum {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
47 PROP_0,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
48 PROP_SESSION,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
49 PROP_CREATOR,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
50 PROP_DISPOSITION,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
51 PROP_NAME,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
52 PROP_SENDERS,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
53 PROP_TRANSPORT,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
54 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
55 PROP_LAST
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
56 };
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
57
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
58 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
59
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
60 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
61 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
62 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
63 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
64 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
65 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
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 /******************************************************************************
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 * 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
70 *****************************************************************************/
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 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
72 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
73 {
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 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
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82 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
83 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
84
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 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
86 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
87
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 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
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
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 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
92 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
93 {
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 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
95 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
96 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
97 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
98 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
99
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, "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
101 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
102 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
103 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
104 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
105
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(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
107 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
108 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
109 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
110
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 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
112 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
113
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 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
115 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
116 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
117 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
118 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
119
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 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
121 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
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
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 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
125 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
126 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
127 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
128
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 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
130 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
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
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 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
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 /******************************************************************************
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 * 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
138 *****************************************************************************/
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 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
140 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
141 {
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 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
143 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
144
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 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
146 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
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 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
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 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
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
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 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
182 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
183 {
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 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
185 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
186
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 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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195 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
196 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
197 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
198 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
199 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
200 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
201 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
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209 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
210 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
211 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
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
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 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
216 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
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
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 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
221 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
222 {
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 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
224
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 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
226
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->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
228 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
229 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
230 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
231 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
232 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
233 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
234 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
235
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 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
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
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 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
241 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
242 {
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
243 }
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
244
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
245 static void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
246 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
247 {
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
248 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 28600
diff changeset
249
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
250 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
251 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
252 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
253
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
254 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
255 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
256
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
257 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
258 "Jingle Session",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
259 "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
260 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
261 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
262
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
263 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
264 "Creator",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
265 "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
266 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
267 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
268
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
269 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
270 "Disposition",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
271 "The disposition of the content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
272 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
273 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
274
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
275 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
276 "Name",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
277 "The name of this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
278 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
279 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
280
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
281 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
282 "Senders",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
283 "The sender of this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
284 NULL,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
285 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
286
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
287 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
288 "transport",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
289 "The transport of this content.",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
290 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
291 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
292
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
293 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
294 "Pending transport",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
295 "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
296 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
297 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
298
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
299 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
300 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
301
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
302 /******************************************************************************
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 * 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
304 *****************************************************************************/
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 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
306 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
307 {
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
308 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
309 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
310
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
311 JingleContent *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
312 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
313 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
314 const gchar *senders, JingleTransport *transport)
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
315 {
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 28600
diff changeset
316
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
317
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
318 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
319 "creator", creator,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
320 "disposition", disposition != NULL ? disposition : "session",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
321 "name", name,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
322 "senders", senders != NULL ? senders : "both",
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
323 "transport", transport,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
324 NULL);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
325 return content;
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
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
328 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
329 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
330 JingleSession *session;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
331 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
332 return session;
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
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
335 const gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
336 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
337 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
338 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
339 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
340
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
341 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
342 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
343 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
344 gchar *creator;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
345 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
346 return creator;
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
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
349 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
350 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
351 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
352 gchar *disposition;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
353 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
354 return disposition;
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
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
357 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
358 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
359 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
360 gchar *name;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
361 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
362 return name;
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
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
365 gchar *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
366 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
367 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
368 gchar *senders;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
369 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
370 return senders;
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
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
373 JingleTransport *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
374 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
375 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
376 JingleTransport *transport;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
377 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
378 return transport;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
379 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
380
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
381 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
382 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
383 {
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 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
385 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
386 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
387 }
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
388
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
389 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
390 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
391 {
28600
861068f003ce Typo fix (thanks to clang-analyzer).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28322
diff changeset
392 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
393 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
394 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
395 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
396
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
397 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
398 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
399 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
400 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
401 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
402
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
403 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
404 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
405 {
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
406 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
407 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
408
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
409 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
410
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
411 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
412
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
413 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
414 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
415
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->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
417 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
418
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
419 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
420 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
421 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
422 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
423 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
424 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
425
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
426 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
427 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
428 {
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
429 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
430
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 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
432
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 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
434
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 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
436 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
437 priv->pending_transport = NULL;
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
438 }
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
439
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
440 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
441 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
442
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
443 void
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
444 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
445 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
446 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
447 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
448
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
449 JingleContent *
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
450 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
451 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
452 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
453 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
454
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
455 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
456 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
457 } else {
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
458 return NULL;
1bb25f5e90ef Actually reject content unknown content types on Jingle session-initiate,
Marcus Lundblad <malu@pidgin.im>
parents: 26411
diff changeset
459 }
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
460 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
461
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
462 PurpleXmlNode *
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
463 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
464 {
32053
e11a51dcd2d8 jabber: Add a few extra g_return_if_fails to the Jingle code
Paul Aurich <darkrain42@pidgin.im>
parents: 31316
diff changeset
465 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
466 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
467 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
468 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
469
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
470 void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 32053
diff changeset
471 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
472 {
32053
e11a51dcd2d8 jabber: Add a few extra g_return_if_fails to the Jingle code
Paul Aurich <darkrain42@pidgin.im>
parents: 31316
diff changeset
473 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
474 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
475 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
476 }
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
477

mercurial