Mercurial > hg
diff mcabber/src/commands.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 | 2b7ef605ddc6 |
children | b75f4105ce32 |
line wrap: on
line diff
--- a/mcabber/src/commands.c Sat Dec 17 13:48:07 2005 +0100 +++ b/mcabber/src/commands.c Sat Dec 17 18:39:04 2005 +0100 @@ -907,10 +907,12 @@ gchar rprio; enum imstatus rstatus; const char *rst_msg; + time_t rst_time; rprio = buddy_getresourceprio(bud, resources->data); rstatus = buddy_getstatus(bud, resources->data); rst_msg = buddy_getstatusmsg(bud, resources->data); + rst_time = buddy_getstatustime(bud, resources->data); snprintf(buffer, 127, "Resource: [%c] (%d) %s", imstatus2char[rstatus], rprio, (char*)resources->data); @@ -919,6 +921,13 @@ snprintf(buffer, 127, "Status message: %s", rst_msg); scr_WriteIncomingMessage(jid, buffer, 0, HBB_PREFIX_INFO); } + if (rst_time) { + char tbuf[256]; + + strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M:%S", localtime(&rst_time)); + snprintf(buffer, 127, "Status timestamp: %s", tbuf); + scr_WriteIncomingMessage(jid, buffer, 0, HBB_PREFIX_INFO); + } } } else { if (name) scr_LogPrint(LPRINT_NORMAL, "Name: %s", name); @@ -1506,6 +1515,7 @@ enum imstatus rstatus; enum imrole role; enum imaffiliation affil; + time_t rst_time; char *strroles[] = { "none", "moderator", "participant", "visitor" }; char *straffil[] = { "none", "owner", "admin", "member", "outcast" }; @@ -1528,6 +1538,7 @@ return; } + rst_time = buddy_getstatustime(bud, nick); rprio = buddy_getresourceprio(bud, nick); rst_msg = buddy_getstatusmsg(bud, nick); if (!rst_msg) rst_msg = ""; @@ -1544,6 +1555,14 @@ rst_msg); scr_WriteIncomingMessage(jid, buffer, 0, HBB_PREFIX_INFO); + if (rst_time) { + char tbuf[256]; + + strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M:%S", localtime(&rst_time)); + snprintf(buffer, 127, "Timestamp: %s", tbuf); + scr_WriteIncomingMessage(jid, buffer, 0, HBB_PREFIX_INFO); + } + if (realjid) { snprintf(buffer, 127, "JID : <%s>", realjid); scr_WriteIncomingMessage(jid, buffer, 0, HBB_PREFIX_INFO); @@ -1555,6 +1574,7 @@ scr_WriteIncomingMessage(jid, buffer, 0, HBB_PREFIX_INFO); snprintf(buffer, 127, "Priority : %d", rprio); scr_WriteIncomingMessage(jid, buffer, 0, HBB_PREFIX_INFO); + scr_WriteIncomingMessage(jid, "End of WHOIS", 0, HBB_PREFIX_INFO); g_free(buffer);