powered by Jive Software

How to get available groups and user on a server


I am starting to develop a Client using Smack

As I am starting the project I thought that the first thing to do when logging on to a server will be

to look what public groups and users are available on it. This will allow the user to interact with these groups and users.

How do I get it using the API?

For example when I connect to jabber.org. I wish to find out the available groups/users so I can add them to my user’'s roster.

Hopefully I make some sense.

Thanks a lot!


The idea is somewhat listed in this method:

private void showRoster(Roster roster){
        Iterator groupItems = roster.getGroups();
     Iterator unfiledItems = roster.getUnfiledEntries();
        RosterGroup group;
        Vector list = new Vector();
        RosterEntry entry;
        while (unfiledItems.hasNext()) {
         entry = (RosterEntry)unfiledItems.next();
        }         while (groupItems.hasNext()) {
            group = (RosterGroup)groupItems.next();
        }         dataList.setListData(list);
    catch(Exception e){
        System.out.println("e "+e);


I am still in the dark but it looks like we can extend IQ, somewhat similar to theRosterPacket for browse

Browse can provide the resource discovery service. It might have to use some recursivenace in the process to get the elements of each category the server returns i.e. people, conferences, boots etc.


On a separate note how do I get the Smack debug functionality, it seems to be missing from the package.



Yes, you have the browse option and the agents option too.

Browser it’‘s a new “feature” of jabber, and it’‘s not oficial yet, but must of the servers have implemented that option. For agents option, it can be said the agents would be deprecated for browse option, soo you don’'t need to implement it!

About the debug mode, in XMPPConnection class you have a declaration like this one:

public static boolean DEBUG_ENABLED = Boolean.getBoolean(“smack.debugEnabled”);

To active the debug mode I change it to:

public static boolean DEBUG_ENABLED = true;

Nuno Agapito

For more information and more correct you can always see the documentation of smack. It has information about the debug mode: