Hi all
I’ve created a plugin that will handle the creation of roster entries via a http request, so 3rd party applications can handle users roster (namely web pages).
So far, I’ve manage to get it as fat as adding in a roster entry fine and broadcasting the roster item. How ever, if both users are currently logged in, the user being added to the other users roster, will show as off line until they log off and back on again.
Here’s the code for the function:
public RosterItem addRosterEntry(String username, JID jidUser, String nickname, List groups, boolean push, boolean persistent) throws UserAlreadyExistsException, SharedGroupException, UserNotFoundException
{
// Get the user details and roster details for the user
Roster roster = this.getRoster(username); // Add a entry into the roster for this user
RosterItem rosterItem = roster.createRosterItem(jidUser, nickname, groups, push, persistent);
rosterItem.setSubStatus(RosterItem.SUB_BOTH);
roster.broadcast(rosterItem, false);
return rosterItem;
}
I’m not sure where to go to from here. My thoughts were to check to see if the user that is having the entry added to their roster is online and if so, it’ll check to see if the being added and if so, then it will do some sort of notify (assuming a presence packet) to the user with the roster.
I looked at the User, UserManager and PresenceManagerImp classes, but most of the functions there are dealing with if the user is available, is that the same as being online?
Any help in what direction to take next?
Thanks
G