Revert "Remove plaintext_file member of struct MsgInfo."
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 25 Jun 2015 11:58:21 +0000 (13:58 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Thu, 25 Jun 2015 11:58:21 +0000 (13:58 +0200)
This reverts commit 4e7e4f922c52439c1212cd1de813a0a9ca9d3691.
Looks like plaintext_file has been misappropriated by
att_remover plugin, and it can't be trivially changed.

src/imap.c
src/plugins/perl/perl_plugin.c
src/procmsg.c
src/procmsg.h

index ea11e0b..606da64 100644 (file)
@@ -4649,6 +4649,7 @@ static MsgInfo *imap_parse_msg(const gchar *file, FolderItem *item)
        msginfo = procheader_parse_file(file, flags, FALSE, FALSE);
        if (!msginfo) return NULL;
        
+       msginfo->plaintext_file = g_strdup(file);
        msginfo->folder = item;
 
        return msginfo;
index 1a62615..6db4c41 100644 (file)
@@ -542,7 +542,7 @@ static XS(XS_ClawsMail_filter_init)
    *         14 references
    *         15 score
    *         16 not used anymore
-   *         17 not used anymore
+   *         17 plaintext_file
    *         18 not used anymore
    *         19 hidden
    *         20 message file path
@@ -607,6 +607,9 @@ static XS(XS_ClawsMail_filter_init)
     ii ? XSRETURN(ii) : XSRETURN_UNDEF;
   case 15:
     msginfo->score      ? XSRETURN_IV(msginfo->score)      : XSRETURN_UNDEF;
+  case 17:
+    msginfo->plaintext_file ?
+      XSRETURN_PV(msginfo->plaintext_file)                 : XSRETURN_UNDEF;
   case 19:
     msginfo->hidden     ? XSRETURN_IV(msginfo->hidden)     : XSRETURN_UNDEF;
   case 20:
@@ -1934,6 +1937,7 @@ static int perl_init(void)
 "                   ClawsMail::C::filter_init(13));\n"
 "    add_header_entries_(\"references\",ClawsMail::C::filter_init(14));\n"
 "    $msginfo{\"score\"}              = ClawsMail::C::filter_init(15);\n"
+"    $msginfo{\"plaintext_file\"}     = ClawsMail::C::filter_init(17);\n"
 "    $msginfo{\"hidden\"}             = ClawsMail::C::filter_init(19);\n"
 "    $msginfo{\"filepath\"}           = ClawsMail::C::filter_init(20);\n"
 "    $msginfo{\"partial_recv\"}       = ClawsMail::C::filter_init(21);\n"
index a398b64..5ff5f4d 100644 (file)
@@ -402,8 +402,17 @@ next_folder:
 
 gchar *procmsg_get_message_file_path(MsgInfo *msginfo)
 {
+       gchar *file;
+
        cm_return_val_if_fail(msginfo != NULL, NULL);
-       return folder_item_fetch_msg(msginfo->folder, msginfo->msgnum);
+
+       if (msginfo->plaintext_file)
+               file = g_strdup(msginfo->plaintext_file);
+       else {
+               file = folder_item_fetch_msg(msginfo->folder, msginfo->msgnum);
+       }
+
+       return file;
 }
 
 gchar *procmsg_get_message_file(MsgInfo *msginfo)
@@ -1286,6 +1295,7 @@ MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo)
         newmsginfo->references = g_slist_reverse(newmsginfo->references);
 
        MEMBCOPY(score);
+       MEMBDUP(plaintext_file);
 
        return newmsginfo;
 }
@@ -1422,6 +1432,8 @@ void procmsg_msginfo_free(MsgInfo *msginfo)
        slist_free_strings_full(msginfo->references);
        g_slist_free(msginfo->tags);
 
+       g_free(msginfo->plaintext_file);
+
        g_free(msginfo);
 }
 
@@ -2339,6 +2351,7 @@ MsgInfo *procmsg_msginfo_new_from_mimeinfo(MsgInfo *src_msginfo, MimeInfo *mimei
        if (tmp_msginfo != NULL) {
                if (src_msginfo)
                        tmp_msginfo->folder = src_msginfo->folder;
+               tmp_msginfo->plaintext_file = g_strdup(tmpfile);
        } else {
                g_warning("procmsg_msginfo_new_from_mimeinfo(): Can't generate new msginfo");
        }
index e5e4bf2..5152c05 100644 (file)
@@ -221,7 +221,10 @@ struct _MsgInfo
 
        gint score;
 
-       gint hidden;
+       /* used only for encrypted messages */
+       gchar *plaintext_file;
+        
+        gint hidden;
 
        /* used only for partially received messages */
        gint total_size;