jingle/sessions.c
changeset 38 121e5ae7c1e5
parent 37 fce6bdc1ff46
child 47 964b3ebeba8d
equal deleted inserted replaced
37:fce6bdc1ff46 38:121e5ae7c1e5
    68 {
    68 {
    69   const gchar *from = lm_message_get_from(jn->message);
    69   const gchar *from = lm_message_get_from(jn->message);
    70   return session_find_by_sid(jn->sid, from);
    70   return session_find_by_sid(jn->sid, from);
    71 }
    71 }
    72 
    72 
    73 void session_add_content(JingleSession *sess, JingleContent *cn)
    73 void session_add_content(JingleSession *sess, JingleContent *cn,
       
    74                          SessionState state)
    74 {
    75 {
    75   SessionContent *sc = g_new0(SessionContent, 1);
    76   SessionContent *sc = g_new0(SessionContent, 1);
    76   
    77   
    77   sc->name = cn->name;
    78   sc->name = cn->name;
       
    79   sc->state = state;
    78   
    80   
    79   const gchar *tmpchar = lm_message_node_get_attribute(cn->description,
    81   const gchar *tmpchar = lm_message_node_get_attribute(cn->description,
    80                                                        "xmlns");
    82                                                        "xmlns");
    81   sc->appfuncs = jingle_get_appfuncs(tmpchar);
    83   sc->appfuncs = jingle_get_appfuncs(tmpchar);
    82   tmpchar = lm_message_node_get_attribute(cn->transport, "xmlns");
    84   tmpchar = lm_message_node_get_attribute(cn->transport, "xmlns");
   103 
   105 
   104 void session_remove_sessioncontent(JingleSession *sess, const gchar *name)
   106 void session_remove_sessioncontent(JingleSession *sess, const gchar *name)
   105 {
   107 {
   106   SessionContent *sc;
   108   SessionContent *sc;
   107   sc = session_find_sessioncontent(sess, name);
   109   sc = session_find_sessioncontent(sess, name);
       
   110   if(sc == NULL) return;
       
   111 
       
   112   if (sc->state == ACTIVE); // We should stop the transfert
       
   113 
       
   114   sess->content = g_slist_remove(sess->content, sc);
       
   115 }
       
   116 
       
   117 void session_changestate_sessioncontent(JingleSession *sess, const gchar *name,
       
   118                                         SessionState state)
       
   119 {
       
   120   SessionContent *sc;
       
   121   sc = session_find_sessioncontent(sess, name);
   108   if(sc != NULL)
   122   if(sc != NULL)
   109     sess->content = g_slist_remove(sess->content, sc);
   123     sc->state = state;
   110 }
   124 }
   111 
   125 
   112 /**
   126 /**
   113  * Remove a session from the linked list and free it.
   127  * Remove a session from the linked list and free it.
   114  */
   128  */