processone / ejabberd-contrib

Growing and curated ejabberd contributions repository - PR or ask to join !
http://ejabberd.im
250 stars 140 forks source link

Prevent room creation with hook #302

Closed farhad2161 closed 3 years ago

farhad2161 commented 3 years ago

How can I prevent room creation by using a hook? The below code doesn't work.

-export([check_create_room/4]).

start(Host, _Opts) ->
    ejabberd_hooks:add(check_create_room, Host, ?MODULE, check_create_room, 50),
    ok.

stop(Host) ->
    ejabberd_hooks:delete(check_create_room, Host, ?MODULE, check_create_room, 50),
    ok.

check_create_room(ServerHost, Host, Room, From) ->
    false.