jingle/action-handlers.c
changeset 96 3922f5c96973
parent 84 cdff1771155d
child 99 3463ce93975a
equal deleted inserted replaced
95:cac87df18e6d 96:3922f5c96973
   334     scr_LogPrint(LPRINT_LOGNORM, "%s", sbuf->str);
   334     scr_LogPrint(LPRINT_LOGNORM, "%s", sbuf->str);
   335   }
   335   }
   336   g_free(disp);
   336   g_free(disp);
   337 }
   337 }
   338 
   338 
       
   339 void handle_session_accept(JingleNode *jn)
       
   340 {
       
   341   JingleSession *sess;
       
   342   JingleContent *jc;
       
   343   SessionContent *sc;
       
   344   
       
   345   GSList *el;
       
   346   const gchar *from = lm_message_get_from(jn->message);
       
   347   
       
   348   // We're looking if the session exist
       
   349   sess = session_find_by_sid(jn->sid, from);
       
   350   if (sess == NULL) {
       
   351     // TODO: send unknow-session
       
   352     return;
       
   353   }
       
   354   
       
   355   jingle_ack_iq(jn->message);
       
   356   
       
   357   for (el = jn->content; el; el = el->next) {
       
   358     jc = (JingleContent*)el->data;
       
   359     session_changestate_sessioncontent(sess, jc->name,
       
   360                                        JINGLE_SESSION_STATE_ACTIVE);
       
   361   }
       
   362   
       
   363   // We delete content who have been refuse
       
   364   for (el = sess->content; el; el = el->next) {
       
   365     sc = (SessionContent*) el->data;
       
   366     if (sc->state == JINGLE_SESSION_STATE_PENDING) {
       
   367       session_remove_sessioncontent(sess, sc->name);
       
   368     }
       
   369   }
       
   370 }
       
   371 
   339 void handle_session_terminate(JingleNode *jn)
   372 void handle_session_terminate(JingleNode *jn)
   340 {
   373 {
   341   JingleSession *sess;
   374   JingleSession *sess;
   342   if ((sess = session_find(jn)) == NULL) {
   375   if ((sess = session_find(jn)) == NULL) {
   343     jingle_send_iq_error(jn->message, "cancel", "item-not-found", "unknown-session");
   376     jingle_send_iq_error(jn->message, "cancel", "item-not-found", "unknown-session");