Offline Presence Problem

I have been testing the new Smack 3.0.0 offline presence feature in my custom client and so far I haven’‘t been able to get a status message for an offline user. I also tried to use the “Log out with reason” feature between 2 Spark 2.5.0 clients and it doesn’‘t seem to work for me either, so I thought it might be a Smack issue. When I debug the code in my client, I do receive a presenceChanged event from the roster with the correct offline presence packet including a status, but any calls to the getPresence(String) method return an unavailable packet with a null status. I spent a few minutes looking at the code and it seems in the Roster class at line 684 it only stores offline presence for packets when the from field does not have a resource. When I look at the Smack debugger window, the offline presence data received does include the resource in the from field. So I think that is causing the offline packets to not be stored. I noticed there is a unit test for this feature that seems to use resources as well though, so I’'m not completely sure. Has anyone used this feature yet?

Thanks,

Chris

Okay I have debugged the problem further. I just tested Spark 2.5.1 beta1 and noticed that the roster now shows offline presence values. So after looking at the Spark code (ContactList, lines 290-293), I noticed it does not use the value it got from getPresence() to update the roster, it uses the received packet instead, so that explains why it works. The Smack unit test works because the test user is disconnected and then re-connected, which causes the roster to be downloaded again with the offline status correctly included.

Matt - Can you file an issue to make Smack store the offline presence changes as they happen, so getPresence() works as expected?

Thanks,

Chris

Thanks for the detailed bug report! I filed this as SMACK-219.

Regards,

Matt