Commit 756eb2bc 756eb2bcfb781350f70e77d2e41fa8ae6e692cdd by Sergey Poznyakoff

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/Makefile.am (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.
1 parent ec989a56
......@@ -37,6 +37,7 @@ imap4d_delete (struct imap4d_command *command, imap4d_tokbuf_t tok)
const char *msg = "Completed";
const char *delim = "/";
char *name;
mu_mailbox_t tmpbox;
if (imap4d_tokbuf_argc (tok) != 3)
return io_completion_response (command, RESP_BAD, "Invalid arguments");
......@@ -54,7 +55,22 @@ imap4d_delete (struct imap4d_command *command, imap4d_tokbuf_t tok)
if (!name)
return io_completion_response (command, RESP_NO, "Cannot remove");
if (remove (name) != 0)
rc = mu_mailbox_create (&tmpbox, name);
if (rc == 0)
{
rc = mu_mailbox_remove (tmpbox);
mu_mailbox_destroy (&tmpbox);
if (rc)
mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_remove", name, rc);
}
else
{
rc = remove (name);
if (rc)
mu_diag_funcall (MU_DIAG_ERROR, "remove", name, errno);
}
if (rc)
{
rc = RESP_NO;
msg = "Cannot remove";
......
......@@ -49,6 +49,7 @@ extern void mu_mailbox_destroy (mu_mailbox_t *);
extern int mu_mailbox_open (mu_mailbox_t, int flag);
extern int mu_mailbox_close (mu_mailbox_t);
extern int mu_mailbox_remove (mu_mailbox_t mbox);
extern int mu_mailbox_flush (mu_mailbox_t mbox, int expunge);
extern int mu_mailbox_get_folder (mu_mailbox_t, mu_folder_t *);
extern int mu_mailbox_set_folder (mu_mailbox_t, mu_folder_t);
......
......@@ -27,7 +27,6 @@ enum mu_buffer_type
mu_buffer_full
};
#define MU_SEEK_SET 0
#define MU_SEEK_CUR 1
#define MU_SEEK_END 2
......@@ -38,8 +37,10 @@ enum mu_buffer_type
#define MU_STREAM_SEEK 0x00000004
#define MU_STREAM_APPEND 0x00000008
#define MU_STREAM_CREAT 0x00000010
/* So far used only by TCP streams. */
#define MU_STREAM_NONBLOCK 0x00000020
#define MU_STREAM_AUTOCLOSE 0x00000040
/* Not used. Intended for mailboxes only. */
#define MU_STREAM_NONLOCK 0x00000080
#define MU_STREAM_ALLOW_LINKS 0x00000100
/* FIXME: This one affects only mailboxes */
......
......@@ -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);
#endif
......
......@@ -54,6 +54,7 @@ struct _mu_mailbox
int (*_open) (mu_mailbox_t, int);
int (*_close) (mu_mailbox_t);
int (*_remove) (mu_mailbox_t);
/* messages */
int (*_get_message) (mu_mailbox_t, size_t, mu_message_t *);
......
......@@ -112,6 +112,7 @@ static int amd_envelope_date (mu_envelope_t envelope, char *buf, size_t len,
size_t *psize);
static int amd_envelope_sender (mu_envelope_t envelope, char *buf, size_t len,
size_t *psize);
static int amd_remove_mbox (mu_mailbox_t mailbox);
static int amd_body_stream_read (mu_stream_t str, char *buffer,
......@@ -309,6 +310,7 @@ amd_init_mailbox (mu_mailbox_t mailbox, size_t amd_size,
mailbox->_is_updated = amd_is_updated;
mailbox->_get_size = amd_get_size;
mailbox->_remove = amd_remove_mbox;
MU_DEBUG1 (mailbox->debug, MU_DEBUG_TRACE1, "amd_init(%s)\n", amd->name);
*pamd = amd;
......@@ -1100,6 +1102,40 @@ compute_mailbox_size (struct _amd_data *amd, const char *name, mu_off_t *psize)
}
static int
amd_remove_mbox (mu_mailbox_t mailbox)
{
int rc;
struct _amd_data *amd = mailbox->data;
if (!amd->remove)
return ENOSYS;
rc = amd->remove (amd);
if (rc == 0)
{
char *name = make_size_file_name (amd);
if (!name)
return ENOMEM;
if (unlink (name) && errno != ENOENT)
rc = errno;
free (name);
}
if (rc == 0)
{
if (rmdir (amd->name) && errno != ENOENT)
{
rc = errno;
/* POSIX.1-2001 allows EEXIST to be returned if the directory
contained entries other than . and .. */
if (rc == EEXIST)
rc = ENOTEMPTY;
}
}
return rc;
}
static int
amd_expunge (mu_mailbox_t mailbox)
{
struct _amd_data *amd = mailbox->data;
......@@ -1923,3 +1959,80 @@ amd_envelope_sender (mu_envelope_t envelope, char *buf, size_t len, size_t *psiz
}
int
amd_remove_dir (const char *name)
{
DIR *dir;
struct dirent *ent;
char *namebuf;
size_t namelen, namesize;
int rc = 0;
int has_subdirs = 0;
namelen = strlen (name);
namesize = namelen + 128;
namebuf = malloc (namesize);
if (!namebuf)
return ENOMEM;
memcpy (namebuf, name, namelen);
if (namebuf[namelen - 1] != '/')
namebuf[namelen++] = '/';
dir = opendir (name);
if (!dir)
return errno;
while ((ent = readdir (dir)))
{
struct stat st;
size_t len;
if (strcmp (ent->d_name, ".") == 0 ||
strcmp (ent->d_name, "..") == 0)
continue;
len = strlen (ent->d_name);
if (namelen + len >= namesize)
{
char *p;
namesize += len + 1;
p = realloc (namebuf, namesize);
if (!p)
{
rc = ENOMEM;
break;
}
}
strcpy (namebuf + namelen, ent->d_name);
if (stat (namebuf, &st) == 0 && S_ISDIR (st.st_mode))
{
has_subdirs = 1;
continue;
}
if (unlink (namebuf))
{
rc = errno;
mu_diag_output (MU_DIAG_WARNING,
"failed to remove %s: %s",
namebuf, mu_strerror (rc));
break;
}
}
closedir (dir);
free (namebuf);
if (rc == 0 && !has_subdirs)
{
if (rmdir (name))
{
rc = errno;
/* POSIX.1-2001 allows EEXIST to be returned if the directory
contained entries other than . and .. */
if (rc == EEXIST)
rc = ENOTEMPTY;
}
}
return rc;
}
......
......@@ -26,6 +26,10 @@ MU_ERR_OUT_NULL _("Pointer to output null")
MU_ERR_OUT_PTR_NULL _("Pointer to output pointer null")
MU_ERR_MBX_NULL _("Mailbox null")
MU_ERR_MBX_REMOVED _("Mailbox removed")
MU_ERR_NOT_OPEN _("Resource not open")
MU_ERR_OPEN _("Resource still open")
MU_ERR_BAD_822_FORMAT _("Format of RFC822 object is bad")
MU_ERR_EMPTY_ADDRESS _("Address contains no addr specs")
......
......@@ -121,7 +121,7 @@ fd_open (struct _mu_stream *str)
{
struct stat fdbuf, filebuf;
/* The next two stats should never fail. */
/* The following two stats should never fail. */
if (fstat (fd, &fdbuf) == -1
|| lstat (fstr->filename, &filebuf) == -1)
{
......
......@@ -44,6 +44,11 @@
#include <mailutils/sys/mailbox.h>
#include <mailutils/sys/url.h>
/* Mailbox-specific flags */
#define _MU_MAILBOX_OPEN 0x10000000
#define _MU_MAILBOX_REMOVED 0x20000000
#define _MU_MAILBOX_MASK 0xF0000000
static int
mailbox_folder_create (mu_mailbox_t mbox, const char *name,
mu_record_t record)
......@@ -287,7 +292,11 @@ mu_mailbox_destroy (mu_mailbox_t *pmbox)
int
mu_mailbox_open (mu_mailbox_t mbox, int flag)
{
if (mbox == NULL || mbox->_open == NULL)
int rc;
if (!mbox)
return MU_ERR_MBX_NULL;
if (mbox->_open == NULL)
return MU_ERR_EMPTY_VFN;
if (flag & MU_STREAM_QACCESS)
{
......@@ -296,16 +305,42 @@ mu_mailbox_open (mu_mailbox_t mbox, int flag)
| MU_STREAM_APPEND | MU_STREAM_CREAT))
return EINVAL; /* FIXME: Better error code, please? */
}
return mbox->_open (mbox, flag);
rc = mbox->_open (mbox, flag);
if (rc == 0)
mbox->flags |= _MU_MAILBOX_OPEN;
return rc;
}
int
mu_mailbox_close (mu_mailbox_t mbox)
{
int rc;
if (!mbox)
return MU_ERR_MBX_NULL;
if (!(mbox->flags & _MU_MAILBOX_OPEN))
return MU_ERR_NOT_OPEN;
if (mbox == NULL || mbox->_close == NULL)
return MU_ERR_EMPTY_VFN;
return mbox->_close (mbox);
rc = mbox->_close (mbox);
if (rc == 0)
mbox->flags &= ~_MU_MAILBOX_OPEN;
return rc;
}
int
mu_mailbox_remove (mu_mailbox_t mbox)
{
if (!mbox)
return MU_ERR_MBX_NULL;
if (mbox->flags & _MU_MAILBOX_OPEN)
return MU_ERR_OPEN;
if (mbox->flags & _MU_MAILBOX_REMOVED)
return MU_ERR_MBX_REMOVED;
if (!mbox->_remove)
return MU_ERR_EMPTY_VFN;
return mbox->_remove (mbox);
}
int
......@@ -315,7 +350,11 @@ mu_mailbox_flush (mu_mailbox_t mbox, int expunge)
int status = 0;
if (!mbox)
return EINVAL;
return MU_ERR_MBX_NULL;
if (mbox->flags & _MU_MAILBOX_REMOVED)
return MU_ERR_MBX_REMOVED;
if (!(mbox->flags & _MU_MAILBOX_OPEN))
return _MU_MAILBOX_OPEN;
if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
return 0;
......@@ -338,12 +377,29 @@ mu_mailbox_flush (mu_mailbox_t mbox, int expunge)
return status;
}
#define _MBOX_CHECK_FLAGS(mbox) \
if (mbox == NULL) \
return MU_ERR_MBX_NULL; \
if (mbox->flags & _MU_MAILBOX_REMOVED) \
return MU_ERR_MBX_REMOVED; \
if (!(mbox->flags & _MU_MAILBOX_OPEN)) \
return _MU_MAILBOX_OPEN
#define _MBOX_CHECK(mbox,method) \
_MBOX_CHECK_FLAGS(mbox); \
if (mbox->method == NULL) \
return MU_ERR_EMPTY_VFN
#define _MBOX_CHECK_Q(mbox,method) \
_MBOX_CHECK(mbox,method); \
if (mbox->flags & MU_STREAM_QACCESS) \
return MU_ERR_BADOP
/* messages */
int
mu_mailbox_append_message (mu_mailbox_t mbox, mu_message_t msg)
{
if (mbox == NULL || mbox->_append_message == NULL)
return MU_ERR_EMPTY_VFN;
_MBOX_CHECK_Q (mbox, _append_message);
if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
return EACCES;
return mbox->_append_message (mbox, msg);
......@@ -352,10 +408,7 @@ mu_mailbox_append_message (mu_mailbox_t mbox, mu_message_t msg)
int
mu_mailbox_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *pmsg)
{
if (mbox == NULL || mbox->_get_message == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
_MBOX_CHECK_Q (mbox, _get_message);
return mbox->_get_message (mbox, msgno, pmsg);
}
......@@ -363,8 +416,7 @@ int
mu_mailbox_quick_get_message (mu_mailbox_t mbox, mu_message_qid_t qid,
mu_message_t *pmsg)
{
if (mbox == NULL || mbox->_quick_get_message == NULL)
return MU_ERR_EMPTY_VFN;
_MBOX_CHECK (mbox, _quick_get_message);
if (!(mbox->flags & MU_STREAM_QACCESS))
return MU_ERR_BADOP;
return mbox->_quick_get_message (mbox, qid, pmsg);
......@@ -373,38 +425,28 @@ mu_mailbox_quick_get_message (mu_mailbox_t mbox, mu_message_qid_t qid,
int
mu_mailbox_messages_count (mu_mailbox_t mbox, size_t *num)
{
if (mbox == NULL || mbox->_messages_count == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
_MBOX_CHECK_Q (mbox, _messages_count);
return mbox->_messages_count (mbox, num);
}
int
mu_mailbox_messages_recent (mu_mailbox_t mbox, size_t *num)
{
if (mbox == NULL || mbox->_messages_recent == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
_MBOX_CHECK_Q (mbox, _messages_recent);
return mbox->_messages_recent (mbox, num);
}
int
mu_mailbox_message_unseen (mu_mailbox_t mbox, size_t *num)
{
if (mbox == NULL || mbox->_message_unseen == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
_MBOX_CHECK_Q (mbox, _message_unseen);
return mbox->_message_unseen (mbox, num);
}
int
mu_mailbox_sync (mu_mailbox_t mbox)
{
if (mbox == NULL || mbox->_sync == NULL)
return MU_ERR_EMPTY_VFN;
_MBOX_CHECK_Q (mbox, _sync);
if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
return 0;
return mbox->_sync (mbox);
......@@ -414,18 +456,13 @@ mu_mailbox_sync (mu_mailbox_t mbox)
int
mu_mailbox_save_attributes (mu_mailbox_t mbox)
{
if (mbox == NULL || mbox->_sync == NULL)
return MU_ERR_EMPTY_VFN;
if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
return EACCES;
return mbox->_sync (mbox);
return mu_mailbox_sync (mbox);
}
int
mu_mailbox_expunge (mu_mailbox_t mbox)
{
if (mbox == NULL || mbox->_expunge == NULL)
return MU_ERR_EMPTY_VFN;
_MBOX_CHECK_Q (mbox, _expunge);
if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
return EACCES;
return mbox->_expunge (mbox);
......@@ -434,7 +471,10 @@ mu_mailbox_expunge (mu_mailbox_t mbox)
int
mu_mailbox_is_updated (mu_mailbox_t mbox)
{
if (mbox == NULL || mbox->_is_updated == NULL)
if (mbox == NULL ||
!(mbox->flags & _MU_MAILBOX_OPEN) ||
(mbox->flags & _MU_MAILBOX_REMOVED) ||
mbox->_is_updated == NULL)
return 1;
if (mbox->flags & MU_STREAM_QACCESS)
return 1;
......@@ -444,10 +484,7 @@ mu_mailbox_is_updated (mu_mailbox_t mbox)
int
mu_mailbox_scan (mu_mailbox_t mbox, size_t msgno, size_t *pcount)
{
if (mbox == NULL || mbox->_scan == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
_MBOX_CHECK_Q (mbox, _scan);
return mbox->_scan (mbox, msgno, pcount);
}
......@@ -455,8 +492,8 @@ int
mu_mailbox_get_size (mu_mailbox_t mbox, mu_off_t *psize)
{
int status;
if (mbox == NULL)
return MU_ERR_EMPTY_VFN;
_MBOX_CHECK_FLAGS (mbox);
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
if (mbox->_get_size == NULL
......@@ -489,20 +526,14 @@ mu_mailbox_get_size (mu_mailbox_t mbox, mu_off_t *psize)
int
mu_mailbox_uidvalidity (mu_mailbox_t mbox, unsigned long *pvalid)
{
if (mbox == NULL || mbox->_uidvalidity == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
_MBOX_CHECK_Q (mbox, _uidvalidity);
return mbox->_uidvalidity (mbox, pvalid);
}
int
mu_mailbox_uidnext (mu_mailbox_t mbox, size_t *puidnext)
{
if (mbox == NULL || mbox->_uidnext == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
_MBOX_CHECK_Q (mbox, _uidnext);
return mbox->_uidnext (mbox, puidnext);
}
......@@ -536,7 +567,7 @@ mu_mailbox_get_flags (mu_mailbox_t mbox, int *flags)
return MU_ERR_MBX_NULL;
if (!*flags)
return MU_ERR_OUT_NULL;
*flags = mbox->flags;
*flags = mbox->flags & ~_MU_MAILBOX_MASK;
return 0;
}
......
......@@ -11,5 +11,6 @@ encode2047
fltst
listop
mailcap
mbdel
mimetest
url-parse
......
......@@ -47,6 +47,7 @@ noinst_PROGRAMS = \
fltst\
listop\
mailcap\
mbdel\
mimetest\
url-parse
......@@ -55,6 +56,10 @@ LDADD =\
${MU_LIB_MBOX}\
${MU_LIB_IMAP}\
${MU_LIB_POP}\
${MU_LIB_NNTP}\
${MU_LIB_MH}\
${MU_LIB_MAILDIR}\
${MU_LIB_MAILER}\
${MU_LIB_AUTH}\
@MU_AUTHLIBS@\
${MU_LIB_MAILUTILS}
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2010 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Mailutils is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <mailutils/mailutils.h>
int
main (int argc, char **argv)
{
int rc;
mu_mailbox_t mbox;
if (argc != 2)
{
fprintf (stderr, "usage: %s URL\n", argv[0]);
return 1;
}
mu_register_all_mbox_formats ();
MU_ASSERT (mu_mailbox_create (&mbox, argv[1]));
rc = mu_mailbox_remove (mbox);
if (rc)
{
if (rc == ENOTEMPTY)
{
printf ("mailbox removed, but has subfolders\n");
rc = 0;
}
else
fprintf (stderr, "%s\n", mu_strerror (rc));
}
mu_mailbox_destroy (&mbox);
return rc != 0;
}
......@@ -766,6 +766,28 @@ maildir_qfetch (struct _amd_data *amd, mu_message_qid_t qid)
}
static int
maildir_remove (struct _amd_data *amd)
{
int i;
static char *suf[3] = { NEWSUF, CURSUF, TMPSUF };
int rc = 0;
for (i = 0; rc == 0 && i < 3; i++)
{
char *name = maildir_mkfilename (amd->name, suf[i], NULL);
rc = amd_remove_dir (name);
if (rc)
mu_diag_output (MU_DIAG_WARNING,
"removing contents of %s failed: %s", name,
mu_strerror (rc));
free (name);
}
return rc;
}
int
_mailbox_maildir_init (mu_mailbox_t mailbox)
{
......@@ -788,6 +810,7 @@ _mailbox_maildir_init (mu_mailbox_t mailbox)
amd->msg_cmp = maildir_message_cmp;
amd->message_uid = maildir_message_uid;
amd->next_uid = maildir_next_uid;
amd->remove = maildir_remove;
/* Set our properties. */
{
......
......@@ -174,6 +174,16 @@ mbox_close (mu_mailbox_t mailbox)
return mu_stream_close (mailbox->stream);
}
static int
mbox_remove (mu_mailbox_t mailbox)
{
mbox_data_t mud = mailbox->data;
MU_DEBUG1 (mailbox->debug, MU_DEBUG_TRACE1,
"mbox_remove (%s)\n", mud->name);
return unlink (mud->name);
}
/* Cover function that calls the real thing, mbox_scan(), with
notification set. */
static int
......@@ -1479,6 +1489,7 @@ _mailbox_mbox_init (mu_mailbox_t mailbox)
mailbox->_open = mbox_open;
mailbox->_close = mbox_close;
mailbox->_remove = mbox_remove;
/* Overloading of the entire mailbox object methods. */
mailbox->_get_message = mbox_get_message;
......
......@@ -353,6 +353,13 @@ _mh_msg_init (struct _amd_data *amd, struct _amd_message *amm)
}
static int
mh_remove (struct _amd_data *amd)
{
return amd_remove_dir (amd->name);
}
int
_mailbox_mh_init (mu_mailbox_t mailbox)
......@@ -375,6 +382,7 @@ _mailbox_mh_init (mu_mailbox_t mailbox)
amd->msg_cmp = mh_message_cmp;
amd->message_uid = mh_message_uid;
amd->next_uid = _mh_next_seq;
amd->remove = mh_remove;
/* Set our properties. */
{
......