about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-10-14 21:12:26 +0100
committerJames Booth <boothj5@gmail.com>2015-10-14 21:12:26 +0100
commitaae526fbde1d3436c2b77834e81910a67ca8825f (patch)
tree964544202156d6027703174b8134ec5aac04c10d
parent85764ddb5314e3e52c515f245bec2190c6c68823 (diff)
downloadprofani-tty-aae526fbde1d3436c2b77834e81910a67ca8825f.tar.gz
Moved idle time check for last activity
-rw-r--r--src/xmpp/presence.c4
-rw-r--r--src/xmpp/stanza.c18
2 files changed, 11 insertions, 11 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index 7ccc20a4..e475f599 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -243,7 +243,9 @@ presence_send(const resource_presence_t presence_type, const char * const msg, c
     }
 
     stanza_attach_priority(ctx, presence, pri);
-    stanza_attach_last_activity(ctx, presence, idle);
+    if (idle > 0) {
+        stanza_attach_last_activity(ctx, presence, idle);
+    }
     stanza_attach_caps(ctx, presence);
     xmpp_send(conn, presence);
     _send_room_presence(conn, presence);
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 691441d4..765b9c4b 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -1662,16 +1662,14 @@ void
 stanza_attach_last_activity(xmpp_ctx_t * const ctx,
     xmpp_stanza_t * const presence, const int idle)
 {
-    if (idle > 0) {
-        xmpp_stanza_t *query = xmpp_stanza_new(ctx);
-        xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
-        xmpp_stanza_set_ns(query, STANZA_NS_LASTACTIVITY);
-        char idle_str[10];
-        snprintf(idle_str, sizeof(idle_str), "%d", idle);
-        xmpp_stanza_set_attribute(query, STANZA_ATTR_SECONDS, idle_str);
-        xmpp_stanza_add_child(presence, query);
-        xmpp_stanza_release(query);
-    }
+    xmpp_stanza_t *query = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
+    xmpp_stanza_set_ns(query, STANZA_NS_LASTACTIVITY);
+    char idle_str[10];
+    snprintf(idle_str, sizeof(idle_str), "%d", idle);
+    xmpp_stanza_set_attribute(query, STANZA_ATTR_SECONDS, idle_str);
+    xmpp_stanza_add_child(presence, query);
+    xmpp_stanza_release(query);
 }
 
 void