diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-11-24 00:13:41 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-11-24 00:13:41 +0200 |
commit | 43853ce85b785d36b44b6850ceac7136c54f54f0 (patch) | |
tree | 091a2815b0378aa27366e04c9d7fb0c0cbcab58d /libmailutils/base | |
parent | 764ebfd7f22dd2634413f1d427ab0f51b0b7797b (diff) | |
download | mailutils-43853ce85b785d36b44b6850ceac7136c54f54f0.tar.gz mailutils-43853ce85b785d36b44b6850ceac7136c54f54f0.tar.bz2 |
mh: implement rmmproc.
* include/mailutils/sys/amd.h (_amd_data) <delete_msg>: New method.
* libmailutils/base/amd.c (amd_expunge): If delete_msg is defined,
use it.
* libproto/mh/mbox.c (_mh_msg_delete): New method.
(_mailbox_mh_init): Set delete_msg if "rmmproc" component is
defined.
* mh/tests/movemsg: New file.
* mh/tests/Makefile.am (EXTRA_DIST): Add movemsg.
* mh/tests/rmm.at: Test rmmproc effects.
* mh/tests/rmf.at (MH_KEYWORDS): Fix copy-n-paste error.
* doc/texinfo/mu-mh.texi: Document rmmproc.
* mh/TODO: Update.
Diffstat (limited to 'libmailutils/base')
-rw-r--r-- | libmailutils/base/amd.c | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/libmailutils/base/amd.c b/libmailutils/base/amd.c index acbfb296b..d51f94127 100644 --- a/libmailutils/base/amd.c +++ b/libmailutils/base/amd.c @@ -1166,37 +1166,46 @@ amd_expunge (mu_mailbox_t mailbox) if (mhm->attr_flags & MU_ATTRIBUTE_DELETED) { int rc; - char *old_name; - char *new_name; - rc = amd->cur_msg_file_name (mhm, &old_name); - if (rc) - return rc; - rc = amd->new_msg_file_name (mhm, mhm->attr_flags, 1, - &new_name); - if (rc) + if (amd->delete_msg) { - free (old_name); - return rc; - } - - if (new_name) - { - /* FIXME: It may be a good idea to have a capability flag - in struct _amd_data indicating that no actual removal - is needed (e.g. for traditional MH). It will allow to - bypass lots of no-op code here. */ - if (strcmp (old_name, new_name)) - /* Rename original message */ - rename (old_name, new_name); + rc = amd->delete_msg (amd, mhm); + if (rc) + return rc; } else - /* Unlink original file */ - unlink (old_name); - - free (old_name); - free (new_name); + { + char *old_name; + char *new_name; + + rc = amd->cur_msg_file_name (mhm, &old_name); + if (rc) + return rc; + rc = amd->new_msg_file_name (mhm, mhm->attr_flags, 1, + &new_name); + if (rc) + { + free (old_name); + return rc; + } + if (new_name) + { + /* FIXME: It may be a good idea to have a capability flag + in struct _amd_data indicating that no actual removal + is needed (e.g. for traditional MH). It will allow to + bypass lots of no-op code here. */ + if (strcmp (old_name, new_name)) + /* Rename original message */ + rename (old_name, new_name); + } + else + /* Unlink original file */ + unlink (old_name); + + free (old_name); + free (new_name); + } _amd_message_delete (amd, mhm); updated = 1; /* Do not increase i! */ |