diff mcabber/src/jabglue.c @ 1254:401639413340

More jabber:iq:last support... (misc) This is a patch from Michael Scherer to answer iq:last requests, slightly modified.
author Mikael Berthe <mikael@lilotux.net>
date Fri, 22 Jun 2007 19:21:23 +0200
parents f7b9a00c512d
children ceada40bbe20
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Fri Jun 22 19:18:44 2007 +0200
+++ b/mcabber/src/jabglue.c	Fri Jun 22 19:21:23 2007 +0200
@@ -60,6 +60,7 @@
 
 static int evscallback_invitation(eviqs *evp, guint evcontext);
 
+
 static void logger(jconn j, int io, const char *buf)
 {
   scr_LogPrint(LPRINT_DEBUG, "%03s: %s", ((io == 0) ? "OUT" : "IN"), buf);
@@ -323,6 +324,11 @@
   return mystatusmsg;
 }
 
+inline void update_last_use(void)
+{
+  iqlast = time(NULL);
+}
+
 //  insert_entity_capabilities(presence_stanza)
 // Entity Capabilities (XEP-0115)
 static void insert_entity_capabilities(xmlnode x)
@@ -502,6 +508,9 @@
       mystatusmsg = NULL;
   }
 
+  if (!Autoaway)
+    update_last_use();
+
   // Update status line
   scr_UpdateMainStatus(TRUE);
 }
@@ -681,6 +690,8 @@
 jb_send_msg_no_chatstates:
   xmlnode_put_attrib(x, "id", msgid);
 
+  if (mystatus != invisible)
+    update_last_use();
   jab_send(jc, x);
   xmlnode_free(x);
 #if defined JEP0022
@@ -1845,6 +1856,7 @@
         scr_LogPrint(LPRINT_LOGNORM, "[Jabber] Communication with the server "
                      "established");
         online = TRUE;
+        update_last_use();
         // We set AutoConnection to true after the 1st successful connection
         AutoConnection = true;
         break;