[英]How to fetch all users from Openfire?
I'm trying to develop a chat client using Smack api with Openfire. 我正在尝试使用Smack api和Openfire开发一个聊天客户端。 I've been searching for couple of days on how to retrieve all users from Openfire.
我一直在寻找有关如何从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. 当您收到条目时,尝试打印所有内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.