How do you find out what a JID is?

I have a chat room logger plugin. I need to know if a JID is a user or a chatroom so that way I don’'t log the user messages being sent. Is there like a JID type or JID user/group class that I can check against?

Thanks,

Jigar Suthar

Hi Jigar,

a chatroom JID usually contains “@conference.” unless you did change the name for the conference service, so you may query which name is used.

LG

That wouldn’'t work for private messages via the MUC, though. Maybe checking the message type for ‘‘groupchat’’ is the best option.

Checking to see if a message is of type groupchat doesn’‘t really do much. I needed to know if a message was going from chatroom -> user or user -> chatroom. I figured out a way. I check to see if the to JID contains a forward slash ("/"), if it does that means it’'s going from a chatroom -> user.

jmsuthar wrote:

Checking to see if a message is of type groupchat doesn’‘t really do much. I needed to know if a message was going from chatroom → user or user → chatroom. I figured out a way. I check to see if the to JID contains a forward slash (“/”), if it does that means it’'s going from a chatroom → user.

Uh, that shouldn’'t work at all. Every connected account has a resource associated with it.

Thinking about it, you should probably send a disco#info-request to the bare jid (without the resource part) – this should be cached of course.

Uh, that shouldn’'t work at all. Every connected account has a resource associated with it.

Yeah, and chatrooms don’'t have it so it works.