2006-02-24 [colin] 2.0.0cvs83
authorColin Leroy <colin@colino.net>
Fri, 24 Feb 2006 19:20:17 +0000 (19:20 +0000)
committerColin Leroy <colin@colino.net>
Fri, 24 Feb 2006 19:20:17 +0000 (19:20 +0000)
* 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

ChangeLog
PATCHSETS
configure.ac
src/plugins/spamassassin/spamassassin.c
src/plugins/spamassassin/spamassassin.h
src/plugins/spamassassin/spamassassin_gtk.c
src/procmsg.c
src/summaryview.c
src/summaryview.h

index 33ebae9..2322722 100644 (file)
--- 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
index b95e02a..aee8d9d 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index fa6a821..eba9703 100644 (file)
@@ -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=
 
index 10ab2ea..ed48d70 100644 (file)
@@ -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;
        
index 4874ef8..e0526b8 100644 (file)
@@ -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
index eefbb2c..2c77936 100644 (file)
@@ -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();
 }
 
index 56a23b5..c1c877f 100644 (file)
@@ -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)
index 01b1cf2..606f255 100644 (file)
@@ -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;
index 39265d5..6d12644 100644 (file)
@@ -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__ */