FolderItem *item);
static MsgInfo *mh_parse_msg (const gchar *file,
FolderItem *item);
-static void mh_scan_tree_recursive (FolderItem *item,
- GHashTable *pptable);
+static void mh_scan_tree_recursive (FolderItem *item);
static gboolean mh_rename_folder_func (GNode *node,
gpointer data);
static void mh_folder_init(Folder *folder, const gchar *name, const gchar *path)
{
- folder_local_folder_init(folder, name, path);
-
folder->type = F_MH;
+ folder_local_folder_init(folder, name, path);
+
/*
folder->get_msg_list = mh_get_msg_list;
*/
}
closedir(dp);
- debug_print(_("Last number in dir %s = %d\n"), item->path, max);
+ debug_print("Last number in dir %s = %d\n", item->path, max);
item->last_num = max;
}
folder_item_set_default_flags(item, &flags);
msginfo = procheader_parse_file(file, flags, TRUE, FALSE);
+ if(!msginfo) {
+ g_free(file);
+ return NULL;
+ }
+
msginfo->msgnum = num;
msginfo->folder = item;
msginfo->mtime = s.st_mtime;
}
+ g_free(file);
+
return msginfo;
}
g_return_val_if_fail(destfile != NULL, -1);
if (link(file, destfile) < 0) {
- if (copy_file(file, destfile) < 0) {
+ if (copy_file(file, destfile, TRUE) < 0) {
g_warning(_("can't copy message %s to %s\n"),
file, destfile);
g_free(destfile);
static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
{
- gchar *destdir;
gchar *srcfile;
gchar *destfile;
- FILE *fp;
gint filemode = 0;
PrefsFolderItem *prefs;
prefs = dest->prefs;
destfile = mh_get_new_msg_filename(dest);
- g_return_val_if_fail(destfile != NULL, -1);
+ if (!destfile) return -1;
- debug_print(_("Moving message %s%c%d to %s ...\n"),
+ srcfile = procmsg_get_message_file(msginfo);
+
+ debug_print("Moving message %s%c%d to %s ...\n",
msginfo->folder->path, G_DIR_SEPARATOR,
msginfo->msgnum, dest->path);
- srcfile = procmsg_get_message_file(msginfo);
-
- destfile = mh_get_new_msg_filename(dest);
- if(!destfile) return -1;
-
- srcfile = procmsg_get_message_file(msginfo);
- if (move_file(srcfile, destfile) < 0) {
+ if (move_file(srcfile, destfile, FALSE) < 0) {
g_free(srcfile);
g_free(destfile);
return -1;
g_free(destfile);
dest->last_num++;
- g_free(destdir);
-
return dest->last_num;
}
{
gchar *srcfile;
gchar *destfile;
- FILE *fp;
GSList *cur;
MsgInfo *msginfo;
PrefsFolderItem *prefs;
g_warning(_("the src folder is identical to the dest.\n"));
continue;
}
- debug_print(_("Moving message %s%c%d to %s ...\n"),
+ debug_print("Moving message %s%c%d to %s ...\n",
msginfo->folder->path, G_DIR_SEPARATOR,
msginfo->msgnum, dest->path);
destfile = mh_get_new_msg_filename(dest);
- if (!destfile) break;
+ if (!destfile) return -1;
srcfile = procmsg_get_message_file(msginfo);
- destfile = mh_get_new_msg_filename(dest);
- if(!destfile) return -1;
- if (move_file(srcfile, destfile) < 0) {
+ if (move_file(srcfile, destfile, FALSE) < 0) {
g_free(srcfile);
g_free(destfile);
break;
{
gchar *srcfile;
gchar *destfile;
- gchar *destdir;
gint filemode = 0;
PrefsFolderItem *prefs;
prefs = dest->prefs;
- destfile = mh_get_new_msg_filename(dest);
- g_return_val_if_fail(destfile != NULL, -1);
-
- debug_print(_("Copying message %s%c%d to %s ...\n"),
- msginfo->folder->path, G_DIR_SEPARATOR,
- msginfo->msgnum, dest->path);
-
srcfile = procmsg_get_message_file(msginfo);
destfile = mh_get_new_msg_filename(dest);
- if(!destfile) {
+ if (!destfile) {
g_free(srcfile);
return -1;
}
- dest->op_count--;
+ debug_print("Copying message %s%c%d to %s ...\n",
+ msginfo->folder->path, G_DIR_SEPARATOR,
+ msginfo->msgnum, dest->path);
+
- if (copy_file(srcfile, destfile) < 0) {
+ if (copy_file(srcfile, destfile, TRUE) < 0) {
FILE_OP_ERROR(srcfile, "copy");
g_free(srcfile);
g_free(destfile);
g_warning(_("the src folder is identical to the dest.\n"));
continue;
}
- debug_print(_("Copying message %s%c%d to %s ...\n"),
+ debug_print("Copying message %s%c%d to %s ...\n",
msginfo->folder->path, G_DIR_SEPARATOR,
msginfo->msgnum, dest->path);
if (!destfile) break;
srcfile = procmsg_get_message_file(msginfo);
- if (copy_file(srcfile, destfile) < 0) {
+ if (copy_file(srcfile, destfile, TRUE) < 0) {
FILE_OP_ERROR(srcfile, "copy");
g_free(srcfile);
g_free(destfile);
gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
{
gchar *file;
- MsgInfo *msginfo;
g_return_val_if_fail(item != NULL, -1);
struct stat s;
gint max = 0;
gint num;
- gint n_msg = 0;
g_return_val_if_fail(item != NULL, -1);
item->total = n_msg;
}
*/
- debug_print(_("Last number in dir %s = %d\n"), item->path, max);
+ debug_print("Last number in dir %s = %d\n", item->path, max);
item->last_num = max;
return 0;
{
FolderItem *item;
gchar *rootpath;
- GHashTable *pptable;
g_return_if_fail(folder != NULL);
- pptable = folder_persist_prefs_new(folder);
-
- prefs_scoring_clear();
- prefs_filtering_clear();
- folder_tree_destroy(folder);
- item = folder_item_new(folder->name, NULL);
+ item = folder_item_new(folder, folder->name, NULL);
item->folder = folder;
folder->node = g_node_new(item);
g_free(rootpath);
mh_create_tree(folder);
- mh_scan_tree_recursive(item, pptable);
-
- folder_persist_prefs_free(pptable);
-
- prefs_matcher_read_config();
+ mh_scan_tree_recursive(item);
}
#define MAKE_DIR_IF_NOT_EXIST(dir) \
NULL);
else
path = g_strdup(name);
- new_item = folder_item_new(name, path);
+ new_item = folder_item_new(folder, name, path);
folder_item_append(parent, new_item);
g_free(path);
return NULL;
}
- debug_print(_("\tSearching uncached messages... "));
+ debug_print("\tSearching uncached messages... ");
if (msg_table) {
while ((d = readdir(dp)) != NULL) {
closedir(dp);
if (n_newmsg)
- debug_print(_("%d uncached message(s) found.\n"), n_newmsg);
+ debug_print("%d uncached message(s) found.\n", n_newmsg);
else
- debug_print(_("done.\n"));
+ debug_print("done.\n");
/* sort new messages in numerical order */
if (newlist) {
- debug_print(_("\tSorting uncached messages in numerical order... "));
+ debug_print("\tSorting uncached messages in numerical order... ");
newlist = g_slist_sort
(newlist, (GCompareFunc)procmsg_cmp_msgnum_for_sort);
- debug_print(_("done.\n"));
+ debug_print("done.\n");
}
return newlist;
return msginfo;
}
+#if 0
static gboolean mh_is_maildir_one(const gchar *path, const gchar *dir)
{
gchar *entry;
mh_is_maildir_one(path, "cur") &&
mh_is_maildir_one(path, "tmp");
}
+#endif
-static void mh_scan_tree_recursive(FolderItem *item, GHashTable *pptable)
+static void mh_scan_tree_recursive(FolderItem *item)
{
DIR *dp;
struct dirent *d;
if (S_ISDIR(s.st_mode)) {
FolderItem *new_item;
+#if 0
if (mh_is_maildir(entry)) {
g_free(entry);
continue;
}
+#endif
- new_item = folder_item_new(d->d_name, entry);
+ new_item = folder_item_new(item->folder, d->d_name, entry);
folder_item_append(item, new_item);
if (!item->path) {
if (!strcmp(d->d_name, INBOX_DIR)) {
item->folder->trash = new_item;
}
}
- folder_item_restore_persist_prefs(new_item, pptable);
- mh_scan_tree_recursive(new_item, pptable);
+ mh_scan_tree_recursive(new_item);
} else if (to_number(d->d_name) != -1) n_msg++;
g_free(entry);
closedir(dp);
+/*
if (item->path) {
gint new, unread, total, min, max;
item->unread = unread;
item->total = n_msg;
}
+*/
}
static gboolean mh_rename_folder_func(GNode *node, gpointer data)