One of the most difficult ideas for me to grasp was the fact that presence and roster management do not imply each other. You can have presence subscriptions without roster entries, and you can have roster entries without presence subscriptions. This is hard to understand after having only used IM programs like AIM, where you can have contacts without groups--but when a person is a contract, that automatically implies that you will exchange presence.
In the case of the former, the server routes packets to everyone who you have a subscription with, but you are not able to organize them into groups or get a list in any way.
In the latter, you can have roster items that exist in any of nine "ask" states, including "none", "to", "from" and "both", with the former three possibly having any combination of "pending to" and "pending from". This indicates the state of the presence subscriptions between you and the roster entry.
The current implementation of PresenceManager and RosterItemManager was created without this understanding. This file is record of that failure, and a place to record new knowledge before a replacement is implemented.
The current implementation handles Presence and Roster items completely separateley. I have come to beleive that this is a mistake (though I am not sure of it yet), and will be looking to supercede it if necessary.
I don't have a real problem with this, aside from not having a defined class for the return type of the get and getBest methods. It seems to be independently functional and do exactly what it needs to do.
Possible improvements would be a pluggable "getBest" algorithm, and refactoring of the packet listener into its own class.
This class holds details about all roster items pushed from the server, stored in a map keyed by JID (with or without resource, I don't know). More later.
Soashable is a completely Open Source (GPL) instant messaging client, built on the Xmpp4Js (LGPL) XMPP library for Javascript. It communicates with an XMPP server using XEP-0124/XEP-0206 HTTP Binding, and provides end-user functionality comparable to Meebo (but is in no way affiliated with Meebo).