diff src/context.cpp @ 272:a99b6c1f5f67

Code cleanup, increase minimum hostname length for uribl checking
author Carl Byington <carl@five-ten-sg.com>
date Mon, 09 Sep 2013 19:30:21 -0700
parents f92f24950bd3
children bdcf203e3f7b
line wrap: on
line diff
--- a/src/context.cpp	Mon Sep 09 15:20:38 2013 -0700
+++ b/src/context.cpp	Mon Sep 09 19:30:21 2013 -0700
@@ -918,14 +918,6 @@
 }
 
 
-void CONTEXT::add_tld(const char *tld) {
-    int n = strlen(tld);
-         if ((n > 1) && (tld[0] == '*') && (tld[1] == '.')) content_tldwilds.insert(tld+1);
-    else if ((n > 0) && (tld[0] == '!'))                    content_tldnots.insert(tld+1);
-    else                                                    content_tlds.insert(tld);
-}
-
-
 CONTEXTP CONTEXT::find_context(const char *from) {
     context_map::iterator i = env_from_context.find(from);
     if (i != env_from_context.end()) return (*i).second;        // found user@domain key
@@ -1435,9 +1427,7 @@
                     have = tok.next();
                     if (!have) break;
                     if (have == token_rbrace) break;  // done
-                    char buf[200];
-                    snprintf(buf, sizeof(buf), "!%s", have);
-                    me.add_tld(register_string(buf));           // leading !
+                    me.add_tldnot(have);
                 }
                 else if (have == token_asterisk) {
                     have = tok.next();
@@ -1447,9 +1437,7 @@
                         have = tok.next();
                         if (!have) break;
                         if (have == token_rbrace) break;  // done
-                        char buf[200];
-                        snprintf(buf, sizeof(buf), "*.%s", have);
-                        me.add_tld(register_string(buf));           // leading *.
+                        me.add_tldwild(have);
                     }
                 }
                 else me.add_tld(have);