2007-06-05 [wwp] 2.9.2cvs40
[claws.git] / src / compose.c
index ca4eeb45092d04c7f146ad74a1b7480883228638..59a27174c345f2f7475a6f74ee4b3e20465a0efe 100644 (file)
@@ -178,6 +178,13 @@ typedef enum
        COMPOSE_WRITE_FOR_STORE
 } ComposeWriteType;
 
+typedef enum
+{
+       COMPOSE_QUOTE_FORCED,
+       COMPOSE_QUOTE_CHECK,
+       COMPOSE_QUOTE_SKIP
+} ComposeQuoteMode;
+
 #define B64_LINE_SIZE          57
 #define B64_BUFFSIZE           77
 
@@ -192,20 +199,21 @@ static Compose *compose_generic_new                       (PrefsAccount   *account,
                                                 GList          *listAddress );
 
 static Compose *compose_create                 (PrefsAccount   *account,
+                                                FolderItem              *item,
                                                 ComposeMode     mode,
                                                 gboolean batch);
 
 static void compose_entry_mark_default_to      (Compose          *compose,
                                         const gchar      *address);
 static Compose *compose_followup_and_reply_to  (MsgInfo        *msginfo,
-                                        gboolean        quote,
+                                        ComposeQuoteMode        quote_mode,
                                         gboolean        to_all,
                                         gboolean        to_sender,
                                         const gchar    *body);
 static Compose *compose_forward_multiple       (PrefsAccount   *account, 
                                         GSList         *msginfo_list);
 static Compose *compose_reply                  (MsgInfo        *msginfo,
-                                        gboolean        quote,
+                                        ComposeQuoteMode        quote_mode,
                                         gboolean        to_all,
                                         gboolean        to_ml,
                                         gboolean        to_sender,
@@ -503,8 +511,10 @@ static void text_inserted          (GtkTextBuffer  *buffer,
                                         const gchar    *text,
                                         gint            len,
                                         Compose        *compose);
-static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
-                                 gboolean to_all, gboolean to_ml,
+static Compose *compose_generic_reply(MsgInfo *msginfo,
+                                 ComposeQuoteMode quote_mode,
+                                 gboolean to_all,
+                                 gboolean to_ml,
                                  gboolean to_sender,
                                  gboolean followup_and_reply_to,
                                  const gchar *body);
@@ -971,6 +981,8 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
        GtkTextBuffer *textbuf;
        GtkTextIter iter;
        GtkItemFactory *ifactory;
+       const gchar *subject_format = NULL;
+       const gchar *body_format = NULL;
 
        if (item && item->prefs && item->prefs->enable_default_account)
                account = account_find_from_id(item->prefs->default_account);
@@ -978,7 +990,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
        if (!account) account = cur_account;
        g_return_val_if_fail(account != NULL, NULL);
 
-       compose = compose_create(account, COMPOSE_NEW, FALSE);
+       compose = compose_create(account, item, COMPOSE_NEW, FALSE);
 
        ifactory = gtk_item_factory_from_widget(compose->menubar);
 
@@ -1024,11 +1036,22 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
        }
        compose_add_field_list( compose, listAddress );
 
