25 |
25 |
26 #include <mcabber/utils.h> |
26 #include <mcabber/utils.h> |
27 |
27 |
28 #include <jingle/check.h> |
28 #include <jingle/check.h> |
29 #include <jingle/jingle.h> |
29 #include <jingle/jingle.h> |
30 |
30 #include <jingle/register.h> |
31 |
31 |
32 static JingleContent *check_content(LmMessageNode *node, GError **err); |
32 static JingleContent *check_content(LmMessageNode *node, GError **err); |
33 gint index_in_array(const gchar *str, const gchar **array); |
33 gint index_in_array(const gchar *str, const gchar **array); |
34 |
34 |
35 |
35 |
102 static JingleContent *check_content(LmMessageNode *node, GError **err) |
102 static JingleContent *check_content(LmMessageNode *node, GError **err) |
103 { |
103 { |
104 JingleContent *cn = g_new0(JingleContent, 1); |
104 JingleContent *cn = g_new0(JingleContent, 1); |
105 const gchar *creatorstr, *sendersstr; |
105 const gchar *creatorstr, *sendersstr; |
106 gint tmp, tmp2; |
106 gint tmp, tmp2; |
107 |
107 LmMessageNode *tmpnode = NULL; |
|
108 |
108 creatorstr = lm_message_node_get_attribute(node, "creator"); |
109 creatorstr = lm_message_node_get_attribute(node, "creator"); |
109 cn->disposition = lm_message_node_get_attribute(node, "disposition"); |
110 cn->disposition = lm_message_node_get_attribute(node, "disposition"); |
110 cn->name = lm_message_node_get_attribute(node, "name"); |
111 cn->name = lm_message_node_get_attribute(node, "name"); |
111 sendersstr = lm_message_node_get_attribute(node, "senders"); |
112 sendersstr = lm_message_node_get_attribute(node, "senders"); |
112 |
113 |
126 return NULL; |
127 return NULL; |
127 } |
128 } |
128 cn->creator = (JingleCreator)tmp; |
129 cn->creator = (JingleCreator)tmp; |
129 cn->senders = (JingleSenders)tmp2; |
130 cn->senders = (JingleSenders)tmp2; |
130 |
131 |
131 |
132 tmpnode = lm_message_node_get_child(node, "description"); |
132 cn->description = lm_message_node_get_child(node, "description"); |
133 if(tmpnode == NULL) { |
133 cn->transport = lm_message_node_get_child(node, "transport"); |
|
134 if (cn->description == NULL || cn->transport == NULL) { |
|
135 g_set_error(err, JINGLE_CHECK_ERROR, JINGLE_CHECK_ERROR_MISSING, |
134 g_set_error(err, JINGLE_CHECK_ERROR, JINGLE_CHECK_ERROR_MISSING, |
136 "a child element of content is missing"); |
135 "a child element of content is missing"); |
137 g_free(cn); |
136 g_free(cn); |
138 return NULL; |
137 return NULL; |
139 } |
138 } |
|
139 |
|
140 cn->xmlns_desc = lm_message_node_get_attribute(tmpnode, "xmlns"); |
|
141 |
|
142 cn->description = (gconstpointer*)jingle_get_appfuncs(cn->xmlns_desc)->parse(tmpnode); |
|
143 |
|
144 tmpnode = lm_message_node_get_child(node, "transport"); |
|
145 if (tmpnode == NULL) { |
|
146 g_set_error(err, JINGLE_CHECK_ERROR, JINGLE_CHECK_ERROR_MISSING, |
|
147 "a child element of content is missing"); |
|
148 g_free(cn); |
|
149 return NULL; |
|
150 } |
|
151 |
|
152 cn->xmlns_trans = lm_message_node_get_attribute(tmpnode, "xmlns"); |
|
153 |
|
154 cn->transport = (gconstpointer*)jingle_get_transportfuncs(cn->xmlns_trans)->parse(tmpnode); |
140 |
155 |
141 return cn; |
156 return cn; |
142 } |
157 } |
143 |
158 |
144 /** |
159 /** |