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;
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;
}
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);
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",
return ret;
}
-static void mh_remove_queue_headers (const gchar *file)
-{
- FILE *fp, *fp2;
- char *tmp;
- fp = fopen(file, "rb");
- tmp = get_tmp_file();
-
- fp2 = fopen(tmp, "wb");
- if (fp && fp2) {
- char buf[BUFFSIZE];
- int len;
- while (fgets(buf, sizeof(buf), fp) != NULL)
- if (buf[0] == '\r' || buf[0] == '\n')
- break;
-
- while ((len=fread(buf, sizeof(char), sizeof(buf), fp)) > 0) {
- fwrite(buf, len, 1, fp2);
- }
- fclose(fp);
- fclose(fp2);
- move_file(tmp, file, TRUE);
- } else {
- if (fp)
- fclose(fp);
- else
- g_warning (_("Couldn't fopen(\"%s\",\"rb\")\n"), file);
- if (fp2)
- fclose(fp2);
- else
- g_warning (_("Couldn't fopen(\"%s\",\"wb\")\n"), tmp);
- }
- g_free(tmp);
-}
-
gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
{
gchar *srcfile;
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;
}
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 ((MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
- && dest->stype != F_QUEUE && dest->stype != F_DRAFT)
- mh_remove_queue_headers(destfile);
if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
if (chmod(destfile, prefs->folder_chmod) < 0)
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",
{ \
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) \
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);
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;
}