Skip to content

Commit

Permalink
Refactored hook handlers in ejabberd_ctl
Browse files Browse the repository at this point in the history
  • Loading branch information
pawlooss1 committed Dec 1, 2022
1 parent b28a1cf commit 197c015
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ejabberd_ctl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

-include("ejabberd_ctl.hrl").
-include("ejabberd_commands.hrl").
-include("mongoose_logger.hrl").

-type format() :: integer | string | binary | {list, format()}.
-type format_type() :: binary() | string() | char().
Expand Down Expand Up @@ -121,7 +122,7 @@ init() ->
Function :: atom()) -> 'ok'.
register_commands(CmdDescs, Module, Function) ->
ets:insert(ejabberd_ctl_cmds, CmdDescs),
ejabberd_hooks:add(ejabberd_ctl_process, global, Module, Function, 50),
?LOG_INFO(#{module => Module, function => Function}),
ok.


Expand All @@ -132,7 +133,7 @@ unregister_commands(CmdDescs, Module, Function) ->
lists:foreach(fun(CmdDesc) ->
ets:delete_object(ejabberd_ctl_cmds, CmdDesc)
end, CmdDescs),
ejabberd_hooks:delete(ejabberd_ctl_process, global, Module, Function, 50),
?LOG_INFO(#{module => Module, function => Function}),
ok.


Expand Down

0 comments on commit 197c015

Please sign in to comment.