I am trying to write a servlet which logs a user on within the servlet (using the default resource) and then performs an action for all buddies which are currently also logged on. However, if I run the following code, the only presence I get is “unavailable”. I know this is not true, as the openfire admin portal verifies that some of the user’s buddies are online and available.
XMPPConnection userConn = new XMPPConnection(“myserver.com”);
Roster roster = userConn.getRoster();
Collection entries = roster.getEntries();
Can someone else explain this please?
Is there a race condition where I am going trying to get the presence of buddies before the roster has received the presence info? If so, what would be the best way to solve it?