* src/mh.c
[claws.git] / src / mh.c
index 2c4a7659eedf93ca02dccbec6ca8df70bff43b27..865ed85488c831810b8a74af4908303e3b7f6a78 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -190,7 +190,7 @@ void mh_get_last_num(Folder *folder, FolderItem *item)
        }
        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;
 }
 
@@ -415,7 +415,7 @@ gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
        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);
@@ -456,19 +456,15 @@ static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        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;
@@ -555,17 +551,15 @@ static gint mh_do_move_msgs_with_dest(Folder *folder, FolderItem *dest,
                        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;
@@ -620,21 +614,19 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 
        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;
        }
        
-       if (copy_file(srcfile, destfile) < 0) {
+       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, TRUE) < 0) {
                FILE_OP_ERROR(srcfile, "copy");
                g_free(srcfile);
                g_free(destfile);
@@ -723,7 +715,7 @@ gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
                        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);
 
@@ -731,7 +723,7 @@ gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
                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);
@@ -850,7 +842,7 @@ gint mh_scan_folder(Folder *folder, FolderItem *item)
                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;
@@ -1050,7 +1042,7 @@ static GSList *mh_get_uncached_msgs(GHashTable *msg_table, FolderItem *item)
                return NULL;
        }
 
-       debug_print(_("\tSearching uncached messages... "));
+       debug_print("\tSearching uncached messages... ");
 
        if (msg_table) {
                while ((d = readdir(dp)) != NULL) {
@@ -1105,16 +1097,16 @@ static GSList *mh_get_uncached_msgs(GHashTable *msg_table, FolderItem *item)
        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;
@@ -1156,6 +1148,7 @@ static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item)
        return msginfo;
 }
 
+#if 0
 static gboolean mh_is_maildir_one(const gchar *path, const gchar *dir)
 {
        gchar *entry;
@@ -1179,6 +1172,7 @@ static gboolean mh_is_maildir(const gchar *path)
               mh_is_maildir_one(path, "cur") &&
               mh_is_maildir_one(path, "tmp");
 }
+#endif
 
 static void mh_scan_tree_recursive(FolderItem *item)
 {
@@ -1222,10 +1216,12 @@ static void mh_scan_tree_recursive(FolderItem *item)
                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(item->folder, d->d_name, entry);
                        folder_item_append(item, new_item);