aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-07-09 06:54:58 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-07-09 06:54:58 +0000
commit4a926a141d7bfb0830e599ab2c85233d24513ea5 (patch)
tree5f3f09b5ae7480b6226cf1b3e3f8af8b0cc74c52
parent2b2a95d6dc052abf955b3a4494e8a05360bd317e (diff)
implemented add-reply-mark-after-sending.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1848 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja6
-rw-r--r--libsylph/procmsg.c80
-rw-r--r--libsylph/procmsg.h5
-rw-r--r--src/compose.c58
-rw-r--r--src/summaryview.c19
-rw-r--r--src/summaryview.h6
7 files changed, 170 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e2c61e0..d3e086e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-07-09
+
+ * libsylph/procmsg.[ch]: procmsg_get_msginfo(): added.
+ * src/compose.c
+ src/summaryview.[ch]: implemented add-reply-mark-after-sending.
+
2007-06-26
* version 2.4.3
diff --git a/ChangeLog.ja b/ChangeLog.ja
index abab6508..0771b05a 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,9 @@
+2007-07-09
+
+ * libsylph/procmsg.[ch]: procmsg_get_msginfo(): 追加。
+ * src/compose.c
+ src/summaryview.[ch]: 送信後返信マーク付加を実装。
+
2007-06-26
* version 2.4.3
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index 3c9a430b..4d3114fa 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1517,6 +1517,84 @@ void procmsg_print_message_part(MsgInfo *msginfo, MimeInfo *partinfo,
g_free(prtmp);
}
+static gboolean procmsg_get_flags(FolderItem *item, gint num,
+ MsgPermFlags *flags)
+{
+ FILE *fp;
+ guint32 idata;
+ gint read_num;
+ MsgPermFlags perm_flags;
+ gboolean found = FALSE;
+ GSList *cur;
+
+ if ((fp = procmsg_open_mark_file(item, DATA_READ)) == NULL)
+ return FALSE;
+
+ while (fread(&idata, sizeof(idata), 1, fp) == 1) {
+ read_num = idata;
+ if (fread(&idata, sizeof(idata), 1, fp) != 1)
+ break;
+ perm_flags = idata;
+ if (read_num == num) {
+ *flags = perm_flags;
+ found = TRUE;
+ break;
+ }
+ }
+
+ fclose(fp);
+ if (found)
+ return TRUE;
+
+ for (cur = item->mark_queue; cur != NULL; cur = cur->next) {
+ MsgInfo *msginfo = (MsgInfo *)cur->data;
+
+ if (msginfo->msgnum == num) {
+ *flags = msginfo->flags.perm_flags;
+ found = TRUE;
+ break;
+ }
+ }
+
+ return found;
+}
+
+MsgInfo *procmsg_get_msginfo(FolderItem *item, gint num)
+{
+ MsgInfo *msginfo;
+ FolderType type;
+
+ g_return_if_fail(item->folder != NULL);
+
+ msginfo = folder_item_get_msginfo(item, num);
+ if (!msginfo)
+ return NULL;
+
+ type = FOLDER_TYPE(item->folder);
+ if (type == F_MH || type == F_IMAP) {
+ if (item->stype == F_QUEUE) {
+ MSG_SET_TMP_FLAGS(msginfo->flags, MSG_QUEUED);
+ } else if (item->stype == F_DRAFT) {
+ MSG_SET_TMP_FLAGS(msginfo->flags, MSG_DRAFT);
+ }
+ }
+ if (type == F_IMAP) {
+ MSG_SET_TMP_FLAGS(msginfo->flags, MSG_IMAP);
+ } else if (type == F_NEWS) {
+ MSG_SET_TMP_FLAGS(msginfo->flags, MSG_NEWS);
+ }
+
+ if (type == F_MH || type == F_NEWS) {
+ MsgPermFlags flags = 0;
+ if (procmsg_get_flags(item, num, &flags)) {
+ g_print("set msg %d's flag\n", num);
+ msginfo->flags.perm_flags = flags;
+ }
+ }
+
+ return msginfo;
+}
+
MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo)
{
MsgInfo *newmsginfo;
diff --git a/libsylph/procmsg.h b/libsylph/procmsg.h
index c349d7b5..1abe7205 100644
--- a/libsylph/procmsg.h
+++ b/libsylph/procmsg.h
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -309,6 +309,9 @@ void procmsg_print_message (MsgInfo *msginfo,
const gchar *cmdline,
gboolean all_headers);
+MsgInfo *procmsg_get_msginfo (FolderItem *item,
+ gint num);
+
MsgInfo *procmsg_msginfo_copy (MsgInfo *msginfo);
MsgInfo *procmsg_msginfo_get_full_info (MsgInfo *msginfo);
gboolean procmsg_msginfo_equal (MsgInfo *msginfo_a,
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);