Update of /cvsroot/mahogany/M/src/modules
In directory usw-pr-cvs1:/tmp/cvs-serv22663/src/modules

Modified Files:
        Filters.cpp 
Log Message:
test for euc-kr in korean charset test as well

Index: Filters.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/Filters.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -b -u -2 -r1.115 -r1.116
--- Filters.cpp 20 Jun 2002 18:12:46 -0000      1.115
+++ Filters.cpp 21 Jun 2002 14:11:02 -0000      1.116
@@ -1927,11 +1927,39 @@
       else if ( test == "korean" )
       {
-         rc = msg->GetHeaderLine("Content-Type", value) &&
-               value.Lower().find("ks_c_5601-1987") != String::npos;
+         if ( msg->GetHeaderLine("Content-Type", value) )
+         {
+            // extract the charset parameter
+            static const char *CHARSET_STRING = "charset=";
+            static const size_t CHARSET_LEN = strlen(CHARSET_STRING);
+
+            const char *pc = strstr(value.MakeLower(), CHARSET_STRING);
+            if ( !pc )
+            {
+               // no charset at all, don't filter
+               continue;
+            }
+
+            pc += CHARSET_LEN;
+            if ( *pc == '"' )
+               pc++;
+
+#define STARTS_WITH(p, what) (!(wxStrncmp((p), (what), strlen(what))))
+
+            // detect all Korean charsets
+            if ( STARTS_WITH(pc, "ks_c_5601-1987") ||
+                    STARTS_WITH(pc, "euc-kr") )
+            {
+               rc = true;
+            }
+
+#undef STARTS_WITH
+         }
       }
       else if ( test == "xauthwarn" )
       {
-         // consider that only spams have this header
-         rc = msg->GetHeaderLine("X-Authentication-Warning", value);
+         // unfortunately not only spams have this header but we consider that
+         // only spammers change their address in such way
+         rc = msg->GetHeaderLine("X-Authentication-Warning", value) &&
+                  value.Matches("Host * claimed to be *");
       }
 #ifdef USE_RBL



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to