diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-09-28 11:56:46 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-09-28 11:58:36 +0300 |
commit | 319268733465095664b0361b9768e6b0f621be28 (patch) | |
tree | 6d8f19de2d85ec54cb16c488a8538a11045dc50f | |
parent | Pubsub: implment '6.5.7 Requesting the Most Recent Items' (diff) |
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
-rw-r--r-- | src/mod_muc_room.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index d883788dd..8521238e8 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -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); |