diff --git a/src/event/server_events.c b/src/event/server_events.c index 7b24f6b9..ea181865 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -743,9 +743,9 @@ sv_ev_lastactivity_response(const char * const from, const int seconds, const ch // full jid or bare jid if (jidp->resourcepart || jidp->localpart) { if (msg) { - cons_show("%s last active %d, status: %s", from, seconds, msg); + cons_show("%s last active %d seconds ago, status: %s", from, seconds, msg); } else { - cons_show("%s last active %d", from, seconds); + cons_show("%s last active %d seconds ago.", from, seconds); } // domain only diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 29aa0944..8796cf0b 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -1091,18 +1091,9 @@ static int _last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { - xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; + xmpp_ctx_t *ctx = connection_get_ctx(); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); - /* - - - - */ - if (from) { int idls_secs = ui_get_idle_time() / 1000; char str[50]; @@ -1115,10 +1106,12 @@ _last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz xmpp_stanza_set_type(response, STANZA_TYPE_RESULT); xmpp_stanza_t *query = xmpp_stanza_new(ctx); + xmpp_stanza_set_name(query, STANZA_NAME_QUERY); xmpp_stanza_set_attribute(query, STANZA_ATTR_XMLNS, "jabber:iq:last"); xmpp_stanza_set_attribute(query, "seconds", str); xmpp_stanza_add_child(response, query); + xmpp_send(conn, response); xmpp_stanza_release(query);