powered by Jive Software

Openfire equivalent of smack.RosterGroup and smack.RosterEntry for my Roster plugin

Hello all,

I am trying to write a plugin that will expose each users roster through http.

I need to display a treeview of the roster and include the groups.

roster


group1


user1


user2


user3


group2


user6


user8

etc…

I currently do this using the smack libraries using the following code:

Roster roster = connx.getRoster();

for( RosterGroup group : roster.getGroups())

{

rosterString.append(“Groups–” + group.getName());

for (RosterEntry entry : group.getEntries() )

{

Presence p = roster.getPresence(entry.getUser());

rosterString.append(this.getPresenceImage§ + entry.getName());

}

}

/code

Now I am trying to accomplish the same thing with a plugin.

There doesnt seem to be a RosterGroup or RosterEntry object.

I currently am using the following to get all users in a roster, but I need to get a group and then this groups members.

XMPPServer server = XMPPServer.getInstance();

roster = server.getRosterManager().getRoster(userName);

User user = null;//User object needed to attain Presence.

List<RosterItem> rosterItems = new ArrayList<RosterItem>(roster.getRosterItems());

for (RosterItem rosterItem : rosterItems) {

user = server.getUserManager().getUser(rosterItem.getJid().toString());

rosterBuffer.append("<buddy>");

rosterBuffer.append("\r\n");//Newline char.

rosterBuffer.append("<name>" + user.getUsername() + “</name>”);

rosterBuffer.append("\r\n");//Newline char.

rosterBuffer.append("<presence>" + this.getStatusString(server,user) + “</presence>”);

rosterBuffer.append("\r\n");//Newline char.

rosterBuffer.append("</buddy>");

}

rosterBuffer.append("</roster>");

}

/code

Now this works but I see no way to get the Group and then the Group members as I can with Smack.

Any Ideas?

Thanks In Advance!