Revision: 7406
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7406&view=rev
Author:   vadz
Date:     2008-03-30 18:16:14 -0700 (Sun, 30 Mar 2008)

Log Message:
-----------
ignore trailing spaces when checking for sentences in all caps, their presence 
doesn't indicate that we have multiple words

Modified Paths:
--------------
    trunk/M/src/modules/spam/HeadersFilter.cpp

Modified: trunk/M/src/modules/spam/HeadersFilter.cpp
===================================================================
--- trunk/M/src/modules/spam/HeadersFilter.cpp  2008-03-27 15:17:38 UTC (rev 
7405)
+++ trunk/M/src/modules/spam/HeadersFilter.cpp  2008-03-31 01:16:14 UTC (rev 
7406)
@@ -522,7 +522,8 @@
 // check if the subject is in capitals
 static bool CheckSubjectForCapitals(const String& subject)
 {
-   bool hasSpace = false;
+   bool hasSpace = false,
+        oneWord = true;
    for ( String::const_iterator i = subject.begin(); i != subject.end(); ++i )
    {
       const wxUChar ch = *i;
@@ -535,14 +536,19 @@
 
       if ( isspace(ch) )
       {
-         // remember that we have more than one word
+         // remember that we have a space
          hasSpace = true;
       }
+      else if ( hasSpace )
+      {
+         // non-space after a space -- remember that we have multiple words
+         oneWord = false;
+      }
    }
 
    // message with a single work in all caps can be legitimate but if we have a
    // sentence (i.e. more than one word here) in all caps it is very suspicious
-   return hasSpace;
+   return !oneWord;
 }
 
 // check if the subject is of the form "...      foo-12-xyz": spammers seem to


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to