2007-06-17 [colin] 2.9.2cvs67
[claws.git] / src / procmsg.c
index dca1f98458cdc446da439bb431d3a0a5913ae97c..04b4b76f20e9e76c9a1846144157a43939a06b91 100644 (file)
@@ -665,8 +665,10 @@ static void procmsg_empty_trash(FolderItem *trash)
                GSList *cur;
                for (cur = mlist ; cur != NULL ; cur = cur->next) {
                        MsgInfo * msginfo = (MsgInfo *) cur->data;
-                       if (MSG_IS_LOCKED(msginfo->flags))
+                       if (MSG_IS_LOCKED(msginfo->flags)) {
+                               procmsg_msginfo_free(msginfo);
                                continue;
+                       }
                        if (msginfo->total_size != 0 && 
                            msginfo->size != (off_t)msginfo->total_size)
                                partial_mark_for_delete(msginfo);
@@ -855,7 +857,7 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, gchar **errstr)
        
        if (send_queue_lock) {
                /* Avoid having to translate two similar strings */
-               log_warning("%s\n", _("Already trying to send."));
+               log_warning(LOG_PROTOCOL, "%s\n", _("Already trying to send."));
                if (errstr) {
                        if (*errstr) g_free(*errstr);
                        *errstr = g_strdup_printf(_("Already trying to send."));
@@ -919,7 +921,9 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, gchar **errstr)
                while (node != NULL) {
                        int res = 0;
                        next = node->next;
+                       send_queue_lock = FALSE;
                        res = procmsg_send_queue(FOLDER_ITEM(node->data), save_msgs, errstr);
+                       send_queue_lock = TRUE;
                        if (res < 0) 
                                err = -res;
                        else
@@ -1741,8 +1745,13 @@ send_mail:
                        }
                        
                        if (msginfo != NULL) {
+                               MsgPermFlags to_unset = 0;
+
+                               if (prefs_common.mark_as_read_on_new_window)
+                                       to_unset = (MSG_NEW|MSG_UNREAD);
+
                                if (replymessageid != NULL) {
-                                       procmsg_msginfo_unset_flags(msginfo, MSG_FORWARDED, 0);
+                                       procmsg_msginfo_unset_flags(msginfo, to_unset|MSG_FORWARDED, 0);
                                        procmsg_msginfo_set_flags(msginfo, MSG_REPLIED, 0);
                                }  else {
                                        procmsg_msginfo_unset_flags(msginfo, MSG_REPLIED, 0);
@@ -2113,13 +2122,15 @@ static gboolean procmsg_msginfo_filter(MsgInfo *msginfo, PrefsAccount* ac_prefs)
        mail_filtering_data.filtered = NULL;                    
        mail_filtering_data.unfiltered = NULL;
        mail_filtering_data.account = ac_prefs; 
-       if (hooks_invoke(MAIL_FILTERING_HOOKLIST, &mail_filtering_data)) {
+
+       if (!ac_prefs || ac_prefs->filterhook_on_recv)
+               if (hooks_invoke(MAIL_FILTERING_HOOKLIST, &mail_filtering_data))
                return TRUE;
-       }
 
        /* filter if enabled in prefs or move to inbox if not */
        if((filtering_rules != NULL) &&
-          filter_message_by_msginfo(filtering_rules, msginfo, ac_prefs)) {
+               filter_message_by_msginfo(filtering_rules, msginfo, ac_prefs,
+                               FILTERING_INCORPORATION, NULL)) {
                return TRUE;
        }
                
@@ -2159,6 +2170,7 @@ void procmsg_msglist_filter(GSList *list, PrefsAccount *ac,
        mail_filtering_data.unfiltered = NULL;  
        mail_filtering_data.account = ac;       
                        
+       if (!ac || ac->filterhook_on_recv)
        hooks_invoke(MAIL_LISTFILTERING_HOOKLIST, &mail_filtering_data);
        
        if (mail_filtering_data.filtered == NULL &&