25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Fixed support for multi-resource occupants (EJAB-305)

This commit is contained in:
Badlop 2011-09-08 16:18:22 +02:00
parent e6e146c0f7
commit 1aa36cb05c

View File

@ -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