Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31699/src/mail

Modified Files:
        SpamFilter.cpp 
Log Message:
added code to configure isspam() filter function argument

Index: SpamFilter.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SpamFilter.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -b -u -2 -r1.9 -r1.10
--- SpamFilter.cpp      11 Jul 2004 23:04:21 -0000      1.9
+++ SpamFilter.cpp      12 Jul 2004 00:33:37 -0000      1.10
@@ -44,9 +44,15 @@
 {
 public:
-   SpamOptionsDialog(wxFrame *parent, wxImageList *imagelist)
+   // we must have a non-NULL profile but we don't Inc/DecRef() it at all
+   SpamOptionsDialog(wxFrame *parent,
+                     Profile *profile,
+                     String *params,
+                     wxImageList *imagelist)
       : wxOptionsEditDialog(parent,
                             _("Spam filters options"),
                             _T("SpamDlg"))
    {
+      m_profile = profile;
+      m_params = params;
       m_imagelist = imagelist;
 
@@ -65,12 +71,14 @@
       for ( SpamFilter *p = SpamFilter::ms_first; p; p = p->m_next )
       {
-         p->CreateOptionPage(m_notebook);
+         p->CreateOptionPage(m_notebook, m_profile, m_params);
       }
    }
 
 protected:
-   virtual Profile *GetProfile() const { return mApplication->GetProfile(); }
+   virtual Profile *GetProfile() const { return m_profile; }
 
 private:
+   Profile *m_profile;
+   String *m_params;
    wxImageList *m_imagelist;
 };
@@ -135,5 +143,5 @@
                               : paramsAll);
 
-      wxArrayString params(strutil_restore_array(paramsAll, _T(';')));
+      wxArrayString params(strutil_restore_array(paramsAllReal, _T(';')));
       const size_t count = params.GetCount();
       for ( size_t n = 0; n < count; n++ )
@@ -192,5 +200,5 @@
 
 /* static */
-void SpamFilter::Configure(wxFrame *parent)
+bool SpamFilter::Configure(wxFrame *parent, String *params)
 {
    LoadAll();
@@ -213,14 +221,35 @@
    }
 
+   // check if we have anything to configure
    if ( !nPages )
    {
       wxLogMessage(_("There are no configurable spam filters."));
-      return;
+      return false;
+   }
+
+
+   // now we must select a profile from which the filters options will be read
+   // from and written to: this can be either the "real" profile or a temporary
+   // one populated with the value of *params and deleted after copying all the
+   // changes back to *params
+   Profile_obj profile(Profile::CreateModuleProfile(SPAM_FILTER_INTERFACE));
+   if ( params )
+   {
+      // ensure that we can undo any changes later by calling Discard()
+      profile->Suspend();
    }
 
-   // do create the dialog and show it
-   SpamOptionsDialog dlg(parent, imagelist);
+   // do create the dialog (this will create all the pages inside its
+   // CreateNotebook()) and show it
+   SpamOptionsDialog dlg(parent, profile, params, imagelist);
+
+   bool ok = dlg.ShowModal() == wxID_OK;
+
+   if ( params )
+   {
+      profile->Discard();
+   }
 
-   (void)dlg.ShowModal();
+   return ok;
 }
 
@@ -299,2 +328,18 @@
 }
 
+// ----------------------------------------------------------------------------
+// trivial implementations of the base class "almost pure" virtuals
+// ----------------------------------------------------------------------------
+
+SpamOptionsPage *
+SpamFilter::CreateOptionPage(wxListOrNoteBook * /* notebook */,
+                             Profile * /* profile */,
+                             String * /* params */) const
+{
+   return NULL;
+}
+
+SpamFilter::~SpamFilter()
+{
+}
+



-------------------------------------------------------
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

Reply via email to