mod_spam_filter: Apply cosmetic changes

This commit is contained in:
Holger Weiss 2019-04-09 22:46:05 +02:00
parent f459a7e57c
commit b5daceaac2
2 changed files with 10 additions and 10 deletions

View File

@ -42,7 +42,7 @@ The configurable mod_spam_filter options are:
- spam_urls_file (default: none) - spam_urls_file (default: none)
This option specifies the full path to a plain text file containing a This option specifies the full path to a plain text file containing a
list of URLs known to be mentioned in spam message bodys. Messages list of URLs known to be mentioned in spam message bodies. Messages
containing at least one of the listed URLs will be classified as spam. containing at least one of the listed URLs will be classified as spam.
Furthermore, the sender's JID will be cached, so that future traffic Furthermore, the sender's JID will be cached, so that future traffic
originating from that JID will be classified as spam as well. originating from that JID will be classified as spam as well.
@ -68,9 +68,9 @@ The configurable mod_spam_filter options are:
----------------- -----------------
This module provides ejabberdctl/API calls to reread the spam JID/URL This module provides ejabberdctl/API calls to reread the spam JID/URL
files, to show the JID cache, and to expire old entries from that cache. files, to print the JID cache contents, and to expire old entries from
See: that cache. See:
$ ejabberdctl help reload-spam-filter-files $ ejabberdctl help reload-spam-filter-files
$ ejabberdctl help show-spam-filter-cache $ ejabberdctl help get-spam-filter-cache
$ ejabberdctl help expire-spam-filter-cache $ ejabberdctl help expire-spam-filter-cache

View File

@ -51,7 +51,7 @@
%% ejabberd_commands callbacks. %% ejabberd_commands callbacks.
-export([get_commands_spec/0, reload_spam_filter_files/1, -export([get_commands_spec/0, reload_spam_filter_files/1,
show_spam_filter_cache/1, expire_spam_filter_cache/2]). get_spam_filter_cache/1, expire_spam_filter_cache/2]).
-include("ejabberd_commands.hrl"). -include("ejabberd_commands.hrl").
-include("logger.hrl"). -include("logger.hrl").
@ -559,9 +559,9 @@ get_commands_spec() ->
module = ?MODULE, function = reload_spam_filter_files, module = ?MODULE, function = reload_spam_filter_files,
args = [{host, binary}], args = [{host, binary}],
result = {res, restuple}}, result = {res, restuple}},
#ejabberd_commands{name = show_spam_filter_cache, tags = [filter], #ejabberd_commands{name = get_spam_filter_cache, tags = [filter],
desc = "Show spam filter cache contents", desc = "Show spam filter cache contents",
module = ?MODULE, function = show_spam_filter_cache, module = ?MODULE, function = get_spam_filter_cache,
args = [{host, binary}], args = [{host, binary}],
result = {spammers, {list, {spammer, {tuple, result = {spammers, {list, {spammer, {tuple,
[{jid, string}, {timestamp, integer}]}}}}}, [{jid, string}, {timestamp, integer}]}}}}},
@ -598,9 +598,9 @@ reload_spam_filter_files(Host) ->
end end
end. end.
-spec show_spam_filter_cache(binary()) -spec get_spam_filter_cache(binary())
-> [{binary(), integer()}] | {error, string()}. -> [{binary(), integer()}] | {error, string()}.
show_spam_filter_cache(Host) -> get_spam_filter_cache(Host) ->
LServer = jid:nameprep(Host), LServer = jid:nameprep(Host),
Proc = get_proc_name(LServer), Proc = get_proc_name(LServer),
try gen_server:call(Proc, get_cache, ?COMMAND_TIMEOUT) of try gen_server:call(Proc, get_cache, ?COMMAND_TIMEOUT) of
@ -619,7 +619,7 @@ expire_spam_filter_cache(<<"global">>, Age) ->
{ok, _} = expire_spam_filter_cache(Host, Age) {ok, _} = expire_spam_filter_cache(Host, Age)
end, ejabberd_config:get_myhosts()) of end, ejabberd_config:get_myhosts()) of
ok -> ok ->
{ok, "Expired cache filter entries"} {ok, "Expired cache entries"}
catch error:{badmatch, {error, _Reason} = Error} -> catch error:{badmatch, {error, _Reason} = Error} ->
Error Error
end; end;