mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Don't forget to route presence-unavailable
When a user has several resources joined to a room using the same nick attempts to leave the room from a single resource, route presence-unavailable back to this (and only this) resource. Fixes #2007
This commit is contained in:
parent
126653e01b
commit
3192687334
@ -1028,8 +1028,16 @@ do_process_presence(Nick, #presence{from = From, type = unavailable} = Packet,
|
||||
end,
|
||||
NewState = add_user_presence_un(From, NewPacket, StateData),
|
||||
case (?DICT):find(Nick, StateData#state.nicks) of
|
||||
{ok, [_, _ | _]} -> ok;
|
||||
_ -> send_new_presence(From, NewState, StateData)
|
||||
{ok, [_, _ | _]} ->
|
||||
Aff = get_affiliation(From, StateData),
|
||||
Item = #muc_item{affiliation = Aff, role = none, jid = From},
|
||||
Pres = xmpp:set_subtag(
|
||||
Packet, #muc_user{items = [Item],
|
||||
status_codes = [110]}),
|
||||
send_wrapped(jid:replace_resource(StateData#state.jid, Nick),
|
||||
From, Pres, ?NS_MUCSUB_NODES_PRESENCE, StateData);
|
||||
_ ->
|
||||
send_new_presence(From, NewState, StateData)
|
||||
end,
|
||||
Reason = xmpp:get_text(NewPacket#presence.status),
|
||||
remove_online_user(From, NewState, Reason);
|
||||
|
Loading…
Reference in New Issue
Block a user