about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-09-29 21:51:04 +0100
committerJames Booth <boothj5@gmail.com>2015-09-29 21:51:04 +0100
commitac1164a3fa6f4c388399af06612e16eade16e46b (patch)
tree43f51416d1e361c6f18c2770a879cad8221d93bd /src
parent09833fb0dd1b778ea1e0078af7fb3a8e734e21a2 (diff)
downloadprofani-tty-ac1164a3fa6f4c388399af06612e16eade16e46b.tar.gz
Use more specific messages for last activity responses
Diffstat (limited to 'src')
-rw-r--r--src/event/server_events.c36
1 files changed, 30 insertions, 6 deletions
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);
     }