summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-01-07 17:48:09 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2011-01-08 00:44:33 +0200
commiteb838fece8d5c38fb6fd4ea2b33d3982607acfff (patch)
treea9f8a11a503a370ec4ef3df97ae9a60c4ac68696
parent273e66dcf41df1fc262629b85b4cde983681d6c4 (diff)
downloadmailutils-eb838fece8d5c38fb6fd4ea2b33d3982607acfff.tar.gz
mailutils-eb838fece8d5c38fb6fd4ea2b33d3982607acfff.tar.bz2
guimb: further improvements
* libmu_scm/mu_body.c (mu-body?): New function. * libmu_scm/mu_mailbox.c (mu-mailbox?): New function. * libmu_scm/mu_message.c (mu-message?): New function. * libmu_scm/mu_mime.c (mu-mime?): New function. * scheme/guimb.scmi (guimb-process-mailbox): guimb-message returns a message to be appended to the output mailbox.
-rw-r--r--libmu_scm/mu_body.c9
-rw-r--r--libmu_scm/mu_mailbox.c9
-rw-r--r--libmu_scm/mu_message.c9
-rw-r--r--libmu_scm/mu_mime.c9
-rw-r--r--scheme/guimb.scmi28
5 files changed, 52 insertions, 12 deletions
diff --git a/libmu_scm/mu_body.c b/libmu_scm/mu_body.c
index 007040be0..8dbe42cc8 100644
--- a/libmu_scm/mu_body.c
+++ b/libmu_scm/mu_body.c
@@ -95,6 +95,15 @@ mu_scm_body_create (SCM msg, mu_body_t body)
/* ************************************************************************* */
/* Guile primitives */
+SCM_DEFINE_PUBLIC (scm_mu_body_p, "mu-body?", 1, 0, 0,
+ (SCM scm),
+"Return @code{true} if @var{scm} is a Mailutils message body object.\n")
+#define FUNC_NAME s_scm_mu_body_p
+{
+ return mu_scm_is_body (scm);
+}
+#undef FUNC_NAME
+
SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0,
(SCM body),
"Read next line from the @var{body}.")
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index 77032165f..df1aa47f2 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -136,6 +136,15 @@ mu_scm_is_mailbox (SCM scm)
/* ************************************************************************* */
/* Guile primitives */
+SCM_DEFINE_PUBLIC (scm_mu_mailbox_p, "mu-mailbox?", 1, 0, 0,
+ (SCM scm),
+"Return @code{true} if @var{scm} is a Mailutils mailbox.\n")
+#define FUNC_NAME s_scm_mu_mailbox_p
+{
+ return scm_from_bool (mu_scm_is_mailbox (scm));
+}
+#undef FUNC_NAME
+
SCM_DEFINE_PUBLIC (scm_mu_mail_directory, "mu-mail-directory", 0, 1, 0,
(SCM url),
"Do not use this function. Use mu-user-mailbox-url instead.")
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index 08bc1d10e..4a99a8e0f 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -175,6 +175,15 @@ mu_scm_is_message (SCM scm)
/* ************************************************************************* */
/* Guile primitives */
+SCM_DEFINE_PUBLIC (scm_mu_message_p, "mu-message?", 1, 0, 0,
+ (SCM scm),
+"Return @code{true} if @var{scm} is a Mailutils message.\n")
+#define FUNC_NAME s_scm_mu_message_p
+{
+ return scm_from_bool (mu_scm_is_message (scm));
+}
+#undef FUNC_NAME
+
SCM_DEFINE_PUBLIC (scm_mu_message_create, "mu-message-create", 0, 0, 0,
(),
"Creates an empty message.\n")
diff --git a/libmu_scm/mu_mime.c b/libmu_scm/mu_mime.c
index aefc455b0..1d29498ff 100644
--- a/libmu_scm/mu_mime.c
+++ b/libmu_scm/mu_mime.c
@@ -88,6 +88,15 @@ mu_scm_is_mime (SCM scm)
/* ************************************************************************* */
/* Guile primitives */
+SCM_DEFINE_PUBLIC (scm_mu_mime_p, "mu-mime?", 1, 0, 0,
+ (SCM scm),
+"Return @code{true} if @var{scm} is a Mailutils MIME object.\n")
+#define FUNC_NAME s_scm_mu_mime_p
+{
+ return scm_from_bool (mu_scm_is_mime (scm));
+}
+#undef FUNC_NAME
+
SCM_DEFINE_PUBLIC (scm_mu_mime_create, "mu-mime-create", 0, 2, 0,
(SCM flags, SCM mesg),
"Creates a new @acronym{MIME} object. Both arguments are optional.\n"
diff --git a/scheme/guimb.scmi b/scheme/guimb.scmi
index f9540432a..dfee8884a 100644
--- a/scheme/guimb.scmi
+++ b/scheme/guimb.scmi
@@ -49,22 +49,26 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (list (command-line)))" "$@"
(format #t "usage: guimb [OPTIONS] [MAILBOX [MAILBOX...]]
guimb applies a scheme function to each message from a set of input mailboxes
-The following options stop argument processing, and pass all remaining
-arguments as the value of (command-line):
+The following options stop argument processing, and pass the remaining
+arguments to the guimb-getopt function, if it is defined in the module:
- -c, --code=EXPR execute given scheme expression
- -s, --source=FILE load Scheme module from FILE.scm
+ -c, --code=EXPR execute given Scheme expression
+ -s, --source=MODNAME load Scheme module MODNAME
-The following options do not affect further options parsing:
+The following options have the same effect, but do not affect further
+options parsing:
- -e, --expression=EXPR execute given scheme expression
- -f, --file=FILE load Scheme module from FILE.scm
+ -e, --expression=EXPR execute given Scheme expression
+ -f, --file=MODNAME load Scheme module MODNAME
+
+The module to be loaded is normally defined in a file named MODNAME.scm
+somewhere in your %load-path.
Other options:
-M, --mailbox=NAME set output mailbox name
- -u, --user[=NAME] act as local MDA for user NAME (default - current
- user)
+ -u, --user[=NAME] direct output to the system mailbox of the
+ user NAME (default - current user)
-r, --read-only open mailbox in read-only mode
Script arguments:
@@ -250,9 +254,9 @@ for any corresponding short options.
(guimb-single-mailbox mbox)
(let msg-loop ((msg (mu-mailbox-first-message mbox)))
(if (not (eof-object? msg))
- (begin
- (if (guimb-message msg)
- (mu-mailbox-append-message output-mailbox msg))
+ (let ((x (guimb-message msg)))
+ (if (mu-message? x)
+ (mu-mailbox-append-message output-mailbox x))
(msg-loop (mu-mailbox-next-message mbox)))))))
(define (guimb cmdline)

Return to:

Send suggestions and report system problems to the System administrator.