powered by Jive Software

Distinction between MUC room JID and Name

I am seeing the following behavior with Smack 1.4.1. Still using the jabber 1.4.3 server.

I have an already created room whose JID is asilounge@mymucserver.

I created this room to have a Name of ASI Lounge.

In the xml file for this room on the server (1.4.3 does not use a database), I see the string “ASI Lounge” as the name for the room.

However, the MultiUserChat class does not seem to have a method to obtain this room name. If I use getRoom(), I get the JID string. The getSubject() method is supposed to allow access to a chat room participant’'s ability to set the subject for a room. In any case, the getSubject method call returns null.

I notice that the Exodus client accessing my server is able to show the room with the name I have given it, not the JID string. I was hoping to obtain the same ability with Smack and show the name in my client UI.

Anyone have experience/advice for accesssing MUC room names?

Jim

Jim,

The name of the room is always the node of the room’‘s JID. So, for instance when you join a room whose name is food@conference.myserver then the room’'s name will be food.

#getSubject() returns the last known room’‘s subject or null if the room does not have a subject yet. To change the room’'s subject you should use #changeSubject(String).

Regards,

– Gato

Thanks for the follow up. It’'s pretty clear that the Smack API equates the room jid (food in your example) with the name of the room.

The jabber server I am using uses XML to define rooms. The following is an example:

ASI Lounge

0

Place to discuss general ASI operations

0

0

1

0

1

0

0

1

0

0

1

ASI General

0

0

The name tag need not be the same as the JID for the room. And at least 1 Jabber client – Exodus – does get access via Service Discovery to this name since Exodus identifies this room by the name (ASI Lounge in my example) defined in the name tag rather than the JID (asilounge). I was hoping that there might be a way to use Smack to discover this name the same way I used disco to get the list of all current room JIDs. Apparently there is not, at least not with the current API methods.

Jim

If you retrieve the VCard for the room asilounge@mymucserver it will contain the name and description info of the room.

(This requires the server to support VCard (most do) and that the room has been configured to be publicly viewable (which they are be default) ).

SMACK doesnt support VCard at present (its still not an approved standard), but try my vcard implementation which is adequate for the task at

ftp://anonymous%40tragicroundabout.info:n@ftp.tragicroundabout.info/vcard0_2.t ar.gzn@ftp.tragicroundabout.info/vcard0_2.tar.gz

You could also use the service discovery classes in smackx and do what Exodus does (see the smack extensions docs).

HTH,

Pheet

Pheet: Thanks for the tip – this looks like it will allow me to get access to the room information beyond the JID itself.

I was using service discovery via smackx to get a list of public rooms on my server and I hadn’'t yet dug into the documentation about the full capabilities of smackx. The code examples in the documentation ought to teach me to access the information I am seeking.

A little RTFM is code for the soul.

Jim

Jim -

It was more of “try looking here in this manual” (TLHITM?) than RTFM - going thru all the docs, JEPs and javadocs is no light task. Good luck!

Pheet