24 #include <mcabber/events.h> |
24 #include <mcabber/events.h> |
25 #include <mcabber/logprint.h> |
25 #include <mcabber/logprint.h> |
26 |
26 |
27 #include <jingle/jingle.h> |
27 #include <jingle/jingle.h> |
28 #include <jingle/general-handlers.h> |
28 #include <jingle/general-handlers.h> |
|
29 |
|
30 GSList *ack_wait = NULL; |
29 |
31 |
30 extern LmMessageHandler* jingle_ack_iq_handler; |
32 extern LmMessageHandler* jingle_ack_iq_handler; |
31 gboolean evscallback_jingle(guint evcontext, const gchar *arg, |
33 gboolean evscallback_jingle(guint evcontext, const gchar *arg, |
32 gpointer userdata) |
34 gpointer userdata) |
33 { |
35 { |
70 |
72 |
71 LmHandlerResult jingle_handle_ack_iq (LmMessageHandler *handler, |
73 LmHandlerResult jingle_handle_ack_iq (LmMessageHandler *handler, |
72 LmConnection *connection, |
74 LmConnection *connection, |
73 LmMessage *message, gpointer user_data) |
75 LmMessage *message, gpointer user_data) |
74 { |
76 { |
75 static GSList *ack_wait; |
|
76 GSList *child; |
77 GSList *child; |
77 LmMessageNode *node = lm_message_get_node(message); |
78 LmMessageNode *node = lm_message_get_node(message); |
78 const gchar *id = lm_message_node_get_attribute(node, "id"); |
79 const gchar *id = lm_message_node_get_attribute(node, "id"); |
79 ack_iq *ai; |
80 ack_iq *ai; |
80 for (child = ack_wait; child; child = child->next) { |
81 for (child = ack_wait; child; child = child->next) { |
81 ai = (ack_iq*)child->data; |
82 ai = (ack_iq*)child->data; |
82 if(!g_strcmp0(ai->id, id)) { |
83 if(!g_strcmp0(ai->id, id)) { |
83 ai->callback(ai->udata); |
84 g_free(ai->id); |
|
85 if(ai->callback != NULL) |
|
86 ai->callback(message, ai->udata); |
84 ack_wait = g_slist_remove(ack_wait, child); |
87 ack_wait = g_slist_remove(ack_wait, child); |
85 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
88 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
86 } |
89 } |
87 } |
90 } |
88 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
91 return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; |
89 } |
92 } |
|
93 |
|
94 void add_ack_wait(ack_iq *elem) |
|
95 { |
|
96 ack_wait = g_slist_append(ack_wait, elem); |
|
97 } |