* 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 5bd9e80..d9c1410 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
index 7e04493..ab850ff 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 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
index ad1c156..8505311 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
  */
-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;
 
-       if (info->folder == NULL) {
+       if ((def_inbox == NULL)) {
                debug_print("using default inbox as final destination!\n");
-               inbox = folder_get_default_inbox(); 
+               inbox = folder_get_default_inbox();
        } else
-               inbox = info->folder;
+               inbox = def_inbox;
 
        /*
         * 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 de71158..3c9124c 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_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);
 
index db6754b..3aa76ac 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -504,6 +504,47 @@ static gint inc_start(IncProgressDialog *inc_dialog)
 
                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) {
@@ -923,13 +964,6 @@ gint inc_drop_message(const gchar *file, Pop3State *state)
                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;
 }
 
index 33a4bfd..41d1503 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 "intl.h"
-#include <glib.h>
-#include "defs.h"
-#include "utils.h"
 
 static gint error = 0;
 static gint bool_op = 0;