diff --git a/ChangeLog b/ChangeLog index 33ebae975..2322722db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-02-24 [colin] 2.0.0cvs83 + + * src/procmsg.c + * src/summaryview.c + * src/summaryview.h + * src/plugins/spamassassin/spamassassin.c + * src/plugins/spamassassin/spamassassin.h + * src/plugins/spamassassin/spamassassin_gtk.c + Unregister learner when spamassassin is either + disabled or over tcp + 2006-02-24 [colin] 2.0.0cvs82 * src/Makefile.am diff --git a/PATCHSETS b/PATCHSETS index b95e02a36..aee8d9d3e 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -1266,3 +1266,4 @@ ( cvs diff -u -r 1.274.2.98 -r 1.274.2.99 src/mainwindow.c; ) > 2.0.0cvs80.patchset ( cvs diff -u -r 1.382.2.246 -r 1.382.2.247 src/compose.c; cvs diff -u -r 1.50.2.21 -r 1.50.2.22 src/compose.h; cvs diff -u -r 1.60.2.13 -r 1.60.2.14 src/filtering.c; ) > 2.0.0cvs81.patchset ( cvs diff -u -r 1.155.2.35 -r 1.155.2.36 src/Makefile.am; cvs diff -u -r 1.274.2.99 -r 1.274.2.100 src/mainwindow.c; cvs diff -u -r 1.39.2.12 -r 1.39.2.13 src/mainwindow.h; cvs diff -u -r 1.150.2.51 -r 1.150.2.52 src/procmsg.c; cvs diff -u -r 1.60.2.23 -r 1.60.2.24 src/procmsg.h; cvs diff -u -r 1.25.2.20 -r 1.25.2.21 src/stock_pixmap.c; cvs diff -u -r 1.18.2.14 -r 1.18.2.15 src/stock_pixmap.h; cvs diff -u -r 1.395.2.173 -r 1.395.2.174 src/summaryview.c; cvs diff -u -r 1.68.2.15 -r 1.68.2.16 src/summaryview.h; cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/gtk/icon_legend.c; diff -u /dev/null src/pixmaps/spam.xpm; cvs diff -u -r 1.18.2.17 -r 1.18.2.18 src/plugins/spamassassin/spamassassin.c; cvs diff -u -r 1.23.2.18 -r 1.23.2.19 src/plugins/spamassassin/spamassassin_gtk.c; ) > 2.0.0cvs82.patchset +( cvs diff -u -r 1.150.2.52 -r 1.150.2.53 src/procmsg.c; cvs diff -u -r 1.395.2.174 -r 1.395.2.175 src/summaryview.c; cvs diff -u -r 1.68.2.16 -r 1.68.2.17 src/summaryview.h; cvs diff -u -r 1.18.2.18 -r 1.18.2.19 src/plugins/spamassassin/spamassassin.c; cvs diff -u -r 1.4.2.6 -r 1.4.2.7 src/plugins/spamassassin/spamassassin.h; cvs diff -u -r 1.23.2.19 -r 1.23.2.20 src/plugins/spamassassin/spamassassin_gtk.c; ) > 2.0.0cvs83.patchset diff --git a/configure.ac b/configure.ac index fa6a821ee..eba970322 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=0 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=82 +EXTRA_VERSION=83 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/plugins/spamassassin/spamassassin.c b/src/plugins/spamassassin/spamassassin.c index 10ab2ea84..ed48d70be 100644 --- a/src/plugins/spamassassin/spamassassin.c +++ b/src/plugins/spamassassin/spamassassin.c @@ -360,15 +360,19 @@ gint plugin_init(gchar **error) prefs_read_config(param, "SpamAssassin", rcpath, NULL); g_free(rcpath); spamassassin_gtk_init(); - - procmsg_register_spam_learner(spamassassin_learn); - procmsg_spam_set_folder(config.save_folder); - + debug_print("Spamassassin plugin loaded\n"); if (config.transport == SPAMASSASSIN_DISABLED) { log_error("Spamassassin plugin is loaded but disabled by its preferences.\n"); } + + if (config.transport != SPAMASSASSIN_DISABLED && + config.transport != SPAMASSASSIN_TRANSPORT_TCP) { + procmsg_register_spam_learner(spamassassin_learn); + procmsg_spam_set_folder(config.save_folder); + } else if (config.transport == SPAMASSASSIN_TRANSPORT_TCP) + debug_print("disabling learner as it only works locally\n"); return 0; diff --git a/src/plugins/spamassassin/spamassassin.h b/src/plugins/spamassassin/spamassassin.h index 4874ef828..e0526b856 100644 --- a/src/plugins/spamassassin/spamassassin.h +++ b/src/plugins/spamassassin/spamassassin.h @@ -50,5 +50,5 @@ void spamassassin_save_config (void); void spamassassin_set_message_callback (MessageCallback callback); gint spamassassin_gtk_init(void); void spamassassin_gtk_done(void); - +void spamassassin_learn(MsgInfo *msginfo, GSList *msglist, gboolean spam); #endif diff --git a/src/plugins/spamassassin/spamassassin_gtk.c b/src/plugins/spamassassin/spamassassin_gtk.c index eefbb2c9f..2c7793610 100644 --- a/src/plugins/spamassassin/spamassassin_gtk.c +++ b/src/plugins/spamassassin/spamassassin_gtk.c @@ -439,7 +439,16 @@ static void spamassassin_save_func(PrefsPage *_page) /* timeout */ config->timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->timeout)); - procmsg_spam_set_folder(config->save_folder); + if (config->transport == SPAMASSASSIN_DISABLED || + config->transport == SPAMASSASSIN_TRANSPORT_TCP) { + procmsg_unregister_spam_learner(spamassassin_learn); + procmsg_spam_set_folder(NULL); + if (config->transport == SPAMASSASSIN_TRANSPORT_TCP) + debug_print("disabling learner as it only works locally\n"); + } else { + procmsg_register_spam_learner(spamassassin_learn); + procmsg_spam_set_folder(config->save_folder); + } spamassassin_save_config(); } diff --git a/src/procmsg.c b/src/procmsg.c index 56a23b502..c1c877fcd 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -42,6 +42,8 @@ #include "hooks.h" #include "msgcache.h" #include "partial_download.h" +#include "mainwindow.h" +#include "summaryview.h" static gint procmsg_send_message_queue_full(const gchar *file, gboolean keep_session); @@ -2073,11 +2075,21 @@ void procmsg_register_spam_learner (void (*learn_func)(MsgInfo *info, GSList *li { if (!g_slist_find(spam_learners, learn_func)) spam_learners = g_slist_append(spam_learners, learn_func); + if (mainwindow_get_mainwindow()) { + main_window_set_menu_sensitive(mainwindow_get_mainwindow()); + summary_set_menu_sensitive( + mainwindow_get_mainwindow()->summaryview); + } } void procmsg_unregister_spam_learner (void (*learn_func)(MsgInfo *info, GSList *list, gboolean spam)) { spam_learners = g_slist_remove(spam_learners, learn_func); + if (mainwindow_get_mainwindow()) { + main_window_set_menu_sensitive(mainwindow_get_mainwindow()); + summary_set_menu_sensitive( + mainwindow_get_mainwindow()->summaryview); + } } gboolean procmsg_spam_can_learn(void) diff --git a/src/summaryview.c b/src/summaryview.c index 01b1cf283..606f25586 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -139,7 +139,7 @@ static void summary_set_marks_func (GtkCTree *ctree, GtkCTreeNode *node, gpointer data); -static void summary_set_menu_sensitive (SummaryView *summaryview); +void summary_set_menu_sensitive (SummaryView *summaryview); static void summary_set_hide_read_msgs_menu (SummaryView *summaryview, guint action); @@ -1300,7 +1300,7 @@ GSList *summary_get_msg_list(SummaryView *summaryview) return mlist; } -static void summary_set_menu_sensitive(SummaryView *summaryview) +void summary_set_menu_sensitive(SummaryView *summaryview) { GtkItemFactory *ifactory = summaryview->popupfactory; SensitiveCond state; diff --git a/src/summaryview.h b/src/summaryview.h index 39265d5fb..6d126440b 100644 --- a/src/summaryview.h +++ b/src/summaryview.h @@ -290,4 +290,5 @@ void summaryview_lock(SummaryView *summaryview, FolderItem *item); void summaryview_unlock(SummaryView *summaryview, FolderItem *item); void summary_reflect_prefs(void); void summaryview_activate_quicksearch(SummaryView *summaryview); +void summary_set_menu_sensitive (SummaryView *summaryview); #endif /* __SUMMARY_H__ */