aboutsummaryrefslogtreecommitdiff
path: root/libsylph
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 /libsylph
parent2b2a95d6dc052abf955b3a4494e8a05360bd317e (diff)
implemented add-reply-mark-after-sending.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1848 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/procmsg.c80
-rw-r--r--libsylph/procmsg.h5
2 files changed, 83 insertions, 2 deletions
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,