powered by Jive Software

MUC getJoinedRooms(userJid) returns empty


I am trying to get list of MUC Rooms that I am a member of.

I am using MultiUserChatManager.getJoinedRooms(userJabberId);

It always return empty list when calling MultiUserChatManager.getJoinedRoom(user@service/resource).

I looked into the packet created, and it looks like this:

<iq to=‘alpha@’



<query xmlns='http://jabber.org/protocol/disco#items'


Now, according to the Xmpp docs (XEP-0045: Multi-User Chat ) the packet should looks like this:

It seems in my packet, from attribute is missing, and to attribute should be the MUC ServiceAddress.

My question is:

  1. Am I using the correct function (getJoinedRooms) to get the Rooms that i am a member of?

  2. If this is the correct function, is there a bug in ServiceDiscoveryManager.getInstanceFor(connection()).discoverItems(user, DISCO_NODE) ?

Any advice is really appreciated!

1 Like


the from attribute can be ommitted.

The method you are using is for the use case described in Example 16.:

XEP-0045: Multi-User Chat

An entity may also query a contact regarding which rooms the contact is in. This is done by querying the contact’s full JID (<user@host/resource>) while specifying the well-known Service Discovery node ‘http://jabber.org/protocol/muc#rooms’.

It requires the full JID of another contact/client to ask it, which chat rooms it has joined.

The stanza you have suggested is only for discovering support for MUC. See § 6.2.

Getting a list of rooms, you have joined should be handled in Smack somewhere. Using the getJoinedRooms with your own full JID (connected resource) should work as well, but would simply ask yourself.

Getting a list of rooms from the server, where you are member is not possible with XEP-0045.


thanks for your reply.

Now I am using MultiUserChatManager.getHostedRooms(DomainBareJid serviceName) to get what I need.

In Xmpp document this is shown in Section 6.3 (XEP-0045: Multi-User Chat )

Request stanza:

Result stanza:

Note 1: There are other muc rooms in this Muc Service, but it is not listed in the result (because I am not a member of those rooms).

Note 2: In my Muc Service, all rooms are set to private. If there are public rooms, then they will be listed also (although I am not a member of these public rooms).

Your answer helped me to find which function to use, but it does not seem that getJoinedRooms(myJid) will give me the list of Rooms that I am a member of.

Thank you!

Am I using the correct function (getJoinedRooms) to get the Rooms that i am a member of?
No, use MultiUserChatManager.getJoinedRooms() (MultiUserChatManager (Smack 4.1.8 API) )

Hi Flow,

My objective: Get list of MUC Rooms from XmppServer that I am a member of (note: not that I am currently active chatting in the room).

MultiUserChatManager.getJoinedRooms() is what I originally called, but it always return an empty list.

My use case:

User1 create MucChat (moderated, private, persistent, memberonly).

User1 added User2 (and other users) as member of the MucChat using mucChat.grantMembership(allJids);

User1 send message to the room, which will cause Server to send push notification to User2.

User2 then call MultiUserChatManager.getJoinedRooms() and it returns empty list. Note that at this point, User2 has not call mucChat.join().

But by calling MultiUserChatManager.getHostedRooms(DomainBareJid serviceName), I got the room that i was just granted membership.

I have the same problem. what is the solution?