During debugging we have found out that our Smack-based client does not send the “from” attribute when joining a chatroom:
<presence xmlns="jabber:client" id="oFLI8-4" to="email@example.com/admin"> <x xmlns="http://jabber.org/protocol/muc"/> </presence>
It works fine with OF. However, this seems to be not compliant with xep-0045 ( 7.1.2 Basic MUC Protocol)
<presence firstname.lastname@example.org/pda' email@example.com/thirdwitch'> <x xmlns='http://jabber.org/protocol/muc'/> </presence>
Is this a bug in OF and Smack that could eventually cause issues when connecting to non-Openfire servers?
An explanation of why the “from” field is not supported can be found in the following two threads:
I expect (without checking the source) that spoofing the from address is not allowed within Smack. Even if it is possible Wildfire should drop such messages.
It could help to write a Wildfire Plugin instead of using Smack.
*AFAIK, what you are trying to do is not allowed by the XMPP spec. The XMPP is very strict in the security area and does not allow to spoof the sender of a message. Otherwise, XMPP servers would be nice targets for spamming. *
So even if you manage to change the sender of the message from Smack you will depend on the server that you are using to not rectify that information.
A possible fix has been found here: http://community.igniterealtime.org/message/191907#191907
MUCRoom room = mucService.getChatRoom(roomName); JID userjid = new JID(userName, server, "Server"); MultiUserChatService mucService = mucManager.getMultiUserChatServices().get(0); Message cheat = new Message(); cheat.setTo(room.getJID()); cheat.setFrom(userjid); mucService.processPacket(cheat);
Could one of the developers shed some light on this?