mbox-sync.c revision e6d35af29202a78abd9c6a8412f340693b36a948
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "mbox-index.h"
#include "mbox-lock.h"
#include "mail-index-util.h"
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
{
struct mail_index_record *rec;
return 0;
}
/* get the last record */
offset = 0;
/* get the offset + size of last message, which tells the
last known mbox file size */
}
/* too large to fit in off_t */
return 0;
}
}
enum mail_lock_type data_lock_type)
{
enum mail_lock_type lock_type;
/* syncing needs exclusive index lock and shared
mbox lock, but if we'd want exclusive mbox lock
we need to set it here already */
return FALSE;
return FALSE;
}
return mbox_sync_full(index);
}
{
"can't get exclusive lock",
return FALSE;
}
/* we've already synced in this locking session */
return TRUE;
}
count = 0;
/* mbox was deleted by someone - happens with some MUAs
when all mail is expunged. easiest way to deal with this
is to recreate the file. */
if (fd != -1)
}
/* mbox file was overwritten, close it if it was open */
}
if (index->mbox_sync_counter == 0) {
/* first sync, get expected mbox size */
}
return FALSE;
/* uidvalidity probably changed, rebuild */
return FALSE;
}
}
/* we need some index lock to be able to lock mbox */
return FALSE;
}
if (data_lock_type == MAIL_LOCK_UNLOCK) {
if (!mbox_unlock(index))
return FALSE;
} else {
return FALSE;
}
return TRUE;
}