/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
unlock_session();
return -1;
}
+ } else if (!(MSG_IS_QUEUED(*fileinfo->flags)
+ || MSG_IS_DRAFT(*fileinfo->flags))
+ && (folder_has_parent_of_type(dest, F_QUEUE)
+ || folder_has_parent_of_type(dest, F_DRAFT))) {
+ return -1;
}
}
if (real_file == NULL)
g_relation_insert(relation, fileinfo->msginfo != NULL ?
(gpointer) fileinfo->msginfo : (gpointer) fileinfo,
GINT_TO_POINTER(dest->last_num + 1));
+ if (new_uid == 0) {
+ new_uid = dest->last_num+1;
+ }
if (last_uid < new_uid)
last_uid = new_uid;
if (file_is_tmp)
statusbar_progress_all(0,0,0);
statusbar_pop_all();
+ imap_cmd_expunge(session);
unlock_session();
g_free(destdir);
msginfo = (MsgInfo *)msglist->data;
g_return_val_if_fail(msginfo->folder != NULL, -1);
+ /* if from/to are the same "type" (with or without extra headers),
+ * copy them via imap */
if (folder == msginfo->folder->folder &&
!folder_has_parent_of_type(msginfo->folder, F_DRAFT) &&
- !folder_has_parent_of_type(msginfo->folder, F_QUEUE)) {
+ !folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
+ !folder_has_parent_of_type(dest, F_DRAFT) &&
+ !folder_has_parent_of_type(dest, F_QUEUE)) {
+ ret = imap_do_copy_msgs(folder, dest, msglist, relation);
+ return ret;
+ } else if (folder == msginfo->folder->folder &&
+ (folder_has_parent_of_type(msginfo->folder, F_DRAFT) ||
+ folder_has_parent_of_type(msginfo->folder, F_QUEUE)) &&
+ (folder_has_parent_of_type(dest, F_DRAFT) ||
+ folder_has_parent_of_type(dest, F_QUEUE))) {
ret = imap_do_copy_msgs(folder, dest, msglist, relation);
return ret;
}
-
+ /* else reupload them */
file_list = procmsg_get_message_file_list(msglist);
g_return_val_if_fail(file_list != NULL, -1);
ret = imap_add_msgs(folder, dest, file_list, relation);
-
procmsg_message_file_list_free(file_list);
return ret;
ok = imap_status(session, IMAP_FOLDER(folder), item->item.path, item,
&exists, &uid_next, &uid_val, NULL, FALSE);
}
+ item->item.last_num = uid_next - 1;
+
item->use_cache = (time_t)0;
if (ok != IMAP_SUCCESS) {
statusbar_pop_all();
/* If old uid_next matches new uid_next we can be sure no message
was added to the folder */
- if (( selected_folder && !session->folder_content_changed) ||
- (!selected_folder && uid_next == item->uid_next)) {
+ debug_print("uid_next is %d and item->uid_next %d \n",
+ uid_next, item->uid_next);
+ if (uid_next == item->uid_next) {
nummsgs = g_slist_length(item->uid_list);
/* If number of messages is still the same we
item->c_uid_next = uid_next;
item->c_uid_validity = uid_val;
item->c_unseen = unseen;
+ item->item.last_num = uid_next - 1;
debug_print("uidnext %d, item->uid_next %d, exists %d, item->item.total_msgs %d\n",
uid_next, item->uid_next, exists, item->item.total_msgs);
if ((uid_next != item->uid_next) || (exists != item->item.total_msgs)) {