+2005-08-07 [colin] 1.9.13cvs23
+
+ * src/compose.c
+ * src/folder.c
+ * src/folder.h
+ * src/foldersel.c
+ * src/folderutils.c
+ * src/folderview.c
+ * src/imap.c
+ * src/mainwindow.c
+ * src/messageview.c
+ * src/mh.c
+ * src/msgcache.c
+ * src/procmime.c
+ * src/summaryview.c
+ Make subfolders of Drafts, Queue, Outbox, Trash
+ work like their parents.
+ Fixes bug #686 (Message view on Drafts/Sent should be the same on Subfolders)
+
2005-08-07 [colin] 1.9.13cvs22
* src/addressbook.c
( cvs diff -u -r 1.207.2.52 -r 1.207.2.53 src/folderview.c; cvs diff -u -r 1.395.2.103 -r 1.395.2.104 src/summaryview.c; ) > 1.9.13cvs20.patchset
( cvs diff -u -r 1.395.2.104 -r 1.395.2.105 src/summaryview.c; ) > 1.9.13cvs21.patchset
( cvs diff -u -r 1.60.2.23 -r 1.60.2.24 src/addressbook.c; ) > 1.9.13cvs22.patchset
+( cvs diff -u -r 1.382.2.148 -r 1.382.2.149 src/compose.c; cvs diff -u -r 1.213.2.45 -r 1.213.2.46 src/folder.c; cvs diff -u -r 1.87.2.14 -r 1.87.2.15 src/folder.h; cvs diff -u -r 1.26.2.18 -r 1.26.2.19 src/foldersel.c; cvs diff -u -r 1.3.2.5 -r 1.3.2.6 src/folderutils.c; cvs diff -u -r 1.207.2.53 -r 1.207.2.54 src/folderview.c; cvs diff -u -r 1.179.2.57 -r 1.179.2.58 src/imap.c; cvs diff -u -r 1.274.2.52 -r 1.274.2.53 src/mainwindow.c; cvs diff -u -r 1.94.2.60 -r 1.94.2.61 src/messageview.c; cvs diff -u -r 1.79.2.15 -r 1.79.2.16 src/mh.c; cvs diff -u -r 1.16.2.23 -r 1.16.2.24 src/msgcache.c; cvs diff -u -r 1.49.2.52 -r 1.49.2.53 src/procmime.c; cvs diff -u -r 1.395.2.105 -r 1.395.2.106 src/summaryview.c; ) > 1.9.13cvs23.patchset
MICRO_VERSION=13
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=22
+EXTRA_VERSION=23
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
if (compose_put_existing_to_front(msginfo))
return;
- if (msginfo->folder->stype == F_QUEUE || msginfo->folder->stype == F_DRAFT) {
+ if (folder_has_parent_of_type(msginfo->folder, F_QUEUE) ||
+ folder_has_parent_of_type(msginfo->folder, F_DRAFT)) {
gchar queueheader_buf[BUFFSIZE];
gint id, param;
compose_use_encryption(compose, use_encryption);
compose->targetinfo = procmsg_msginfo_copy(msginfo);
- if (msginfo->folder->stype == F_QUEUE
- || msginfo->folder->stype == F_DRAFT) {
+ if (folder_has_parent_of_type(msginfo->folder, F_QUEUE) ||
+ folder_has_parent_of_type(msginfo->folder, F_DRAFT)) {
gchar queueheader_buf[BUFFSIZE];
/* Set message save folder */
g_return_val_if_fail(item != NULL, -1);
if (procmsg_msg_exist(msginfo) &&
- (item->stype == F_DRAFT || item->stype == F_QUEUE
+ (folder_has_parent_of_type(item, F_QUEUE) ||
+ folder_has_parent_of_type(item, F_DRAFT)
|| msginfo == compose->autosaved_draft)) {
if (folder_item_remove_msg(item, msginfo->msgnum) < 0) {
g_warning("can't remove the old message\n");
void folder_item_set_default_flags(FolderItem *dest, MsgFlags *flags)
{
- if (!(dest->stype == F_OUTBOX ||
- dest->stype == F_QUEUE ||
- dest->stype == F_DRAFT ||
- dest->stype == F_TRASH)) {
+ if (!(folder_has_parent_of_type(dest, F_OUTBOX) ||
+ folder_has_parent_of_type(dest, F_QUEUE) ||
+ folder_has_parent_of_type(dest, F_DRAFT) ||
+ folder_has_parent_of_type(dest, F_TRASH))) {
flags->perm_flags = MSG_NEW|MSG_UNREAD;
} else {
flags->perm_flags = 0;
}
if (FOLDER_TYPE(dest->folder) == F_MH) {
- if (dest->stype == F_QUEUE) {
+ if (folder_has_parent_of_type(dest, F_QUEUE)) {
MSG_SET_TMP_FLAGS(*flags, MSG_QUEUED);
- } else if (dest->stype == F_DRAFT) {
+ } else if (folder_has_parent_of_type(dest, F_DRAFT)) {
MSG_SET_TMP_FLAGS(*flags, MSG_DRAFT);
}
}
procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
}
- if ((item->stype == F_OUTBOX ||
- item->stype == F_QUEUE ||
- item->stype == F_DRAFT ||
- item->stype == F_TRASH) &&
+ if ((folder_has_parent_of_type(item, F_OUTBOX) ||
+ folder_has_parent_of_type(item, F_QUEUE) ||
+ folder_has_parent_of_type(item, F_DRAFT) ||
+ folder_has_parent_of_type(item, F_TRASH)) &&
(MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)))
procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
if (MSG_IS_NEW(msginfo->flags))
if ((msginfo != NULL) && !MSG_IS_SCANNED(msginfo->flags)) {
MimeInfo *mimeinfo;
- if (msginfo->folder->stype != F_QUEUE &&
- msginfo->folder->stype != F_DRAFT)
+ if (!folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
+ !folder_has_parent_of_type(msginfo->folder, F_DRAFT))
mimeinfo = procmime_scan_file(msgfile);
else
mimeinfo = procmime_scan_queue_file(msgfile);
if ((msginfo != NULL) && !MSG_IS_SCANNED(msginfo->flags)) {
MimeInfo *mimeinfo;
- if (msginfo->folder->stype != F_QUEUE &&
- msginfo->folder->stype != F_DRAFT)
+ if (!folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
+ !folder_has_parent_of_type(msginfo->folder, F_DRAFT))
mimeinfo = procmime_scan_file(msgfile);
else
mimeinfo = procmime_scan_queue_file(msgfile);
if ((fp = fopen(file, "rb")) == NULL)
return 0;
- if ((dest->stype == F_QUEUE) || (dest->stype == F_DRAFT))
+ if ((folder_has_parent_of_type(dest, F_QUEUE)) ||
+ (folder_has_parent_of_type(msginfo->folder, F_DRAFT)))
while (fgets(buf, sizeof(buf), fp) != NULL)
if (buf[0] == '\r' || buf[0] == '\n') break;
}
/* remove new, unread and deleted in special folders */
- if (dest->folder->stype == F_OUTBOX ||
- dest->folder->stype == F_QUEUE ||
- dest->folder->stype == F_DRAFT ||
- dest->folder->stype == F_TRASH)
+ if (folder_has_parent_of_type(dest, F_OUTBOX) ||
+ folder_has_parent_of_type(dest, F_QUEUE) ||
+ folder_has_parent_of_type(dest, F_DRAFT) ||
+ folder_has_parent_of_type(dest, F_TRASH))
perm_flags &= ~(MSG_NEW | MSG_UNREAD | MSG_DELETED);
/* set ignore flag of ignored parent exists */
}
}
+gboolean folder_has_parent_of_type(FolderItem *item,
+ SpecialFolderItemType type)
+{
+ FolderItem *cur = item;
+ while (cur) {
+ if (cur->stype == type)
+ return TRUE;
+ cur = folder_item_parent(cur);
+ }
+ return FALSE;
+}
+
#undef PUT_ESCAPE_STR
void folder_item_update_freeze (void);
void folder_item_update_thaw (void);
void folder_item_set_batch (FolderItem *item, gboolean batch);
+gboolean folder_has_parent_of_type (FolderItem *item, SpecialFolderItemType type);
#endif /* __FOLDER_H__ */
}
#endif
- if (item->stype == F_QUEUE && item->total_msgs > 0) {
+ if (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0) {
name = g_strdup_printf("%s (%d)", name, item->total_msgs);
} else if (item->unread_msgs > 0) {
name = g_strdup_printf("%s (%d)", name, item->unread_msgs);
pixbuf_open =
item->no_select ? foldernoselect_pixbuf : folderopen_pixbuf;
- if (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
- item->stype == F_TRASH) {
+ if (folder_has_parent_of_type(item, F_DRAFT) ||
+ folder_has_parent_of_type(item, F_OUTBOX) ||
+ folder_has_parent_of_type(item, F_TRASH)) {
use_bold = use_color = FALSE;
- } else if (item->stype == F_QUEUE) {
+ } else if (folder_has_parent_of_type(item, F_QUEUE)) {
use_bold = use_color = (item->total_msgs > 0);
} else {
use_bold = (item->unread_msgs > 0);
case DELETE_DUPLICATES_REMOVE: {
FolderItem *trash = item->folder->trash;
- if (item->stype == F_TRASH || trash == NULL)
+ if (folder_has_parent_of_type(item, F_TRASH) || trash == NULL)
folder_item_remove_msgs(item, duplist);
else
folder_item_move_msgs(trash, duplist);
if (in_sub &&
(item->new_msgs > 0 ||
- (item->stype == F_QUEUE && item->total_msgs > 0))) {
+ (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0))) {
return TRUE;
}
if (in_sub &&
(item->unread_msgs > 0 ||
- (item->stype == F_QUEUE && item->total_msgs > 0))) {
+ (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0))) {
return TRUE;
}
mask = openmask = searchmask;
}
- if (item->stype == F_QUEUE && item->total_msgs > 0 &&
+ if (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0 &&
prefs_common.display_folder_unread) {
str = g_strdup_printf("%s (%d%s)", name, item->total_msgs,
add_unread_mark ? "+" : "");
gtk_ctree_node_set_text(ctree, node, col_pos[F_COL_TOTAL], itos(item->total_msgs));
}
- if (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
- item->stype == F_TRASH) {
+ if (folder_has_parent_of_type(item, F_OUTBOX) ||
+ folder_has_parent_of_type(item, F_DRAFT) ||
+ folder_has_parent_of_type(item, F_TRASH)) {
use_bold = use_color = FALSE;
- } else if (item->stype == F_QUEUE) {
+ } else if (folder_has_parent_of_type(item, F_QUEUE)) {
/* highlight queue folder if there are any messages */
use_bold = use_color = (item->total_msgs > 0);
} else {
iflags |= IMAP_FLAG_SEEN;
}
- if (dest->stype == F_OUTBOX ||
- dest->stype == F_QUEUE ||
- dest->stype == F_DRAFT ||
- dest->stype == F_TRASH)
+ if (folder_has_parent_of_type(dest, F_QUEUE) ||
+ folder_has_parent_of_type(dest, F_OUTBOX) ||
+ folder_has_parent_of_type(dest, F_DRAFT) ||
+ folder_has_parent_of_type(dest, F_TRASH))
iflags |= IMAP_FLAG_SEEN;
ok = imap_cmd_append(session, destdir, fileinfo->file, iflags,
g_return_val_if_fail(item != NULL, NULL);
g_return_val_if_fail(file != NULL, NULL);
- if (item->stype == F_QUEUE) {
+ if (folder_has_parent_of_type(item, F_QUEUE)) {
MSG_SET_TMP_FLAGS(flags, MSG_QUEUED);
- } else if (item->stype == F_DRAFT) {
+ } else if (folder_has_parent_of_type(item, F_DRAFT)) {
MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
}
if (ok != IMAP_SUCCESS)
return NULL;
- if (!(item->stype == F_QUEUE || item->stype == F_DRAFT)) {
+ if (!(folder_has_parent_of_type(item, F_DRAFT) ||
+ folder_has_parent_of_type(item, F_QUEUE))) {
ret = g_slist_concat(ret,
imap_get_uncached_messages(session, item,
msgnum_list));
MsgFlags flags = {0, 0};
MSG_SET_TMP_FLAGS(flags, MSG_IMAP);
- if (item->stype == F_QUEUE) {
+ if (folder_has_parent_of_type(item, F_QUEUE)) {
MSG_SET_TMP_FLAGS(flags, MSG_QUEUED);
- } else if (item->stype == F_DRAFT) {
+ } else if (folder_has_parent_of_type(item, F_DRAFT)) {
MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
}
flags.perm_flags = info->flags;
state |= M_NOT_NEWS;
if (selection == SUMMARY_SELECTED_SINGLE &&
(item &&
- (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
- item->stype == F_QUEUE)))
+ (folder_has_parent_of_type(item, F_DRAFT) ||
+ folder_has_parent_of_type(item, F_OUTBOX) ||
+ folder_has_parent_of_type(item, F_QUEUE))))
state |= M_ALLOW_REEDIT;
if (cur_account)
state |= M_HAVE_ACCOUNT;
if (!messageview->msginfo) return;
msginfo = messageview->msginfo;
if (!msginfo->folder) return;
- if (msginfo->folder->stype != F_OUTBOX &&
- msginfo->folder->stype != F_DRAFT &&
- msginfo->folder->stype != F_QUEUE) return;
+ if (!folder_has_parent_of_type(msginfo->folder, F_DRAFT) &&
+ !folder_has_parent_of_type(msginfo->folder, F_OUTBOX) &&
+ !folder_has_parent_of_type(msginfo->folder, F_QUEUE))
+ return;
compose_reedit(msginfo);
}
if ((MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
- && dest->stype != F_QUEUE && dest->stype != F_DRAFT) {
+ && !folder_has_parent_of_type(dest, F_QUEUE)
+ && !folder_has_parent_of_type(dest, F_DRAFT)) {
if (procmsg_remove_special_headers(srcfile, destfile) !=0) {
g_free(srcfile);
g_free(destfile);
return -1;
}
} else if (!(MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
- && (dest->stype == F_QUEUE || dest->stype == F_DRAFT)) {
+ && (folder_has_parent_of_type(dest, F_QUEUE)
+ || folder_has_parent_of_type(dest, F_DRAFT))) {
g_free(srcfile);
g_free(destfile);
return -1;
flags.perm_flags = MSG_NEW|MSG_UNREAD;
flags.tmp_flags = 0;
- if (item->stype == F_QUEUE) {
+ if (folder_has_parent_of_type(item, F_QUEUE)) {
MSG_SET_TMP_FLAGS(flags, MSG_QUEUED);
- } else if (item->stype == F_DRAFT) {
+ } else if (folder_has_parent_of_type(item, F_DRAFT)) {
MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
}
debug_print("\tReading %sswapped message cache from %s...\n", swapping?"":"un", cache_file);
- if (item->stype == F_QUEUE) {
+ if (folder_has_parent_of_type(item, F_QUEUE)) {
tmp_flags |= MSG_QUEUED;
- } else if (item->stype == F_DRAFT) {
+ } else if (folder_has_parent_of_type(item, F_DRAFT)) {
tmp_flags |= MSG_DRAFT;
}
if (!filename || !is_file_exist(filename))
return NULL;
- if (msginfo->folder->stype != F_QUEUE &&
- msginfo->folder->stype != F_DRAFT)
+ if (!folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
+ !folder_has_parent_of_type(msginfo->folder, F_DRAFT))
mimeinfo = procmime_scan_file(filename);
else
mimeinfo = procmime_scan_queue_file(filename);
if (!summaryview->selected) return;
if (!summaryview->folder_item) return;
- if (summaryview->folder_item->stype != F_OUTBOX &&
- summaryview->folder_item->stype != F_DRAFT &&
- summaryview->folder_item->stype != F_QUEUE) return;
+ if (!folder_has_parent_of_type(summaryview->folder_item, F_OUTBOX)
+ && !folder_has_parent_of_type(summaryview->folder_item, F_DRAFT)
+ && !folder_has_parent_of_type(summaryview->folder_item, F_QUEUE))
+ return;
msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
summaryview->selected);
summaryview->deleted++;
if (!prefs_common.immediate_exec &&
- summaryview->folder_item->stype != F_TRASH)
+ !folder_has_parent_of_type(summaryview->folder_item, F_TRASH))
summary_set_row_marks(summaryview, row);
debug_print("Message %s/%d is set to delete\n",
summary_select_node(summaryview, node, prefs_common.always_show_msg, TRUE);
- if (prefs_common.immediate_exec || item->stype == F_TRASH) {
+ if (prefs_common.immediate_exec || folder_has_parent_of_type(item, F_TRASH)) {
summary_execute(summaryview);
/* after deleting, the anchor may be at an invalid row
* so reset it to the node we found earlier */
static void summary_open_row(GtkSCTree *sctree, SummaryView *summaryview)
{
- if (summaryview->folder_item->stype == F_OUTBOX ||
- summaryview->folder_item->stype == F_DRAFT ||
- summaryview->folder_item->stype == F_QUEUE)
+ if (folder_has_parent_of_type(summaryview->folder_item, F_OUTBOX)
+ || folder_has_parent_of_type(summaryview->folder_item, F_DRAFT)
+ || folder_has_parent_of_type(summaryview->folder_item, F_QUEUE))
summary_reedit(summaryview);
else
summary_open_msg(summaryview);