Tomasz and others,

I'm using jabberd2 v2.2.17. For a while now I have experienced strange values in the "status" database table for some users, including myself. The most obvious problem is that the status field can show "online" even if the user is offline and last-login and last-logout are both zero.

I have done some debugging and I found what is causing it. This problem occurs if the user has the server itself added to his/her roster. I am running jabberd2 on jabber.no-sense.net and when I add "jabber.no-sense.net" as Agent/Transport to my roster the problem starts occurring. I have traced the problem to mod_status handling a presence status which it should ignore, it thinks a presence message from sm itself to "jabber.no-sense.net" (announcing to the agent that the user is present) is mistakenly handled as a presence packet from another server.

This is what the packet looks like:
"<route xmlns='http://jabberd.jabberstudio.org/ns/component/1.0' from='sm' to='jabber.no-sense.net'><presence xmlns='jabber:client' to='jabber.no-sense.net' from='ara...@jabber.no-sense.net/Psi+'>
<priority>50</priority>
<c xmlns='http://jabber.org/protocol/caps' ext='cs e-time ep-notify-2 html last-act mr sxe whiteboard' ver='0.15' node='http://psi-dev.googlecode.com/caps'/>
</presence></route>"

This will be caught by mod_status in function _status_pkt_sm(). This function only checks whether it's a presence packet and not where it originated from. It is a presence packet and therefore the status for the user will always be set to online and the login times to zero.
I have made a quick fix by changing mod_status.c:195 :

if((pkt->type == pkt_PRESENCE || pkt->type == pkt_PRESENCE_UN)) {

into

if((pkt->type == pkt_PRESENCE || pkt->type == pkt_PRESENCE_UN) && strcmp(jid_full(pkt->rfrom), "sm") != 0)

but I doubt if this is acceptable as real fix.

Does someone have a better idea? Thanks in advance!

Regards,
Eric.




Reply via email to