I’'ve already mailed the core team about this some time ago, but using the forums gives other users the ability to reply.
The purpose of the patch is quite simple. Right now, Smack only remembers the Resource from with the last Presence was received. With this patch, for each resource the last presence is stored. This way, you can easily get an overview of all the available resources for each user.
Roster.getPresence(user) had to be changed, since there may be quite a few Resources to choose from. Right now, it returns the Presence with the hightest priority. There was some discussion with the core team regarding this, so it might be changed so that it returns the Presence with the highest ‘‘availability’’:
work / away
home / available
In this case getPresence would return the Presence for home, since that one is ‘‘available’’, and work is only ‘‘away’’.
resources_patch.diff (4007 Bytes)