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-29 15:32:33 -0700
commit58b88adfe892e5a327148ad7a991d453ba231607 (patch)
tree10787e566e107a8b8fd9c871efefa7a4d31f7283 /tools
parentcbbd45a9700a660bcc4e2f762f5004c2aa2b1078 (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 9e79ff9..1ea245f 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){