From 4a926a141d7bfb0830e599ab2c85233d24513ea5 Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 9 Jul 2007 06:54:58 +0000 Subject: implemented add-reply-mark-after-sending. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1848 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++-------- src/summaryview.c | 19 ++++++++++++++++++ src/summaryview.h | 6 ++++++ 3 files changed, 75 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/compose.c b/src/compose.c index 1724e9b9..4b0163a7 100644 --- a/src/compose.c +++ b/src/compose.c @@ -820,14 +820,6 @@ void compose_reply(MsgInfo *msginfo, FolderItem *item, ComposeMode mode, account = cur_account; g_return_if_fail(account != NULL); - MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_FORWARDED); - MSG_SET_PERM_FLAGS(msginfo->flags, MSG_REPLIED); - MSG_SET_TMP_FLAGS(msginfo->flags, MSG_FLAG_CHANGED); - if (item) - item->mark_dirty = TRUE; - if (MSG_IS_IMAP(msginfo->flags)) - imap_msg_set_perm_flags(msginfo, MSG_REPLIED); - compose = compose_create(account, COMPOSE_REPLY); compose->replyinfo = procmsg_msginfo_get_full_info(msginfo); @@ -2788,6 +2780,52 @@ void compose_unlock(Compose *compose) compose->lock_count--; } +static gint compose_set_reply_flag(Compose *compose) +{ + MsgInfo *msginfo; + MsgInfo *replyinfo; + SummaryView *summaryview; + + g_return_val_if_fail(compose->replyinfo != NULL, -1); + g_return_val_if_fail(compose->replyinfo->folder != NULL, -1); + + replyinfo = compose->replyinfo; + + summaryview = main_window_get()->summaryview; + if (summaryview->folder_item == replyinfo->folder) { + msginfo = summary_get_msginfo_by_msgnum + (summaryview, replyinfo->msgnum); + if (msginfo) { + MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_FORWARDED); + MSG_SET_PERM_FLAGS(msginfo->flags, MSG_REPLIED); + MSG_SET_TMP_FLAGS(msginfo->flags, MSG_FLAG_CHANGED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_set_perm_flags(msginfo, MSG_REPLIED); + if (msginfo->folder) + msginfo->folder->mark_dirty = TRUE; + summary_update_by_msgnum + (summaryview, msginfo->msgnum); + } + } else { + msginfo = procmsg_get_msginfo + (replyinfo->folder, replyinfo->msgnum); + + if (msginfo) { + MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_FORWARDED); + MSG_SET_PERM_FLAGS(msginfo->flags, MSG_REPLIED); + MSG_SET_TMP_FLAGS(msginfo->flags, MSG_FLAG_CHANGED); + if (MSG_IS_IMAP(msginfo->flags)) + imap_msg_set_perm_flags(msginfo, MSG_REPLIED); + if (msginfo->folder) + msginfo->folder->mark_dirty = TRUE; + procmsg_add_flags(msginfo->folder, + msginfo->msgnum, + msginfo->flags); + procmsg_msginfo_free(msginfo); + } + } +} + static gint compose_send(Compose *compose) { gchar tmp[MAXPATHLEN + 1]; @@ -2876,6 +2914,10 @@ static gint compose_send(Compose *compose) folderview_update_item (compose->targetinfo->folder, TRUE); } + + if (compose->replyinfo) + compose_set_reply_flag(compose); + /* save message to outbox */ if (prefs_common.savemsg) { FolderItem *outbox; diff --git a/src/summaryview.c b/src/summaryview.c index 6cd839f8..9ca43108 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1616,6 +1616,17 @@ gboolean summary_select_by_msginfo(SummaryView *summaryview, MsgInfo *msginfo) return FALSE; } +MsgInfo *summary_get_msginfo_by_msgnum(SummaryView *summaryview, guint msgnum) +{ + GtkTreeIter iter; + MsgInfo *msginfo = NULL; + + if (summary_find_msg_by_msgnum(summaryview, msgnum, &iter)) + GET_MSG_INFO(msginfo, &iter); + + return msginfo; +} + /** * summary_select_row: * @summaryview: Summary view. @@ -2888,6 +2899,14 @@ void summary_update_selected_rows(SummaryView *summaryview) } } +void summary_update_by_msgnum(SummaryView *summaryview, guint msgnum) +{ + GtkTreeIter iter; + + if (summary_find_msg_by_msgnum(summaryview, msgnum, &iter)) + summary_set_row(summaryview, &iter, NULL); +} + static void summary_mark_row(SummaryView *summaryview, GtkTreeIter *iter) { MsgInfo *msginfo = NULL; diff --git a/src/summaryview.h b/src/summaryview.h index 021b9f21..3dfa3d8d 100644 --- a/src/summaryview.h +++ b/src/summaryview.h @@ -185,6 +185,9 @@ GSList *summary_get_msg_list (SummaryView *summaryview); GSList *summary_get_flagged_msg_list (SummaryView *summaryview, MsgPermFlags flags); +MsgInfo *summary_get_msginfo_by_msgnum (SummaryView *summaryview, + guint msgnum); + void summary_select_prev_unread (SummaryView *summaryview); void summary_select_next_unread (SummaryView *summaryview); void summary_select_prev_new (SummaryView *summaryview); @@ -197,6 +200,7 @@ void summary_select_by_msgnum (SummaryView *summaryview, guint msgnum); gboolean summary_select_by_msginfo(SummaryView *summaryview, MsgInfo *msginfo); + void summary_select_row (SummaryView *summaryview, GtkTreeIter *iter, gboolean display_msg, @@ -247,6 +251,8 @@ gboolean summary_step (SummaryView *summaryview, void summary_toggle_view (SummaryView *summaryview); void summary_update_selected_rows (SummaryView *summaryview); +void summary_update_by_msgnum (SummaryView *summaryview, + guint msgnum); void summary_move_selected_to (SummaryView *summaryview, FolderItem *to_folder); -- cgit v1.2.3