mod_last: Admin can't query users last activity

Hi and welcome.

This in my first post here and I'm quite new to ejabberd.
The case that we're trying to solve is to query some users for last activity.
I was thiniking that we could use mod_last and ask for number of seconds offline but it seams to be forbidden for admin user:

Example response:

<iq
    from="1@myhost"
    id="dfe5db07-9d8e-4ad2-b087-990ba2edb855-3"
    to="admin@myhost/31738286691432298373204525"
    type="error"
    >
    <query xmlns="jabber:iq:last" />
    <error code="403" type="auth">
        <forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
    </error>
</iq>

and when I do it for connected user I always get value 0 with no error:

<iq
    from="admin@myhost"
    id="22ff12ce-cdfe-40ed-b87b-11b3989db5ec-3"
    to="admin@myhost/24255162731432314625848823"
    type="result"
    >
    <query xmlns="jabber:iq:last" seconds="0"/>
</iq>

Please let me know how to use it properly.
ejabberd 15.04.51

Thanks

I am not sure to understand

I am not sure to understand what you want to do. You seem to create an admin bot to integrate with external stuff, which is not usually the good approach.

Anyway, mod_last can only be queried by user contact. Here is what XEP-0012 says:

If the requesting entity is not authorized to view the user's presence information (normally via a presence subscription as defined in XMPP-IM), the user's server MUST NOT return last activity information but instead MUST return a error in response to the last activity request.

So, ejabberd behaviour is conform to specifications.

Syndicate content