2006-03-16 [colin] 2.0.0cvs141
authorColin Leroy <colin@colino.net>
Thu, 16 Mar 2006 18:13:25 +0000 (18:13 +0000)
committerColin Leroy <colin@colino.net>
Thu, 16 Mar 2006 18:13:25 +0000 (18:13 +0000)
* src/procmsg.h
* src/procmsg.c
* src/folder.c
Fix POSTPROCESSING hook
Patch by H. Merijn Brand

* src/procmime.c
* src/procmime.h
Parse Content-Location

* src/toolbar.c
* src/messageview.c
* src/messageview.h
Don't crash when a top-level MessageView has
been closed on us. Same problematic than
yesterday's quicksearch issue.

ChangeLog
PATCHSETS
configure.ac
src/folder.c
src/messageview.c
src/messageview.h
src/procmime.c
src/procmime.h
src/procmsg.c
src/procmsg.h
src/toolbar.c

index 71ace855a2b6d2ad384d41006df0d4e6e82cfc2a..b652410ff1ae1037f5be753b9bd0a35fa23b5fd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2006-03-16 [colin]     2.0.0cvs141
+
+       * src/procmsg.h
+       * src/procmsg.c
+       * src/folder.c
+               Fix POSTPROCESSING hook
+               Patch by H. Merijn Brand
+
+       * src/procmime.c
+       * src/procmime.h
+               Parse Content-Location
+
+       * src/toolbar.c
+       * src/messageview.c
+       * src/messageview.h
+               Don't crash when a top-level MessageView has
+               been closed on us. Same problematic than
+               yesterday's quicksearch issue.
+
 2006-03-15 [colin]     2.0.0cvs140
 
        * src/gtk/quicksearch.c
 2006-03-15 [colin]     2.0.0cvs140
 
        * src/gtk/quicksearch.c
index 96e115b157cd8db8b927cec94b389f723ce9af24..45092a2b8cca90117d768f4d0be1eb5893db6a10 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.5.2.20 -r 1.5.2.21 src/prefs_spelling.c;  ) > 2.0.0cvs138.patchset
 ( cvs diff -u -r 1.17.2.21 -r 1.17.2.22 src/alertpanel.c;  ) > 2.0.0cvs139.patchset
 ( cvs diff -u -r 1.1.2.34 -r 1.1.2.35 src/gtk/quicksearch.c;  cvs diff -u -r 1.395.2.181 -r 1.395.2.182 src/summaryview.c;  ) > 2.0.0cvs140.patchset
 ( cvs diff -u -r 1.5.2.20 -r 1.5.2.21 src/prefs_spelling.c;  ) > 2.0.0cvs138.patchset
 ( cvs diff -u -r 1.17.2.21 -r 1.17.2.22 src/alertpanel.c;  ) > 2.0.0cvs139.patchset
 ( cvs diff -u -r 1.1.2.34 -r 1.1.2.35 src/gtk/quicksearch.c;  cvs diff -u -r 1.395.2.181 -r 1.395.2.182 src/summaryview.c;  ) > 2.0.0cvs140.patchset
+( cvs diff -u -r 1.150.2.57 -r 1.150.2.58 src/procmsg.c;  cvs diff -u -r 1.60.2.26 -r 1.60.2.27 src/procmsg.h;  cvs diff -u -r 1.213.2.85 -r 1.213.2.86 src/folder.c;  cvs diff -u -r 1.49.2.74 -r 1.49.2.75 src/procmime.c;  cvs diff -u -r 1.17.2.14 -r 1.17.2.15 src/procmime.h;  cvs diff -u -r 1.43.2.41 -r 1.43.2.42 src/toolbar.c;  cvs diff -u -r 1.94.2.80 -r 1.94.2.81 src/messageview.c;  cvs diff -u -r 1.19.2.7 -r 1.19.2.8 src/messageview.h;  ) > 2.0.0cvs141.patchset
index 9a0d1fcaf86d219adfbf80e30185fadbd219aa37..831101b2b3268e40c6f01cfb04432960a6686d0f 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=140
+EXTRA_VERSION=141
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index eb6905e201c801386e77c88f2c2c2b0c5b99cb5e..47985fc48ba608e86b0a1602f6ef105d2cbb3718 100644 (file)
@@ -2894,6 +2894,11 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
                            == POP3_PARTIAL_DLOAD_DLOAD) {
                                partial_mark_for_download(newmsginfo);
                        }
                            == POP3_PARTIAL_DLOAD_DLOAD) {
                                partial_mark_for_download(newmsginfo);
                        }
