equal
deleted
inserted
replaced
29 #include <mcabber/modules.h> |
29 #include <mcabber/modules.h> |
30 #include <mcabber/logprint.h> |
30 #include <mcabber/logprint.h> |
31 #include <mcabber/xmpp_helper.h> |
31 #include <mcabber/xmpp_helper.h> |
32 #include <mcabber/xmpp_defines.h> |
32 #include <mcabber/xmpp_defines.h> |
33 |
33 |
34 #include "jingle.h" |
34 #include <jingle/jingle.h> |
35 #include "check.h" |
35 #include <jingle/check.h> |
36 #include "action-handlers.h" |
36 #include <jingle/action-handlers.h> |
37 #include "register.h" |
37 #include <jingle/register.h> |
38 |
38 |
39 |
39 |
40 static void jingle_register_lm_handlers(void); |
40 static void jingle_register_lm_handlers(void); |
41 static void jingle_unregister_lm_handlers(void); |
41 static void jingle_unregister_lm_handlers(void); |
42 static guint jingle_connect_hh(const gchar *hname, hk_arg_t *args, gpointer ignore); |
42 static guint jingle_connect_hh(const gchar *hname, hk_arg_t *args, gpointer ignore); |
105 if (g_strcmp0(lm_message_node_get_attribute(jnode, "xmlns"), NS_JINGLE)) { |
105 if (g_strcmp0(lm_message_node_get_attribute(jnode, "xmlns"), NS_JINGLE)) { |
106 scr_log_print(LPRINT_DEBUG, "jingle: Received a jingle IQ with an invalid namespace"); |
106 scr_log_print(LPRINT_DEBUG, "jingle: Received a jingle IQ with an invalid namespace"); |
107 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
107 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
108 } |
108 } |
109 |
109 |
110 check_jingle(jnode, jn, &error); |
110 check_jingle(message, jnode, jn, &error); |
111 if (error != NULL) { |
111 if (error != NULL) { |
112 if (error->domain == JINGLE_CHECK_ERROR) { |
112 if (error->domain == JINGLE_CHECK_ERROR) { |
113 // request malformed, we reply with a bad-request |
113 // request malformed, we reply with a bad-request |
114 jingle_send_iq_error(message, "cancel", "bad-request", NULL); |
114 jingle_send_iq_error(message, "cancel", "bad-request", NULL); |
115 } |
115 } |
144 lm_connection_send(lconnection, r, NULL); |
144 lm_connection_send(lconnection, r, NULL); |
145 lm_message_unref(r); |
145 lm_message_unref(r); |
146 } |
146 } |
147 |
147 |
148 /** |
148 /** |
149 * Reply to a Jingle IQ with an error. |
149 * Create an error IQ. |
150 */ |
150 */ |
151 LmMessage *jingle_new_iq_error(LmMessage *m, const gchar *errtype, |
151 LmMessage *jingle_new_iq_error(LmMessage *m, const gchar *errtype, |
152 const gchar *cond, const gchar *jinglecond) |
152 const gchar *cond, const gchar *jinglecond) |
153 { |
153 { |
154 LmMessage *r; |
154 LmMessage *r; |
171 } |
171 } |
172 |
172 |
173 return r; |
173 return r; |
174 } |
174 } |
175 |
175 |
|
176 /** |
|
177 * Reply to a Jingle IQ with an error. |
|
178 */ |
176 void jingle_send_iq_error(LmMessage *m, const gchar *errtype, |
179 void jingle_send_iq_error(LmMessage *m, const gchar *errtype, |
177 const gchar *cond, const gchar *jinglecond) |
180 const gchar *cond, const gchar *jinglecond) |
178 { |
181 { |
179 LmMessage *r = jingle_new_iq_error(m, errtype, cond, jinglecond); |
182 LmMessage *r = jingle_new_iq_error(m, errtype, cond, jinglecond); |
180 if (r) { |
183 if (r) { |
192 for (i = 0; i < actstrlen; i++) |
195 for (i = 0; i < actstrlen; i++) |
193 if (!g_strcmp0(jingle_action_list[i].name, string)) |
196 if (!g_strcmp0(jingle_action_list[i].name, string)) |
194 return (JingleAction) i; |
197 return (JingleAction) i; |
195 |
198 |
196 return JINGLE_UNKNOWN_ACTION; |
199 return JINGLE_UNKNOWN_ACTION; |
|
200 } |
|
201 |
|
202 void jingle_free_jinglenode(JingleNode *jn) |
|
203 { |
|
204 GSList *entry = NULL; |
|
205 for (entry = jn->content; entry; entry = entry->next) { |
|
206 if (entry->data != NULL) |
|
207 g_free((JingleContentNode*) entry->data); |
|
208 } |
|
209 g_slist_free(jn->content); |
|
210 lm_message_unref(jn->message); |
|
211 g_free(jn); |
197 } |
212 } |
198 |
213 |
199 static void jingle_unregister_lm_handlers(void) |
214 static void jingle_unregister_lm_handlers(void) |
200 { |
215 { |
201 if (lconnection) { |
216 if (lconnection) { |