From ac1164a3fa6f4c388399af06612e16eade16e46b Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 29 Sep 2015 21:51:04 +0100 Subject: Use more specific messages for last activity responses --- src/event/server_events.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/event/server_events.c b/src/event/server_events.c index ea181865..74e5cf75 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -740,15 +740,39 @@ sv_ev_lastactivity_response(const char * const from, const int seconds, const ch return; } - // full jid or bare jid - if (jidp->resourcepart || jidp->localpart) { - if (msg) { - cons_show("%s last active %d seconds ago, status: %s", from, seconds, msg); + // full jid - last activity + if (jidp->resourcepart) { + if (seconds == 0) { + if (msg) { + cons_show("%s currently active, status: %s", from, msg); + } else { + cons_show("%s currently active.", from); + } } else { - cons_show("%s last active %d seconds ago.", from, seconds); + if (msg) { + cons_show("%s last active %d seconds ago, status: %s", from, seconds, msg); + } else { + cons_show("%s last active %d seconds ago.", from, seconds); + } + } + + // barejid - last logged in + } else if (jidp->localpart) { + if (seconds == 0) { + if (msg) { + cons_show("%s currently logged in, status: %s", from, msg); + } else { + cons_show("%s currently loggrd in.", from); + } + } else { + if (msg) { + cons_show("%s last logged in %d seconds ago, status: %s", from, seconds, msg); + } else { + cons_show("%s last logged in %d seconds ago.", from, seconds); + } } - // domain only + // domain only - uptime } else { cons_show("%s uptime %d seconds", from, seconds); } -- cgit 1.4.1-2-gfad0