diff mcabber/src/roster.c @ 625:028c01940490

Show presence timestamps in "/info" and "/room whois"
author Mikael Berthe <mikael@lilotux.net>
date Sat, 17 Dec 2005 18:39:04 +0100
parents f20c1934a8a7
children 68fb0c1dfb15
line wrap: on
line diff
--- a/mcabber/src/roster.c	Sat Dec 17 13:48:07 2005 +0100
+++ b/mcabber/src/roster.c	Sat Dec 17 18:39:04 2005 +0100
@@ -47,6 +47,7 @@
   gchar prio;
   enum imstatus status;
   gchar *status_msg;
+  time_t status_timestamp;
   enum imrole role;
   enum imaffiliation affil;
   gchar *realjid;       /* for chatrooms, if buddy's real jid is known */
@@ -404,6 +405,7 @@
 // Note: resname, role, affil and realjid are for room members only
 void roster_setstatus(const char *jid, const char *resname, gchar prio,
                       enum imstatus bstat, const char *status_msg,
+                      time_t status_time,
                       enum imrole role, enum imaffiliation affil,
                       const char *realjid)
 {
@@ -438,6 +440,9 @@
   }
   if (status_msg)
     p_res->status_msg = g_strdup(status_msg);
+  if (!status_time)
+    time(&status_time);
+  p_res->status_timestamp = status_time;
 
   p_res->role = role;
   p_res->affil = affil;
@@ -912,6 +917,15 @@
   return NULL;
 }
 
+time_t buddy_getstatustime(gpointer rosterdata, const char *resname)
+{
+  roster *roster_usr = rosterdata;
+  res *p_res = get_resource(roster_usr, resname);
+  if (p_res)
+    return p_res->status_timestamp;
+  return 0;
+}
+
 gchar buddy_getresourceprio(gpointer rosterdata, const char *resname)
 {
   roster *roster_usr = rosterdata;