Sat, 21 Mar 2009 00:34:29 +0000
Use stream-info instead of state-changed for hangup and reject.
|
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 transport.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 | * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
6 | * 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
|
7 | * 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
|
8 | * 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
|
9 | * (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
|
10 | * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
11 | * 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
|
12 | * 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
|
13 | * 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
|
14 | * 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
|
15 | * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
16 | * 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
|
17 | * 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
|
18 | * 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
|
19 | */ |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
20 | |
|
26221
bc5d5d3fe4de
Make it compile in Windows with the equivalent of --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26143
diff
changeset
|
21 | #include "internal.h" |
|
bc5d5d3fe4de
Make it compile in Windows with the equivalent of --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26143
diff
changeset
|
22 | |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
23 | #include "transport.h" |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
24 | #include "jingle.h" |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
25 | #include "debug.h" |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
26 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
27 | #include <string.h> |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
28 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
29 | struct _JingleTransportPrivate |
|
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 | void *dummy; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
32 | }; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
33 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
34 | #define JINGLE_TRANSPORT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_TRANSPORT, JingleTransportPrivate)) |
|
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 | static void jingle_transport_class_init (JingleTransportClass *klass); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
37 | static void jingle_transport_init (JingleTransport *transport); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
38 | static void jingle_transport_finalize (GObject *object); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
39 | static void jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
40 | static void jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
41 | JingleTransport *jingle_transport_parse_internal(xmlnode *transport); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
42 | xmlnode *jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
43 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
44 | static GObjectClass *parent_class = NULL; |
|
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 | }; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
49 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
50 | GType |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
51 | jingle_transport_get_type() |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
52 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
53 | static GType type = 0; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
54 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
55 | if (type == 0) { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
56 | static const GTypeInfo info = { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
57 | sizeof(JingleTransportClass), |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
58 | NULL, |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
59 | NULL, |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
60 | (GClassInitFunc) jingle_transport_class_init, |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
61 | NULL, |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
62 | NULL, |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
63 | sizeof(JingleTransport), |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
64 | 0, |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
65 | (GInstanceInitFunc) jingle_transport_init, |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
66 | NULL |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
67 | }; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
68 | type = g_type_register_static(G_TYPE_OBJECT, "JingleTransport", &info, 0); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
69 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
70 | return type; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
71 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
72 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
73 | static void |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
74 | jingle_transport_class_init (JingleTransportClass *klass) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
75 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
76 | GObjectClass *gobject_class = (GObjectClass*)klass; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
77 | parent_class = g_type_class_peek_parent(klass); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
78 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
79 | gobject_class->finalize = jingle_transport_finalize; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
80 | gobject_class->set_property = jingle_transport_set_property; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
81 | gobject_class->get_property = jingle_transport_get_property; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
82 | klass->to_xml = jingle_transport_to_xml_internal; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
83 | klass->parse = jingle_transport_parse_internal; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
84 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
85 | g_type_class_add_private(klass, sizeof(JingleTransportPrivate)); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
86 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
87 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
88 | static void |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
89 | jingle_transport_init (JingleTransport *transport) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
90 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
91 | transport->priv = JINGLE_TRANSPORT_GET_PRIVATE(transport); |
|
26411
6b7c565cfa9a
Fix a bunch of memsets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26221
diff
changeset
|
92 | transport->priv->dummy = NULL; |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
93 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
94 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
95 | static void |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
96 | jingle_transport_finalize (GObject *transport) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
97 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
98 | /* JingleTransportPrivate *priv = JINGLE_TRANSPORT_GET_PRIVATE(transport); */ |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
99 | purple_debug_info("jingle","jingle_transport_finalize\n"); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
100 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
101 | parent_class->finalize(transport); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
102 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
103 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
104 | static void |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
105 | jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
106 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
107 | JingleTransport *transport; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
108 | g_return_if_fail(JINGLE_IS_TRANSPORT(object)); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
109 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
110 | transport = JINGLE_TRANSPORT(object); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
111 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
112 | switch (prop_id) { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
113 | default: |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
114 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
115 | break; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
116 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
117 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
118 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
119 | static void |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
120 | jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
121 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
122 | JingleTransport *transport; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
123 | g_return_if_fail(JINGLE_IS_TRANSPORT(object)); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
124 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
125 | transport = JINGLE_TRANSPORT(object); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
126 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
127 | switch (prop_id) { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
128 | default: |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
129 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
130 | break; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
131 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
132 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
133 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
134 | JingleTransport * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
135 | jingle_transport_create(const gchar *type) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
136 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
137 | return g_object_new(jingle_get_type(type), NULL); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
138 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
139 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
140 | const gchar * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
141 | jingle_transport_get_transport_type(JingleTransport *transport) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
142 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
143 | return JINGLE_TRANSPORT_GET_CLASS(transport)->transport_type; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
144 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
145 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
146 | JingleTransport * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
147 | jingle_transport_parse_internal(xmlnode *transport) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
148 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
149 | const gchar *type = xmlnode_get_namespace(transport); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
150 | return jingle_transport_create(type); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
151 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
152 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
153 | xmlnode * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
154 | jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
155 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
156 | xmlnode *node = xmlnode_new_child(content, "transport"); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
157 | xmlnode_set_namespace(node, jingle_transport_get_transport_type(transport)); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
158 | return node; |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
159 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
160 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
161 | JingleTransport * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
162 | jingle_transport_parse(xmlnode *transport) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
163 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
164 | const gchar *type = xmlnode_get_namespace(transport); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
165 | return JINGLE_TRANSPORT_CLASS(g_type_class_ref(jingle_get_type(type)))->parse(transport); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
166 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
167 | |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
168 | xmlnode * |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
169 | jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action) |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
170 | { |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
171 | g_return_val_if_fail(JINGLE_IS_TRANSPORT(transport), NULL); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
172 | return JINGLE_TRANSPORT_GET_CLASS(transport)->to_xml(transport, content, action); |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
173 | } |
|
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
174 |