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

Add muc related hooks

This commit is contained in:
Christophe Romain 2017-07-27 17:02:06 +02:00
parent 58110e4bc1
commit b66dab1313
2 changed files with 4 additions and 1 deletions

View File

@ -166,7 +166,7 @@ restore_room(ServerHost, Host, Name) ->
forget_room(ServerHost, Host, Name) -> forget_room(ServerHost, Host, Name) ->
LServer = jid:nameprep(ServerHost), LServer = jid:nameprep(ServerHost),
ejabberd_hooks:run(remove_room, LServer, [LServer, Name, Host]), ejabberd_hooks:run(destroy_room, LServer, [LServer, Name, Host]),
Mod = gen_mod:db_mod(LServer, ?MODULE), Mod = gen_mod:db_mod(LServer, ?MODULE),
Mod:forget_room(LServer, Host, Name). Mod:forget_room(LServer, Host, Name).
@ -256,6 +256,7 @@ handle_call({create, Room, From, Nick, Opts}, _From,
Nick, NewOpts, QueueType), Nick, NewOpts, QueueType),
RMod = gen_mod:ram_db_mod(ServerHost, ?MODULE), RMod = gen_mod:ram_db_mod(ServerHost, ?MODULE),
RMod:register_online_room(ServerHost, Room, Host, Pid), RMod:register_online_room(ServerHost, Room, Host, Pid),
ejabberd_hooks:run(create_room, ServerHost, [ServerHost, Room, Host]),
{reply, ok, State}. {reply, ok, State}.
handle_cast({reload, ServerHost, NewOpts, OldOpts}, #state{host = OldHost}) -> handle_cast({reload, ServerHost, NewOpts, OldOpts}, #state{host = OldHost}) ->

View File

@ -4004,6 +4004,7 @@ tab_add_online_user(JID, StateData) ->
Room = StateData#state.room, Room = StateData#state.room,
Host = StateData#state.host, Host = StateData#state.host,
ServerHost = StateData#state.server_host, ServerHost = StateData#state.server_host,
ejabberd_hooks:run(join_room, ServerHost, [ServerHost, Room, Host, JID]),
mod_muc:register_online_user(ServerHost, jid:tolower(JID), Room, Host). mod_muc:register_online_user(ServerHost, jid:tolower(JID), Room, Host).
-spec tab_remove_online_user(jid(), state()) -> any(). -spec tab_remove_online_user(jid(), state()) -> any().
@ -4011,6 +4012,7 @@ tab_remove_online_user(JID, StateData) ->
Room = StateData#state.room, Room = StateData#state.room,
Host = StateData#state.host, Host = StateData#state.host,
ServerHost = StateData#state.server_host, ServerHost = StateData#state.server_host,
ejabberd_hooks:run(leave_room, ServerHost, [ServerHost, Room, Host, JID]),
mod_muc:unregister_online_user(ServerHost, jid:tolower(JID), Room, Host). mod_muc:unregister_online_user(ServerHost, jid:tolower(JID), Room, Host).
-spec tab_count_user(jid(), state()) -> non_neg_integer(). -spec tab_count_user(jid(), state()) -> non_neg_integer().