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".
This commit is contained in:
Evgeniy Khramtsov 2017-09-26 19:01:54 +03:00
parent 05feab35c4
commit e1efd29156
1 changed files with 6 additions and 1 deletions

View File

@ -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().