path: root/include/mailutils/sys/amd.h
diff options
authorSergey Poznyakoff <>2010-09-16 01:53:04 +0300
committerSergey Poznyakoff <>2010-09-16 01:53:04 +0300
commit756eb2bcfb781350f70e77d2e41fa8ae6e692cdd (patch)
treeb446c1e4ba9bf3343e49205abfdd78ae4ce09e4f /include/mailutils/sys/amd.h
parentec989a562f5a64f36909dc0a151fc24b50a733be (diff)
Implement `remove' method for mailboxes.
* include/mailutils/mailbox.h (mu_mailbox_remove): New function. * include/mailutils/stream.h: Add some comments. * include/mailutils/sys/amd.h (_amd_data)<remove>: New method. (amd_remove_dir): New function. * include/mailutils/sys/mailbox.h (_mu_mailbox)<_remove>: New method. * libmailutils/amd.c (amd_remove_mbox): New function. (amd_init_mailbox): Initialize the _remove method. (amd_remove_dir): New function. * libmailutils/errors (MU_ERR_MBX_REMOVED) (MU_ERR_NOT_OPEN, MU_ERR_OPEN): New error codes. * libmailutils/mailbox.c: Keep state of the mailbox (open vs. not open, removed). Check it before doing anything on it. (_MU_MAILBOX_OPEN, _MU_MAILBOX_REMOVED, _MU_MAILBOX_MASK): New defines. (mu_mailbox_open): Set _MU_MAILBOX_OPEN if the operation succeeds. (mu_mailbox_close): Clear _MU_MAILBOX_OPEN if the operation succeeds. Refuse to run if the mailbox was not opened. (mu_mailbox_remove): New function. (all functions): return MU_ERR_MBX_NULL if the mbox argument is NULL. Check mailbox state on entry and proceed accordingly. * libproto/maildir/mbox.c: Implement _remove method. (maildir_remove): New function. (_mailbox_maildir_init): Initialize amd->_remove. * libproto/mbox/mbox.c: Implement _remove method. (mbox_remove): New function. (_mailbox_mbox_init): Initialize amd->_remove. * libproto/mh/mbox.c: Implement _remove method. (mh_remove): New function. (_mailbox_mh_init): Initialize amd->_remove. * libmailutils/tests/mbdel.c: New file. * libmailutils/tests/.gitignore: Add mbdel. * libmailutils/tests/ (noinst_PROGRAMS): Likewise. (LDADD): List all mailbox formats. * imap4d/delete.c (imap4d_delete): Use mu_mailbox_remove to delete the folder. Fall back to remove() if it does not appear to be a mailbox.
Diffstat (limited to 'include/mailutils/sys/amd.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/include/mailutils/sys/amd.h b/include/mailutils/sys/amd.h
index b72c3c1ec..52f039515 100644
--- a/include/mailutils/sys/amd.h
+++ b/include/mailutils/sys/amd.h
@@ -82,6 +82,7 @@ struct _amd_data
int (*msg_cmp) (struct _amd_message *, struct _amd_message *);
int (*message_uid) (mu_message_t msg, size_t *puid);
size_t (*next_uid) (struct _amd_data *mhd);
+ int (*remove) (struct _amd_data *);
/* List of messages: */
size_t msg_count; /* number of messages in the list */
@@ -112,5 +113,6 @@ void amd_cleanup (void *arg);
struct _amd_message *_amd_get_message (struct _amd_data *amd, size_t msgno);
int amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg,
size_t *pret);
+int amd_remove_dir (const char *name);

Return to:

Send suggestions and report system problems to the System administrator.