powered by Jive Software

MUC Who sent the messages?

Hey all, I’m having trouble finding out “who” was the sender of a message in a MultiUserChat. Essentially the .getfrom() returns the chatroom id as opposed to the nickname of the sender. What’s the correct way to do this?

Any help would be great.

Hello,

According to XEP-0045 messages sent to all the room’s occupants will have been changed with “the ‘from’ attribute to the sender’s room JID and reflect the message out to the full JID of each occupant”. So that means their username/nickname will be the resource part of JID which you can access via smack by doing the following:

String messageNickname = StringUtils.parseResource(message.getFrom());

Hope that helps,

Ryan

Yup! thanks again.