25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

now admins are able to see private rooms in disco (EJAB-1269)

This commit is contained in:
Evgeniy Khramtsov 2010-06-23 17:44:35 +10:00
parent f66f049ef3
commit 21d2f4efab

View File

@ -593,21 +593,9 @@ handle_event(_Event, StateName, StateData) ->
%% {stop, Reason, Reply, NewStateData} %% {stop, Reason, Reply, NewStateData}
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
handle_sync_event({get_disco_item, JID, Lang}, _From, StateName, StateData) -> handle_sync_event({get_disco_item, JID, Lang}, _From, StateName, StateData) ->
case (StateData#state.config)#config.public_list of Reply = get_roomdesc_reply(JID, StateData,
true -> get_roomdesc_tail(StateData, Lang)),
Reply = get_roomdesc_reply(StateData, {reply, Reply, StateName, StateData};
get_roomdesc_tail(StateData, Lang)),
{reply, Reply, StateName, StateData};
_ ->
case is_occupant_or_admin(JID, StateData) of
true ->
Reply = get_roomdesc_reply(StateData, get_roomdesc_tail(
StateData, Lang)),
{reply, Reply, StateName, StateData};
_ ->
{reply, false, StateName, StateData}
end
end;
handle_sync_event(get_config, _From, StateName, StateData) -> handle_sync_event(get_config, _From, StateName, StateData) ->
{reply, {ok, StateData#state.config}, StateName, StateData}; {reply, {ok, StateData#state.config}, StateName, StateData};
handle_sync_event(get_state, _From, StateName, StateData) -> handle_sync_event(get_state, _From, StateName, StateData) ->
@ -3357,11 +3345,15 @@ get_title(StateData) ->
Name Name
end. end.
get_roomdesc_reply(StateData, Tail) -> get_roomdesc_reply(JID, StateData, Tail) ->
case ((StateData#state.config)#config.public == true) of IsOccupantOrAdmin = is_occupant_or_admin(JID, StateData),
true -> if (StateData#state.config)#config.public or IsOccupantOrAdmin ->
{item, get_title(StateData) ++ Tail}; if (StateData#state.config)#config.public_list or IsOccupantOrAdmin ->
_ -> {item, get_title(StateData) ++ Tail};
true ->
{item, get_title(StateData)}
end;
true ->
false false
end. end.