Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv6947/src/gui
Modified Files:
wxFiltersDialog.cpp
Log Message:
extracted the pam test strings in their own header to avoid duplicating them in 2
different files; also partly fixed the initial value of the spam properties dialog
checkboxes
Index: wxFiltersDialog.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFiltersDialog.cpp,v
retrieving revision 1.88
retrieving revision 1.89
diff -b -u -2 -r1.88 -r1.89
--- wxFiltersDialog.cpp 27 Jun 2002 11:17:29 -0000 1.88
+++ wxFiltersDialog.cpp 27 Jun 2002 13:37:46 -0000 1.89
@@ -47,4 +47,6 @@
#include "MFolder.h"
+#include "MFilterLang.h" // for SPAM_TEST_XXX constants
+
#include <wx/window.h>
#include <wx/confbase.h>
@@ -350,5 +352,5 @@
// enable the controls corresponding to the current m_Type value
- void UpdateUI();
+ void UpdateUI(wxTextCtrl *textProgram);
// show the details dialog: called by CritDetailsButton::OnClick()
@@ -364,8 +366,8 @@
private:
// create the spam button and position it correctly
- void CreateSpamButton();
+ void CreateSpamButton(const String& rule);
// initialize m_checkXXX vars(called from CreateSpamButton())
- void InitSpamOptions();
+ void InitSpamOptions(const String& rule);
// return the string containing the argument for the isspam() test
@@ -511,9 +513,9 @@
void
-OneCritControl::CreateSpamButton()
+OneCritControl::CreateSpamButton(const String& rule)
{
ASSERT_MSG( !m_btnSpam, "CreateSpamButton() called twice?" );
- InitSpamOptions();
+ InitSpamOptions(rule);
m_btnSpam = new CritDetailsButton(m_Parent, this);
@@ -530,5 +532,5 @@
void
-OneCritControl::UpdateUI()
+OneCritControl::UpdateUI(wxTextCtrl *textProgram)
{
int test = m_Type->GetSelection();
@@ -542,5 +544,5 @@
if ( !m_btnSpam )
{
- CreateSpamButton();
+ CreateSpamButton(textProgram->GetValue());
}
@@ -558,6 +560,6 @@
//
// NB: don't call SetValue() unconditionally because it results in
- // another callback generated by wxGTK even if the text control is
- // already empty!
+ // another callback generated by wxGTK even if the text control
+ // is already empty!
if ( !m_Argument->GetValue().empty() )
{
@@ -676,14 +678,16 @@
void
-OneCritControl::InitSpamOptions()
+OneCritControl::InitSpamOptions(const String& rule)
{
- m_check8bit = MP_SPAM_8BIT_SUBJECT_D;
- m_checkKorean = MP_SPAM_KOREAN_CSET_D;
+ // this is really crude but should work in common case when there is only
+ // one spam test in the rule
+ m_check8bit = strstr(rule, SPAM_TEST_SUBJ8BIT) != 0;
+ m_checkKorean = strstr(rule, SPAM_TEST_KOREAN) != 0;
- m_checkXAuthWarn = MP_SPAM_X_AUTH_WARN_D;
- m_checkHtml = MP_SPAM_HTML_D;
+ m_checkXAuthWarn = strstr(rule, SPAM_TEST_XAUTHWARN) != 0;
+ m_checkHtml = strstr(rule, SPAM_TEST_HTML) != 0;
#ifdef USE_RBL
- m_checkRBL = MP_SPAM_RBL_D;
+ m_checkRBL = strstr(rule, SPAM_TEST_RBL) != 0;
#endif // USE_RBL
}
@@ -747,18 +751,15 @@
CHECK( m_btnSpam, s, "shouldn't be called if spam button not used" );
- // these strings are the same as in Filters.cpp (of course we should have a
- // common header for them... TODO!)
-
if ( m_check8bit )
- AddToSpamArgument(s, "subj8bit");
+ AddToSpamArgument(s, SPAM_TEST_SUBJ8BIT);
if ( m_checkKorean )
- AddToSpamArgument(s, "korean");
+ AddToSpamArgument(s, SPAM_TEST_KOREAN);
if ( m_checkXAuthWarn )
- AddToSpamArgument(s, "xauthwarn");
+ AddToSpamArgument(s, SPAM_TEST_XAUTHWARN);
if ( m_checkHtml )
- AddToSpamArgument(s, "html");
+ AddToSpamArgument(s, SPAM_TEST_HTML);
#ifdef USE_RBL
if ( m_checkRBL )
- AddToSpamArgument(s, "rbl");
+ AddToSpamArgument(s, SPAM_TEST_RBL);
#endif // USE_RBL
@@ -1129,5 +1130,5 @@
for ( size_t idx = 0; idx < m_nControls; idx++ )
{
- m_CritControl[idx]->UpdateUI();
+ m_CritControl[idx]->UpdateUI(m_textProgram);
}
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates