Is it possible to get all resources for a given user from the Roster?
For Smack 2.2.0 the javadoc says
for org.jivesoftware.smack.Roster.getPresence(String user)
''public Presence getPresence(String user)
Returns the presence info for a particular user, or null if the user is unavailable (offline) or if no presence information is available, such as when you are not subscribed to the user’'s presence updates.
If the user has several presences (one for each resource) then answer the presence with the highest priority.
But is there any way to get all presences and all resources for a given user from the Roster
If answer to 1 is no, I am assuming I could listen on org.jivesoftware.smack.XMPPConnection and get all this information with a presence message. Would this work?
The method below Roster#getPresence(String user) is
Roster#getPresences(String user)
Returns an iterator (of Presence objects) for all the user’‘s current presences or null if the user is unavailable (offline) or if no presence information is available, such as when you are not subscribed to the user’'s presence updates.
The problem seems be that RosterEntry does not give me the ‘‘full’’ jabber id (with resource), as far as I know, only Presence.getFrom() seems to do this.
I don’'t expect you spend any more time looking at this for me. It looks like I have will have to bypass the Roster & listen directly on XMPPConnection, so that I see all messages going to and fro.
The presence objects from getPresences(String) includes the resource as the “from” field in the packet. You could use the following code as an example:
I’‘m sure someone can correct me if I’'m wrong but is it not impossible to add a contact with a particular resource to a Group?.
I thought that you added a Contact to 0.* more groups and they were then able to login with various different resources should they wish. You have no control over that.
and we wanted to display in roster by group, all 3 resources (and any other resources of me@mycompany.com) should be always be displayed in both the work and the play groups.
I think you are right but if I could find a JEP or similar standard that confirms this, that would be perfect.