Commit a8487d73 authored by Dave Cridland's avatar Dave Cridland

OF-910 - Error stanzas to MUC room should remove occupants

Currently, only stanzas containing errors of type cancel will cause the
occupant to be removed, however this doesn't appear to catch and remove many
occupants in practise.

This patch therefore removes occupants from the service on any message or
presence error stanza, irrespective of the error type. IQ stanzas do not
trigger the same response, as these may be due to lack of client support
rather than a vanished occupant.
parent 1a0b665a
......@@ -310,20 +310,26 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
if (process((IQ)packet)) {
return;
}
} else if (packet instanceof Message) {
Message msg = (Message) packet;
if (msg.getType() == Message.Type.error) {
// Bounced message, drop user.
removeUser(packet.getFrom());
return;
}
// OF-670: Kick MUC users who return permanent error conditions;
// also detects S2S-based users from non-responsive domains.
if (packet.getError() != null &&
packet.getError().getType().equals(PacketError.Type.cancel)) {
} else if (packet instanceof Presence) {
Presence pres = (Presence) packet;
if (pres.getType() == Presence.Type.error) {
// Bounced presence, drop user.
removeUser(packet.getFrom());
return;
}
}
else {
// The packet is a normal packet that should possibly be sent to the room
JID receipient = packet.getTo();
String roomName = receipient != null ? receipient.getNode() : null;
JID recipient = packet.getTo();
String roomName = recipient != null ? recipient.getNode() : null;
getChatUser(packet.getFrom(), roomName).process(packet);
}
}
catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment