* src/filtering.[ch]
authorChristoph Hohmann <reboot@gmx.ch>
Mon, 25 Feb 2002 16:56:22 +0000 (16:56 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Mon, 25 Feb 2002 16:56:22 +0000 (16:56 +0000)
* src/inc.c
        do filtering stuff after all messages have been received
          1. drop all messages to .processing
          2. scan processing folder for messages
          3. filter messages or move to inbox
        this will also find old messages left in processing after
        a crash or something like that and we get a real msginfo
        from folder->get_msg_list and do not have to create our
        own in filter_message
* src/matcher_parser_parse.y
        remove MIX/MAX warning (reordered includes)

ChangeLog.claws
configure.in
src/filtering.c
src/filtering.h
src/inc.c
src/matcher_parser_parse.y

index 5bd9e80ee2fe3758c48ed03d105b51687c0d43cd..d9c1410cf309cde92f72e673402832f76d7f47ca 100644 (file)
@@ -1,3 +1,18 @@
+2002-02-15 [christoph] 0.7.2claws14
+
+       * src/filtering.[ch]
+       * src/inc.c
+               do filtering stuff after all messages have been received
+                 1. drop all messages to .processing
+                 2. scan processing folder for messages
+                 3. filter messages or move to inbox
+               this will also find old messages left in processing after
+               a crash or something like that and we get a real msginfo
+               from folder->get_msg_list and do not have to create our
+               own in filter_message
+       * src/matcher_parser_parse.y
+               remove MIX/MAX warning (reordered includes)
+
 2002-02-25 [paul]      0.7.2claws13
 
        * sync with sylpheed 0.7.2cvs15
 2002-02-25 [paul]      0.7.2claws13
 
        * sync with sylpheed 0.7.2cvs15
index 7e0449303d1e027286b9cc9903baa6fe1f18d0a6..ab850ff18ccc2321b136745d57173fcad7bc4c64 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws13
+EXTRA_VERSION=claws14
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index ad1c156b5ab35b2ae677251a283c905f04b1b708..8505311a86f4127ead0a5f4b42fe6a7b7addc077 100644 (file)
@@ -355,21 +355,26 @@ static void filter_msginfo(GSList * filtering_list, FolderItem *inbox,
  *\param       info message
  *\param       ftable table with changed folders after call
  */
  *\param       info message
  *\param       ftable table with changed folders after call
  */
-void filter_message_by_msginfo(GSList *flist, MsgInfo *info, GHashTable *ftable)
+void filter_message_by_msginfo_with_inbox(GSList *flist, MsgInfo *info, GHashTable *ftable, FolderItem *def_inbox)
 {
        FolderItem *inbox;
 
 {
        FolderItem *inbox;
 
-       if (info->folder == NULL) {
+       if ((def_inbox == NULL)) {
                debug_print("using default inbox as final destination!\n");
                debug_print("using default inbox as final destination!\n");
-               inbox = folder_get_default_inbox(); 
+               inbox = folder_get_default_inbox();
        } else
        } else
-               inbox = info->folder;
+               inbox = def_inbox;
 
        /*
         * message is already in a folder. the filtering code will
         * handle duplicate moves and copies.
         */
 
        /*
         * message is already in a folder. the filtering code will
         * handle duplicate moves and copies.
         */
-       filter_msginfo(flist, inbox,  info, ftable);
+       filter_msginfo(flist, inbox, info, ftable);
+}
+
+void filter_message_by_msginfo(GSList *flist, MsgInfo *info, GHashTable *ftable)
+{
+       filter_message_by_msginfo_with_inbox(flist, info, ftable, info->folder);
 }
 
 /*!
 }
 
 /*!
index de71158e50b8f1983394574e755769c081544deb..3c9124ccd2eaa9bdb6cd0e0159d5f8c00ee14007 100644 (file)
@@ -59,6 +59,11 @@ FilteringProp * filteringprop_parse(gchar **str);
 
 void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info,
                                   GHashTable *folder_table);
 
 void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info,
                                   GHashTable *folder_table);
+void filter_message_by_msginfo_with_inbox(GSList *flist, MsgInfo *info, 
+                                         GHashTable *ftable,
+                                         FolderItem *def_inbox);
+void filter_message_by_msginfo(GSList *flist, MsgInfo *info, 
+                              GHashTable *ftable);
 void filter_message(GSList *filtering_list, FolderItem *inbox,
                    gint msgnum, GHashTable *folder_table);
 
 void filter_message(GSList *filtering_list, FolderItem *inbox,
                    gint msgnum, GHashTable *folder_table);
 
index db6754baeadb15ea0b7df60ef28d807f0a3ea2d0..3aa76aca1a6dcfb2874ab094f913047ce8e5f1ac 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -504,6 +504,47 @@ static gint inc_start(IncProgressDialog *inc_dialog)
 
                statusbar_pop_all();
 
 
                statusbar_pop_all();
 
+               /* CLAWS: perform filtering actions on dropped message */
+               if (global_processing != NULL) {
+                       FolderItem *processing, *inbox;
+                       Folder *folder;
+                       MsgInfo *msginfo;
+                       GSList *msglist, *msglist_element;
+
+                       /* CLAWS: get default inbox (perhaps per account) */
+                       if (pop3_state->ac_prefs->inbox) {
+                               /* CLAWS: get destination folder / mailbox */
+                               inbox = folder_find_item_from_identifier(pop3_state->ac_prefs->inbox);
+                               if (!inbox)
+                                       inbox = folder_get_default_inbox();
+                       } else
+                               inbox = folder_get_default_inbox();
+
+                       /* get list of messages in processing */
+                       processing = folder_get_default_processing();
+                       folder_item_scan(processing);
+                       folder = processing->folder;
+                       msglist = folder->get_msg_list(folder, processing, FALSE);
+
+                       /* process messages */
+                       for(msglist_element = msglist; msglist_element != NULL; msglist_element = msglist_element->next) {
+                               msginfo = (MsgInfo *) msglist_element->data;
+                               /* filter if enabled in prefs or move to inbox if not */
+                               if(pop3_state->ac_prefs->filter_on_recv) {
+                                       filter_message_by_msginfo_with_inbox(global_processing, msginfo,
+                                                                            pop3_state->folder_table,
+                                                                            inbox);
+                               } else {
+                                       folder_item_move_msg(inbox, msginfo);
+                                       g_hash_table_insert(pop3_state->folder_table, inbox,
+                                                           GINT_TO_POINTER(1));
+                               }
+                               procmsg_msginfo_free(msginfo);
+                       }
+                       g_slist_free(msglist);
+               }
+
+
                new_msgs += pop3_state->cur_total_num;
 
                if (!prefs_common.scan_all_after_inc) {
                new_msgs += pop3_state->cur_total_num;
 
                if (!prefs_common.scan_all_after_inc) {
@@ -923,13 +964,6 @@ gint inc_drop_message(const gchar *file, Pop3State *state)
                return -1;
        }
 
                return -1;
        }
 
-       /* CLAWS: perform filtering actions on dropped message */
-       if (global_processing != NULL) { 
-               if (state->ac_prefs->filter_on_recv)
-                       filter_message(global_processing, inbox, msgnum,
-                                      state->folder_table);
-       }
-
        return 0;
 }
 
        return 0;
 }
 
index 33a4bfd0c4c0de7b546585fe481241370fc27b1a..41d1503f561f80abe4f3f2493fb901405e9f169b 100644 (file)
@@ -1,13 +1,15 @@
 %{
 %{
+#include "defs.h"
+
+#include <glib.h>
+
+#include "intl.h"
+#include "utils.h"
 #include "filtering.h"
 #include "scoring.h"
 #include "matcher.h"
 #include "matcher_parser.h"
 #include "matcher_parser_lex.h"
 #include "filtering.h"
 #include "scoring.h"
 #include "matcher.h"
 #include "matcher_parser.h"
 #include "matcher_parser_lex.h"
-#include "intl.h"
-#include <glib.h>
-#include "defs.h"
-#include "utils.h"
 
 static gint error = 0;
 static gint bool_op = 0;
 
 static gint error = 0;
 static gint bool_op = 0;