+                       if (!MSG_IS_POSTFILTERED (msginfo->flags)) {
+                           procmsg_msginfo_set_flags (   msginfo, MSG_POSTFILTERED, 0);
+                           procmsg_msginfo_set_flags (newmsginfo, MSG_POSTFILTERED, 0);
+                           hooks_invoke (MAIL_POSTFILTERING_HOOKLIST, newmsginfo);
+                       }
                        procmsg_msginfo_free(newmsginfo);
 
 
                        procmsg_msginfo_free(newmsginfo);
 
 
index ce9296d74e4fca1d6c452d176ae58e9ebd97b02b..4f31456841a8dcd0557cc6798f4a00d3fc98f642 100644 (file)
@@ -874,8 +874,17 @@ void messageview_destroy(MessageView *messageview)
        debug_print("destroy messageview\n");
        messageview_list = g_list_remove(messageview_list, messageview);
 
        debug_print("destroy messageview\n");
        messageview_list = g_list_remove(messageview_list, messageview);
 
-       hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
+       if (!messageview->deferred_destroy) {
+               hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
                              messageview->msginfo_update_callback_id);
                              messageview->msginfo_update_callback_id);
+       }
+
+       if (messageview->updating) {
+               debug_print("uh oh, better not touch that now\n");
+               messageview->deferred_destroy = TRUE;
+               gtk_widget_hide(messageview->window);
+               return;
+       }
 
        headerview_destroy(messageview->headerview);
        mimeview_destroy(messageview->mimeview);
 
        headerview_destroy(messageview->headerview);
        mimeview_destroy(messageview->mimeview);
index ebf7a27458e04de91a4f047d462949a37a17adbe..109995bcf704dbc921cb78a1dd61bc395201e686 100644 (file)
@@ -68,6 +68,8 @@ struct _MessageView
        gboolean all_headers;
     
        gint msginfo_update_callback_id;
        gboolean all_headers;
     
        gint msginfo_update_callback_id;
+       gboolean updating;
+       gboolean deferred_destroy;
 };
 
 MessageView *messageview_create                        (MainWindow     *mainwin);
 };
 
 MessageView *messageview_create                        (MainWindow     *mainwin);
index e7d058bcb9db8ac7e18b32ceeb97dedb05912059..72602898dbc56558c19872ac8974361c4bcfc7ce 100644 (file)
@@ -118,6 +118,7 @@ static gboolean free_func(GNode *node, gpointer data)
        g_free(mimeinfo->subtype);
        g_free(mimeinfo->description);
        g_free(mimeinfo->id);
        g_free(mimeinfo->subtype);
        g_free(mimeinfo->description);
        g_free(mimeinfo->id);
+       g_free(mimeinfo->location);
 
        g_hash_table_foreach_remove(mimeinfo->typeparameters,
                procmime_mimeinfo_parameters_destroy, NULL);
 
        g_hash_table_foreach_remove(mimeinfo->typeparameters,
                procmime_mimeinfo_parameters_destroy, NULL);
@@ -1270,12 +1271,13 @@ gchar *procmime_get_content_type_str(MimeMediaType type,
        return g_strdup_printf("%s/%s", type_str, subtype);
 }
 
        return g_strdup_printf("%s/%s", type_str, subtype);
 }
 
-int procmime_parse_mimepart(MimeInfo *parent,
+static int procmime_parse_mimepart(MimeInfo *parent,
                             gchar *content_type,
                             gchar *content_encoding,
                             gchar *content_description,
                             gchar *content_id,
                             gchar *content_disposition,
                             gchar *content_type,
                             gchar *content_encoding,
                             gchar *content_description,
                             gchar *content_id,
                             gchar *content_disposition,
+                            gchar *content_location,
                             const gchar *filename,
                             guint offset,
                             guint length);
                             const gchar *filename,
                             guint offset,
                             guint length);
@@ -1291,6 +1293,8 @@ void procmime_parse_message_rfc822(MimeInfo *mimeinfo)
                                                   NULL, TRUE},
                                {"Content-Disposition:",
                                                   NULL, TRUE},
                                                   NULL, TRUE},
                                {"Content-Disposition:",
                                                   NULL, TRUE},
