mcabber/src/jabglue.c
changeset 1254 401639413340
parent 1244 f7b9a00c512d
child 1255 ceada40bbe20
equal deleted inserted replaced
1253:eb38963e082f 1254:401639413340
    58 static void packethandler(jconn, jpacket);
    58 static void packethandler(jconn, jpacket);
    59 static void handle_state_events(char* from, xmlnode xmldata);
    59 static void handle_state_events(char* from, xmlnode xmldata);
    60 
    60 
    61 static int evscallback_invitation(eviqs *evp, guint evcontext);
    61 static int evscallback_invitation(eviqs *evp, guint evcontext);
    62 
    62 
       
    63 
    63 static void logger(jconn j, int io, const char *buf)
    64 static void logger(jconn j, int io, const char *buf)
    64 {
    65 {
    65   scr_LogPrint(LPRINT_DEBUG, "%03s: %s", ((io == 0) ? "OUT" : "IN"), buf);
    66   scr_LogPrint(LPRINT_DEBUG, "%03s: %s", ((io == 0) ? "OUT" : "IN"), buf);
    66 }
    67 }
    67 
    68 
   319 }
   320 }
   320 
   321 
   321 inline const char *jb_getstatusmsg()
   322 inline const char *jb_getstatusmsg()
   322 {
   323 {
   323   return mystatusmsg;
   324   return mystatusmsg;
       
   325 }
       
   326 
       
   327 inline void update_last_use(void)
       
   328 {
       
   329   iqlast = time(NULL);
   324 }
   330 }
   325 
   331 
   326 //  insert_entity_capabilities(presence_stanza)
   332 //  insert_entity_capabilities(presence_stanza)
   327 // Entity Capabilities (XEP-0115)
   333 // Entity Capabilities (XEP-0115)
   328 static void insert_entity_capabilities(xmlnode x)
   334 static void insert_entity_capabilities(xmlnode x)
   499     if (*msg)
   505     if (*msg)
   500       mystatusmsg = g_strdup(msg);
   506       mystatusmsg = g_strdup(msg);
   501     else
   507     else
   502       mystatusmsg = NULL;
   508       mystatusmsg = NULL;
   503   }
   509   }
       
   510 
       
   511   if (!Autoaway)
       
   512     update_last_use();
   504 
   513 
   505   // Update status line
   514   // Update status line
   506   scr_UpdateMainStatus(TRUE);
   515   scr_UpdateMainStatus(TRUE);
   507 }
   516 }
   508 
   517 
   679 #endif
   688 #endif
   680 
   689 
   681 jb_send_msg_no_chatstates:
   690 jb_send_msg_no_chatstates:
   682   xmlnode_put_attrib(x, "id", msgid);
   691   xmlnode_put_attrib(x, "id", msgid);
   683 
   692 
       
   693   if (mystatus != invisible)
       
   694     update_last_use();
   684   jab_send(jc, x);
   695   jab_send(jc, x);
   685   xmlnode_free(x);
   696   xmlnode_free(x);
   686 #if defined JEP0022
   697 #if defined JEP0022
   687   g_free(nmsgid);
   698   g_free(nmsgid);
   688 #endif
   699 #endif
  1843 
  1854 
  1844     case JCONN_STATE_ON:
  1855     case JCONN_STATE_ON:
  1845         scr_LogPrint(LPRINT_LOGNORM, "[Jabber] Communication with the server "
  1856         scr_LogPrint(LPRINT_LOGNORM, "[Jabber] Communication with the server "
  1846                      "established");
  1857                      "established");
  1847         online = TRUE;
  1858         online = TRUE;
       
  1859         update_last_use();
  1848         // We set AutoConnection to true after the 1st successful connection
  1860         // We set AutoConnection to true after the 1st successful connection
  1849         AutoConnection = true;
  1861         AutoConnection = true;
  1850         break;
  1862         break;
  1851 
  1863 
  1852     case JCONN_STATE_CONNECTING:
  1864     case JCONN_STATE_CONNECTING: