From e1efd291568aae29ac06f507c8b0bbf60b65d91a Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Tue, 26 Sep 2017 19:01:54 +0300 Subject: [PATCH] Improve presence-error processing When a presence-error is received from a participant in a MUC, kick only this particular participant's full JID, leaving other resources untouched. This will prevent from erroneous kicking all user's resources in the presence of "multi-session nicks". --- src/mod_muc_room.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 41e776339..d883788dd 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -1243,7 +1243,12 @@ expulse_participant(Packet, From, StateData, Reason1) -> #presence{type = unavailable, status = xmpp:mk_text(Reason2)}, StateData), - send_new_presence(From, NewState, StateData), + LJID = jid:tolower(From), + {ok, #user{nick = Nick}} = (?DICT):find(LJID, StateData#state.users), + case (?DICT):find(Nick, StateData#state.nicks) of + {ok, [_, _ | _]} -> ok; + _ -> send_new_presence(From, NewState, StateData) + end, remove_online_user(From, NewState). -spec set_affiliation(jid(), affiliation(), state()) -> state().