@@ -160,9 +160,7 @@ mod_opt_type(rtbl_host) ->
160160 econf :enum ([none ]),
161161 econf :host ());
162162mod_opt_type (rtbl_domains_node ) ->
163- econf :either (
164- none ,
165- econf :binary ()).
163+ econf :non_empty (econf :binary ()).
166164
167165-spec mod_options (binary ()) -> [{atom (), any ()}].
168166mod_options (_Host ) ->
@@ -295,7 +293,9 @@ handle_cast({dump, XML}, #state{dump_fd = Fd} = State) ->
295293handle_cast ({reload , NewOpts , OldOpts },
296294 # state {host = Host ,
297295 rtbl_host = OldRTBLHost ,
298- rtbl_domains_node = OldRTBLDomainsNode } = State ) ->
296+ rtbl_domains_node = OldRTBLDomainsNode ,
297+ rtbl_retry_timer = RTBLRetryTimer } = State ) ->
298+ misc :cancel_timer (RTBLRetryTimer ),
299299 State1 = case {gen_mod :get_opt (spam_dump_file , OldOpts ),
300300 gen_mod :get_opt (spam_dump_file , NewOpts )} of
301301 {OldDumpFile , NewDumpFile } when NewDumpFile /= OldDumpFile ->
@@ -375,8 +375,13 @@ handle_info(Info, State) ->
375375 {noreply , State }.
376376
377377-spec terminate (normal | shutdown | {shutdown , term ()} | term (), state ()) -> ok .
378- terminate (Reason , # state {host = Host , rtbl_host = RTBLHost , rtbl_domains_node = RTBLDomainsNode } = State ) ->
378+ terminate (Reason ,
379+ # state {host = Host ,
380+ rtbl_host = RTBLHost ,
381+ rtbl_domains_node = RTBLDomainsNode ,
382+ rtbl_retry_timer = RTBLRetryTimer } = State ) ->
379383 ? DEBUG (" Stopping spam filter process for ~s : ~p " , [Host , Reason ]),
384+ misc :cancel_timer (RTBLRetryTimer ),
380385 DumpFile = gen_mod :get_module_opt (Host , ? MODULE , spam_dump_file ),
381386 DumpFile1 = expand_host (DumpFile , Host ),
382387 close_dump_file (DumpFile1 , State ),
@@ -679,7 +684,7 @@ read_files(Files) ->
679684-spec line_parser (Type :: atom ()) -> fun ((binary ()) -> binary ()).
680685line_parser (jid ) -> fun parse_jid /1 ;
681686line_parser (url ) -> fun parse_url /1 ;
682- line_parser (_ ) -> fun trim /1 .
687+ line_parser (_ ) -> fun trim /1 .
683688
684689-spec read_file (filename (), fun ((binary ()) -> ljid () | url ()))
685690 -> jid_set () | url_set ().
@@ -934,7 +939,7 @@ get_commands_spec() ->
934939 args = [{host , binary }, {domain , binary }],
935940 result = {res , restuple }}
936941 ].
937-
942+
938943for_all_hosts (F , A ) ->
939944 try lists :map (
940945 fun (Host ) ->
@@ -968,13 +973,13 @@ reload_spam_filter_files(Host) ->
968973 LServer = jid :nameprep (Host ),
969974 Files = #{domains => gen_mod :get_module_opt (LServer , ? MODULE , spam_domains_file ),
970975 jid => gen_mod :get_module_opt (LServer , ? MODULE , spam_jids_file ),
971- url => gen_mod :get_module_opt (LServer , ? MODULE , spam_urls_file )},
976+ url => gen_mod :get_module_opt (LServer , ? MODULE , spam_urls_file )},
972977 case try_call_by_host (Host , {reload_files , Files }) of
973978 {spam_filter , ok } ->
974979 ok ;
975980 {spam_filter , {error , Txt }} ->
976981 {error , binary_to_list (Txt )};
977- {error , _R } = Error ->
982+ {error , _R } = Error ->
978983 Error
979984 end .
980985
@@ -1031,7 +1036,7 @@ expire_spam_filter_cache(Host, Age) ->
10311036 Error
10321037 end .
10331038
1034- -spec add_to_spam_filter_cache (binary (), binary ()) -> [{binary (), integer ()}] | {error , string ()}.
1039+ -spec add_to_spam_filter_cache (binary (), binary ()) -> [{binary (), integer ()}] | {error , string ()}.
10351040add_to_spam_filter_cache (<<" global" >>, JID ) ->
10361041 for_all_hosts (fun add_to_spam_filter_cache /2 , [JID ]);
10371042add_to_spam_filter_cache (Host , EncJID ) ->
0 commit comments