0.8.6claws105
[claws.git] / src / mh.c
index 75b54e770c2c11d8a4ced0fd527e8320eff1541e..8ff5fcaaa60168e818c564736f2da792fc4e8723 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -390,7 +390,7 @@ gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
 
        if (link(file, destfile) < 0) {
                if (copy_file(file, destfile, TRUE) < 0) {
-                       g_warning(_("can't copy message %s to %s\n"),
+                       g_warning("can't copy message %s to %s\n",
                                  file, destfile);
                        g_free(destfile);
                        return -1;
@@ -418,7 +418,7 @@ static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        g_return_val_if_fail(msginfo != NULL, -1);
 
        if (msginfo->folder == dest) {
-               g_warning(_("the src folder is identical to the dest.\n"));
+               g_warning("the src folder is identical to the dest.\n");
                return -1;
        }
 
@@ -486,7 +486,7 @@ gint mh_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
  
                destdir = folder_item_get_path(dest);
                if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
-                       g_warning(_("Can't open mark file.\n"));
+                       g_warning("Can't open mark file.\n");
                else {
                        SET_DEST_MSG_FLAGS(fp, dest, msginfo);
                        fclose(fp);
@@ -522,7 +522,7 @@ static gint mh_do_move_msgs_with_dest(Folder *folder, FolderItem *dest,
                msginfo = (MsgInfo *)cur->data;
 
                if (msginfo->folder == dest) {
-                       g_warning(_("the src folder is identical to the dest.\n"));
+                       g_warning("the src folder is identical to the dest.\n");
                        continue;
                }
                debug_print("Moving message %s%c%d to %s ...\n",
@@ -577,7 +577,7 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        g_return_val_if_fail(msginfo != NULL, -1);
 
        if (msginfo->folder == dest) {
-               g_warning(_("the src folder is identical to the dest.\n"));
+               g_warning("the src folder is identical to the dest.\n");
                return -1;
        }
 
@@ -600,13 +600,21 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
                    msginfo->msgnum, dest->path);
        
 
-       if (copy_file(srcfile, destfile, TRUE) < 0) {
+       if ((MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
+       &&  dest->stype != F_QUEUE && dest->stype != F_DRAFT) {
+               if (procmsg_remove_special_headers(srcfile, destfile) !=0) {
+                       g_free(srcfile);
+                       g_free(destfile);
+                       return -1;
+               }
+       } else if (copy_file(srcfile, destfile, TRUE) < 0) {
                FILE_OP_ERROR(srcfile, "copy");
                g_free(srcfile);
                g_free(destfile);
                return -1;
        }
 
+
        if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
                if (chmod(destfile, prefs->folder_chmod) < 0)
                        FILE_OP_ERROR(destfile, "chmod");
@@ -686,7 +694,7 @@ gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
                msginfo = (MsgInfo *)cur->data;
 
                if (msginfo->folder == dest) {
-                       g_warning(_("the src folder is identical to the dest.\n"));
+                       g_warning("the src folder is identical to the dest.\n");
                        continue;
                }
                debug_print("Copying message %s%c%d to %s ...\n",
@@ -848,8 +856,8 @@ void mh_scan_tree(Folder *folder)
 { \
        if (!is_dir_exist(dir)) { \
                if (is_file_exist(dir)) { \
-                       g_warning(_("File `%s' already exists.\n" \
-                                   "Can't create folder."), dir); \
+                       g_warning("File `%s' already exists.\n" \
+                                   "Can't create folder.", dir); \
                        return -1; \
                } \
                if (make_dir(dir) < 0) \
@@ -884,6 +892,8 @@ FolderItem *mh_create_folder(Folder *folder, FolderItem *parent,
        gchar *path;
        gchar *fullpath;
        FolderItem *new_item;
+       gchar *mh_sequences_filename;
+       FILE *mh_sequences_file;
 
        g_return_val_if_fail(folder != NULL, NULL);
        g_return_val_if_fail(parent != NULL, NULL);
@@ -911,8 +921,17 @@ FolderItem *mh_create_folder(Folder *folder, FolderItem *parent,
                path = g_strdup(name);
        new_item = folder_item_new(folder, name, path);
        folder_item_append(parent, new_item);
+
        g_free(path);
 
+       path = folder_item_get_path(new_item);
+       mh_sequences_filename = g_strconcat(path, G_DIR_SEPARATOR_S,
+                                           ".mh_sequences", NULL);
+       if ((mh_sequences_file = fopen(mh_sequences_filename, "a+b")) != NULL) {
+               fclose(mh_sequences_file);
+       }
+       g_free(mh_sequences_filename);
+
        return new_item;
 }