From ffc4515614840dc37574275fd8d30ab089ab458f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Tue, 29 Mar 2022 10:23:27 +0200 Subject: [PATCH] Update config_metrics callbacks in modules already using maps --- src/mod_muc.erl | 4 ++-- src/mod_private.erl | 6 +++--- src/muc_light/mod_muc_light.erl | 6 +++--- src/privacy/mod_privacy.erl | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mod_muc.erl b/src/mod_muc.erl index e4ee45364e..c72a465efa 100644 --- a/src/mod_muc.erl +++ b/src/mod_muc.erl @@ -1370,9 +1370,9 @@ ensure_metrics(_Host) -> {function, mod_muc, online_rooms_number, [], eval, ?EX_EVAL_SINGLE_VALUE}). +-spec config_metrics(mongooseim:host_type()) -> [{gen_mod:opt_key(), gen_mod:opt_value()}]. config_metrics(HostType) -> - OptsToReport = [{backend, mnesia}], %list of tuples {option, defualt_value} - mongoose_module_metrics:opts_for_module(HostType, ?MODULE, OptsToReport). + mongoose_module_metrics:opts_for_module(HostType, ?MODULE, [backend]). hooks(HostType) -> [{is_muc_room_owner, HostType, ?MODULE, is_muc_room_owner, 50}, diff --git a/src/mod_private.erl b/src/mod_private.erl index 93f0794445..f0cb8db674 100644 --- a/src/mod_private.erl +++ b/src/mod_private.erl @@ -196,6 +196,6 @@ is_valid_namespace(Namespace) -> Namespace =/= <<>>. error_iq(IQ=#iq{sub_el=SubElem}, ErrorStanza) -> IQ#iq{type = error, sub_el = [SubElem, ErrorStanza]}. -config_metrics(Host) -> - OptsToReport = [{backend, mnesia}], %list of tuples {option, defualt_value} - mongoose_module_metrics:opts_for_module(Host, ?MODULE, OptsToReport). +-spec config_metrics(mongooseim:host_type()) -> [{gen_mod:opt_key(), gen_mod:opt_value()}]. +config_metrics(HostType) -> + mongoose_module_metrics:opts_for_module(HostType, ?MODULE, [backend]). diff --git a/src/muc_light/mod_muc_light.erl b/src/muc_light/mod_muc_light.erl index f09fc23dd6..beaf28821e 100644 --- a/src/muc_light/mod_muc_light.erl +++ b/src/muc_light/mod_muc_light.erl @@ -830,6 +830,6 @@ maybe_forget_rooms(Acc, [{RoomUS, {ok, _, NewAffUsers, _, _}} | RAffectedRooms], make_handler_fun(Acc) -> fun(From, To, Packet) -> ejabberd_router:route(From, To, Acc, Packet) end. -config_metrics(Host) -> - OptsToReport = [{backend, mnesia}], %list of tuples {option, defualt_value} - mongoose_module_metrics:opts_for_module(Host, ?MODULE, OptsToReport). +-spec config_metrics(mongooseim:host_type()) -> [{gen_mod:opt_key(), gen_mod:opt_value()}]. +config_metrics(HostType) -> + mongoose_module_metrics:opts_for_module(HostType, ?MODULE, [backend]). diff --git a/src/privacy/mod_privacy.erl b/src/privacy/mod_privacy.erl index 573731f8c9..ac636823f6 100644 --- a/src/privacy/mod_privacy.erl +++ b/src/privacy/mod_privacy.erl @@ -658,6 +658,6 @@ broadcast_privacy_list_packet(Name, UserList) -> roster_get_jid_info(HostType, ToJID, LJID) -> mongoose_hooks:roster_get_jid_info(HostType, ToJID, LJID). +-spec config_metrics(mongooseim:host_type()) -> [{gen_mod:opt_key(), gen_mod:opt_value()}]. config_metrics(HostType) -> - OptsToReport = [{backend, mnesia}], %list of tuples {option, defualt_value} - mongoose_module_metrics:opts_for_module(HostType, ?MODULE, OptsToReport). + mongoose_module_metrics:opts_for_module(HostType, ?MODULE, [backend]).