#include "imap.h"
#include "news.h"
#include "mh.h"
-#include "mbox_folder.h"
+#include "mailmbox_folder.h"
#include "utils.h"
#include "xml.h"
#include "codeconv.h"
folder_register_class(mh_get_class());
folder_register_class(imap_get_class());
folder_register_class(news_get_class());
- folder_register_class(mbox_get_class());
+ folder_register_class(mailmbox_get_class());
}
GSList *folder_get_class_list(void)
for (list = folder_list; list != NULL; list = list->next) {
folder = list->data;
- if ((FOLDER_TYPE(folder) == F_MH || FOLDER_TYPE(folder) == F_MBOX) &&
+ if ((FOLDER_TYPE(folder) == F_MH ||
+ FOLDER_TYPE(folder) == F_MBOX) &&
!path_cmp(LOCAL_FOLDER(folder)->rootpath, path))
return folder;
}
for (list = folder_list; list != NULL; list = list->next) {
folder = list->data;
- if (folder->klass == klass && strcmp2(name, folder->name) == 0)
+ if (folder->klass == klass &&
+ strcmp2(name, folder->name) == 0)
return folder;
}
MsgInfo *msginfo;
g_return_val_if_fail(item != NULL, NULL);
+ g_return_val_if_fail(msgid != NULL, NULL);
folder = item->folder;
if (!item->cache)
relation = g_relation_new(2);
g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
+ g_relation_index(relation, 1, g_direct_hash, g_direct_equal);
/*
* Copy messages to destination folder and
* Fetch new MsgInfos for new messages in dest folder,
* add them to the msgcache and update folder message counts
*/
+ if (g_relation_count(relation, GINT_TO_POINTER(0), 1) > 0) {
+ folder_item_scan_full(dest, FALSE);
+ folderscan = TRUE;
+ }
+
for (l = msglist; l != NULL; l = g_slist_next(l)) {
MsgInfo *msginfo = (MsgInfo *) l->data;
GTuples *tuples;
if (num >= 0) {
MsgInfo *newmsginfo;
- if (num == 0) {
- gchar *file;
-
- if (!folderscan) {
- folder_item_scan_full(dest, FALSE);
- folderscan = TRUE;
+ if (folderscan) {
+ if (msginfo->msgid != NULL) {
+ newmsginfo = folder_item_get_msginfo_by_msgid(dest, msginfo->msgid);
+ if (newmsginfo != NULL) {
+ copy_msginfo_flags(msginfo, newmsginfo);
+ num = newmsginfo->msgnum;
+ procmsg_msginfo_free(newmsginfo);
+ }
+ }
+ } else {
+ newmsginfo = folder->klass->get_msginfo(folder, dest, num);
+ if (newmsginfo != NULL) {
+ add_msginfo_to_cache(dest, newmsginfo, msginfo);
+ procmsg_msginfo_free(newmsginfo);
}
- file = folder_item_fetch_msg(msginfo->folder, msginfo->msgnum);
- num = folder_item_get_msg_num_by_file(dest, file);
- g_free(file);
}
if (num > lastnum)
lastnum = num;
-
- if (num == 0)
- continue;
-
- if (!folderscan &&
- ((newmsginfo = folder->klass->get_msginfo(folder, dest, num)) != NULL)) {
- add_msginfo_to_cache(dest, newmsginfo, msginfo);
- procmsg_msginfo_free(newmsginfo);
- } else if ((newmsginfo = msgcache_get_msg(dest->cache, num)) != NULL) {
- copy_msginfo_flags(msginfo, newmsginfo);
- procmsg_msginfo_free(newmsginfo);
- }
}
}
fprintf(fp, "<folder type=\"%s\"", folder->klass->idstr);
if (folder->name)
PUT_ESCAPE_STR(fp, "name", folder->name);
- if (FOLDER_TYPE(folder) == F_MH || FOLDER_TYPE(folder) == F_MBOX || FOLDER_TYPE(folder) == F_MAILDIR)
+ if (FOLDER_TYPE(folder) == F_MH ||
+ FOLDER_TYPE(folder) == F_MBOX ||
+ FOLDER_TYPE(folder) == F_MAILDIR)
PUT_ESCAPE_STR(fp, "path",
LOCAL_FOLDER(folder)->rootpath);
if (item->collapsed && node->children)