+                               {"Content-Location:",
+                                                  NULL, TRUE},
                                {"MIME-Version:",
                                                   NULL, TRUE},
                                {NULL,             NULL, FALSE}};
                                {"MIME-Version:",
                                                   NULL, TRUE},
                                {NULL,             NULL, FALSE}};
@@ -1322,13 +1326,18 @@ void procmime_parse_message_rfc822(MimeInfo *mimeinfo)
                 g_free(hentry[4].body);
                 hentry[4].body = tmp;
         }                
                 g_free(hentry[4].body);
                 hentry[4].body = tmp;
         }                
+       if (hentry[5].body != NULL) {
+                tmp = conv_unmime_header(hentry[5].body, NULL);
+                g_free(hentry[5].body);
+                hentry[5].body = tmp;
+        }                
        content_start = ftell(fp);
        fclose(fp);
        
        procmime_parse_mimepart(mimeinfo,
                                hentry[0].body, hentry[1].body,
                                hentry[2].body, hentry[3].body,
        content_start = ftell(fp);
        fclose(fp);
        
        procmime_parse_mimepart(mimeinfo,
                                hentry[0].body, hentry[1].body,
                                hentry[2].body, hentry[3].body,
-                               hentry[4].body,
+                               hentry[4].body, hentry[5].body,
                                mimeinfo->data.filename, content_start,
                                mimeinfo->length - (content_start - mimeinfo->offset));
        
                                mimeinfo->data.filename, content_start,
                                mimeinfo->length - (content_start - mimeinfo->offset));
        
@@ -1349,6 +1358,8 @@ void procmime_parse_multipart(MimeInfo *mimeinfo)
                                                   NULL, TRUE},
                                {"Content-Disposition:",
                                                   NULL, TRUE},
                                                   NULL, TRUE},
                                {"Content-Disposition:",
                                                   NULL, TRUE},
+                               {"Content-Location:",
+                                                  NULL, TRUE},
                                {NULL,             NULL, FALSE}};
        gchar *p, *tmp;
        gchar *boundary;
                                {NULL,             NULL, FALSE}};
        gchar *p, *tmp;
        gchar *boundary;
@@ -1379,7 +1390,7 @@ void procmime_parse_multipart(MimeInfo *mimeinfo)
                                result = procmime_parse_mimepart(mimeinfo,
                                                        hentry[0].body, hentry[1].body,
                                                        hentry[2].body, hentry[3].body, 
                                result = procmime_parse_mimepart(mimeinfo,
                                                        hentry[0].body, hentry[1].body,
                                                        hentry[2].body, hentry[3].body, 
-                                                       hentry[4].body, 
+                                                       hentry[4].body, hentry[5].body,
                                                        mimeinfo->data.filename, lastoffset,
                                                        (ftell(fp) - strlen(buf)) - lastoffset - 1);
                        }
                                                        mimeinfo->data.filename, lastoffset,
                                                        (ftell(fp) - strlen(buf)) - lastoffset - 1);
                        }
@@ -1408,6 +1419,11 @@ void procmime_parse_multipart(MimeInfo *mimeinfo)
                                 g_free(hentry[4].body);
                                 hentry[4].body = tmp;
                         }                
                                 g_free(hentry[4].body);
                                 hentry[4].body = tmp;
                         }                
+                        if (hentry[5].body != NULL) {
+                                tmp = conv_unmime_header(hentry[5].body, NULL);
+                                g_free(hentry[5].body);
+                                hentry[5].body = tmp;
+                        }                
                        lastoffset = ftell(fp);
                }
        }
                        lastoffset = ftell(fp);
                }
        }
@@ -1660,12 +1676,13 @@ static void procmime_parse_content_encoding(const gchar *content_encoding, MimeI
        return;
 }
 
        return;
 }
 
-int procmime_parse_mimepart(MimeInfo *parent,
+static int procmime_parse_mimepart(MimeInfo *parent,
                             gchar *content_type,
                             gchar *content_encoding,
                             gchar *content_description,
                             gchar *content_id,
                             gchar *content_disposition,
                             gchar *content_type,
                             gchar *content_encoding,
                             gchar *content_description,
                             gchar *content_id,
                             gchar *content_disposition,
+                            gchar *content_location,
                             const gchar *filename,
                             guint offset,
                             guint length)
                             const gchar *filename,
                             guint offset,
                             guint length)
