mod_lastactivity: Allow users to request their own last activity.
authorWaqas Hussain <waqas20@gmail.com>
Tue, 20 Oct 2009 20:01:46 +0000 (01:01 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Tue, 20 Oct 2009 20:01:46 +0000 (01:01 +0500)
plugins/mod_lastactivity.lua

index 04f817cb0334d73beeb822b9993bedf3c3f7b5b7..acbfb87d829bbf07f96cb0671cfeee9cbca069bb 100644 (file)
@@ -29,7 +29,7 @@ module:hook("iq/bare/jabber:iq:last:query", function(event)
        local origin, stanza = event.origin, event.stanza;
        if stanza.attr.type == "get" then
                local username = jid_split(stanza.attr.to) or origin.username;
-               if is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then
+               if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then
                        local seconds, text = "0", "";
                        if map[username] then
                                seconds = tostring(os.difftime(os.time(), map[username].t));