1 |
|
%%============================================================================== |
2 |
|
%% Copyright 2018 Erlang Solutions Ltd. |
3 |
|
%% |
4 |
|
%% Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
|
%% you may not use this file except in compliance with the License. |
6 |
|
%% You may obtain a copy of the License at |
7 |
|
%% |
8 |
|
%% http://www.apache.org/licenses/LICENSE-2.0 |
9 |
|
%% |
10 |
|
%% Unless required by applicable law or agreed to in writing, software |
11 |
|
%% distributed under the License is distributed on an "AS IS" BASIS, |
12 |
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
|
%% See the License for the specific language governing permissions and |
14 |
|
%% limitations under the License. |
15 |
|
%%============================================================================== |
16 |
|
|
17 |
|
-module(mod_mam_params). |
18 |
|
|
19 |
|
-type mam_module() :: mod_mam_pm | mod_mam_muc. |
20 |
|
|
21 |
|
-export([extra_params_module/2, max_result_limit/2, default_result_limit/2, |
22 |
|
has_full_text_search/2, is_archivable_message_module/2, send_message_mod/2, |
23 |
|
archive_chat_markers/2, add_stanzaid_element/2, extra_fin_element_module/2, |
24 |
|
enforce_simple_queries/2]). |
25 |
|
|
26 |
|
%%-------------------------------------------------------------------- |
27 |
|
%% API |
28 |
|
%%-------------------------------------------------------------------- |
29 |
|
|
30 |
|
-spec extra_params_module(mam_module(), mongooseim:host_type()) -> module() | undefined. |
31 |
|
extra_params_module(Module, HostType) -> |
32 |
1422 |
gen_mod:get_module_opt(HostType, Module, extra_lookup_params, undefined). |
33 |
|
|
34 |
|
-spec max_result_limit(mam_module(), mongooseim:host_type()) -> pos_integer(). |
35 |
|
max_result_limit(Module, HostType) -> |
36 |
1466 |
gen_mod:get_module_opt(HostType, Module, max_result_limit). |
37 |
|
|
38 |
|
-spec default_result_limit(mam_module(), mongooseim:host_type()) -> pos_integer(). |
39 |
|
default_result_limit(Module, HostType) -> |
40 |
1422 |
gen_mod:get_module_opt(HostType, Module, default_result_limit). |
41 |
|
|
42 |
|
-spec enforce_simple_queries(mam_module(), mongooseim:host_type()) -> module() | undefined. |
43 |
|
enforce_simple_queries(Module, HostType) -> |
44 |
1422 |
gen_mod:get_module_opt(HostType, Module, enforce_simple_queries, false). |
45 |
|
|
46 |
|
-spec has_full_text_search(Module :: mod_mam_pm | mod_mam_muc, mongooseim:host_type()) -> boolean(). |
47 |
|
has_full_text_search(Module, HostType) -> |
48 |
49 |
gen_mod:get_module_opt(HostType, Module, full_text_search). |
49 |
|
|
50 |
|
-spec is_archivable_message_module(mam_module(), mongooseim:host_type()) -> module(). |
51 |
|
is_archivable_message_module(Module, HostType) -> |
52 |
13347 |
gen_mod:get_module_opt(HostType, Module, is_archivable_message). |
53 |
|
|
54 |
|
-spec send_message_mod(mam_module(), mongooseim:host_type()) -> module(). |
55 |
|
send_message_mod(Module, HostType) -> |
56 |
1324 |
gen_mod:get_module_opt(HostType, Module, send_message). |
57 |
|
|
58 |
|
-spec archive_chat_markers(mam_module(), mongooseim:host_type()) -> boolean(). |
59 |
|
archive_chat_markers(Module, HostType) -> |
60 |
13347 |
gen_mod:get_module_opt(HostType, Module, archive_chat_markers). |
61 |
|
|
62 |
|
-spec add_stanzaid_element(mam_module(), mongooseim:host_type()) -> boolean(). |
63 |
|
add_stanzaid_element(Module, HostType) -> |
64 |
1863 |
not gen_mod:get_module_opt(HostType, Module, no_stanzaid_element). |
65 |
|
|
66 |
|
-spec extra_fin_element_module(mam_module(), mongooseim:host_type()) -> module() | undefined. |
67 |
|
extra_fin_element_module(Module, HostType) -> |
68 |
1324 |
gen_mod:get_module_opt(HostType, Module, extra_fin_element, undefined). |