Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1:/tmp/cvs-serv17815/src/modules
Modified Files:
Filters.cpp
Log Message:
Search for parent domain in whitelist
Index: Filters.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/Filters.cpp,v
retrieving revision 1.170
retrieving revision 1.171
diff -b -u -2 -r1.170 -r1.171
--- Filters.cpp 16 Oct 2003 16:17:06 -0000 1.170
+++ Filters.cpp 16 Oct 2003 16:53:00 -0000 1.171
@@ -2288,4 +2288,25 @@
}
+static wxArrayString GenerateSuperDomains(const String &domain)
+{
+ wxArrayString parts(strutil_restore_array(domain,_T('.')));
+
+ wxArrayString result;
+ for( size_t count = 1; count <= parts.GetCount(); ++count )
+ {
+ String super;
+ for( size_t each = 0; each < count; ++each )
+ {
+ if( !each )
+ super += _T('.');
+ super += parts[parts.GetCount() - count + each];
+ }
+
+ result.Add(super);
+ }
+
+ return result;
+}
+
// check whether any address field (sender or recipient) matches whitelist
// FIXME: Match address groups ([EMAIL PROTECTED]) and domains
@@ -2347,8 +2368,17 @@
candidate = parser->GetNext(candidate) )
{
- if( !candidate->GetDomain().empty() )
+ wxArrayString domains(GenerateSuperDomains(candidate->GetDomain()));
+
+ for( size_t super = 0; super < domains.GetCount(); ++super )
{
- if( book->Matches(String(_T("*@"))+candidate->GetDomain(),
+ // FIXME: Grammar without escape sequences
+ if( book->Matches(String(_T("*@"))+domains[super],
AdbLookup_EMail,AdbLookup_Match) )
+ {
+ return false;
+ }
+
+ // Allow whitelisting domain itself
+ if( book->Matches(domains[super],AdbLookup_EMail,AdbLookup_Match) )
{
return false;
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates