handle error for session-initiate
authorNicolas Cornu <nicolas.cornu@ensi-bourges.fr>
Tue, 10 Aug 2010 18:59:28 +0200
changeset 91 7d3e75eec29e
parent 90 b250d32fea87
child 92 e6c23d765038
handle error for session-initiate
jingle/jingle.c
jingle/send.c
--- a/jingle/jingle.c	Tue Aug 10 18:23:07 2010 +0200
+++ b/jingle/jingle.c	Tue Aug 10 18:59:28 2010 +0200
@@ -119,7 +119,7 @@
       // request malformed, we reply with a bad-request
       jingle_send_iq_error(message, "cancel", "bad-request", NULL);
       scr_log_print(LPRINT_DEBUG,
-                    "jingle: ", error->message);
+                    "jingle: %s", error->message);
     }
     g_clear_error(&error);
     return LM_HANDLER_RESULT_REMOVE_MESSAGE;
@@ -290,8 +290,8 @@
   for (thisres = reslist; thisres; thisres = g_slist_next(thisres)) {
     found = TRUE;
     for (indexns = 0; ns[indexns]; indexns++) {
-	   if (!caps_has_feature(buddy_resource_getcaps(roster_usr->data, thisres->data), ns[indexns]))
-	     found = FALSE;
+	  // if (!caps_has_feature(buddy_resource_getcaps(roster_usr->data, thisres->data), ns[indexns]))
+	   //  found = FALSE;
 	 }
 	 if (!found) continue;
 
--- a/jingle/send.c	Tue Aug 10 18:23:07 2010 +0200
+++ b/jingle/send.c	Tue Aug 10 18:59:28 2010 +0200
@@ -123,6 +123,24 @@
   }
 }
 
+static void jingle_handle_ack_iq_si(LmMessage *mess, gpointer *data)
+{
+  LmMessageNode *node;
+  const gchar *type, *cause;
+  
+  if(lm_message_get_sub_type(mess) == LM_MESSAGE_SUB_TYPE_RESULT)
+    return;
+  if(lm_message_get_sub_type(mess) == LM_MESSAGE_SUB_TYPE_ERROR) {
+    node = lm_message_get_node(mess);
+    node = lm_message_node_get_child(node,"error");
+    type = lm_message_node_get_attribute(node, "type");
+    if(node->children != NULL) {
+      cause = node->children->name;
+    }
+    scr_LogPrint(LPRINT_LOGNORM, "Jingle: session-initiate refuse: %s %s", type, cause);
+  } 
+}
+
 void jingle_send_session_initiate(JingleSession *js)
 {
   JingleAckHandle *ackhandle;
@@ -135,7 +153,7 @@
 
   if (mess) {
     ackhandle = g_new0(JingleAckHandle, 1);
-    ackhandle->callback = NULL;
+    ackhandle->callback = jingle_handle_ack_iq_si;
     ackhandle->user_data = NULL;
     lm_connection_send_with_reply(lconnection, mess,
                                   jingle_new_ack_handler(ackhandle), NULL);