[JDEV] Fix for AIM 0.9.5 transport presence problem
Kevin Limperos
kevin at omnipod.com
Fri Mar 16 22:55:39 CST 2001
I have experienced a problem with the AIM 0.9.5 transport not sending 'online' presence updates back to the WinJab client if a buddy logs back in after having logged out once while my WinJab was online. Here is a code segment from buddies.c, lines 267+ in function at_parse_incoming():
was_away = buddy->is_away;
if(userinfo->flags&AIM_FLAG_AWAY)
buddy->is_away = 1;
else
buddy->is_away = 0;
if(buddy->is_away == 0 && (buddy->is_away != was_away))
{
x = xmlnode_new_tag("presence");
xmlnode_put_attrib(x, "to", jid_full(s->cur));
xmlnode_put_attrib(x, "from", ti->i->id);
jp = jpacket_new(x);
jid_set(jp->from, at_normalize(userinfo->sn), JID_USER);
xmlnode_put_attrib(jp->x, "from", jid_full(jp->from));
status = xmlnode_insert_tag(x, "status");
xmlnode_insert_cdata(status, "Online", -1);
deliver(dpacket_new(jp->x), ti->i);
}
else if(buddy->is_away == 1 && (buddy->is_away != was_away))
{
log_debug(ZONE, "[AT] Requesting Away message for %s", userinfo->sn);
aim_getinfo(ass, command->conn, userinfo->sn, AIM_GETINFO_AWAYMESSAGE);
}
This code makes calls to generate an XML presence message back to the jabberd, so it may alert the client of a change in user presence information. However, it does not account for the case where: buddy->is_away is initially 0 and userinfo->flags&AIM_FLAG_AWAY is also 0. In that case, buddy->is_away is set to 0 (this occurs when a buddy, who was not 'away' logs out and back in again), and the expression (buddy->is_away == 0 && (buddy->is_away != was_away)) is false, so no presence message is sent to the jabberd in this case. (I assume that the other case of 'was_away == 1 && buddy->is_away == 1' should never occur.)
Changing the expression (buddy->is_away == 0 && (buddy->is_away != was_away)) to just ( buddy->is_away == 0 ) after the 'if' apparently resolves the problem - at least for my WinJab tests. Since I am not familiar with precisely what each line of code does, I'm not certain if this is completely correct, or whether another 'else if' to do something slightly different is preferred.
-Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20010316/47b381eb/attachment-0002.htm>
More information about the JDev
mailing list