diff src/context.cpp @ 119:d9d2f8699621

uribl patch from Jeff Evans <jeffe@tricab.com>
author carl
date Sun, 12 Mar 2006 12:38:43 -0800
parents aa07452e641b
children c5cd1261394d
line wrap: on
line diff
--- a/src/context.cpp	Sun Mar 12 10:20:59 2006 -0800
+++ b/src/context.cpp	Sun Mar 12 12:38:43 2006 -0800
@@ -52,6 +52,7 @@
 char *token_tld;
 char *token_cctld;
 char *token_unknown;
+char *token_uribl;
 char *token_verify;
 char *token_white;
 
@@ -486,6 +487,8 @@
 	content_filtering	= (parent) ? parent->content_filtering : false;
 	content_suffix		= NULL;
 	content_message 	= NULL;
+	uribl_suffix		= NULL;
+	uribl_message		= NULL;
 	host_limit			= (parent) ? parent->host_limit  : 0;
 	host_limit_message	= NULL;
 	host_random 		= (parent) ? parent->host_random : false;
@@ -615,12 +618,24 @@
 }
 
 
+char* CONTEXT::get_uribl_suffix() {
+	if (!uribl_suffix && parent) return parent->get_uribl_suffix();
+	return uribl_suffix;
+}
+
+
 char* CONTEXT::get_content_message() {
 	if (!content_message && parent) return parent->get_content_message();
 	return content_message;
 }
 
 
+char* CONTEXT::get_uribl_message() {
+	if (!uribl_message && parent) return parent->get_uribl_message();
+	return uribl_message;
+}
+
+
 string_set& CONTEXT::get_content_host_ignore() {
 	if (content_host_ignore.empty() && parent) return parent->get_content_host_ignore();
 	return content_host_ignore;
@@ -692,6 +707,9 @@
 		if (content_suffix) {
 			printf("%s         filter %s \"%s\"; \n", indent, content_suffix, content_message);
 		}
+		if (uribl_suffix) {
+			printf("%s         uribl %s \"%s\"; \n", indent, uribl_suffix, uribl_message);
+		}
 		if (!content_host_ignore.empty()) {
 			printf("%s         ignore { \n", indent);
 			for (string_set::iterator i=content_host_ignore.begin(); i!=content_host_ignore.end(); i++) {
@@ -891,6 +909,13 @@
 			me.set_content_message(messag);
 			if (!tsa(tok, token_semi)) return false;
 		}
+		else if (have == token_uribl) {
+			char *suffix = tok.next();
+			char *messag = tok.next();
+			me.set_uribl_suffix(suffix);
+			me.set_uribl_message(messag);
+			if (!tsa(tok, token_semi)) return false;
+		}
 		else if (have == token_ignore) {
 			if (!tsa(tok, token_lbrace)) return false;
 			while (true) {
@@ -1282,6 +1307,7 @@
 	token_substitute = register_string("substitute");
 	token_tld		 = register_string("tld");
 	token_unknown	 = register_string("unknown");
+	token_uribl 	 = register_string("uribl");
 	token_verify	 = register_string("verify");
 	token_white 	 = register_string("white");