EXPORTED int mailbox_copyfile(const char *from, const char *to, int nolink)
{
    int flags = COPYFILE_MKDIR|COPYFILE_KEEPTIME;
    if (nolink) flags |= COPYFILE_NOLINK;

    if (mailbox_wait_cb) mailbox_wait_cb(mailbox_wait_cb_rock);

    if (cyrus_copyfile(from, to, flags))
        return IMAP_IOERROR;

    return 0;
}
EXPORTED int mailbox_copyfile(const char *from, const char *to, int nolink)
{
    int flags = COPYFILE_MKDIR|COPYFILE_KEEPTIME;
    if (nolink) flags |= COPYFILE_NOLINK;

    if (mailbox_wait_cb) mailbox_wait_cb(mailbox_wait_cb_rock);

    if (cyrus_copyfile(from, to, flags))
        return IMAP_IOERROR;

    return 0;
}