maildir-uidlist.h revision e30b748edcef3cf3352478bf21fa8f785bdc773a
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa /* POP3 UIDL format unless overridden by records */
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa /* Virtual message size. If filename also contains ,W=<vsize> this
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa isn't written to uidlist. */
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksa /* POP3 UIDL overriding the default format */
f0264afd33a980b6584747fc8159ee950805d9e3Eugen Kuksaint maildir_uidlist_lock(struct maildir_uidlist *uidlist);
b51057b860560bf3ee454c03a121af3d5d34f482Eugen Kuksaint maildir_uidlist_try_lock(struct maildir_uidlist *uidlist);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksaint maildir_uidlist_lock_touch(struct maildir_uidlist *uidlist);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksavoid maildir_uidlist_unlock(struct maildir_uidlist *uidlist);
28001d576e67ba46ed481c5695f1e0827ff26007Eugen Kuksabool maildir_uidlist_is_locked(struct maildir_uidlist *uidlist);
b1fe9054ad7c7192fe4c474363247dad15963e99Eugen Kuksastruct maildir_uidlist *maildir_uidlist_init(struct maildir_mailbox *mbox);
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksamaildir_uidlist_init_readonly(struct index_mailbox *ibox);
d89f470f7da0b9f8295d0ac0defff09884894b8bEugen Kuksavoid maildir_uidlist_deinit(struct maildir_uidlist **uidlist);
d89f470f7da0b9f8295d0ac0defff09884894b8bEugen Kuksa/* Returns -1 if error, 0 if file is broken or lost, 1 if ok. If nfs_flush=TRUE
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksa and storage has NFS_FLUSH flag set, the NFS attribute cache is flushed to
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa make sure that we see the latest uidlist file. */
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksaint maildir_uidlist_refresh(struct maildir_uidlist *uidlist);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa/* Returns uidlist record for given filename, or NULL if not found. */
6bbb71b52f053c148669e5b128e236781150da1fEugen Kuksamaildir_uidlist_lookup(struct maildir_uidlist *uidlist, uint32_t uid,
4fbbf628eda08ffdeb98cb41fb7e9001050eec3aEugen Kuksa/* Returns extension's value or NULL if it doesn't exist. */
4fbbf628eda08ffdeb98cb41fb7e9001050eec3aEugen Kuksamaildir_uidlist_lookup_ext(struct maildir_uidlist *uidlist, uint32_t uid,
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksauint32_t maildir_uidlist_get_uid_validity(struct maildir_uidlist *uidlist);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksauint32_t maildir_uidlist_get_next_uid(struct maildir_uidlist *uidlist);
7e19fab3af21714e410863295a27b859111ba40dEugen Kuksavoid maildir_uidlist_set_uid_validity(struct maildir_uidlist *uidlist,
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksavoid maildir_uidlist_set_next_uid(struct maildir_uidlist *uidlist,
a8028fd2789e323040de08827a0fe1f7d36fde2bEugen Kuksavoid maildir_uidlist_set_ext(struct maildir_uidlist *uidlist, uint32_t uid,
7e19fab3af21714e410863295a27b859111ba40dEugen Kuksa const char *value);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa/* If uidlist has changed, update it. This is mostly meant to be used with
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa maildir_uidlist_set_ext() */
67daeb8066e4460cb820db60c45138dd48309bb9Eugen Kuksaint maildir_uidlist_update(struct maildir_uidlist *uidlist);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa/* Sync uidlist with what's actually on maildir. Returns same as
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa maildir_uidlist_lock(). */
4ec9d8b62c3c1a001548eb0883b6f81e00c391a0Eugen Kuksaint maildir_uidlist_sync_init(struct maildir_uidlist *uidlist,
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa/* Returns 1 = ok, -1 = error, 0 = new file and dovecot-uidlist is locked */
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksaint maildir_uidlist_sync_next_pre(struct maildir_uidlist_sync_ctx *ctx,
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa const char *filename);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksaint maildir_uidlist_sync_next(struct maildir_uidlist_sync_ctx *ctx,
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksavoid maildir_uidlist_sync_remove(struct maildir_uidlist_sync_ctx *ctx,
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa const char *filename);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksamaildir_uidlist_sync_get_full_filename(struct maildir_uidlist_sync_ctx *ctx,
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksa const char *filename);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksavoid maildir_uidlist_sync_finish(struct maildir_uidlist_sync_ctx *ctx);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksaint maildir_uidlist_sync_deinit(struct maildir_uidlist_sync_ctx **ctx);
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksabool maildir_uidlist_get_uid(struct maildir_uidlist *uidlist,
daf3e28fff47a65b53d6fb65155301763b9f166eEugen Kuksamaildir_uidlist_get_full_filename(struct maildir_uidlist *uidlist,
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksa const char *filename);
923d69139038e74c0936e826bbfdc8717fbbc7b3Eugen Kuksavoid maildir_uidlist_add_flags(struct maildir_uidlist *uidlist,
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksa/* List all maildir files. */
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksamaildir_uidlist_iter_init(struct maildir_uidlist *uidlist);
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksabool maildir_uidlist_iter_next(struct maildir_uidlist_iter_ctx *ctx,
5efadb4662f2a63d5f5f1a5b303ab7c3371069a8Eugen Kuksa const char **filename_r);