powered by Jive Software

Trying to get all connected nicknames

Hello,

I would like to know if it’s possible to get all connected member nickname.

I can get all usernames, but I dont figured out to get all nicknames.

Thank you for your help.

Collection sessions = sessionManager.getSessions();

    List<String> result = new ArrayList<String>(sessions.size());
    for(ClientSession cs : sessions) {
        try {
            result.add(cs.getUsername());
        } catch (UserNotFoundException e) {
        }
    }

By memory I think you would have to then look up that user in the userManager and then getName() - or something close to that.

Let me know if you need more info.

public List getOnlineUsers() {
Collection users = userManager.getUsers();
List result = new ArrayList(users.size());
for (User u : users) {
result.add(u.getName());
}

    return result;   
}

Like that ?

Doesnt work, return firstname and lastname ; I would like to get all nicknames.