From 8ef7c0ad473e5271fb349a69c819675e242235a2 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 7 Jun 2012 07:31:30 +0300 Subject: Implement two new Scheme functions. * NEWS: Update. * configure.ac: Version 2.99.97 * libmu_scm/mu_mailbox.c (mu-mailbox-sync) (mu-mailbox-flush): New functions. --- NEWS | 22 ++++++++++++++++++++-- configure.ac | 2 +- libmu_scm/mu_mailbox.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 1da261c2c..4017176a1 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,11 @@ -GNU mailutils NEWS -- history of user-visible changes. 2012-05-31 +GNU mailutils NEWS -- history of user-visible changes. 2012-06-07 Copyright (C) 2002-2012 Free Software Foundation, Inc. See the end of file for copying conditions. Please send mailutils bug reports to . -Version 2.99.96 (Git) +Version 2.99.97 (Git) This version is a major rewrite of GNU Mailutils. Quite a few parts of the basic framework were rewritten from scratch, while some others @@ -254,6 +254,24 @@ See . ** Configuration file support (libmu_cfg) rewritten. +* New Scheme primitives + +** mu-mailbox-sync + +Synchronizes the changes done to the mailbox with its external +storage. + +** mu-mailbox-expunge + +Similar to mu-mailbox-sync, but also permanently removes messages +marked for deletion. + +** mu-mailbox-flush + +Marks all messages as seen, and synchronizes the changes with the +mailbox external storage. Depending on its second argument, removes +messages marked for deletion. + Version 2.2 - 2010-09-08 diff --git a/configure.ac b/configure.ac index cb07ad4f3..ec3b41621 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License along dnl with GNU Mailutils. If not, see . AC_PREREQ(2.63) -AC_INIT([GNU Mailutils], [2.99.96], [bug-mailutils@gnu.org], [mailutils]) +AC_INIT([GNU Mailutils], [2.99.97], [bug-mailutils@gnu.org], [mailutils]) AC_CONFIG_SRCDIR([libmailutils/mailbox/mailbox.c]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([gnits 1.11 dist-bzip2 dist-xz std-options silent-rules]) diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c index 9699b0d70..5345f95c6 100644 --- a/libmu_scm/mu_mailbox.c +++ b/libmu_scm/mu_mailbox.c @@ -373,6 +373,51 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_expunge, "mu-mailbox-expunge", 1, 0, 0, } #undef FUNC_NAME +SCM_DEFINE_PUBLIC (scm_mu_mailbox_sync, "mu-mailbox-sync", 1, 0, 0, + (SCM mbox), +"Synchronize changes to @var{mbox} with its storage.") +#define FUNC_NAME s_scm_mu_mailbox_sync +{ + struct mu_mailbox *mum; + int status; + + SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); + mum = (struct mu_mailbox *) SCM_CDR (mbox); + status = mu_mailbox_sync (mum->mbox); + if (status) + mu_scm_error (FUNC_NAME, status, + "Sync failed for mailbox ~A", + scm_list_1 (mbox)); + return SCM_BOOL_T; +} +#undef FUNC_NAME + +SCM_DEFINE_PUBLIC (scm_mu_mailbox_flush, "mu-mailbox-flush", 1, 1, 0, + (SCM mbox, SCM expunge), +"Mark all messages in @var{mbox} as seen and synchronize all changes with " +"its storage. If @var{expunge} is @samp{#t}, expunge deleted messages " +"as well.") +#define FUNC_NAME s_scm_mu_mailbox_flush +{ + struct mu_mailbox *mum; + int status, do_expunge = 0; + + SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); + mum = (struct mu_mailbox *) SCM_CDR (mbox); + if (!SCM_UNBNDP (expunge)) + { + SCM_ASSERT (scm_is_bool (expunge), expunge, SCM_ARG2, FUNC_NAME); + do_expunge = expunge == SCM_BOOL_T; + } + status = mu_mailbox_flush (mum->mbox, do_expunge); + if (status) + mu_scm_error (FUNC_NAME, status, + "Flush failed for mailbox ~A", + scm_list_1 (mbox)); + return SCM_BOOL_T; +} +#undef FUNC_NAME + SCM_DEFINE_PUBLIC (scm_mu_mailbox_append_message, "mu-mailbox-append-message", 2, 0, 0, (SCM mbox, SCM mesg), "Appends message @var{mesg} to the mailbox @var{mbox}.") -- cgit v1.2.1