summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-17 15:17:17 -0700
committerJohn Denker <jsd@av8n.com>2012-07-17 15:17:17 -0700
commit2400eaeb734f5a80812fdb936626fa9fdcbda115 (patch)
treeb1a601243f9e529fe1e8cdd55101806214630dcd /tools
parent11f086c5843430273b67e8fcb85dee38d4325688 (diff)
implement regular expressions
Diffstat (limited to 'tools')
-rw-r--r--tools/mail-scan.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/mail-scan.c b/tools/mail-scan.c
index 79b8d58..0cda6e5 100644
--- a/tools/mail-scan.c
+++ b/tools/mail-scan.c
@@ -15,9 +15,8 @@
/////////////
// Another hint: using the "-addr" feature:
-// grep score=[234] /home/user/Maildir/spam/* -l | \...
-// xargs mail-scan +from -addr | sort | uniq -c | sort -nr | head | blacklist-update -bare
-
+// mail-scan +x-spam.*:score=[234] /home/jean/Maildir/spam/* -l | \....
+// xargs mail-scan +from -addr | sort | uniq -c | sort -nr | head -20
#include <iostream>
#include <stdlib.h> /* for exit() */
@@ -294,15 +293,14 @@ int main(int _argc, const char** _argv){
headword = header.substr(0, where);
rest = ltrim(header.substr(1+where));
}
-// temporary? FIXME? lowercase
- headword = toLower(headword);
- rest = toLower(rest);
+
for (list<watcher>::const_iterator ptr = watchword.begin();
ptr != watchword.end(); ptr++) {
- if (headword == toLower(ptr->key)) {
+// regex_match not regex_search ... keyrx must match *whole* headword
+ if (boost::regex_match(headword, ptr->keyrx)){
// here if match as to keyword; check for match as to value
if (ptr->val.length()==0
- || rest.find(toLower(ptr->val)) != string::npos) {
+ || boost::regex_search(rest, ptr->valrx)){
foundsome_infile++;
if (!vflag) {
if (!addr_mode){