@@ -1720,6 +1737,11 @@ int procmime_parse_mimepart(MimeInfo *parent,
        else
                mimeinfo->id = NULL;
 
        else
                mimeinfo->id = NULL;
 
+       if (content_location != NULL)
+               mimeinfo->location = g_strdup(content_location);
+       else
+               mimeinfo->location = NULL;
+
        if (content_disposition != NULL) 
                procmime_parse_content_disposition(content_disposition, mimeinfo);
        else
        if (content_disposition != NULL) 
                procmime_parse_content_disposition(content_disposition, mimeinfo);
        else
@@ -1974,6 +1996,9 @@ void procmime_write_mime_header(MimeInfo *mimeinfo, FILE *fp)
        if (mimeinfo->id != NULL)
                fprintf(fp, "Content-ID: %s\n", mimeinfo->id);
 
        if (mimeinfo->id != NULL)
                fprintf(fp, "Content-ID: %s\n", mimeinfo->id);
 
+       if (mimeinfo->location != NULL)
+               fprintf(fp, "Content-Location: %s\n", mimeinfo->location);
+
        if (mimeinfo->disposition != DISPOSITIONTYPE_UNKNOWN) {
                ParametersData *pdata = g_new0(ParametersData, 1);
                gchar *buf = NULL;
        if (mimeinfo->disposition != DISPOSITIONTYPE_UNKNOWN) {
                ParametersData *pdata = g_new0(ParametersData, 1);
                gchar *buf = NULL;
@@ -2027,6 +2052,7 @@ gint procmime_write_message_rfc822(MimeInfo *mimeinfo, FILE *fp)
                            g_ascii_strncasecmp(buf, "Content-Transfer-Encoding:", 26) == 0 ||
                            g_ascii_strncasecmp(buf, "Content-Description:", 20) == 0 ||
                            g_ascii_strncasecmp(buf, "Content-ID:", 11) == 0 ||
                            g_ascii_strncasecmp(buf, "Content-Transfer-Encoding:", 26) == 0 ||
                            g_ascii_strncasecmp(buf, "Content-Description:", 20) == 0 ||
                            g_ascii_strncasecmp(buf, "Content-ID:", 11) == 0 ||
+                           g_ascii_strncasecmp(buf, "Content-Location:", 17) == 0 ||
                            g_ascii_strncasecmp(buf, "Content-Disposition:", 20) == 0) {
                                skip = TRUE;
                                continue;
                            g_ascii_strncasecmp(buf, "Content-Disposition:", 20) == 0) {
                                skip = TRUE;
                                continue;
index 374b66408f7665e1638de46bb2c3a201dcc8a8df..ba90995fa9869444cbb77c1e1c9b32579de5dde6 100644 (file)
@@ -130,6 +130,9 @@ struct _MimeInfo
        /* Content-ID */
        gchar           *id;
 
        /* Content-ID */
        gchar           *id;
 
+       /* Content-Location */
+       gchar           *location;
+
        guint            offset;
        guint            length;
 
        guint            offset;
        guint            length;
 
index 7b1a5f90669d6d08a57cd20abd5ce2f329f2b730..cd247811a7bbb1b25dd0ae977a76a160c5dc090b 100644 (file)
@@ -1983,18 +1983,15 @@ gboolean procmsg_msginfo_filter(MsgInfo *msginfo)
                        
        mail_filtering_data.msginfo = msginfo;                  
        if (hooks_invoke(MAIL_FILTERING_HOOKLIST, &mail_filtering_data)) {
                        
        mail_filtering_data.msginfo = msginfo;                  
        if (hooks_invoke(MAIL_FILTERING_HOOKLIST, &mail_filtering_data)) {
-               hooks_invoke(MAIL_POSTFILTERING_HOOKLIST, msginfo);
                return TRUE;
        }
 
        /* filter if enabled in prefs or move to inbox if not */
        if((filtering_rules != NULL) &&
           filter_message_by_msginfo(filtering_rules, msginfo)) {
                return TRUE;
        }
 
        /* filter if enabled in prefs or move to inbox if not */
        if((filtering_rules != NULL) &&
           filter_message_by_msginfo(filtering_rules, msginfo)) {
-               hooks_invoke(MAIL_POSTFILTERING_HOOKLIST, msginfo);
                return TRUE;
        }
                
                return TRUE;
        }
                
-       hooks_invoke(MAIL_POSTFILTERING_HOOKLIST, msginfo);
        return FALSE;
 }
 
        return FALSE;
 }
 
index 3a7ee872cb98a7ca22599a195e25e0260ad48d15..5efb49942219517401c6a015c456e98b22655642 100644 (file)
@@ -45,6 +45,7 @@ typedef GSList MsgNumberList;
 #define MSG_DELETED            (1U << 3)
 #define MSG_REPLIED            (1U << 4)
 #define MSG_FORWARDED          (1U << 5)
 #define MSG_DELETED            (1U << 3)
 #define MSG_REPLIED            (1U << 4)
 #define MSG_FORWARDED          (1U << 5)
+#define MSG_POSTFILTERED       (1U << 14)
 
 #define MSG_CLABEL_SBIT        (7)             /* start bit of color label */
 #define MAKE_MSG_CLABEL(h, m, l)       (((h) << (MSG_CLABEL_SBIT + 2)) | \
 
 #define MSG_CLABEL_SBIT        (7)             /* start bit of color label */
 #define MAKE_MSG_CLABEL(h, m, l)       (((h) << (MSG_CLABEL_SBIT + 2)) | \
@@ -115,6 +116,7 @@ typedef guint32 MsgTmpFlags;
 #define MSG_IS_REPLIED(msg)            (((msg).perm_flags & MSG_REPLIED) != 0)
 #define MSG_IS_LOCKED(msg)             (((msg).perm_flags & MSG_LOCKED) != 0)
 #define MSG_IS_FORWARDED(msg)          (((msg).perm_flags & MSG_FORWARDED) != 0)
 #define MSG_IS_REPLIED(msg)            (((msg).perm_flags & MSG_REPLIED) != 0)
 #define MSG_IS_LOCKED(msg)             (((msg).perm_flags & MSG_LOCKED) != 0)
 #define MSG_IS_FORWARDED(msg)          (((msg).perm_flags & MSG_FORWARDED) != 0)
+#define MSG_IS_POSTFILTERED(msg)       (((msg).perm_flags & MSG_POSTFILTERED) != 0)
 
 #define MSG_GET_COLORLABEL(msg)                (((msg).perm_flags & MSG_CLABEL_FLAG_MASK))
 #define MSG_GET_COLORLABEL_VALUE(msg)  (MSG_GET_COLORLABEL(msg) >> MSG_CLABEL_SBIT)
 
 #define MSG_GET_COLORLABEL(msg)                (((msg).perm_flags & MSG_CLABEL_FLAG_MASK))
 #define MSG_GET_COLORLABEL_VALUE(msg)  (MSG_GET_COLORLABEL(msg) >> MSG_CLABEL_SBIT)
index 045f455b71ffae88b4d157f1728b506475cae5db..36e76fe75d8ed2ae1ebdb8a5c32d55bc35b9c4ed 100644 (file)
@@ -1128,7 +1128,15 @@ static void toolbar_prev_unread_cb(GtkWidget *widget, gpointer data)
                
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)toolbar_item->parent;
                
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)toolbar_item->parent;
+               msgview->updating = TRUE;
                summary_select_prev_unread(msgview->mainwin->summaryview);
                summary_select_prev_unread(msgview->mainwin->summaryview);
+               msgview->updating = FALSE;
+
+               if (msgview->deferred_destroy) {
+                       debug_print("messageview got away!\n");
+                       messageview_destroy(msgview);
+                       return;
+               }
                
                /* Now we need to update the messageview window */
                if (msgview->mainwin->summaryview->selected) {
                
                /* Now we need to update the messageview window */
                if (msgview->mainwin->summaryview->selected) {
@@ -1167,8 +1175,16 @@ static void toolbar_next_unread_cb(GtkWidget *widget, gpointer data)
                
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)toolbar_item->parent;
                
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)toolbar_item->parent;
+               msgview->updating = TRUE;
                summary_select_next_unread(msgview->mainwin->summaryview);
                summary_select_next_unread(msgview->mainwin->summaryview);
-               
+               msgview->updating = FALSE;
+
+               if (msgview->deferred_destroy) {
+                       debug_print("messageview got away!\n");
+                       messageview_destroy(msgview);
+                       return;
+               }
+
                /* Now we need to update the messageview window */
                if (msgview->mainwin->summaryview->selected) {
                        GtkCTree *ctree = GTK_CTREE(msgview->mainwin->summaryview->ctree);
                /* Now we need to update the messageview window */
                if (msgview->mainwin->summaryview->selected) {
                        GtkCTree *ctree = GTK_CTREE(msgview->mainwin->summaryview->ctree);