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

Normalize names passed to destroy_room

This commit is contained in:
Paweł Chmielowski 2020-12-08 09:19:05 +01:00
parent e95ae66d3c
commit 0c09599d7b

View File

@ -710,7 +710,13 @@ muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) ->
%% @doc Destroy the room immediately. %% @doc Destroy the room immediately.
%% If the room has participants, they are not notified that the room was destroyed; %% If the room has participants, they are not notified that the room was destroyed;
%% they will notice when they try to chat and receive an error that the room doesn't exist. %% they will notice when they try to chat and receive an error that the room doesn't exist.
destroy_room(Name, Service) -> destroy_room(Name1, Service1) ->
case {jid:nodeprep(Name1), jid:nodeprep(Service1)} of
{error, _} ->
throw({error, "Invalid 'name'"});
{_, error} ->
throw({error, "Invalid 'service'"});
{Name, Service} ->
case get_room_pid(Name, Service) of case get_room_pid(Name, Service) of
room_not_found -> room_not_found ->
throw({error, "Room doesn't exists"}); throw({error, "Room doesn't exists"});
@ -719,6 +725,7 @@ destroy_room(Name, Service) ->
Pid -> Pid ->
mod_muc_room:destroy(Pid), mod_muc_room:destroy(Pid),
ok ok
end
end. end.
destroy_room({N, H, SH}) -> destroy_room({N, H, SH}) ->