25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +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( lists:foldl(
fun(E, SD) -> fun(E, SD) ->
process_admin_items_set(E, SD) process_admin_items_set(E, SD)
end, StateData, Res), end, StateData, lists:flatten(Res)),
case (NSD#state.config)#config.persistent of case (NSD#state.config)#config.persistent of
true -> true ->
mod_muc:store_room(NSD#state.host, NSD#state.room, 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 case exmpp_xml:get_attribute(Item, <<"nick">>, false) of
N when N =/= false -> N when N =/= false ->
case find_jid_by_nick(N, StateData) of case find_jids_by_nick(N, StateData) of
false -> false ->
ErrText = ErrText =
io_lib:format( io_lib:format(
@ -2588,7 +2588,7 @@ find_changed_items(UJID, UAffiliation, URole,
end end
end, end,
case TJID of case TJID of
{value, JID} -> {value, [JID|_]=JIDs} ->
TAffiliation = get_affiliation(JID, StateData), TAffiliation = get_affiliation(JID, StateData),
TRole = get_role(JID, StateData), TRole = get_role(JID, StateData),
case exmpp_xml:get_attribute_as_binary(Item, <<"role">>,false) of case exmpp_xml:get_attribute_as_binary(Item, <<"role">>,false) of
@ -2638,16 +2638,13 @@ find_changed_items(UJID, UAffiliation, URole,
Items, Lang, StateData, Items, Lang, StateData,
Res); Res);
true -> true ->
Reason = exmpp_xml:get_path(Item, [{element, 'reason'}, cdata]),
MoreRes = [{exmpp_jid:bare(Jidx), affiliation, SAffiliation, Reason} || Jidx <- JIDs],
find_changed_items( find_changed_items(
UJID, UJID,
UAffiliation, URole, UAffiliation, URole,
Items, Lang, StateData, Items, Lang, StateData,
[{exmpp_jid:bare(JID), [MoreRes | Res]);
affiliation,
SAffiliation,
exmpp_xml:get_path(
Item, [{element, 'reason'},
cdata])} | Res]);
false -> false ->
{error, 'not-allowed'} {error, 'not-allowed'}
end end
@ -2695,14 +2692,13 @@ find_changed_items(UJID, UAffiliation, URole,
Items, Lang, StateData, Items, Lang, StateData,
Res); Res);
true -> true ->
Reason = exmpp_xml:get_path(Item, [{element, 'reason'}, cdata]),
MoreRes = [{Jidx, role, SRole, Reason} || Jidx <- JIDs],
find_changed_items( find_changed_items(
UJID, UJID,
UAffiliation, URole, UAffiliation, URole,
Items, Lang, StateData, Items, Lang, StateData,
[{JID, role, SRole, [MoreRes | Res]);
exmpp_xml:get_path(
Item, [{element, 'reason'},
cdata])} | Res]);
_ -> _ ->
{error, 'not-allowed'} {error, 'not-allowed'}
end end