diff options
author | Paweł Chmielowski <pchmielowski@process-one.net> | 2020-12-08 09:19:05 +0100 |
---|---|---|
committer | Paweł Chmielowski <pchmielowski@process-one.net> | 2020-12-08 09:19:29 +0100 |
commit | 0c09599d7bc2d9a2ec06da04dc641a8250f56beb (patch) | |
tree | 1ac8128a603e4eb3e8257c9c38a3045dfd816ea3 /src | |
parent | Merge pull request #3435 from fdie/fix_odbc_binary_errors (diff) |
Normalize names passed to destroy_room
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_muc_admin.erl | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl index d843e0db4..4ee74ad33 100644 --- a/src/mod_muc_admin.erl +++ b/src/mod_muc_admin.erl @@ -710,15 +710,22 @@ muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) -> %% @doc Destroy the room immediately. %% 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. -destroy_room(Name, Service) -> - case get_room_pid(Name, Service) of - room_not_found -> - throw({error, "Room doesn't exists"}); - invalid_service -> +destroy_room(Name1, Service1) -> + case {jid:nodeprep(Name1), jid:nodeprep(Service1)} of + {error, _} -> + throw({error, "Invalid 'name'"}); + {_, error} -> throw({error, "Invalid 'service'"}); - Pid -> - mod_muc_room:destroy(Pid), - ok + {Name, Service} -> + case get_room_pid(Name, Service) of + room_not_found -> + throw({error, "Room doesn't exists"}); + invalid_service -> + throw({error, "Invalid 'service'"}); + Pid -> + mod_muc_room:destroy(Pid), + ok + end end. destroy_room({N, H, SH}) -> |