Commit b5c572f7 authored by Guus der Kinderen's avatar Guus der Kinderen

Merge pull request #221 from dwd/OF-910

OF-910 - Error stanzas to MUC room should remove occupants
parents 1a0b665a a8487d73
...@@ -310,20 +310,26 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService ...@@ -310,20 +310,26 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
if (process((IQ)packet)) { if (process((IQ)packet)) {
return; 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; } else if (packet instanceof Presence) {
// also detects S2S-based users from non-responsive domains. Presence pres = (Presence) packet;
if (packet.getError() != null && if (pres.getType() == Presence.Type.error) {
packet.getError().getType().equals(PacketError.Type.cancel)) { // Bounced presence, drop user.
removeUser(packet.getFrom()); removeUser(packet.getFrom());
return;
}
} }
else {
// The packet is a normal packet that should possibly be sent to the room // The packet is a normal packet that should possibly be sent to the room
JID receipient = packet.getTo(); JID recipient = packet.getTo();
String roomName = receipient != null ? receipient.getNode() : null; String roomName = recipient != null ? recipient.getNode() : null;
getChatUser(packet.getFrom(), roomName).process(packet); getChatUser(packet.getFrom(), roomName).process(packet);
} }
}
catch (Exception e) { catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), 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