+ return TRUE;
+}
+
+void compose_clear_exit_drafts(void)
+{
+ gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ DRAFTED_AT_EXIT, NULL);
+ if (is_file_exist(filepath))
+ g_unlink(filepath);
+
+ g_free(filepath);
+}
+
+void compose_reopen_exit_drafts(void)
+{
+ gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ DRAFTED_AT_EXIT, NULL);
+ FILE *fp = fopen(filepath, "rb");
+ gchar buf[1024];
+
+ if (fp) {
+ while (fgets(buf, sizeof(buf), fp)) {
+ gchar **parts = g_strsplit(buf, "\t", 2);
+ const gchar *folder = parts[0];
+ int msgnum = parts[1] ? atoi(parts[1]):-1;
+
+ if (folder && *folder && msgnum > -1) {
+ FolderItem *item = folder_find_item_from_identifier(folder);
+ MsgInfo *info = folder_item_get_msginfo(item, msgnum);
+ if (info)
+ compose_reedit(info, FALSE);
+ }
+ g_strfreev(parts);
+ }
+ fclose(fp);
+ }
+ g_free(filepath);
+ compose_clear_exit_drafts();
+}
+
+static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
+{
+ compose_draft(data, action);