Is there a way to determine which Mulit User Conferences (MUC) a user has joined?
Asked Answered
T

3

6

I wonder if there is a way to query the XMPP server (passing user JID?) to find out what chat room(s) this user is currently in? If not, can we query jabber server to get a list of all active chat rooms?

BTW we're running ejabber enabled for multiuser chat. A solution using a java library (smack?) would be ideal.

Towrey answered 28/1, 2012 at 1:7 Comment(3)
Do you want the list of rooms you are in, or another user? There aren't good answers to either, but the first is theoretically possible, and the second is a privacy violation.Halhalafian
tx, Joe. I indeed wanted to get the list of chat rooms for random user (I wanted to present a list of rooms where his facebook friends joined at the moment).Towrey
I need the first, (To find chats the current user is in). How would one go about doing this? Thanks.Garrote
D
3

As mentioned by Joe Hildebrand, there is no such a standard feature as it is a privacy violation to allow that over XMPP, so you cannot expect to do that from Smack. Maybe with admin privilege you could have a custom protocol extension that does that but that seems risky.

However, at the server level, you should be able to write a custom module for ejabberd that will query or index all rooms users are in. This is not standard and there is plugin development involved.

Doggett answered 29/1, 2012 at 11:9 Comment(0)
B
2

There are two (maybe three) XMPP entities that have that information:

  • the XMPP MUC component which provides the MUC room
  • the users XMPP client (or better the XMPP library used by the user)
  • maybe the XMPP server(s) (but let's ignore that)

At the time of writing this, there is no standardized way (in terms of XMPP XEPs) to query that information. As Joe Hildebrand pointed out, this would result in a information leak which is not what we want in most cases.

But you can either extend the MUC component to provide that information (remember XMPP is easily extendable) or the XMPP client library. The usual approach would be via an iq get query. For example:

<iq type='get' from='[email protected]/balcony' to='capulet.lit' id='q1'>
  <query xmlns='http://jabber.org/protocol/muc#joinedrooms'/>
</iq>

The entities which support that query would then report back the joined rooms of the requested entity. Also they would may announce the http://jabber.org/protocol/muc#joinedrooms feature in their service discovery information.

Note that this is a fictional protocol extension meant as example. I have never seen it in real use

If the MUC component provides this feature then it's not controllable by the client if this information is exposed. But if the client provides this feature then of course he can control who can retrieve this information. You may decide what's the better approach in your case.

Bevy answered 2/3, 2013 at 12:54 Comment(0)
R
0

Getting all chat rooms is no problem, just use this query.

There seems to be already a question on how to retrieve rooms with smack. Look here.

Radioscopy answered 28/1, 2012 at 1:53 Comment(1)
great, tx. I'll keep on looking for the way to get specific room(s) for a given user.. jabber got to have this information somewhere..Towrey

© 2022 - 2024 — McMap. All rights reserved.