I have managed to cause a user to join a MUC succesfully through a plugin by sending a presence packet to the room.
This user is however unable to send messages to the room. Any message sent with this user (through the plugin) is rejcted with
<message from="test1@127.0.0.1" type="groupchat" to="testroom@conference.127.0.0.1"> <body>testing</body>
</message> <message from="testroom@conference.127.0.0.1" type="error" to="test1@127.0.0.1"> <body>testing</body> <error code="406" type="modify"> <not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> </error>
</message>
From the openfire source it is not quite clear why this message is being rejected. Amessage sent from a logged in client to the room shows the correct behaviour. Any idea what I am missing?
public String chat(String username, String to, String body, String type) {
Message message = new Message();
message.setBody(body);
message.setFrom(new JID(username,server,"Server");
if ("groupchat".equals(type)){
message.setType(Message.Type.groupchat);
message.setTo(to + "@conference." + server);
} else {
message.setTo(to + "@" + server);
message.setType(Message.Type.chat);
}
Log.debug("CHAT: from:"+message.getFrom().toString());
Log.debug("CHAT: to :"+message.getTo().toString());
Log.debug("CHAT: type:"+message.getType().toString());
xmppServer.getMessageRouter().route(message);
return "1";
}