diff src/context.h @ 73:2b369f7db7bf

start coding on new config syntax
author carl
date Sun, 10 Jul 2005 13:28:33 -0700
parents dd21c8e13074
children b7449114ebb0
line wrap: on
line diff
--- a/src/context.h	Sun Jul 10 13:28:33 2005 -0700
+++ b/src/context.h	Sun Jul 10 13:28:33 2005 -0700
@@ -1,3 +1,6 @@
+#ifndef context_include
+#define context_include
+
 #include "tokenizer.h"
 #include <map>
 
@@ -11,6 +14,7 @@
 
 class DNSBL;
 class CONTEXT;
+class recorder;
 
 typedef map<char *, char *, ltstr>        string_map;
 typedef set<int>                          int_set;
@@ -86,6 +90,19 @@
     void        add_dnsbl(DNSBLP dns)                       {dnsbl_list.push_back(dns);};
     DNSBLP      find_dnsbl(char *name);
 
+    int             get_host_limit()                        {return host_limit;};
+    bool            get_host_random()                       {return host_random;};
+    char*           get_content_suffix()                    {return content_suffix;};
+    char*           get_content_message()                   {return content_message;};
+    string_set&     get_content_host_ignore()               {return content_host_ignore;};
+    string_set&     get_content_tlds()                      {return content_tlds;};
+    string_set&     get_html_tags()                         {return html_tags;};
+    dnsblp_list&    get_dnsbl_list()                        {return dnsbl_list;};
+    bool            get_content_filtering()                 {return content_filtering;};
+
+    bool        acceptable_content(recorder &memory);
+    bool        ignore_host(char *host);
+
     void        dump(int level = 0);
 };
 
@@ -100,12 +117,20 @@
     context_list    contexts;       // owns all the contexts, not just top level contexts
     context_map     env_to;         // map recipient to a filtering context
     CONTEXTP        default_context;// for env_to values that don't have their own specific filtering context
+    // the default context is also used for some of the content filtering values
 
     CONFIG();
     ~CONFIG();
     void        add_context(CONTEXTP con);
     void        add_to(char *to, CONTEXTP con)      {env_to[to] = con;};
     CONTEXTP    find_context(char *to, char *from);
+
+    char*       get_content_suffix()                        {return default_context->get_content_suffix()      ;};
+    char*       get_content_message()                       {return default_context->get_content_message()     ;};
+    string_set& get_content_host_ignore()                   {return default_context->get_content_host_ignore() ;};
+    string_set& get_content_tlds()                          {return default_context->get_content_tlds()        ;};
+    string_set& get_html_tags()                             {return default_context->get_html_tags()           ;};
+
     void        dump();
 };
 
@@ -147,3 +172,5 @@
 CONFIG *parse_config(char *fn);
 bool load_conf(CONFIG &dc, char *fn);
 void token_init();
+
+#endif