maildir-uidlist.h revision 2bde8972f2dcec46d96543407cc5b56954054359
#ifndef MAILDIR_UIDLIST_H
#define MAILDIR_UIDLIST_H
#include "mail-storage.h"
#define MAILDIR_UIDLIST_NAME "dovecot-uidlist"
/* how many seconds to wait before overriding uidlist.lock */
struct maildir_mailbox;
struct maildir_uidlist;
struct maildir_uidlist_sync_ctx;
struct maildir_uidlist_rec;
enum maildir_uidlist_sync_flags {
MAILDIR_UIDLIST_SYNC_PARTIAL = 0x01,
MAILDIR_UIDLIST_SYNC_KEEP_STATE = 0x02,
MAILDIR_UIDLIST_SYNC_FORCE = 0x04,
MAILDIR_UIDLIST_SYNC_TRYLOCK = 0x08,
MAILDIR_UIDLIST_SYNC_NOREFRESH = 0x10,
MAILDIR_UIDLIST_SYNC_NOLOCK = 0x20
};
enum maildir_uidlist_rec_flag {
MAILDIR_UIDLIST_REC_FLAG_NEW_DIR = 0x01,
MAILDIR_UIDLIST_REC_FLAG_MOVED = 0x02,
MAILDIR_UIDLIST_REC_FLAG_RECENT = 0x04,
};
enum maildir_uidlist_hdr_ext_key {
MAILDIR_UIDLIST_HDR_EXT_GUID = 'G',
/* POP3 UIDL format unless overridden by records */
};
#define MAILDIR_UIDLIST_REC_EXT_KEY_IS_VALID(c) \
((c) >= 'A' && (c) <= 'Z')
enum maildir_uidlist_rec_ext_key {
/* Physical message size. If filename also contains ,S=<vsize> this
isn't written to uidlist. */
/* Virtual message size. If filename also contains ,W=<vsize> this
isn't written to uidlist. */
/* POP3 UIDL overriding the default format */
/* POP3 message ordering number. Lower numbered messages are listed
first. Messages without ordering number are listed after them.
The idea is to be able to preserve POP3 UIDL list and IMAP UIDs
perfectly when migrating from other servers. */
/* Message GUID (default is the base filename) */
};
/* Returns TRUE if uidlist file is currently open */
/* Returns -1 if error, 0 if file is broken or lost, 1 if ok. If nfs_flush=TRUE
and storage has NFS_FLUSH flag set, the NFS attribute cache is flushed to
make sure that we see the latest uidlist file. */
/* Like maildir_uidlist_refresh(), but if uidlist isn't opened yet, try to
fill in the uidvalidity/nextuid from index file instead. */
/* Look up uidlist record for given filename. Returns 1 if found,
0 if not found, -1 if error */
enum maildir_uidlist_rec_flag *flags_r,
const char **fname_r);
/* Returns extension's value or NULL if it doesn't exist. */
const char *
enum maildir_uidlist_rec_ext_key key);
const guid_128_t mailbox_guid);
/* Update extended record. value=NULL removes the key. */
const char *value);
/* If uidlist has changed, update it. This is mostly meant to be used with
maildir_uidlist_set_ext() */
/* Sync uidlist with what's actually on maildir. Returns same as
maildir_uidlist_lock(). */
struct maildir_uidlist_sync_ctx **sync_ctx_r);
const char *filename,
enum maildir_uidlist_rec_flag flags);
struct maildir_uidlist_rec **rec_r);
const char *filename);
struct maildir_uidlist_rec *rec,
const char *value);
const char *filename);
const char *
const char *filename);
bool success);
const char *
const char *filename);
const char *filename,
enum maildir_uidlist_rec_flag flags);
/* List all maildir files. */
struct maildir_uidlist_iter_ctx *
enum maildir_uidlist_rec_flag *flags_r,
const char **filename_r);
#endif