简体   繁体   中英

How to fetch all users from Openfire?

I'm trying to develop a chat client using Smack api with Openfire. I've been searching for couple of days on how to retrieve all users from Openfire. I tried adding all the users to a group and tried fetching it :

Roster roster = conn.getRoster();
RosterGroup grp = roster.getGroup("GroupName");
Collection<RosterEntry> ent = grp.getEntries();
for(RosterEntry rosEnt : ent){
 System.out.println(rosEnt.getUser());
}

But this prints only the current user. I also noticed something called Shared Group but did not know how to create one. Is there a way to fetch all users?

I think this is what u looking for its may be

Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry entry : entries) {
    System.out.println(entry);
}

when u getting entries try to print all of that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM