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 71ace85..b652410 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
index 96e115b..45092a2 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.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 9a0d1fc..831101b 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=140
+EXTRA_VERSION=141
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index eb6905e..47985fc 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);
                        }
+                       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);
 
 
index ce9296d..4f31456 100644 (file)
@@ -874,8 +874,17 @@ void messageview_destroy(MessageView *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);
+       }
+
+       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);
index ebf7a27..109995b 100644 (file)
@@ -68,6 +68,8 @@ struct _MessageView
        gboolean all_headers;
     
        gint msginfo_update_callback_id;
+       gboolean updating;
+       gboolean deferred_destroy;
 };
 
 MessageView *messageview_create                        (MainWindow     *mainwin);
index e7d058b..7260289 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->location);
 
        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);
 }
 
-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_location,
                             const gchar *filename,
                             guint offset,
                             guint length);
@@ -1291,6 +1293,8 @@ void procmime_parse_message_rfc822(MimeInfo *mimeinfo)
                                                   NULL, TRUE},
                                {"Content-Disposition:",
                                                   NULL, TRUE},
+                               {"Content-Location:",
+                                                  NULL, TRUE},
                                {"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;
         }                
+       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,
-                               hentry[4].body,
+                               hentry[4].body, hentry[5].body,
                                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},
+                               {"Content-Location:",
+                                                  NULL, TRUE},
                                {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, 
-                                                       hentry[4].body, 
+                                                       hentry[4].body, hentry[5].body,
                                                        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;
                         }                
+                        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);
                }
        }
@@ -1660,12 +1676,13 @@ static void procmime_parse_content_encoding(const gchar *content_encoding, MimeI
        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_location,
                             const gchar *filename,
                             guint offset,
                             guint length)
@@ -1720,6 +1737,11 @@ int procmime_parse_mimepart(MimeInfo *parent,
        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
@@ -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->location != NULL)
+               fprintf(fp, "Content-Location: %s\n", mimeinfo->location);
+
        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-Location:", 17) == 0 ||
                            g_ascii_strncasecmp(buf, "Content-Disposition:", 20) == 0) {
                                skip = TRUE;
                                continue;
index 374b664..ba90995 100644 (file)
@@ -130,6 +130,9 @@ struct _MimeInfo
        /* Content-ID */
        gchar           *id;
 
+       /* Content-Location */
+       gchar           *location;
+
        guint            offset;
        guint            length;
 
index 7b1a5f9..cd24781 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)) {
-               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)) {
-               hooks_invoke(MAIL_POSTFILTERING_HOOKLIST, msginfo);
                return TRUE;
        }
                
-       hooks_invoke(MAIL_POSTFILTERING_HOOKLIST, msginfo);
        return FALSE;
 }
 
index 3a7ee87..5efb499 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_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)) | \
@@ -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_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)
index 045f455..36e76fe 100644 (file)
@@ -1128,7 +1128,15 @@ static void toolbar_prev_unread_cb(GtkWidget *widget, gpointer data)
                
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)toolbar_item->parent;
+               msgview->updating = TRUE;
                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) {
@@ -1167,8 +1175,16 @@ static void toolbar_next_unread_cb(GtkWidget *widget, gpointer data)
                
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)toolbar_item->parent;
+               msgview->updating = TRUE;
                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);