make sure that we use the inbox set per account when filtering
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 6 Dec 2001 20:48:32 +0000 (20:48 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 6 Dec 2001 20:48:32 +0000 (20:48 +0000)
ChangeLog.claws
configure.in
src/filtering.c
src/filtering.h
src/inc.c

index 020bb05..93cd825 100644 (file)
@@ -1,3 +1,11 @@
+2001-12-06 [alfons]    0.6.5claws55
+
+       * src/filtering.[ch]
+       * src/inc.c
+               revise filtering a little bit more, and make sure
+               messages are delivered to the appropriate inbox
+               (perhaps set per account)
+
 2001-12-06 [paul]      0.6.5claws54
 
        * sync with sylpheed 0.6.5cvs22
 2001-12-06 [paul]      0.6.5claws54
 
        * sync with sylpheed 0.6.5cvs22
index 512fd4f..ecb211a 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws54
+EXTRA_VERSION=claws55
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 13c200a..c36b32b 100644 (file)
@@ -509,12 +509,11 @@ static gboolean filteringprop_apply(FilteringProp * filtering, MsgInfo * info,
                return FALSE;
 }
 
                return FALSE;
 }
 
-void filter_msginfo(GSList * filtering_list, MsgInfo * info,
-                   GHashTable *folder_table)
+static void filter_msginfo(GSList * filtering_list, FolderItem *inbox,
+                          MsgInfo * info, GHashTable *folder_table)
 {
        GSList          *l;
        gboolean         result;
 {
        GSList          *l;
        gboolean         result;
-       FolderItem      *inbox;
        
        if (info == NULL) {
                g_warning(_("msginfo is not set"));
        
        if (info == NULL) {
                g_warning(_("msginfo is not set"));
@@ -531,9 +530,6 @@ void filter_msginfo(GSList * filtering_list, MsgInfo * info,
        if (!result) {
                gint val;
 
        if (!result) {
                gint val;
 
-               inbox = folder_get_default_inbox();
-               g_assert(inbox);
-               
                if (folder_item_move_msg(inbox, info) == -1) {
                        debug_print(_("*** Could not drop message in inbox; still in .processing\n"));
                        return;
                if (folder_item_move_msg(inbox, info) == -1) {
                        debug_print(_("*** Could not drop message in inbox; still in .processing\n"));
                        return;
@@ -573,12 +569,13 @@ void filter_msginfo_move_or_delete(GSList * filtering_list, MsgInfo * info,
        }
 }
 
        }
 }
 
-void filter_message(GSList * filtering_list, FolderItem * item,
+void filter_message(GSList *filtering_list, FolderItem *inbox,
                    gint msgnum, GHashTable *folder_table)
 {
                    gint msgnum, GHashTable *folder_table)
 {
-       MsgInfo * msginfo;
-       gchar * filename;
+       MsgInfo *msginfo;
+       gchar *filename;
        MsgFlags  msgflags = { 0, 0 };
        MsgFlags  msgflags = { 0, 0 };
+       FolderItem *item = folder_get_default_processing();
 
        if (item == NULL) {
                g_warning(_("folderitem not set"));
 
        if (item == NULL) {
                g_warning(_("folderitem not set"));
@@ -604,7 +601,7 @@ void filter_message(GSList * filtering_list, FolderItem * item,
        msginfo->folder = item;
        msginfo->msgnum = msgnum;
 
        msginfo->folder = item;
        msginfo->msgnum = msgnum;
 
-       filter_msginfo(filtering_list, msginfo, folder_table);
+       filter_msginfo(filtering_list, inbox, msginfo, folder_table);
 }
 
 gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *action)
 }
 
 gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *action)
index d670509..9382fd9 100644 (file)
 #include "procmsg.h"
 
 struct _FilteringAction {
 #include "procmsg.h"
 
 struct _FilteringAction {
-       gint type;
-       gint account_id;
-       gchar *destination;
-       gint labelcolor;
+       gint    type;
+       gint    account_id;
+       gchar  *destination;
+       gint    labelcolor;
 };
 
 typedef struct _FilteringAction FilteringAction;
 };
 
 typedef struct _FilteringAction FilteringAction;
@@ -45,32 +45,29 @@ typedef struct _FilteringProp FilteringProp;
 
 
 FilteringAction * filteringaction_new(int type, int account_id,
 
 
 FilteringAction * filteringaction_new(int type, int account_id,
-                                     gchar * destination,
+                                     gchar *destination,
                                      gint labelcolor);
                                      gint labelcolor);
-void filteringaction_free(FilteringAction * action);
-FilteringAction * filteringaction_parse(gchar ** str);
+void filteringaction_free(FilteringAction *action);
+FilteringAction * filteringaction_parse(gchar **str);
 
 
-FilteringProp * filteringprop_new(MatcherList * matchers,
-                                 FilteringAction * action);
-void filteringprop_free(FilteringProp * prop);
+FilteringProp * filteringprop_new(MatcherList *matchers,
+                                 FilteringAction *action);
+void filteringprop_free(FilteringProp *prop);
 
 
-FilteringProp * filteringprop_parse(gchar ** str);
+FilteringProp * filteringprop_parse(gchar **str);
 
 
-
-void filter_msginfo(GSList * filtering_list, MsgInfo * info,
-                   GHashTable *folder_table);
-void filter_msginfo_move_or_delete(GSList * filtering_list, MsgInfo * info,
+void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info,
                                   GHashTable *folder_table);
                                   GHashTable *folder_table);
-void filter_message(GSList * filtering_list, FolderItem * item,
+void filter_message(GSList *filtering_list, FolderItem *inbox,
                    gint msgnum, GHashTable *folder_table);
 
                    gint msgnum, GHashTable *folder_table);
 
-gchar * filteringaction_to_string(gchar *dest, gint destlen, FilteringAction * action);
+gchar * filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *action);
 void prefs_filtering_write_config(void);
 void prefs_filtering_read_config(void);
 void prefs_filtering_write_config(void);
 void prefs_filtering_read_config(void);
-gchar * filteringprop_to_string(FilteringProp * prop);
+gchar * filteringprop_to_string(FilteringProp *prop);
 
 void prefs_filtering_clear();
 
 void prefs_filtering_clear();
-void prefs_filtering_free(GSList * prefs_filtering);
+void prefs_filtering_free(GSList *prefs_filtering);
 
 extern GSList * global_processing;
 
 
 extern GSList * global_processing;
 
index 58de021..8fac19b 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -882,8 +882,8 @@ gint inc_drop_message(const gchar *file, Pop3State *state)
        FolderItem *dropfolder;
        gint val;
        gint msgnum;
        FolderItem *dropfolder;
        gint val;
        gint msgnum;
-       FolderItem *filtering_folder = folder_get_default_processing();
 
 
+       /* get default inbox (perhaps per account) */
        if (state->ac_prefs->inbox) {
                inbox = folder_find_item_from_path(state->ac_prefs->inbox);
                if (!inbox)
        if (state->ac_prefs->inbox) {
                inbox = folder_find_item_from_path(state->ac_prefs->inbox);
                if (!inbox)
@@ -908,8 +908,8 @@ gint inc_drop_message(const gchar *file, Pop3State *state)
                } else
                        dropfolder = inbox;
        } else {
                } else
                        dropfolder = inbox;
        } else {
-               /* new filtering */
-               dropfolder = filtering_folder;
+               /* CLAWS: new filtering */
+               dropfolder = folder_get_default_processing();
        }
 
        val = GPOINTER_TO_INT(g_hash_table_lookup
        }
 
        val = GPOINTER_TO_INT(g_hash_table_lookup
@@ -920,15 +920,16 @@ gint inc_drop_message(const gchar *file, Pop3State *state)
                                    GINT_TO_POINTER(1));
        }
        
                                    GINT_TO_POINTER(1));
        }
        
+       /* add msg file to drop folder */
        if ((msgnum = folder_item_add_msg(dropfolder, file, TRUE)) < 0) {
                unlink(file);
                return -1;
        }
 
        if ((msgnum = folder_item_add_msg(dropfolder, file, TRUE)) < 0) {
                unlink(file);
                return -1;
        }
 
+       /* CLAWS: perform filtering actions on dropped message */
        if (global_processing != NULL) { 
        if (global_processing != NULL) { 
-               /* new filtering */
                if (state->ac_prefs->filter_on_recv)
                if (state->ac_prefs->filter_on_recv)
-                       filter_message(global_processing, dropfolder, msgnum,
+                       filter_message(global_processing, inbox, msgnum,
                                       state->folder_table);
        }
 
                                       state->folder_table);
        }