powered by Jive Software

Why not see all user with roster?

roster = connection.getRoster();

Collection entries = roster.getEntries();

for (RosterEntry entry : entries) {



Not see users, how I can see all users in my openfire ?

Why I don’t see none users ?

Why do you put methods that do not work?

I find it distasteful, I’m not adivine for get user, is code openfire, not is mine, I repeat I’m not adivine.

i doubt the method “isn’t working”, but that rather you are expecting it to do something it’s not actually doing, and/or you are going about this the wrong way.

http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/ smack/Connection.html#getRoster()


> public abstract Roster **getRoster**()

Returns the roster for the user.
This method will never return null, instead if the user has not yet logged into the server or is logged in anonymously all modifying methods of the returned roster object like Roster.createEntry(String, String, String[]),Roster.removeEntry(RosterEntry) , etc. except adding or removing RosterListeners will throw an IllegalStateException.

the user’s roster.

and if we look at Roster and see what it’s about:

http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/ smack/Roster.html

Represents a user’s roster, which is the collection of users a person receives presence updates for.

And from the Smack documentation:


Rosters and presence use a permissions-based model where users must give permission before they are added to someone else’s roster. This protects a user’s privacy by making sure that only approved users are able to view their presence information. Therefore, when you add a new roster entry it will be in a pending state until the other user accepts your request.

So it would seem your test environment is not setup correctly and the user you are logging in with for testing, does not have anyone in the roster.

I understand,

that is, 100% privacy.

If the user does not add it, there’s no way to know what the other user.

Why always see null, when is connected ?

Test1 (friend test2)

Test2 (friend test1)

Run Test1

Run Test2 (getPresence users friends)

-> Output test1

  • null (getMode)

  • null (getStatus)

But test1 running … Why always see null, when is connected ?

Because there is no status or mode set by the contact.

for(RosterEntry entry : entries) {

System.out.println("User: " + entry.getUser());

System.out.println("Name: " + entry.getName());

//System.out.println("Status: " + entry.getStatus());

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

System.out.println("====== Mode: " + p.getMode());

System.out.println("====== Status: " + p.getStatus());



User: test5

Name: test5

Status: subscribe

====== Mode: null

====== Status: null

Null null why ?