diff options
author | Badlop <badlop@process-one.net> | 2011-09-08 18:18:22 +0400 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2011-09-08 18:18:22 +0400 |
commit | 1aa36cb05cc0b161418ec85218bcc61542fbf79c (patch) | |
tree | 4e24ba6b3b301c2b3913b9794382268e2ce687c8 | |
parent | e6e146c0f76fd250cbc6d6a2d075f47568c95b73 (diff) |
Fixed support for multi-resource occupants (EJAB-305)
-rw-r--r-- | src/mod_muc/mod_muc_room.erl | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/mod_muc/mod_muc_room.erl b/src/mod_muc/mod_muc_room.erl index dc97cf040..2ea2272f0 100644 --- a/src/mod_muc/mod_muc_room.erl +++ b/src/mod_muc/mod_muc_room.erl @@ -2462,7 +2462,7 @@ process_admin_items_set(UJID, Items, Lang, StateData) -> lists:foldl( fun(E, SD) -> process_admin_items_set(E, SD) - end, StateData, Res), + end, StateData, lists:flatten(Res)), case (NSD#state.config)#config.persistent of true -> mod_muc:store_room(NSD#state.host, NSD#state.room, @@ -2571,7 +2571,7 @@ find_changed_items(UJID, UAffiliation, URole, _ -> case exmpp_xml:get_attribute(Item, <<"nick">>, false) of N when N =/= false -> - case find_jid_by_nick(N, StateData) of + case find_jids_by_nick(N, StateData) of false -> ErrText = io_lib:format( @@ -2588,7 +2588,7 @@ find_changed_items(UJID, UAffiliation, URole, end end, case TJID of - {value, JID} -> + {value, [JID|_]=JIDs} -> TAffiliation = get_affiliation(JID, StateData), TRole = get_role(JID, StateData), case exmpp_xml:get_attribute_as_binary(Item, <<"role">>,false) of @@ -2638,16 +2638,13 @@ find_changed_items(UJID, UAffiliation, URole, Items, Lang, StateData, Res); true -> + Reason = exmpp_xml:get_path(Item, [{element, 'reason'}, cdata]), + MoreRes = [{exmpp_jid:bare(Jidx), affiliation, SAffiliation, Reason} || Jidx <- JIDs], find_changed_items( UJID, UAffiliation, URole, Items, Lang, StateData, - [{exmpp_jid:bare(JID), - affiliation, - SAffiliation, - exmpp_xml:get_path( - Item, [{element, 'reason'}, - cdata])} | Res]); + [MoreRes | Res]); false -> {error, 'not-allowed'} end @@ -2695,14 +2692,13 @@ find_changed_items(UJID, UAffiliation, URole, Items, Lang, StateData, Res); true -> + Reason = exmpp_xml:get_path(Item, [{element, 'reason'}, cdata]), + MoreRes = [{Jidx, role, SRole, Reason} || Jidx <- JIDs], find_changed_items( UJID, UAffiliation, URole, Items, Lang, StateData, - [{JID, role, SRole, - exmpp_xml:get_path( - Item, [{element, 'reason'}, - cdata])} | Res]); + [MoreRes | Res]); _ -> {error, 'not-allowed'} end |