sycn with 0.8.8cvs11
[claws.git] / src / procmsg.c
index dbdd87671ca0903d18ded7fe8d0234dd805ef5f6..11180f2b4033553b48e19fa7afe54e4a6f5903a2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -810,8 +810,7 @@ FILE *procmsg_open_message_decrypted(MsgInfo *msginfo, MimeInfo **mimeinfo)
        }
 
        if (MSG_IS_ENCRYPTED(msginfo->flags) &&
-           !msginfo->plaintext_file &&
-           !msginfo->decryption_failed) {
+           (!msginfo->plaintext_file || msginfo->decryption_failed)) {
                rfc2015_decrypt_message(msginfo, mimeinfo_, fp);
                if (msginfo->plaintext_file &&
                    !msginfo->decryption_failed) {
@@ -1218,6 +1217,7 @@ enum
        Q_NEWS_ACCOUNT_ID  = 5,
        Q_SAVE_COPY_FOLDER = 6,
        Q_REPLY_MESSAGE_ID = 7,
+       Q_FWD_MESSAGE_ID   = 8
 };
 
 gint procmsg_send_message_queue(const gchar *file)
@@ -1230,6 +1230,7 @@ gint procmsg_send_message_queue(const gchar *file)
                                       {"NAID:", NULL, FALSE},
                                       {"SCF:",  NULL, FALSE},
                                       {"RMID:", NULL, FALSE},
+                                      {"FMID:", NULL, FALSE},
                                       {NULL,    NULL, FALSE}};
        FILE *fp;
        gint filepos;
@@ -1240,6 +1241,7 @@ gint procmsg_send_message_queue(const gchar *file)
        GSList *newsgroup_list = NULL;
        gchar *savecopyfolder = NULL;
        gchar *replymessageid = NULL;
+       gchar *fwdmessageid = NULL;
        gchar buf[BUFFSIZE];
        gint hnum;
        PrefsAccount *mailac = NULL, *newsac = NULL;
@@ -1281,6 +1283,9 @@ gint procmsg_send_message_queue(const gchar *file)
                case Q_REPLY_MESSAGE_ID:
                        if (!replymessageid) replymessageid = g_strdup(p);
                        break;
+               case Q_FWD_MESSAGE_ID:
+                       if (!fwdmessageid) fwdmessageid = g_strdup(p);
+                       break;
                }
        }
        filepos = ftell(fp);
@@ -1400,11 +1405,14 @@ gint procmsg_send_message_queue(const gchar *file)
                procmsg_save_to_outbox(outbox, file, TRUE);
        }
 
-       if (replymessageid != NULL) {
+       if (replymessageid != NULL || fwdmessageid != NULL) {
                gchar **tokens;
                FolderItem *item;
                
-               tokens = g_strsplit(replymessageid, "\x7f", 0);
+               if (replymessageid != NULL)
+                       tokens = g_strsplit(replymessageid, "\x7f", 0);
+               else
+                       tokens = g_strsplit(fwdmessageid, "\x7f", 0);
                item = folder_find_item_from_identifier(tokens[0]);
                if (item != NULL) {
                        MsgInfo *msginfo;
@@ -1420,9 +1428,14 @@ gint procmsg_send_message_queue(const gchar *file)
                        }
                        
                        if (msginfo != NULL) {
-                               procmsg_msginfo_unset_flags(msginfo, MSG_FORWARDED, 0);
-                               procmsg_msginfo_set_flags(msginfo, MSG_REPLIED, 0);
-
+                               if (replymessageid != NULL) {
+                                       procmsg_msginfo_unset_flags(msginfo, MSG_FORWARDED, 0);
+                                       procmsg_msginfo_set_flags(msginfo, MSG_REPLIED, 0);
+                               } 
+                               else {
+                                       procmsg_msginfo_unset_flags(msginfo, MSG_REPLIED, 0);
+                                       procmsg_msginfo_set_flags(msginfo, MSG_FORWARDED, 0);
+                               }
                                procmsg_msginfo_free(msginfo);
                        }
                }
@@ -1431,6 +1444,7 @@ gint procmsg_send_message_queue(const gchar *file)
 
        g_free(savecopyfolder);
        g_free(replymessageid);
+       g_free(fwdmessageid);
        
        return (newsval != 0 ? newsval : mailval);
 }