-       if (prefs_common.compose_with_format) {
+       if (item && item->prefs && item->prefs->compose_with_format) {
+               subject_format = item->prefs->compose_subject_format;
+               body_format = item->prefs->compose_body_format;
+       } else if (account->compose_with_format) {
+               subject_format = account->compose_subject_format;
+               body_format = account->compose_body_format;
+       } else if (prefs_common.compose_with_format) {
+               subject_format = prefs_common.compose_subject_format;
+               body_format = prefs_common.compose_body_format;
+       }
+
+       if (subject_format || body_format) {
                MsgInfo* dummyinfo = NULL;
 
-               if ( prefs_common.compose_subject_format
-                        && *prefs_common.compose_subject_format != '\0' )
+               if ( subject_format
+                        && *subject_format != '\0' )
                {
                        gchar *subject = NULL;
                        gchar *tmp = NULL;
@@ -1037,8 +1060,8 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                        dummyinfo = compose_msginfo_new_from_compose(compose);
 
                        /* decode \-escape sequences in the internal representation of the quote format */
-                       tmp = malloc(strlen(prefs_common.compose_subject_format)+1);
-                       pref_get_unescaped_pref(tmp, prefs_common.compose_subject_format);
+                       tmp = malloc(strlen(subject_format)+1);
+                       pref_get_unescaped_pref(tmp, subject_format);
 
                        subject = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1);
 #ifdef USE_ASPELL
@@ -1061,8 +1084,8 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                        g_free(tmp);
                }
 
-               if ( prefs_common.compose_body_format
-                        && *prefs_common.compose_body_format != '\0' )
+               if ( body_format
+                        && *body_format != '\0' )
                {
                        GtkTextView *text;
                        GtkTextBuffer *buffer;
@@ -1079,7 +1102,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                        tmp = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
 
                        compose_quote_fmt(compose, dummyinfo,
-                                         prefs_common.compose_body_format,
+                                         body_format,
                                          NULL, tmp, FALSE, TRUE,
                                                  _("New message body format error at line %d."));
                        quote_fmt_reset_vartable();
@@ -1189,56 +1212,56 @@ static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar
 
        switch (mode) {
        case COMPOSE_REPLY:
-               compose = compose_reply(msginfo, prefs_common.reply_with_quote,
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_CHECK,
                              FALSE, prefs_common.default_reply_list, FALSE, body);
                break;
        case COMPOSE_REPLY_WITH_QUOTE:
-               compose = compose_reply(msginfo, TRUE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_FORCED
                        FALSE, prefs_common.default_reply_list, FALSE, body);
                break;
        case COMPOSE_REPLY_WITHOUT_QUOTE:
-               compose = compose_reply(msginfo, FALSE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_SKIP
                        FALSE, prefs_common.default_reply_list, FALSE, NULL);
                break;
        case COMPOSE_REPLY_TO_SENDER:
-               compose = compose_reply(msginfo, prefs_common.reply_with_quote,
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_CHECK,
                              FALSE, FALSE, TRUE, body);
                break;
        case COMPOSE_FOLLOWUP_AND_REPLY_TO:
                compose = compose_followup_and_reply_to(msginfo,
-                                             prefs_common.reply_with_quote,
+                                             COMPOSE_QUOTE_CHECK,
                                              FALSE, FALSE, body);
                break;
        case COMPOSE_REPLY_TO_SENDER_WITH_QUOTE:
-               compose = compose_reply(msginfo, TRUE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_FORCED
                        FALSE, FALSE, TRUE, body);
                break;
        case COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE:
-               compose = compose_reply(msginfo, FALSE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_SKIP
                        FALSE, FALSE, TRUE, NULL);
                break;
        case COMPOSE_REPLY_TO_ALL:
-               compose = compose_reply(msginfo, prefs_common.reply_with_quote,
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_CHECK,
                        TRUE, FALSE, FALSE, body);
                break;
        case COMPOSE_REPLY_TO_ALL_WITH_QUOTE:
-               compose = compose_reply(msginfo, TRUE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_FORCED
                        TRUE, FALSE, FALSE, body);
                break;
        case COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE:
-               compose = compose_reply(msginfo, FALSE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_SKIP
                        TRUE, FALSE, FALSE, NULL);
                break;
        case COMPOSE_REPLY_TO_LIST:
-               compose = compose_reply(msginfo, prefs_common.reply_with_quote,
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_CHECK,
                        FALSE, TRUE, FALSE, body);
                break;
        case COMPOSE_REPLY_TO_LIST_WITH_QUOTE:
-               compose = compose_reply(msginfo, TRUE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_FORCED
                        FALSE, TRUE, FALSE, body);
                break;
        case COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE:
-               compose = compose_reply(msginfo, FALSE
+               compose = compose_reply(msginfo, COMPOSE_QUOTE_SKIP
                        FALSE, TRUE, FALSE, NULL);
                break;
        case COMPOSE_FORWARD:
@@ -1264,7 +1287,7 @@ static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar
                compose = compose_redirect(NULL, msginfo, FALSE);
                break;
        default:
-               g_warning("compose_reply(): invalid Compose Mode: %d\n", mode);
+               g_warning("compose_reply_mode(): invalid Compose Mode: %d\n", mode);
        }
        
        ifactory = gtk_item_factory_from_widget(compose->menubar);
@@ -1303,20 +1326,24 @@ static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar
        return compose;
 }
 
-static Compose *compose_reply(MsgInfo *msginfo, gboolean quote, gboolean to_all,
-                  gboolean to_ml, gboolean to_sender, 
+static Compose *compose_reply(MsgInfo *msginfo,
+                                  ComposeQuoteMode quote_mode,
+                                  gboolean to_all,
+                                  gboolean to_ml,
+                                  gboolean to_sender, 
                   const gchar *body)
 {
-       return compose_generic_reply(msginfo, quote, to_all, to_ml, 
+       return compose_generic_reply(msginfo, quote_mode, to_all, to_ml, 
                              to_sender, FALSE, body);
 }
 
-static Compose *compose_followup_and_reply_to(MsgInfo *msginfo, gboolean quote,
+static Compose *compose_followup_and_reply_to(MsgInfo *msginfo,
+                                  ComposeQuoteMode quote_mode,
                                   gboolean to_all,
                                   gboolean to_sender,
                                   const gchar *body)
 {
-       return compose_generic_reply(msginfo, quote, to_all, FALSE, 
+       return compose_generic_reply(msginfo, quote_mode, to_all, FALSE, 
                              to_sender, TRUE, body);
 }
 
@@ -1362,7 +1389,8 @@ static void compose_extract_original_charset(Compose *compose)
                                compose);                       \
 }
 
-static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
+static Compose *compose_generic_reply(MsgInfo *msginfo,
+                                 ComposeQuoteMode quote_mode,
                                  gboolean to_all, gboolean to_ml,
                                  gboolean to_sender,
                                  gboolean followup_and_reply_to,
@@ -1371,9 +1399,11 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
        GtkItemFactory *ifactory;
        Compose *compose;
        PrefsAccount *account = NULL;
-       PrefsAccount *reply_account;
        GtkTextView *textview;
        GtkTextBuffer *textbuf;
+       gboolean quote = FALSE;
+       const gchar *qmark = NULL;
+       const gchar *body_fmt = NULL;
 
        g_return_val_if_fail(msginfo != NULL, NULL);
        g_return_val_if_fail(msginfo->folder != NULL, NULL);
@@ -1382,18 +1412,7 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
 
        g_return_val_if_fail(account != NULL, NULL);
 
-       if (to_sender && account->protocol == A_NNTP &&
-           !followup_and_reply_to) {
-               reply_account =
-                       account_find_from_address(account->address);
-               if (!reply_account)
-                       reply_account = compose_current_mail_account();
-               if (!reply_account)
-                       return NULL;
-       } else
-               reply_account = account;
-
-       compose = compose_create(account, COMPOSE_REPLY, FALSE);
+       compose = compose_create(account, msginfo->folder, COMPOSE_REPLY, FALSE);
 
        compose->updating = TRUE;
 
@@ -1432,17 +1451,33 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                compose_set_dictionaries_from_folder_prefs(compose, msginfo->folder);
 #endif
 
-       if (quote) {
-               gchar *qmark;
+       if (quote_mode == COMPOSE_QUOTE_FORCED ||
+                       (quote_mode == COMPOSE_QUOTE_CHECK && prefs_common.reply_with_quote)) {
+               /* use the reply format of folder (if enabled), or the account's one
+                  (if enabled) or fallback to the global reply format, which is always
+                  enabled (even if empty), and use the relevant quotemark */
+               quote = TRUE;
+               if (msginfo->folder && msginfo->folder->prefs &&
+                               msginfo->folder->prefs->reply_with_format) {
+                       qmark = msginfo->folder->prefs->reply_quotemark;
+                       body_fmt = msginfo->folder->prefs->reply_body_format;
+
+               } else if (account->reply_with_format) {
+                       qmark = account->reply_quotemark;
+                       body_fmt = account->reply_body_format;
 
-               if (prefs_common.quotemark && *prefs_common.quotemark)
+               } else {
                        qmark = prefs_common.quotemark;
-               else
-                       qmark = "> ";
+                       body_fmt = prefs_common.quotefmt;
+               }
+       }
 
+       if (quote) {
+               /* empty quotemark is not allowed */
+               if (qmark == NULL || *qmark == '\0')
+                       qmark = "> ";
                compose_quote_fmt(compose, compose->replyinfo,
-                                 prefs_common.quotefmt,
-                                 qmark, body, FALSE, TRUE,
+                                 body_fmt, qmark, body, FALSE, TRUE,
                                          _("Message reply format error at line %d."));
                quote_fmt_reset_vartable();
        }
@@ -1504,7 +1539,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                                (msginfo)))
                account = cur_account;
 
-       compose = compose_create(account, COMPOSE_FORWARD, batch);
+       compose = compose_create(account, msginfo->folder, COMPOSE_FORWARD, batch);
 
        compose->updating = TRUE;
        compose->fwdinfo = procmsg_msginfo_get_full_info(msginfo);
@@ -1535,7 +1570,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
        if (as_attach) {
                gchar *msgfile;
 
-               msgfile = procmsg_get_message_file_path(msginfo);
+               msgfile = procmsg_get_message_file(msginfo);
                if (!is_file_exist(msgfile))
                        g_warning("%s: file not exist\n", msgfile);
                else
@@ -1544,22 +1579,37 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
 
                g_free(msgfile);
        } else {
-               gchar *qmark;
+               const gchar *qmark = NULL;
+               const gchar *body_fmt = prefs_common.fw_quotefmt;
                MsgInfo *full_msginfo;
 
                full_msginfo = procmsg_msginfo_get_full_info(msginfo);
                if (!full_msginfo)
                        full_msginfo = procmsg_msginfo_copy(msginfo);
 
-               if (prefs_common.fw_quotemark &&
-                   *prefs_common.fw_quotemark)
+               /* use the forward format of folder (if enabled), or the account's one
+                  (if enabled) or fallback to the global forward format, which is always
+                  enabled (even if empty), and use the relevant quotemark */
+               if (msginfo->folder && msginfo->folder->prefs &&
+                               msginfo->folder->prefs->forward_with_format) {
+                       qmark = msginfo->folder->prefs->forward_quotemark;
+                       body_fmt = msginfo->folder->prefs->forward_body_format;
+
+               } else if (account->forward_with_format) {
+                       qmark = account->forward_quotemark;
+                       body_fmt = account->forward_body_format;
+
+               } else {
                        qmark = prefs_common.fw_quotemark;
-               else
+                       body_fmt = prefs_common.fw_quotefmt;
+               }
+
+               /* empty quotemark is not allowed */
+               if (qmark == NULL || *qmark == '\0')
                        qmark = "> ";
 
                compose_quote_fmt(compose, full_msginfo,
-                                 prefs_common.fw_quotefmt,
-                                 qmark, body, FALSE, TRUE,
+                                 body_fmt, qmark, body, FALSE, TRUE,
                                          _("Message forward format error at line %d."));
                quote_fmt_reset_vartable();
                compose_attach_parts(compose, msginfo);
@@ -1643,7 +1693,7 @@ static Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_
                MSG_SET_PERM_FLAGS(((MsgInfo *)msginfo->data)->flags, MSG_FORWARDED);
        }
 
-       compose = compose_create(account, COMPOSE_FORWARD, FALSE);
+       compose = compose_create(account, ((MsgInfo *)msginfo_list->data)->folder, COMPOSE_FORWARD, FALSE);
 
        compose->updating = TRUE;
 
@@ -1653,7 +1703,7 @@ static Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_
        
        undo_block(compose->undostruct);
        for (msginfo = msginfo_list; msginfo != NULL; msginfo = msginfo->next) {
-               msgfile = procmsg_get_message_file_path((MsgInfo *)msginfo->data);
+               msgfile = procmsg_get_message_file((MsgInfo *)msginfo->data);
 
                if (!is_file_exist(msgfile))
                        g_warning("%s: file not exist\n", msgfile);
@@ -1883,7 +1933,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
         }
        g_return_val_if_fail(account != NULL, NULL);
 
-       compose = compose_create(account, COMPOSE_REEDIT, batch);
+       compose = compose_create(account, msginfo->folder, COMPOSE_REEDIT, batch);
        
        compose->replyinfo = replyinfo;
        compose->fwdinfo = fwdinfo;
@@ -2012,7 +2062,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
                                        prefs_common.reply_account_autosel);
        g_return_val_if_fail(account != NULL, NULL);
 
-       compose = compose_create(account, COMPOSE_REDIRECT, batch);
+       compose = compose_create(account, msginfo->folder, COMPOSE_REDIRECT, batch);
 
        compose->updating = TRUE;
 
@@ -2025,7 +2075,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
 
        gtk_widget_grab_focus(compose->header_last->entry);
 
-       filename = procmsg_get_message_file_path(msginfo);
+       filename = procmsg_get_message_file(msginfo);
 
        if (filename == NULL) {
                compose->updating = FALSE;
@@ -3349,9 +3399,10 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
 
                        /* if we meet a pgp signature, we don't attach it, but
                         * we force signing. */
-                       if (strcmp(content_type, "application/pgp-signature") &&
+                       if ((strcmp(content_type, "application/pgp-signature") &&
                            strcmp(content_type, "application/pkcs7-signature") &&
-                           strcmp(content_type, "application/x-pkcs7-signature")) {
+                           strcmp(content_type, "application/x-pkcs7-signature"))
+                           || compose->mode == COMPOSE_REDIRECT) {
                                partname = procmime_mimeinfo_get_parameter(child, "filename");
                                if (partname == NULL)
                                        partname = procmime_mimeinfo_get_parameter(child, "name");
@@ -4406,8 +4457,6 @@ gint compose_send(Compose *compose)
                g_free(msgpath);
        }
        if (!discard_window) {
-               compose->sending = FALSE;
-               compose_allow_user_actions (compose, TRUE);
                if (val != 0) {
                        if (!queued_removed)
                                folder_item_remove_msg(folder, msgnum);
@@ -4437,8 +4486,11 @@ gint compose_send(Compose *compose)
                                procmsg_msginfo_free(tmp);
                        }
                }
-               if (!discard_window)
+               if (!discard_window) {
+                       compose->sending = FALSE;
+                       compose_allow_user_actions (compose, TRUE);
                        compose_close(compose);
+               }
        } else {
                if (errstr) {
                        gchar *tmp = g_strdup_printf(_("%s\nUse \"Send queued messages\" from "
@@ -6235,7 +6287,9 @@ static gboolean compose_popup_menu(GtkWidget *widget, gpointer data)
 }
 
 static gboolean compose_force_window_origin = TRUE;
-static Compose *compose_create(PrefsAccount *account, ComposeMode mode,
+static Compose *compose_create(PrefsAccount *account,
+                                                FolderItem *folder,
+                                                ComposeMode mode,
                                                 gboolean batch)
 {
        Compose   *compose;
@@ -6291,6 +6345,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode,
 
        compose->batch = batch;
        compose->account = account;
+       compose->folder = folder;
        
        compose->mutex = g_mutex_new();
        compose->set_cursor_pos = -1;
@@ -7056,6 +7111,44 @@ void compose_reflect_prefs_pixmap_theme(void)
        }
 }
 
+static const gchar *compose_quote_char_from_context(Compose *compose)
+{
+       const gchar *qmark = NULL;
+
+       g_return_val_if_fail(compose != NULL, NULL);
+
+       switch (compose->mode) {
+               /* use forward-specific quote char */
+               case COMPOSE_FORWARD:
+               case COMPOSE_FORWARD_AS_ATTACH:
+               case COMPOSE_FORWARD_INLINE:
+                       if (compose->folder && compose->folder->prefs &&
+                                       compose->folder->prefs->forward_with_format)
+                               qmark = compose->folder->prefs->forward_quotemark;
+                       else if (compose->account->forward_with_format)
+                               qmark = compose->account->forward_quotemark;
+                       else
+                               qmark = prefs_common.fw_quotemark;
+                       break;
+
+               /* use reply-specific quote char in all other modes */
+               default:
+                       if (compose->folder && compose->folder->prefs &&
+                                       compose->folder->prefs->reply_with_format)
+                               qmark = compose->folder->prefs->reply_quotemark;
+                       else if (compose->account->reply_with_format)
+                               qmark = compose->account->reply_quotemark;
+                       else
+                               qmark = prefs_common.quotemark;
+                       break;
+       }
+
+       if (qmark == NULL || *qmark == '\0')
+               qmark = "> ";
+
+       return qmark;
+}
+
 static void compose_template_apply(Compose *compose, Template *tmpl,
                                   gboolean replace)
 {
@@ -7063,7 +7156,7 @@ static void compose_template_apply(Compose *compose, Template *tmpl,
        GtkTextBuffer *buffer;
        GtkTextMark *mark;
        GtkTextIter iter;
-       gchar *qmark;
+       const gchar *qmark;
        gchar *parsed_str = NULL;
        gint cursor_pos = 0;
        const gchar *err_msg = _("Template body format error at line %d.");
@@ -7075,10 +7168,7 @@ static void compose_template_apply(Compose *compose, Template *tmpl,
        buffer = gtk_text_view_get_buffer(text);
 
        if (tmpl->value) {
-               if (prefs_common.quotemark && *prefs_common.quotemark)
-                       qmark = prefs_common.quotemark;
-               else
-                       qmark = "> ";
+               qmark = compose_quote_char_from_context(compose);
 
                if (compose->replyinfo != NULL) {
 
@@ -9476,16 +9566,14 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
                                        compose);
        if (paste_as_quotation) {
                gchar *new_text;
-               gchar *qmark;
+               const gchar *qmark;
 
                if (len < 0)
                        len = strlen(text);
 
                new_text = g_strndup(text, len);
-               if (prefs_common.quotemark && *prefs_common.quotemark)
-                       qmark = prefs_common.quotemark;
-               else
-                       qmark = "> ";
+
+               qmark = compose_quote_char_from_context(compose);
 
                mark = gtk_text_buffer_create_mark(buffer, NULL, iter, FALSE);
                gtk_text_buffer_place_cursor(buffer, iter);
@@ -9683,7 +9771,9 @@ static void compose_reply_from_messageview_real(MessageView *msgview, GSList *ms
                                if (procmime_msginfo_is_encrypted(orig_msginfo)) {
                                        originally_enc = TRUE;
                                }
-                       } 
+                               tmp_msginfo->folder = orig_msginfo->folder;
+                               tmp_msginfo->msgnum = orig_msginfo->msgnum; 
+                       }
                }
        }