maildir-copy.c revision dfbf03518468bee9a2ca54c104a9be71b38d4436
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "ioloop.h"
#include "maildir-index.h"
#include "maildir-storage.h"
#include "mail-custom-flags.h"
#include "mail-index-util.h"
#include "index-messageset.h"
#include <stdlib.h>
#include <unistd.h>
struct maildir_copy_context {
struct index_mailbox *ibox;
int hardlink;
struct mail_copy_context *ctx;
};
struct rollback {
const char *fname;
};
struct mail_index_record *rec,
{
const char *path;
return -1;
/* probably in new/ dir */
return 1;
return -1;
}
return -1;
return -1;
}
}
return 1;
return -1;
}
return -1;
return -1;
}
return 0;
}
struct maildir_copy_context *ctx)
{
enum mail_flags flags;
/* link the file */
dest_fname, NULL);
for (i = 0;; i++) {
if (ret != 0)
break;
if (i == 10) {
"File name keeps changing, copy failed");
break;
}
&found)) {
ret = -1;
break;
}
if (!found)
break;
}
if (ret > 0) {
2048);
}
}
return ret;
}
{
struct maildir_copy_context *ctx;
"Destination mailbox is read-only");
return NULL;
}
return (struct mail_copy_context *) ctx;
}
{
if (rollback) {
t_push();
t_pop();
}
}
return ret;
}
{
int ret;
t_push();
t_pop();
if (ret > 0)
return TRUE;
if (ret < 0)
return FALSE;
/* non-fatal hardlinking failure, try the slow way */
}
}