send session accept
authorNicolas Cornu <nicolas.cornu@ensi-bourges.fr>
Thu, 08 Jul 2010 18:47:06 +0200
changeset 41 9c3620daec8f
parent 40 cbc7a83fbdf5
child 42 526d61c145a7
send session accept
jingle/action-handlers.c
--- a/jingle/action-handlers.c	Thu Jul 08 17:48:29 2010 +0200
+++ b/jingle/action-handlers.c	Thu Jul 08 18:47:06 2010 +0200
@@ -260,7 +260,9 @@
   gconstpointer description, transport;
   const gchar *xmlns;
   JingleSession* sess;
-
+  JingleNode accept;
+  LmMessage *r;
+  
   if (!check_contents(jn, &err)) {
     scr_log_print(LPRINT_DEBUG, "jingle: One of the content element was invalid (%s)",
                   err->message);
@@ -296,6 +298,13 @@
 
   jingle_ack_iq(m);
 
+  accept.action = JINGLE_SESSION_ACCEPT;
+  accept.initiator = jn->initiator;
+  accept.creator = jn->creator;
+  accept.responder = jn->responder;
+  accept.sid = jn->sid;
+  accept.content = NULL;
+  
   sess = session_new(jn);
   
   for (child = jn->content; child; child = child->next) {
@@ -315,6 +324,7 @@
     if (transport == NULL || err != NULL) continue;
     
     session_add_content(sess, cn, ACTIVE);
+    accept.content = g_slist_append(accept.content, cn);
   }
   
   if(g_slist_length(sess->content) == 0) {
@@ -324,7 +334,14 @@
   }
   
   // Send a session-accept
-  
+  if (g_slist_length(accept.content) != 0) {
+    r = lm_message_from_jinglenode(&accept, lm_message_get_from(m));
+    if (r) {
+      lm_connection_send(lconnection, r, NULL);
+      lm_message_unref(r);
+    }
+  }
+
 }
 
 void handle_session_terminate(LmMessage *m, JingleNode *jn)