I think I encountered a Non-Roster Presence Bug

Hi;

There is a case where I have to work with non-roster contacts, so I set roster loading at startup to false and use Roster for presences only. It seems to work OK, the presences are kept track of using the nonRosterPresenceMap, except this one case:

When a contact becomes unavailable, the non-roster presence Map is not updated. I tracked it to the PresencePacketListener at line 1440 of Roster class (Smack 4.2.3). In the switch with presence types, available puts the available presence in the nonRosterPresenceMap through a call to getOrCreatePresencesInternal(). However in the case block for unavailable; only roster presences seem to be modified.

I just wanted someone to have a look to make sure this is actually a bug rather than an implementation decision for reasons I am unaware of. I would also want to fix it and make a pull request if this is the case, however I have not built Smack from source and I am not comfortable with it yet.

Best regards.

You are right, I’ve created SMACK-808 to track this.

1 Like

Note that you could easily work-around this by using your own presence listener creating and filling your own map of presences.

Hi Flow;

Thanks for checking it out. I will probably use a workaround like that for now.

Best regards.