I use Smack to exchange xmpp messages, on the OpenFire server OpenFire created two users, created the Friends group and added these users to this group.

enter image description here

Now on the phone I want to get a list of users in Roster , for this I use the following code:

  Roster roster = Roster.getInstanceFor(connection); Collection<RosterEntry> entries = roster.getEntries(); Presence presence; for(RosterEntry entry : entries) { presence = roster.getPresence(entry.getUser()); Log.e("Users in roster ", entry.getUser()); Log.e("Name of user in roster ", presence.getType().name()); Log.e("Status in roster", presence.getStatus()); } 

I get the size of the entries zero. Accordingly, the log does not display the name of users who are in the roster . Why is roster size zero? How to get users who are in the roster ? Both users are online. I can send a message to the user (for this I exclude problems with connection).

I also want to add that in OpenFire itself in the OpenFire section I see a user who is in the roster :

enter image description here

  • And mod_roster is enabled in the mod_roster ? - Suvitruf
  • @Suvitruf mod_roster is a plugin? If this is a plugin, then I do not see it on the official OpenFire website. - Lucky_girl
  • My mistake. With ejabberd mixed up. - Suvitruf
  • And when you connect to one of the public servers, a similar situation occurs? - post_zeew

1 answer 1

Creating users on the server and adding these users to some group does not entail changing the rosters of these users.

Creating a user on the server is, formally speaking, simply adding a username / password pair to the database, after which the user can log in with this connection on this server.

You need to add a contact to the roster of a specific user. I don’t know for sure if it is possible to edit a roster of a certain user with OpenFire tools (but most likely it is possible), but you can simply log in from a client (for example, with Xabber) under a certain user and client’s tools to add contacts to the roster of a logged in user.

After this procedure, the user's roster will change, and, most likely, you will see the added contacts.