mod_client_state: Delete only the configured hooks
This commit is contained in:
parent
f7f40cf9a6
commit
4717d64d7a
|
@ -40,13 +40,11 @@
|
||||||
|
|
||||||
start(Host, Opts) ->
|
start(Host, Opts) ->
|
||||||
QueuePresence = gen_mod:get_opt(queue_presence, Opts,
|
QueuePresence = gen_mod:get_opt(queue_presence, Opts,
|
||||||
fun(true) -> true;
|
fun(B) when is_boolean(B) -> B end,
|
||||||
(false) -> false
|
true),
|
||||||
end, true),
|
|
||||||
DropChatStates = gen_mod:get_opt(drop_chat_states, Opts,
|
DropChatStates = gen_mod:get_opt(drop_chat_states, Opts,
|
||||||
fun(true) -> true;
|
fun(B) when is_boolean(B) -> B end,
|
||||||
(false) -> false
|
true),
|
||||||
end, true),
|
|
||||||
if QueuePresence; DropChatStates ->
|
if QueuePresence; DropChatStates ->
|
||||||
ejabberd_hooks:add(c2s_post_auth_features, Host, ?MODULE,
|
ejabberd_hooks:add(c2s_post_auth_features, Host, ?MODULE,
|
||||||
add_stream_feature, 50),
|
add_stream_feature, 50),
|
||||||
|
@ -65,12 +63,27 @@ start(Host, Opts) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
ejabberd_hooks:delete(csi_filter_stanza, Host, ?MODULE,
|
QueuePresence = gen_mod:get_module_opt(Host, ?MODULE, queue_presence,
|
||||||
filter_presence, 50),
|
fun(B) when is_boolean(B) -> B end,
|
||||||
ejabberd_hooks:delete(csi_filter_stanza, Host, ?MODULE,
|
true),
|
||||||
filter_chat_states, 50),
|
DropChatStates = gen_mod:get_module_opt(Host, ?MODULE, drop_chat_states,
|
||||||
ejabberd_hooks:delete(c2s_post_auth_features, Host, ?MODULE,
|
fun(B) when is_boolean(B) -> B end,
|
||||||
add_stream_feature, 50),
|
true),
|
||||||
|
if QueuePresence; DropChatStates ->
|
||||||
|
ejabberd_hooks:delete(c2s_post_auth_features, Host, ?MODULE,
|
||||||
|
add_stream_feature, 50),
|
||||||
|
if QueuePresence ->
|
||||||
|
ejabberd_hooks:delete(csi_filter_stanza, Host, ?MODULE,
|
||||||
|
filter_presence, 50);
|
||||||
|
true -> ok
|
||||||
|
end,
|
||||||
|
if DropChatStates ->
|
||||||
|
ejabberd_hooks:delete(csi_filter_stanza, Host, ?MODULE,
|
||||||
|
filter_chat_states, 50);
|
||||||
|
true -> ok
|
||||||
|
end;
|
||||||
|
true -> ok
|
||||||
|
end,
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
add_stream_feature(Features, _Host) ->
|
add_stream_feature(Features, _Host) ->
|
||||||
|
@ -102,11 +115,7 @@ filter_chat_states(_Action, #xmlel{name = <<"message">>} = Stanza) ->
|
||||||
filter_chat_states(Action, _Stanza) -> Action.
|
filter_chat_states(Action, _Stanza) -> Action.
|
||||||
|
|
||||||
mod_opt_type(drop_chat_states) ->
|
mod_opt_type(drop_chat_states) ->
|
||||||
fun (true) -> true;
|
fun(B) when is_boolean(B) -> B end;
|
||||||
(false) -> false
|
|
||||||
end;
|
|
||||||
mod_opt_type(queue_presence) ->
|
mod_opt_type(queue_presence) ->
|
||||||
fun (true) -> true;
|
fun(B) when is_boolean(B) -> B end;
|
||||||
(false) -> false
|
|
||||||
end;
|
|
||||||
mod_opt_type(_) -> [drop_chat_states, queue_presence].
|
mod_opt_type(_) -> [drop_chat_states, queue_presence].
|
||||||
|
|
Loading…
Reference in New Issue