Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15516/src/mail
Modified Files:
SpamFilter.cpp
Log Message:
replaced array argument to CheckIfSpam() with a string one, changed its semantics
Index: SpamFilter.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SpamFilter.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -u -2 -r1.7 -r1.8
--- SpamFilter.cpp 11 Jul 2004 20:32:33 -0000 1.7
+++ SpamFilter.cpp 11 Jul 2004 22:52:21 -0000 1.8
@@ -118,30 +118,39 @@
bool
SpamFilter::CheckIfSpam(const Message& msg,
- const wxArrayString& params,
+ const String& paramsAll,
String *result)
{
LoadAll();
- // break down the parameters into names and parameters
+ // break down the parameters (if we have any) into names and values
wxSortedArrayString names;
wxArrayString values;
+ if ( !paramsAll.empty() )
+ {
+ // hack: for backwards compatibility with older versions when there was
+ // only one spam filter
+ String paramsAllReal(paramsAll.Find(_T(';')) == wxNOT_FOUND
+ ? _T("headers=") + paramsAll + _T(";dspam=")
+ : paramsAll);
+
+ wxArrayString params(strutil_restore_array(paramsAll, _T(';')));
const size_t count = params.GetCount();
for ( size_t n = 0; n < count; n++ )
{
- wxString param = params[n];
+ const wxString& param = params[n];
int pos = param.Find(_T('='));
if ( pos == wxNOT_FOUND )
{
- // hack: for backwards compatibility with older versions when there
- // was only one spam filter
- param = _T("headers=") + param;
- pos = 7;
+ wxLogDebug(_T("Bogus spam function argument \"%s\" ignored."),
+ param.c_str());
+ continue;
}
- // insert the value in the same position in values array as name is going
- // to have in the names one (as it's sorted we don't know where will it
- // be)
+ // insert the value in the same position in values array as name is
+ // going to have in the names one (as it's sorted we don't know where
+ // will it be)
values.Insert(param.c_str() + pos + 1, names.Add(wxString(param, pos)));
}
+ }
@@ -151,8 +160,17 @@
const String& name(p->GetName());
- int n = names.Index(name);
String param;
- if ( n != wxNOT_FOUND )
+ if ( !paramsAll.empty() )
+ {
+ int n = names.Index(name);
+ if ( n == wxNOT_FOUND )
+ {
+ // skip filters not appearing in paramsAll
+ continue;
+ }
+
param = values[(size_t)n];
+ }
+ //else: use all filters
if ( p->DoCheckIfSpam(msg, param, result) )
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates