]> source.dussan.org Git - rspamd.git/commitdiff
Use TLD file directly within API.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 6 Apr 2015 12:48:35 +0000 (13:48 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 6 Apr 2015 12:48:35 +0000 (13:48 +0100)
src/libserver/url.c
src/libserver/url.h
src/main.c
test/lua/unit/url.lua

index dff3ea1fc832d385f2bcf087dcbdc315f127d9b0..b4c605d366039a77a4ee2391c298adbd1a6c401a 100644 (file)
@@ -890,7 +890,7 @@ rspamd_url_add_static_matchers (GArray *matchers)
 }
 
 void
-rspamd_url_init (struct rspamd_config *cfg)
+rspamd_url_init (const gchar *tld_file)
 {
        guint i;
        gchar patbuf[128];
@@ -904,8 +904,8 @@ rspamd_url_init (struct rspamd_config *cfg)
                url_scanner->tld_trie = rspamd_trie_create (TRUE);
                rspamd_url_add_static_matchers (url_scanner->matchers);
 
-               if (cfg != NULL && cfg->tld_file) {
-                       rspamd_url_parse_tld_file (cfg->tld_file, url_scanner);
+               if (tld_file != NULL) {
+                       rspamd_url_parse_tld_file (tld_file, url_scanner);
                }
                else {
                        msg_warn ("tld extension file is not specified, url matching is limited");
index a066d214d613dfeb45bb17fa96d5c63ae8047953..8dc2a70321a97e0ff2d9a4b525e44c35c12983f1 100644 (file)
@@ -7,7 +7,6 @@
 
 struct rspamd_task;
 struct mime_text_part;
-struct rspamd_config;
 
 struct rspamd_url {
        gchar *string;
@@ -67,7 +66,7 @@ enum rspamd_url_protocol {
  * Initialize url library
  * @param cfg
  */
-void rspamd_url_init (struct rspamd_config *cfg);
+void rspamd_url_init (const gchar *tld_file);
 
 /*
  * Parse urls inside text
index 6cfbf114b4ed7a80f6e7214206432972288b4716..2d6216b1fd5f2936872328427357c74742dfda82 100644 (file)
@@ -1358,7 +1358,7 @@ main (gint argc, gchar **argv, gchar **env)
        }
 
        rspamd_stat_init (rspamd_main->cfg);
-       rspamd_url_init (rspamd_main->cfg);
+       rspamd_url_init (rspamd_main->cfg->tld_file);
 
        /* Insert classifiers symbols */
        (void)rspamd_config_insert_classify_symbols (rspamd_main->cfg);
index dd6f4b7601cb5772dcdda3a17e5530dc48894733..a593ac15385c41d44868d79d39ce3d82a65f7d80 100644 (file)
@@ -42,7 +42,7 @@ context("URL check functions", function()
   struct rspamd_url* rspamd_url_get_next (void *pool,
     const char *start, char const **pos);
   void * rspamd_mempool_new (unsigned long size);
-  void rspamd_url_init (struct rspamd_config *cfg);
+  void rspamd_url_init (const char *tld_file);
   ]]
   
   test("Extract urls from text", function()