jingle/action-handlers.c
changeset 58 daafe5b8a48d
parent 52 d803c882a182
child 60 05184a1846d1
equal deleted inserted replaced
57:23df37238a3a 58:daafe5b8a48d
    24 #include <mcabber/logprint.h>
    24 #include <mcabber/logprint.h>
    25 #include <mcabber/xmpp_helper.h>
    25 #include <mcabber/xmpp_helper.h>
    26 #include <mcabber/events.h>
    26 #include <mcabber/events.h>
    27 #include <mcabber/hbuf.h>
    27 #include <mcabber/hbuf.h>
    28 #include <mcabber/utils.h>
    28 #include <mcabber/utils.h>
       
    29 #include <mcabber/screen.h>
    29 
    30 
    30 #include <jingle/jingle.h>
    31 #include <jingle/jingle.h>
    31 #include <jingle/check.h>
    32 #include <jingle/check.h>
    32 #include <jingle/sessions.h>
    33 #include <jingle/sessions.h>
    33 #include <jingle/register.h>
    34 #include <jingle/register.h>
   260   gboolean valid_disposition = FALSE;
   261   gboolean valid_disposition = FALSE;
   261   JingleContent *cn;
   262   JingleContent *cn;
   262   GString *sbuf;
   263   GString *sbuf;
   263   GSList *child = NULL;
   264   GSList *child = NULL;
   264   LmMessage *r;
   265   LmMessage *r;
       
   266   gchar *disp;
   265   
   267   
   266   // Make sure the request come from an user in our roster
   268   // Make sure the request come from an user in our roster
   267   if (!roster_find(jidtodisp(lm_message_get_from(jn->message)), jidsearch, 0)) {
   269   if (!roster_find(jidtodisp(lm_message_get_from(jn->message)), jidsearch, 0)) {
   268     jingle_send_session_terminate(jn, "decline");
   270     jingle_send_session_terminate(jn, "decline");
   269     jingle_free_jinglenode(jn);
   271     jingle_free_jinglenode(jn);
   307 
   309 
   308   // Wait that user accept the jingle
   310   // Wait that user accept the jingle
   309   sbuf = g_string_new("");
   311   sbuf = g_string_new("");
   310   g_string_printf(sbuf, "Received an invitation for a jingle session from <%s>", lm_message_get_from(jn->message));
   312   g_string_printf(sbuf, "Received an invitation for a jingle session from <%s>", lm_message_get_from(jn->message));
   311 
   313 
   312   scr_WriteIncomingMessage(jidtodisp(lm_message_get_from(jn->message)), sbuf->str, 0, HBB_PREFIX_INFO, 0);
   314   disp = jidtodisp(lm_message_get_from(jn->message));
       
   315   scr_WriteIncomingMessage(disp, sbuf->str, 0, HBB_PREFIX_INFO, 0);
   313   scr_LogPrint(LPRINT_LOGNORM, "%s", sbuf->str);
   316   scr_LogPrint(LPRINT_LOGNORM, "%s", sbuf->str);
   314 
   317 
   315   {
   318   {
   316     const char *id;
   319     const char *id;
   317     char *desc = g_strdup_printf("<%s> invites you to do a jingle session", lm_message_get_from(jn->message));
   320     char *desc = g_strdup_printf("<%s> invites you to do a jingle session", lm_message_get_from(jn->message));
   320     g_free(desc);
   323     g_free(desc);
   321     if (id)
   324     if (id)
   322       g_string_printf(sbuf, "Please use /event %s accept|reject", id);
   325       g_string_printf(sbuf, "Please use /event %s accept|reject", id);
   323     else
   326     else
   324       g_string_printf(sbuf, "Unable to create a new event!");
   327       g_string_printf(sbuf, "Unable to create a new event!");
   325   }
   328     scr_WriteIncomingMessage(disp, sbuf->str, 0, HBB_PREFIX_INFO, 0);
       
   329     scr_LogPrint(LPRINT_LOGNORM, "%s", sbuf->str);
       
   330   }
       
   331   g_free(disp);
   326 }
   332 }
   327 
   333 
   328 void handle_session_terminate(JingleNode *jn)
   334 void handle_session_terminate(JingleNode *jn)
   329 {
   335 {
   330   JingleSession *sess;
   336   JingleSession *sess;