summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-04-14 11:36:52 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-04-14 11:38:41 +0300
commit94adc8f49244e0abfd3ac47e0cfb2af2a063adc5 (patch)
treea58a72081ee281f55bedf322e0f77b90da13ad4a
parent49e121acc32a38b2d618cfd0544de349618c2bb1 (diff)
downloadmailutils-94adc8f49244e0abfd3ac47e0cfb2af2a063adc5.tar.gz
mailutils-94adc8f49244e0abfd3ac47e0cfb2af2a063adc5.tar.bz2
Further improvements in the Guile-related code.
* gint: Upgrade. * libmu_scm/Makefile.am: Initialize BUILT_SOURCES. * libmu_scm/mu_address.c (address_get_fp): Change signature to match those of mu_address_aget family. (all functions): Use functions from mu_address_aget family. Downcase argument names. Refer to them in the docstring using @var notation. * libmu_scm/mu_body.c: Downcase argument names. Refer to them in the docstring using @var notation. * libmu_scm/mu_logger.c: Likewise. * libmu_scm/mu_mailbox.c: Likewise. * libmu_scm/mu_message.c: Likewise. * libmu_scm/mu_mime.c: Likewise. * libmu_scm/mu_scm.c: Likewise. * libmu_scm/mu_util.c: Likewise.
m---------gint0
-rw-r--r--libmu_scm/Makefile.am1
-rw-r--r--libmu_scm/mu_address.c89
-rw-r--r--libmu_scm/mu_body.c21
-rw-r--r--libmu_scm/mu_logger.c30
-rw-r--r--libmu_scm/mu_mailbox.c187
-rw-r--r--libmu_scm/mu_message.c427
-rw-r--r--libmu_scm/mu_mime.c101
-rw-r--r--libmu_scm/mu_scm.c16
-rw-r--r--libmu_scm/mu_util.c12
10 files changed, 440 insertions, 444 deletions
diff --git a/gint b/gint
-Subproject c6a7620deb7e3e139329e2daad31d4071f01b43
+Subproject 4254b0590e609b82dac3d688ecb401c9eefb7e2
diff --git a/libmu_scm/Makefile.am b/libmu_scm/Makefile.am
index f317bba2d..a65df2847 100644
--- a/libmu_scm/Makefile.am
+++ b/libmu_scm/Makefile.am
@@ -98,4 +98,5 @@ install-data-hook:
sitedir = @GUILE_SITE@/$(PACKAGE)
site_DATA = mailutils.scm
SUFFIXES=
+BUILT_SOURCES=
include ../gint/gint.mk
diff --git a/libmu_scm/mu_address.c b/libmu_scm/mu_address.c
index 9ced92c8c..2df7dcb51 100644
--- a/libmu_scm/mu_address.c
+++ b/libmu_scm/mu_address.c
@@ -19,30 +19,29 @@
#include "mu_scm.h"
-typedef int (*address_get_fp) (mu_address_t, size_t, char *, size_t, size_t *);
+typedef int (*address_get_fp) (mu_address_t, size_t, char **);
static SCM
_get_address_part (const char *func_name, address_get_fp fun,
- SCM ADDRESS, SCM NUM)
+ SCM address, SCM num)
{
mu_address_t addr;
- int length;
char *str;
SCM ret;
- int num;
+ int n;
int status;
- SCM_ASSERT (scm_is_string (ADDRESS), ADDRESS, SCM_ARG1, func_name);
+ SCM_ASSERT (scm_is_string (address), address, SCM_ARG1, func_name);
- if (!SCM_UNBNDP (NUM))
+ if (!SCM_UNBNDP (num))
{
- SCM_ASSERT (scm_is_integer (NUM), NUM, SCM_ARG1, func_name);
- num = scm_to_int (NUM);
+ SCM_ASSERT (scm_is_integer (num), num, SCM_ARG1, func_name);
+ n = scm_to_int (num);
}
else
- num = 1;
+ n = 1;
- str = scm_to_locale_string (ADDRESS);
+ str = scm_to_locale_string (address);
if (!str[0])
{
free (str);
@@ -54,15 +53,7 @@ _get_address_part (const char *func_name, address_get_fp fun,
if (status)
mu_scm_error (func_name, status, "Cannot create address", SCM_BOOL_F);
- str = malloc (length + 1);
- if (!str)
- {
- mu_address_destroy (&addr);
- mu_scm_error (func_name, ENOMEM,
- "Cannot allocate memory", SCM_BOOL_F);
- }
-
- status = (*fun) (addr, num, str, length + 1, NULL);
+ status = (*fun) (addr, n, &str);
mu_address_destroy (&addr);
if (status == 0)
@@ -79,58 +70,58 @@ _get_address_part (const char *func_name, address_get_fp fun,
}
SCM_DEFINE_PUBLIC (scm_mu_address_get_personal, "mu-address-get-personal", 1, 1, 0,
- (SCM ADDRESS, SCM NUM),
- "Return personal part of the NUMth email address from ADDRESS.\n")
+ (SCM address, SCM num),
+ "Return personal part of the @var{num}th email address from @var{address}.\n")
#define FUNC_NAME s_scm_mu_address_get_personal
{
return _get_address_part (FUNC_NAME,
- mu_address_get_personal, ADDRESS, NUM);
+ mu_address_aget_personal, address, num);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_address_get_comments, "mu-address-get-comments", 1, 1, 0,
- (SCM ADDRESS, SCM NUM),
- "Return comment part of the NUMth email address from ADDRESS.\n")
+ (SCM address, SCM num),
+ "Return comment part of the @var{num}th email address from @var{address}.\n")
#define FUNC_NAME s_scm_mu_address_get_comments
{
return _get_address_part (FUNC_NAME,
- mu_address_get_comments, ADDRESS, NUM);
+ mu_address_aget_comments, address, num);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_address_get_email, "mu-address-get-email", 1, 1, 0,
- (SCM ADDRESS, SCM NUM),
- "Return email part of the NUMth email address from ADDRESS.\n")
+ (SCM address, SCM num),
+ "Return email part of the @var{num}th email address from @var{address}.\n")
#define FUNC_NAME s_scm_mu_address_get_email
{
return _get_address_part (FUNC_NAME,
- mu_address_get_email, ADDRESS, NUM);
+ mu_address_aget_email, address, num);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_address_get_domain, "mu-address-get-domain", 1, 1, 0,
- (SCM ADDRESS, SCM NUM),
- "Return domain part of the NUMth email address from ADDRESS.\n")
+ (SCM address, SCM num),
+ "Return domain part of the @var{num}th email address from @var{address}.\n")
#define FUNC_NAME s_scm_mu_address_get_domain
{
return _get_address_part (FUNC_NAME,
- mu_address_get_domain, ADDRESS, NUM);
+ mu_address_aget_domain, address, num);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_address_get_local, "mu-address-get-local", 1, 1, 0,
- (SCM ADDRESS, SCM NUM),
- "Return local part of the NUMth email address from ADDRESS.\n")
+ (SCM address, SCM num),
+ "Return local part of the @var{num}th email address from @var{address}.\n")
#define FUNC_NAME s_scm_mu_address_get_local
{
return _get_address_part (FUNC_NAME,
- mu_address_get_local_part, ADDRESS, NUM);
+ mu_address_aget_local_part, address, num);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0,
- (SCM ADDRESS),
- "Return number of parts in email address ADDRESS.\n")
+ (SCM address),
+ "Return number of parts in email address @var{address}.\n")
#define FUNC_NAME s_scm_mu_address_get_count
{
mu_address_t addr;
@@ -138,15 +129,15 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0,
int status;
char *str;
- SCM_ASSERT (scm_is_string (ADDRESS), ADDRESS, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_string (address), address, SCM_ARG1, FUNC_NAME);
- str = scm_to_locale_string (ADDRESS);
+ str = scm_to_locale_string (address);
status = mu_address_create (&addr, str);
free (str);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot create address for ~A",
- scm_list_1 (ADDRESS));
+ scm_list_1 (address));
mu_address_get_count (addr, &count);
mu_address_destroy (&addr);
@@ -155,29 +146,29 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_username_to_email, "mu-username->email", 0, 1, 0,
- (SCM NAME),
-"Deduce user's email address from his username. If NAME is omitted, \n"
+ (SCM name),
+"Deduce user's email address from his username. If @var{name} is omitted, \n"
"current username is assumed\n")
#define FUNC_NAME s_scm_mu_username_to_email
{
- char *name;
+ char *username;
char *email;
SCM ret;
- if (SCM_UNBNDP (NAME))
- name = NULL;
+ if (SCM_UNBNDP (name))
+ username = NULL;
else
{
- SCM_ASSERT (scm_is_string (NAME), NAME, SCM_ARG1, FUNC_NAME);
- name = scm_to_locale_string (NAME);
+ SCM_ASSERT (scm_is_string (name), name, SCM_ARG1, FUNC_NAME);
+ username = scm_to_locale_string (name);
}
- email = mu_get_user_email (name);
- free (name);
+ email = mu_get_user_email (username);
+ free (username);
if (!email)
mu_scm_error (FUNC_NAME, 0,
"Cannot get user email for ~A",
- scm_list_1 (NAME));
+ scm_list_1 (name));
ret = scm_from_locale_string (email);
free (email);
diff --git a/libmu_scm/mu_body.c b/libmu_scm/mu_body.c
index a2597171b..ff88759ec 100644
--- a/libmu_scm/mu_body.c
+++ b/libmu_scm/mu_body.c
@@ -103,16 +103,16 @@ mu_scm_body_create (SCM msg, mu_body_t body)
/* Guile primitives */
SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0,
- (SCM BODY),
- "Read next line from the BODY.")
+ (SCM body),
+ "Read next line from the @var{body}.")
#define FUNC_NAME s_scm_mu_body_read_line
{
struct mu_body *mbp;
size_t n, nread;
int status;
- SCM_ASSERT (mu_scm_is_body (BODY), BODY, SCM_ARG1, FUNC_NAME);
- mbp = (struct mu_body *) SCM_CDR (BODY);
+ SCM_ASSERT (mu_scm_is_body (body), body, SCM_ARG1, FUNC_NAME);
+ mbp = (struct mu_body *) SCM_CDR (body);
if (!mbp->stream)
{
@@ -164,8 +164,8 @@ SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0,
- (SCM BODY, SCM TEXT),
- "Append TEXT to message BODY.")
+ (SCM body, SCM text),
+ "Append @var{text} to message @var{body}.")
#define FUNC_NAME s_scm_mu_body_write
{
char *ptr;
@@ -173,9 +173,9 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0,
struct mu_body *mbp;
int status;
- SCM_ASSERT (mu_scm_is_body (BODY), BODY, SCM_ARG1, FUNC_NAME);
- mbp = (struct mu_body *) SCM_CDR (BODY);
- SCM_ASSERT (scm_is_string (TEXT), TEXT, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_body (body), body, SCM_ARG1, FUNC_NAME);
+ mbp = (struct mu_body *) SCM_CDR (body);
+ SCM_ASSERT (scm_is_string (text), text, SCM_ARG2, FUNC_NAME);
if (!mbp->stream)
{
@@ -185,9 +185,10 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0,
"Cannot get body stream", SCM_BOOL_F);
}
- ptr = SCM_STRING_CHARS (TEXT);
+ ptr = scm_to_locale_string (text);
len = strlen (ptr);
status = mu_stream_write (mbp->stream, ptr, len, mbp->offset, &n);
+ free (ptr);
mu_scm_error (FUNC_NAME, status,
"Error writing to stream", SCM_BOOL_F);
mbp->offset += n;
diff --git a/libmu_scm/mu_logger.c b/libmu_scm/mu_logger.c
index ab6ee87be..01ebe0041 100644
--- a/libmu_scm/mu_logger.c
+++ b/libmu_scm/mu_logger.c
@@ -24,37 +24,37 @@
static char *log_tag;
SCM_DEFINE_PUBLIC (scm_mu_openlog, "mu-openlog", 3, 0, 0,
- (SCM IDENT, SCM OPTION, SCM FACILITY),
+ (SCM ident, SCM option, SCM facility),
"Opens a connection to the system logger for Guile program.\n"
-"IDENT, OPTION and FACILITY have the same meaning as in openlog(3)")
+"@var{ident}, @var{option} and @var{facility} have the same meaning as in openlog(3)")
#define FUNC_NAME s_scm_mu_openlog
{
- SCM_ASSERT (scm_is_string (IDENT), IDENT, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_string (ident), ident, SCM_ARG1, FUNC_NAME);
if (log_tag)
free (log_tag);
- log_tag = scm_to_locale_string(IDENT);
+ log_tag = scm_to_locale_string (ident);
- SCM_ASSERT (scm_is_integer (OPTION), OPTION, SCM_ARG2, FUNC_NAME);
- SCM_ASSERT (scm_is_integer (FACILITY), FACILITY, SCM_ARG3, FUNC_NAME);
- openlog (log_tag, scm_to_int (OPTION), scm_to_int (FACILITY));
+ SCM_ASSERT (scm_is_integer (option), option, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (scm_is_integer (facility), facility, SCM_ARG3, FUNC_NAME);
+ openlog (log_tag, scm_to_int (option), scm_to_int (facility));
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_logger, "mu-logger", 2, 0, 0,
- (SCM PRIO, SCM TEXT),
- "Distributes TEXT via syslogd priority PRIO.")
+ (SCM prio, SCM text),
+ "Distributes @var{text} via the syslog priority @var{prio}.")
#define FUNC_NAME s_scm_mu_logger
{
- int prio;
+ int nprio;
char *str;
- SCM_ASSERT (scm_is_integer (PRIO), PRIO, SCM_ARG1, FUNC_NAME);
- prio = scm_to_int (PRIO);
+ SCM_ASSERT (scm_is_integer (prio), prio, SCM_ARG1, FUNC_NAME);
+ nprio = scm_to_int (prio);
- SCM_ASSERT (scm_is_string (TEXT), TEXT, SCM_ARG2, FUNC_NAME);
- str = scm_to_locale_string (TEXT);
- syslog (prio, "%s", str);
+ SCM_ASSERT (scm_is_string (text), text, SCM_ARG2, FUNC_NAME);
+ str = scm_to_locale_string (text);
+ syslog (nprio, "%s", str);
free (str);
return SCM_UNSPECIFIED;
}
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index f58fbad9e..dce05e8db 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -138,34 +138,34 @@ mu_scm_is_mailbox (SCM scm)
/* Guile primitives */
SCM_DEFINE_PUBLIC (scm_mu_mail_directory, "mu-mail-directory", 0, 1, 0,
- (SCM URL),
+ (SCM url),
"Do not use this function. Use mu-user-mailbox-url instead.")
#define FUNC_NAME s_scm_mu_mail_directory
{
mu_scm_error (FUNC_NAME, ENOSYS,
"This function is deprecated. Use mu-user-mailbox-url instead.",
- scm_list_1 (URL));
+ scm_list_1 (url));
return SCM_EOL;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0,
- (SCM USER),
- "")
+ (SCM user),
+ "Return URL of the default mailbox for user @var{user}.")
#define FUNC_NAME s_scm_mu_user_mailbox_url
{
int rc;
char *p, *str;
SCM ret;
- SCM_ASSERT (scm_is_string (USER), USER, SCM_ARG1, FUNC_NAME);
- str = scm_to_locale_string (USER);
+ SCM_ASSERT (scm_is_string (user), user, SCM_ARG1, FUNC_NAME);
+ str = scm_to_locale_string (user);
rc = mu_construct_user_mailbox_url (&p, str);
free (str);
if (rc)
mu_scm_error (FUNC_NAME, rc,
"Cannot construct mailbox URL for ~A",
- scm_list_1 (USER));
+ scm_list_1 (user));
ret = scm_from_locale_string (p);
free (p);
return ret;
@@ -173,17 +173,17 @@ SCM_DEFINE_PUBLIC (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0,
- (SCM URL),
-"If URL is given, sets it as a name of the user's folder directory.\n"
+ (SCM url),
+"If @var{url} is given, sets it as a name of the user's folder directory.\n"
"Returns the current value of the folder directory.")
#define FUNC_NAME s_scm_mu_folder_directory
{
- if (!SCM_UNBNDP (URL))
+ if (!SCM_UNBNDP (url))
{
char *s;
- SCM_ASSERT (scm_is_string (URL), URL, SCM_ARG1, FUNC_NAME);
- s = scm_to_locale_string (URL);
+ SCM_ASSERT (scm_is_string (url), url, SCM_ARG1, FUNC_NAME);
+ s = scm_to_locale_string (url);
mu_set_folder_directory (s);
free (s);
}
@@ -192,12 +192,12 @@ SCM_DEFINE_PUBLIC (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0,
- (SCM URL, SCM MODE),
-"Opens the mailbox specified by URL. MODE is a string, consisting of\n"
+ (SCM url, SCM mode),
+"Opens the mailbox specified by @var{url}. @var{mode} is a string, consisting of\n"
"the characters described below, giving the access mode for the mailbox\n"
"\n"
"@multitable @columnfractions 0.20 0.70\n"
-"@headitem MODE @tab Meaning\n"
+"@headitem @var{mode} @tab Meaning\n"
"@item r @tab Open for reading.\n"
"@item w @tab Open for writing.\n"
"@item a @tab Open for appending to the end of the mailbox.\n"
@@ -208,54 +208,54 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0,
{
mu_mailbox_t mbox = NULL;
char *mode_str;
- int mode = 0;
+ int mode_bits = 0;
int status;
SCM ret;
- SCM_ASSERT (scm_is_string (URL), URL, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (scm_is_string (MODE), MODE, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (scm_is_string (url), url, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME);
scm_dynwind_begin (0);
- mode_str = scm_to_locale_string (MODE);
+ mode_str = scm_to_locale_string (mode);
scm_dynwind_free (mode_str);
for (; *mode_str; mode_str++)
switch (*mode_str)
{
case 'r':
- mode |= MU_STREAM_READ;
+ mode_bits |= MU_STREAM_READ;
break;
case 'w':
- mode |= MU_STREAM_WRITE;
+ mode_bits |= MU_STREAM_WRITE;
break;
case 'a':
- mode |= MU_STREAM_APPEND;
+ mode_bits |= MU_STREAM_APPEND;
break;
case 'c':
- mode |= MU_STREAM_CREAT;
+ mode_bits |= MU_STREAM_CREAT;
break;
}
- if (mode & MU_STREAM_READ && mode & MU_STREAM_WRITE)
- mode = (mode & ~(MU_STREAM_READ | MU_STREAM_WRITE)) | MU_STREAM_RDWR;
+ if (mode_bits & MU_STREAM_READ && mode_bits & MU_STREAM_WRITE)
+ mode_bits = (mode_bits & ~(MU_STREAM_READ | MU_STREAM_WRITE)) | MU_STREAM_RDWR;
- mode_str = scm_to_locale_string (URL);
+ mode_str = scm_to_locale_string (url);
scm_dynwind_free (mode_str);
status = mu_mailbox_create_default (&mbox, mode_str);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot create default mailbox ~A",
- scm_list_1 (URL));
+ scm_list_1 (url));
- status = mu_mailbox_open (mbox, mode);
+ status = mu_mailbox_open (mbox, mode_bits);
if (status)
{
mu_mailbox_destroy (&mbox);
mu_scm_error (FUNC_NAME, status,
"Cannot open default mailbox ~A",
- scm_list_1 (URL));
+ scm_list_1 (url));
}
ret = mu_scm_mailbox_create (mbox);
scm_dynwind_end ();
@@ -264,13 +264,14 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_close, "mu-mailbox-close", 1, 0, 0,
- (SCM MBOX), "Closes mailbox MBOX.")
+ (SCM mbox),
+ "Closes mailbox @var{mbox}.")
#define FUNC_NAME s_scm_mu_mailbox_close
{
struct mu_mailbox *mum;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
mu_mailbox_close (mum->mbox);
mu_mailbox_destroy (&mum->mbox);
return SCM_UNSPECIFIED;
@@ -278,16 +279,16 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_close, "mu-mailbox-close", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0,
- (SCM MBOX),
- "Returns url of the mailbox MBOX.")
+ (SCM mbox),
+ "Returns URL of the mailbox @var{MBOX}.")
#define FUNC_NAME s_scm_mu_mailbox_get_url
{
struct mu_mailbox *mum;
mu_url_t url;
int status;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
status = mu_mailbox_get_url (mum->mbox, &url);
if (status)
mu_scm_error (FUNC_NAME, status,
@@ -299,9 +300,9 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0,
- (SCM MBOX, SCM MODE),
-"Returns a port associated with the contents of the MBOX.\n"
-"MODE is a string defining operation mode of the stream. It may\n"
+ (SCM mbox, SCM mode),
+"Returns a port associated with the contents of the @var{mbox},\n"
+"which is a string defining operation mode of the stream. It may\n"
"contain any of the two characters: @samp{r} for reading, @samp{w} for\n"
"writing.\n")
#define FUNC_NAME s_scm_mu_mailbox_get_port
@@ -312,105 +313,105 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0,
char *s;
SCM ret;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (scm_is_string (MODE), MODE, SCM_ARG2, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
status = mu_mailbox_get_stream (mum->mbox, &stream);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get mailbox stream",
- scm_list_1 (MBOX));
- s = scm_to_locale_string (MODE);
- ret = mu_port_make_from_stream (MBOX, stream, scm_mode_bits (s));
+ scm_list_1 (mbox));
+ s = scm_to_locale_string (mode);
+ ret = mu_port_make_from_stream (mbox, stream, scm_mode_bits (s));
free (s);
return ret;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_message, "mu-mailbox-get-message", 2, 0, 0,
- (SCM MBOX, SCM MSGNO),
-"Retrieve from message #MSGNO from the mailbox MBOX.")
+ (SCM mbox, SCM msgno),
+"Retrieve from message #@var{msgno} from the mailbox @var{mbox}.")
#define FUNC_NAME s_scm_mu_mailbox_get_message
{
- size_t msgno;
+ size_t n;
struct mu_mailbox *mum;
mu_message_t msg;
int status;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (scm_is_integer (MSGNO), MSGNO, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_integer (msgno), msgno, SCM_ARG2, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
- msgno = scm_to_int32 (MSGNO);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
+ n = scm_to_size_t (msgno);
- status = mu_mailbox_get_message (mum->mbox, msgno, &msg);
+ status = mu_mailbox_get_message (mum->mbox, n, &msg);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get message ~A from mailbox ~A",
- scm_list_2 (MSGNO, MBOX));
+ scm_list_2 (msgno, mbox));
- return mu_scm_message_create (MBOX, msg);
+ return mu_scm_message_create (mbox, msg);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_messages_count, "mu-mailbox-messages-count", 1, 0, 0,
- (SCM MBOX),
-"Returns number of messages in the mailbox MBOX.")
+ (SCM mbox),
+"Returns number of messages in the mailbox @var{mbox}.")
#define FUNC_NAME s_scm_mu_mailbox_messages_count
{
struct mu_mailbox *mum;
size_t nmesg;
int status;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
status = mu_mailbox_messages_count (mum->mbox, &nmesg);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot count messages in mailbox ~A",
- scm_list_1 (MBOX));
+ scm_list_1 (mbox));
return scm_from_size_t (nmesg);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_expunge, "mu-mailbox-expunge", 1, 0, 0,
- (SCM MBOX),
-"Expunges deleted messages from the mailbox MBOX.")
+ (SCM mbox),
+"Expunges deleted messages from the mailbox @var{mbox}.")
#define FUNC_NAME s_scm_mu_mailbox_expunge
{
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);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
status = mu_mailbox_expunge (mum->mbox);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot expunge messages in mailbox ~A",
- scm_list_1 (MBOX));
+ 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 MESG to the mailbox MBOX.")
+ (SCM mbox, SCM mesg),
+ "Appends message @var{mesg} to the mailbox @var{mbox}.")
#define FUNC_NAME s_scm_mu_mailbox_append_message
{
struct mu_mailbox *mum;
mu_message_t msg;
int status;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
+ msg = mu_scm_message_get (mesg);
status = mu_mailbox_append_message (mum->mbox, msg);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot append message ~A to mailbox ~A",
- scm_list_2 (MESG, MBOX));
+ scm_list_2 (mesg, mbox));
return SCM_BOOL_T;
}
#undef FUNC_NAME
@@ -425,56 +426,56 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_append_message, "mu-mailbox-append-message", 2
if (status) \
mu_scm_error (FUNC_NAME, status, \
"~A: " descr ": ~A", \
- scm_list_2 (MBOX, \
+ scm_list_2 (mbox, \
scm_from_locale_string (mu_strerror (status)))); \
} \
while (0)
SCM_DEFINE_PUBLIC (scm_mu_mailbox_first_message, "mu-mailbox-first-message", 1, 0, 0,
- (SCM MBOX),
- "Returns first message from the mailbox.")
+ (SCM mbox),
+ "Returns first message from the mailbox @var{mbox}.")
#define FUNC_NAME s_scm_mu_mailbox_first_message
{
struct mu_mailbox *mum;
int status;
mu_message_t msg;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
if (!mum->itr)
{
status = mu_mailbox_get_iterator (mum->mbox, &mum->itr);
if (status)
mu_scm_error (FUNC_NAME, status,
"~A: cannot create iterator: ~A",
- scm_list_2 (MBOX,
+ scm_list_2 (mbox,
scm_from_locale_string (mu_strerror (status))));
}
ITROP (mu_iterator_first (mum->itr), "moving to the first message");
ITROP (mu_iterator_current (mum->itr, (void**)&msg),
"getting current message");
- return mu_scm_message_create (MBOX, msg);
+ return mu_scm_message_create (mbox, msg);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_next_message, "mu-mailbox-next-message", 1, 0, 0,
- (SCM MBOX),
- "Returns next message from the mailbox.")
+ (SCM mbox),
+ "Returns next message from the mailbox @var{mbox}.")
#define FUNC_NAME s_scm_mu_mailbox_next_message
{
struct mu_mailbox *mum;
int status;
mu_message_t msg;
- SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME);
- mum = (struct mu_mailbox *) SCM_CDR (MBOX);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
if (!mum->itr)
{
status = mu_mailbox_get_iterator (mum->mbox, &mum->itr);
if (status)
mu_scm_error (FUNC_NAME, status,
"~A: cannot create iterator: ~A",
- scm_list_2 (MBOX,
+ scm_list_2 (mbox,
scm_from_locale_string (mu_strerror (status))));
ITROP (mu_iterator_first (mum->itr), "moving to the first message");
}
@@ -483,27 +484,31 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_next_message, "mu-mailbox-next-message", 1, 0,
ITROP (mu_iterator_current (mum->itr, (void**)&msg),
"getting current message");
- return mu_scm_message_create (MBOX, msg);
+ return mu_scm_message_create (mbox, msg);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_more_messages_p, "mu-mailbox-more-messages?", 1, 0, 0,
- (SCM MBOX),
- "Returns next message from the mailbox.")
+ (SCM mbox),
+"Returns @samp{#t} if there are more messages in the mailbox @var{mbox}\n"
+"ahead of current iterator position. Usually this function is used after\n"
+"a call to @samp{mu-mailbox-first-message} or @samp{mu-mailbox-next-message}.\n"
+"If not, it initializes the iterator and points it to the first message inn"
+"the mailbox.")
#define FUNC_NAME s_scm_mu_mailbox_more_messages_p
{
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);
+ SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_mailbox *) SCM_CDR (mbox);
if (!mum->itr)
{
status = mu_mailbox_get_iterator (mum->mbox, &mum->itr);
if (status)
mu_scm_error (FUNC_NAME, status,
"~A: cannot create iterator: ~A",
- scm_list_2 (MBOX,
+ scm_list_2 (mbox,
scm_from_locale_string (mu_strerror (status))));
status = mu_iterator_first (mum->itr);
if (status == MU_ERR_NOENT)
@@ -511,7 +516,7 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_more_messages_p, "mu-mailbox-more-messages?",
if (status)
mu_scm_error (FUNC_NAME, status,
"~A: cannot set iterator to the first message: ~A",
- scm_list_2 (MBOX,
+ scm_list_2 (mbox,
scm_from_locale_string (mu_strerror (status))));
}
return scm_from_bool (!!mu_iterator_is_done (mum->itr));
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index d9e338630..27c96be43 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -177,8 +177,8 @@ mu_scm_is_message (SCM scm)
/* Guile primitives */
SCM_DEFINE_PUBLIC (scm_mu_message_create, "mu-message-create", 0, 0, 0,
- (),
- "Creates an empty message.\n")
+ (),
+ "Creates an empty message.\n")
#define FUNC_NAME s_scm_mu_message_create
{
mu_message_t msg;
@@ -189,8 +189,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_create, "mu-message-create", 0, 0, 0,
/* FIXME: This changes envelope date */
SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0,
- (SCM MESG),
- "Creates the copy of the message MESG.\n")
+ (SCM mesg),
+ "Creates a copy of the message @var{mesg}.\n")
#define FUNC_NAME s_scm_mu_message_copy
{
mu_message_t msg, newmsg;
@@ -199,14 +199,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0,
size_t off, n;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
status = mu_message_get_stream (msg, &in);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get input stream from message ~A",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
status = mu_message_create (&newmsg, NULL);
if (status)
@@ -250,44 +250,44 @@ SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_destroy, "mu-message-destroy", 1, 0, 0,
- (SCM MESG),
- "Destroys the message MESG.")
+ (SCM mesg),
+ "Destroys the message @var{mesg}.")
#define FUNC_NAME s_scm_mu_message_destroy
{
struct mu_message *mum;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- mum = (struct mu_message *) SCM_CDR (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ mum = (struct mu_message *) SCM_CDR (mesg);
mu_message_destroy (&mum->msg, mu_message_get_owner (mum->msg));
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_set_header, "mu-message-set-header", 3, 1, 0,
- (SCM MESG, SCM HEADER, SCM VALUE, SCM REPLACE),
-"Sets new VALUE to the header HEADER of the message MESG.\n"
-"If HEADER is already present in the message its value\n"
-"is replaced with the suplied one iff the optional REPLACE is\n"
-"#t. Otherwise, a new header is created and appended.")
+ (SCM mesg, SCM header, SCM value, SCM replace),
+"Sets header @var{header} of the message @var{mesg} to new @var{value}.\n"
+"If @var{header} is already present in the message, its value\n"
+"is replaced with the suplied one iff the optional @var{replace} is\n"
+"@code{#t}. Otherwise, a new header is created and appended.")
#define FUNC_NAME s_scm_mu_message_set_header
{
mu_message_t msg;
mu_header_t hdr;
- int replace = 0;
+ int repl = 0;
int status;
char *hdr_c, *val_c;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- SCM_ASSERT (scm_is_string (HEADER), HEADER, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ SCM_ASSERT (scm_is_string (header), header, SCM_ARG2, FUNC_NAME);
- if (scm_is_bool (VALUE))
- return SCM_UNSPECIFIED;
+ if (scm_is_bool (value))
+ return SCM_UNSPECIFIED;/*FIXME: Exception*/
- SCM_ASSERT (scm_is_string (VALUE), VALUE, SCM_ARG3, FUNC_NAME);
- if (!SCM_UNBNDP (REPLACE))
+ SCM_ASSERT (scm_is_string (value), value, SCM_ARG3, FUNC_NAME);
+ if (!SCM_UNBNDP (replace))
{
- replace = REPLACE == SCM_BOOL_T;
+ repl = replace == SCM_BOOL_T;
}
status = mu_message_get_header (msg, &hdr);
@@ -295,52 +295,52 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header, "mu-message-set-header", 3, 1, 0,
mu_scm_error (FUNC_NAME, status,
"Cannot get message headers", SCM_BOOL_F);
- hdr_c = scm_to_locale_string (HEADER);
- val_c = scm_to_locale_string (VALUE);
- status = mu_header_set_value (hdr, hdr_c, val_c, replace);
+ hdr_c = scm_to_locale_string (header);
+ val_c = scm_to_locale_string (value);
+ status = mu_header_set_value (hdr, hdr_c, val_c, repl);
free (hdr_c);
free (val_c);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot set header \"~A: ~A\" in message ~A",
- scm_list_3 (HEADER, VALUE, MESG));
+ scm_list_3 (header, value, mesg));
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_size, "mu-message-get-size", 1, 0, 0,
- (SCM MESG),
- "Returns the size of the message MESG\n.")
+ (SCM mesg),
+ "Returns size of the message @var{mesg}\n.")
#define FUNC_NAME s_scm_mu_message_get_size
{
mu_message_t msg;
size_t size;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
mu_message_size (msg, &size);
return scm_from_size_t (size);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_lines, "mu-message-get-lines", 1, 0, 0,
- (SCM MESG),
- "Returns number of lines in the given message.\n")
+ (SCM mesg),
+ "Returns number of lines in the message @var{msg}.\n")
#define FUNC_NAME s_scm_mu_message_get_lines
{
mu_message_t msg;
size_t lines;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
status = mu_message_lines (msg, &lines);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get number of lines in message ~A",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
return scm_from_size_t (lines);
}
@@ -368,8 +368,8 @@ filltime (struct tm *bd_time, int zoff, const char *zname)
}
SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0, 0,
- (SCM MESG),
- "Returns envelope date of the message MESG.\n")
+ (SCM mesg),
+ "Returns envelope date of the message @var{mesg}.\n")
#define FUNC_NAME s_scm_mu_message_get_envelope
{
mu_message_t msg;
@@ -379,20 +379,20 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0,
const char *date;
size_t dlen;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
status = mu_message_get_envelope (msg, &env);
if (status)
mu_scm_error (FUNC_NAME, status, "cannot get envelope",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
status = mu_envelope_sget_sender (env, &sender);
if (status)
mu_scm_error (FUNC_NAME, status, "cannot get envelope sender",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
status = mu_envelope_sget_date (env, &date);
if (status)
mu_scm_error (FUNC_NAME, status, "cannot get envelope date",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
dlen = strlen (date);
if (date[dlen-1] == '\n')
dlen--;
@@ -403,8 +403,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-date", 1, 0, 0,
- (SCM MESG),
- "Returns envelope date of the message MESG.\n")
+ (SCM mesg),
+ "Returns envelope date of the message @var{mesg}.\n")
#define FUNC_NAME s_scm_mu_message_get_envelope_date
{
mu_message_t msg;
@@ -414,16 +414,16 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-da
struct tm tm;
mu_timezone tz;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
status = mu_message_get_envelope (msg, &env);
if (status)
mu_scm_error (FUNC_NAME, status, "cannot get envelope",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
status = mu_envelope_sget_date (env, &sdate);
if (status)
mu_scm_error (FUNC_NAME, status, "cannot get envelope date",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
status = mu_parse_ctime_date_time (&sdate, &tm, &tz);
if (status)
mu_scm_error (FUNC_NAME, status, "invalid envelope date",
@@ -433,8 +433,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-da
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0,
- (SCM MESG),
- "Returns email address of the sender of the message MESG.\n")
+ (SCM mesg),
+ "Returns email address of the sender of the message @var{mesg}.\n")
#define FUNC_NAME s_scm_mu_message_get_sender
{
mu_message_t msg;
@@ -442,8 +442,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0,
int status;
SCM ret;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
status = mu_message_get_envelope (msg, &env);
if (status == 0)
{
@@ -454,14 +454,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0,
else
mu_scm_error (FUNC_NAME, status,
"Cannot get envelope of message ~A",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
return ret;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0,
- (SCM MESG, SCM HEADER),
- "Returns value of the header HEADER from the message MESG.\n")
+ (SCM mesg, SCM header),
+"Returns value of the header @var{header} from the message @var{mesg}.\n")
#define FUNC_NAME s_scm_mu_message_get_header
{
mu_message_t msg;
@@ -471,15 +471,15 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0,
SCM ret;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- SCM_ASSERT (scm_is_string (HEADER), HEADER, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ SCM_ASSERT (scm_is_string (header), header, SCM_ARG2, FUNC_NAME);
status = mu_message_get_header (msg, &hdr);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get message headers", SCM_BOOL_F);
- header_string = scm_to_locale_string (HEADER);
+ header_string = scm_to_locale_string (header);
status = mu_header_aget_value (hdr, header_string, &value);
free (header_string);
switch (status)
@@ -496,7 +496,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0,
default:
mu_scm_error (FUNC_NAME, status,
"Cannot get header ~A from message ~A",
- scm_list_2 (HEADER, MESG));
+ scm_list_2 (header, mesg));
}
return ret;
@@ -518,25 +518,23 @@ string_sloppy_member (SCM lst, char *name)
}
SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, 1, 0,
- (SCM MESG, SCM HEADERS),
-"Returns the list of headers in the message MESG. Optional argument\n"
-"HEADERS gives a list of header names to restrict return value to.\n")
+ (SCM mesg, SCM headers),
+"Returns list of headers in the message @var{mesg}. optional argument\n"
+"@var{headers} gives a list of header names to restrict return value to.\n")
#define FUNC_NAME s_scm_mu_message_get_header_fields
{
size_t i, nfields = 0;
mu_message_t msg;
mu_header_t hdr = NULL;
SCM scm_first = SCM_EOL, scm_last = SCM_EOL;
- SCM headers = SCM_EOL;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- if (!SCM_UNBNDP (HEADERS))
- {
- SCM_ASSERT (scm_is_pair (HEADERS), HEADERS, SCM_ARG2, FUNC_NAME);
- headers = HEADERS;
- }
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ if (SCM_UNBNDP (headers))
+ headers = SCM_EOL;
+ else
+ SCM_ASSERT (scm_is_pair (headers), headers, SCM_ARG2, FUNC_NAME);
status = mu_message_get_header (msg, &hdr);
if (status)
@@ -556,7 +554,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get header field ~A, message ~A",
- scm_list_2 (scm_from_size_t (i), MESG));
+ scm_list_2 (scm_from_size_t (i), mesg));
if (!scm_is_null (headers) && string_sloppy_member (headers, name) == 0)
continue;
@@ -564,7 +562,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get header value ~A, message ~A",
- scm_list_2 (scm_from_size_t (i), MESG));
+ scm_list_2 (scm_from_size_t (i), mesg));
scm_name = scm_from_locale_string (name);
scm_value = scm_from_locale_string (value);
@@ -584,29 +582,27 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fields", 2, 1, 0,
- (SCM MESG, SCM LIST, SCM REPLACE),
-"Set the headers in the message MESG from LIST\n"
-"LIST is a list of conses (cons HEADER VALUE). The function sets\n"
-"these headers in the message MESG.\n"
-"Optional parameter REPLACE specifies whether the new header\n"
+ (SCM mesg, SCM list, SCM replace),
+"Set headers in the message @var{mesg} to those listed in @var{list},\n"
+"which is a list of conses @code{(cons @var{header} @var{value})}.\n\n"
+"Optional parameter @var{replace} specifies whether new header\n"
"values should replace the headers already present in the\n"
"message.")
#define FUNC_NAME s_scm_mu_message_set_header_fields
{
mu_message_t msg;
mu_header_t hdr;
- SCM list;
- int replace = 0;
+ int repl = 0;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- SCM_ASSERT (scm_is_null (LIST) || scm_is_pair (LIST),
- LIST, SCM_ARG2, FUNC_NAME);
- if (!SCM_UNBNDP (REPLACE))
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ SCM_ASSERT (scm_is_null (list) || scm_is_pair (list),
+ list, SCM_ARG2, FUNC_NAME);
+ if (!SCM_UNBNDP (replace))
{
- SCM_ASSERT (scm_is_bool (REPLACE), REPLACE, SCM_ARG3, FUNC_NAME);
- replace = REPLACE == SCM_BOOL_T;
+ SCM_ASSERT (scm_is_bool (replace), replace, SCM_ARG3, FUNC_NAME);
+ repl = replace == SCM_BOOL_T;
}
status = mu_message_get_header (msg, &hdr);
@@ -614,7 +610,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel
mu_scm_error (FUNC_NAME, status,
"Cannot get message headers", SCM_BOOL_F);
- for (list = LIST; !scm_is_null (list); list = SCM_CDR (list))
+ for (; !scm_is_null (list); list = SCM_CDR (list))
{
SCM cell = SCM_CAR (list);
SCM car, cdr;
@@ -627,13 +623,13 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel
SCM_ASSERT (scm_is_string (cdr), cdr, SCM_ARGn, FUNC_NAME);
hdr_c = scm_to_locale_string (car);
val_c = scm_to_locale_string (cdr);
- status = mu_header_set_value (hdr, hdr_c, val_c, replace);
+ status = mu_header_set_value (hdr, hdr_c, val_c, repl);
free (hdr_c);
free (val_c);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot set header value: message ~A, header ~A, value ~A",
- scm_list_3 (MESG, car, cdr));
+ scm_list_3 (mesg, car, cdr));
}
return SCM_UNSPECIFIED;
@@ -641,10 +637,10 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0,
- (SCM MESG, SCM FLAG),
-"Mark the message MESG as deleted. Optional argument FLAG allows to toggle\n"
-"deletion mark. The message is deleted if it is @code{#t} and undeleted if\n"
-"it is @code{#f}")
+ (SCM mesg, SCM flag),
+"Mark message @var{mesg} as deleted. Optional argument @var{flag} allows to\n"
+"toggle the deletion mark. The message is deleted if it is @code{#t} and\n"
+"undeleted if it is @code{#f}.")
#define FUNC_NAME s_scm_mu_message_delete
{
mu_message_t msg;
@@ -652,12 +648,12 @@ SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0,
int delete = 1;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- if (!SCM_UNBNDP (FLAG))
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ if (!SCM_UNBNDP (flag))
{
- SCM_ASSERT (scm_is_bool (FLAG), FLAG, SCM_ARG2, FUNC_NAME);
- delete = FLAG == SCM_BOOL_T;
+ SCM_ASSERT (scm_is_bool (flag), flag, SCM_ARG2, FUNC_NAME);
+ delete = flag == SCM_BOOL_T;
}
status = mu_message_get_attribute (msg, &attr);
if (status)
@@ -678,8 +674,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0,
- (SCM MESG, SCM FLAG),
-"Return value of the attribute FLAG of the message MESG.")
+ (SCM mesg, SCM flag),
+"Return the value of the attribute @var{flag} of the message @var{mesg}.")
#define FUNC_NAME s_scm_mu_message_get_flag
{
mu_message_t msg;
@@ -687,16 +683,16 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0,
int ret = 0;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME);
status = mu_message_get_attribute (msg, &attr);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get message attribute", SCM_BOOL_F);
- switch (scm_to_int32 (FLAG))
+ switch (scm_to_int (flag))
{
case MU_ATTRIBUTE_ANSWERED:
ret = mu_attribute_is_answered (attr);
@@ -732,31 +728,31 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0,
default:
mu_attribute_get_flags (attr, &ret);
- ret &= scm_to_int32 (FLAG);
+ ret &= scm_to_int (flag);
}
return ret ? SCM_BOOL_T : SCM_BOOL_F;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0,
- (SCM MESG, SCM FLAG, SCM VALUE),
-"Set the attribute FLAG of the message MESG. If optional VALUE is #f, the\n"
-"attribute is unset.")
+ (SCM mesg, SCM flag, SCM value),
+"Set the attribute @var{flag} in message @var{mesg}. If optional @var{value}\n"
+"is @samp{#f}, the attribute is unset.\n")
#define FUNC_NAME s_scm_mu_message_set_flag
{
mu_message_t msg;
mu_attribute_t attr;
- int value = 1;
+ int val = 1;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME);
- if (!SCM_UNBNDP (VALUE))
+ if (!SCM_UNBNDP (value))
{
- SCM_ASSERT (scm_is_bool (VALUE), VALUE, SCM_ARG3, FUNC_NAME);
- value = VALUE == SCM_BOOL_T;
+ SCM_ASSERT (scm_is_bool (value), value, SCM_ARG3, FUNC_NAME);
+ val = value == SCM_BOOL_T;
}
status = mu_message_get_attribute (msg, &attr);
@@ -765,67 +761,67 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0,
"Cannot get message attribute", SCM_BOOL_F);
status = 0;
- switch (scm_to_int32 (FLAG))
+ switch (scm_to_int (flag))
{
case MU_ATTRIBUTE_ANSWERED:
- if (value)
+ if (val)
status = mu_attribute_set_answered (attr);
else
status = mu_attribute_unset_answered (attr);
break;
case MU_ATTRIBUTE_FLAGGED:
- if (value)
+ if (val)
status = mu_attribute_set_flagged (attr);
else
status = mu_attribute_unset_flagged (attr);
break;
case MU_ATTRIBUTE_DELETED:
- if (value)
+ if (val)
status = mu_attribute_set_deleted (attr);
else
status = mu_attribute_unset_deleted (attr);
break;
case MU_ATTRIBUTE_DRAFT:
- if (value)
+ if (val)
status = mu_attribute_set_draft (attr);
else
status = mu_attribute_unset_draft (attr);
break;
case MU_ATTRIBUTE_SEEN:
- if (value)
+ if (val)
status = mu_attribute_set_seen (attr);
else
status = mu_attribute_unset_seen (attr);
break;
case MU_ATTRIBUTE_READ:
- if (value)
+ if (val)
status = mu_attribute_set_read (attr);
else
status = mu_attribute_unset_read (attr);
break;
case MU_ATTRIBUTE_MODIFIED:
- if (value)
+ if (val)
status = mu_attribute_set_modified (attr);
else
status = mu_attribute_clear_modified (attr);
break;
case MU_ATTRIBUTE_RECENT:
- if (value)
+ if (val)
status = mu_attribute_set_recent (attr);
else
status = mu_attribute_unset_recent (attr);
break;
default:
- if (value)
- status = mu_attribute_set_flags (attr, scm_to_int32 (FLAG));
+ if (val)
+ status = mu_attribute_set_flags (attr, scm_to_int (flag));
}
if (status)
@@ -837,31 +833,31 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_user_flag, "mu-message-get-user-flag", 2, 0, 0,
- (SCM MESG, SCM FLAG),
-"Return the value of the user attribute FLAG from the message MESG.")
+ (SCM mesg, SCM flag),
+"Return value of the user-defined attribute @var{flag} from the message @var{mesg}.")
#define FUNC_NAME s_scm_mu_message_get_user_flag
{
mu_message_t msg;
mu_attribute_t attr;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME);
status = mu_message_get_attribute (msg, &attr);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get message attribute", SCM_BOOL_F);
- return mu_attribute_is_userflag (attr, scm_to_int32 (FLAG)) ?
- SCM_BOOL_T : SCM_BOOL_F;
+ return mu_attribute_is_userflag (attr, scm_to_int (flag)) ?
+ SCM_BOOL_T : SCM_BOOL_F;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, 1, 0,
- (SCM MESG, SCM FLAG, SCM VALUE),
-"Set the given user attribute FLAG in the message MESG. If optional argumen\n"
-"VALUE is @samp{#f}, the attribute is unset.")
+ (SCM mesg, SCM flag, SCM value),
+"Set user-defined attribute @var{flag} in the message @var{mesg}.\n"
+"If optional argumen @var{value} is @samp{#f}, the attribute is unset.")
#define FUNC_NAME s_scm_mu_message_set_user_flag
{
mu_message_t msg;
@@ -869,14 +865,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2,
int set = 1;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
- SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
+ SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME);
- if (!SCM_UNBNDP (VALUE))
+ if (!SCM_UNBNDP (value))
{
- SCM_ASSERT (scm_is_bool (VALUE), VALUE, SCM_ARG3, FUNC_NAME);
- set = VALUE == SCM_BOOL_T;
+ SCM_ASSERT (scm_is_bool (value), value, SCM_ARG3, FUNC_NAME);
+ set = value == SCM_BOOL_T;
}
status = mu_message_get_attribute (msg, &attr);
@@ -885,19 +881,19 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2,
"Cannot get message attribute", SCM_BOOL_F);
if (set)
- mu_attribute_set_userflag (attr, scm_to_int32 (FLAG));
+ mu_attribute_set_userflag (attr, scm_to_int (flag));
else
- mu_attribute_unset_userflag (attr, scm_to_int32 (FLAG));
+ mu_attribute_unset_userflag (attr, scm_to_int (flag));
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0,
- (SCM MESG, SCM MODE, SCM FULL),
-"Returns a port associated with the given MESG. MODE is a string\n"
-"defining operation mode of the stream. It may contain any of the\n"
+ (SCM mesg, SCM mode, SCM full),
+"Returns a port associated with the message @var{mesg}. The @var{mode} is a\n"
+"string defining operation mode of the stream. It may contain any of the\n"
"two characters: @samp{r} for reading, @samp{w} for writing.\n"
-"If optional argument FULL is specified, it should be a boolean value.\n"
+"If optional argument @var{full} is specified, it should be a boolean value.\n"
"If it is @samp{#t} then the returned port will allow access to any\n"
"part of the message (including headers). If it is @code{#f} then the port\n"
"accesses only the message body (the default).\n")
@@ -909,15 +905,15 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0,
char *str;
SCM ret;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (scm_is_string (MODE), MODE, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ msg = mu_scm_message_get (mesg);
- if (!SCM_UNBNDP (FULL))
+ if (!SCM_UNBNDP (full))
{
- SCM_ASSERT (scm_is_bool (FULL), FULL, SCM_ARG3, FUNC_NAME);
- if (FULL == SCM_BOOL_T)
+ SCM_ASSERT (scm_is_bool (full), full, SCM_ARG3, FUNC_NAME);
+ if (full == SCM_BOOL_T)
{
status = mu_message_get_stream (msg, &stream);
if (status)
@@ -940,8 +936,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0,
SCM_BOOL_F);
}
- str = scm_to_locale_string (MODE);
- ret = mu_port_make_from_stream (MESG, stream, scm_mode_bits (str));
+ str = scm_to_locale_string (mode);
+ ret = mu_port_make_from_stream (mesg, stream, scm_mode_bits (str));
free (str);
return ret;
}
@@ -949,42 +945,42 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0,
SCM_DEFINE_PUBLIC (scm_mu_message_get_body, "mu-message-get-body", 1, 0, 0,
- (SCM MESG),
- "Returns the message body for the message MESG.")
+ (SCM mesg),
+ "Returns message body for the message @var{mesg}.")
#define FUNC_NAME s_scm_mu_message_get_body
{
mu_message_t msg;
mu_body_t body = NULL;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
status = mu_message_get_body (msg, &body);
if (status)
mu_scm_error (FUNC_NAME, status, "Cannot get message body", SCM_BOOL_F);
- return mu_scm_body_create (MESG, body);
+ return mu_scm_body_create (mesg, body);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_multipart_p, "mu-message-multipart?", 1, 0, 0,
- (SCM MESG),
- "Returns @code{#t} if MESG is a multipart @acronym{MIME} message.")
+ (SCM mesg),
+"Returns @code{#t} if @var{mesg} is a multipart @acronym{MIME} message.")
#define FUNC_NAME s_scm_mu_message_multipart_p
{
mu_message_t msg;
int ismime = 0;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
mu_message_is_multipart (msg, &ismime);
return ismime ? SCM_BOOL_T : SCM_BOOL_F;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, 0, 0,
- (SCM MESG),
-"Returns number of parts in a multipart @acronym{MIME} message. Returns\n"
-"@code{#f} if the argument is not a multipart message.")
+ (SCM mesg),
+"Returns number of parts in a multipart @acronym{MIME} message @var{mesg}.\n"
+"Returns @code{#f} if the argument is not a multipart message.")
#define FUNC_NAME s_scm_mu_message_get_num_parts
{
mu_message_t msg;
@@ -992,8 +988,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1,
size_t nparts = 0;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
mu_message_is_multipart (msg, &ismime);
if (!ismime)
return SCM_BOOL_F;
@@ -1002,58 +998,59 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1,
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get number of parts in the message ~A",
- scm_list_1 (MESG));
+ scm_list_1 (mesg));
return scm_from_size_t (nparts);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_part, "mu-message-get-part", 2, 0, 0,
- (SCM MESG, SCM PART),
-"Returns part #PART from a multipart @acronym{MIME} message MESG.")
+ (SCM mesg, SCM part),
+"Returns part #@var{part} of a multipart @acronym{MIME} message @var{mesg}.")
#define FUNC_NAME s_scm_mu_message_get_part
{
mu_message_t msg, submsg;
int ismime = 0;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (scm_is_integer (PART), PART, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_integer (part), part, SCM_ARG2, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ msg = mu_scm_message_get (mesg);
mu_message_is_multipart (msg, &ismime);
if (!ismime)
return SCM_BOOL_F;
- status = mu_message_get_part (msg, scm_to_int32 (PART), &submsg);
+ status = mu_message_get_part (msg, scm_to_size_t (part), &submsg);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get number of part ~A from the message ~A",
- scm_list_2 (PART, MESG));
+ scm_list_2 (part, mesg));
- return mu_scm_message_create (MESG, submsg);
+ return mu_scm_message_create (mesg, submsg);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_send, "mu-message-send", 1, 3, 0,
- (SCM MESG, SCM MAILER, SCM FROM, SCM TO),
-"Sends the message MESG. Optional MAILER overrides default mailer settings\n"
-"in mu-mailer. Optional FROM and TO give sender and recever addresses.\n")
+ (SCM mesg, SCM mailer, SCM from, SCM to),
+"Sends message @var{mesg}. Optional @var{mailer} overrides default mailer\n"
+"settings. Optional @var{from} and @var{to} give sender and recever\n"
+"addresses, respectively.\n")
#define FUNC_NAME s_scm_mu_message_send
{
char *mailer_name;
- mu_address_t from = NULL;
- mu_address_t to = NULL;
- mu_mailer_t mailer = NULL;
+ mu_address_t from_addr = NULL;
+ mu_address_t to_addr = NULL;
+ mu_mailer_t mailer_c = NULL;
mu_message_t msg;
int status;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
- if (!SCM_UNBNDP (MAILER) && MAILER != SCM_BOOL_F)
+ if (!SCM_UNBNDP (mailer) && mailer != SCM_BOOL_F)
{
- SCM_ASSERT (scm_is_string (MAILER), MAILER, SCM_ARG2, FUNC_NAME);
- mailer_name = scm_to_locale_string (MAILER);
+ SCM_ASSERT (scm_is_string (mailer), mailer, SCM_ARG2, FUNC_NAME);
+ mailer_name = scm_to_locale_string (mailer);
}
else
{
@@ -1061,74 +1058,74 @@ SCM_DEFINE_PUBLIC (scm_mu_message_send, "mu-message-send", 1, 3, 0,
mailer_name = scm_to_locale_string (val);
}
- if (!SCM_UNBNDP (FROM) && FROM != SCM_BOOL_F)
+ if (!SCM_UNBNDP (from) && from != SCM_BOOL_F)
{
char *s;
int rc;
- SCM_ASSERT (scm_is_string (FROM), FROM, SCM_ARG3, FUNC_NAME);
- s = scm_to_locale_string (FROM);
- rc = mu_address_create (&from, s);
+ SCM_ASSERT (scm_is_string (from), from, SCM_ARG3, FUNC_NAME);
+ s = scm_to_locale_string (from);
+ rc = mu_address_create (&from_addr, s);
free (s);
if (rc)
mu_scm_error (FUNC_NAME, rc, "cannot create address",
- scm_list_1 (FROM));
+ scm_list_1 (from));
}
- if (!SCM_UNBNDP (TO) && TO != SCM_BOOL_F)
+ if (!SCM_UNBNDP (to) && to != SCM_BOOL_F)
{
char *s;
int rc;
- SCM_ASSERT (scm_is_string (TO), TO, SCM_ARG4, FUNC_NAME);
- s = scm_to_locale_string (TO);
- rc = mu_address_create (&to, s);
+ SCM_ASSERT (scm_is_string (to), to, SCM_ARG4, FUNC_NAME);
+ s = scm_to_locale_string (to);
+ rc = mu_address_create (&to_addr, s);
free (s);
if (rc)
mu_scm_error (FUNC_NAME, rc, "cannot create address",
- scm_list_1 (TO));
+ scm_list_1 (to));
}
- status = mu_mailer_create (&mailer, mailer_name);
+ status = mu_mailer_create (&mailer_c, mailer_name);
free (mailer_name);
if (status)
mu_scm_error (FUNC_NAME, status, "Cannot get create mailer", SCM_BOOL_F);
- if (scm_to_int32 (MU_SCM_SYMBOL_VALUE ("mu-debug")))
+ if (scm_to_int (MU_SCM_SYMBOL_VALUE ("mu-debug")))
{
mu_debug_t debug = NULL;
- mu_mailer_get_debug (mailer, &debug);
+ mu_mailer_get_debug (mailer_c, &debug);
mu_debug_set_level (debug, MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
}
- status = mu_mailer_open (mailer, MU_STREAM_RDWR);
+ status = mu_mailer_open (mailer_c, MU_STREAM_RDWR);
if (status == 0)
{
- status = mu_mailer_send_message (mailer, msg, from, to);
+ status = mu_mailer_send_message (mailer_c, msg, from_addr, to_addr);
if (status)
mu_scm_error (FUNC_NAME, status, "Cannot send message", SCM_BOOL_F);
- mu_mailer_close (mailer);
+ mu_mailer_close (mailer_c);
}
else
mu_scm_error (FUNC_NAME, status, "Cannot open mailer", SCM_BOOL_F);
- mu_mailer_destroy (&mailer);
+ mu_mailer_destroy (&mailer_c);
return status == 0 ? SCM_BOOL_T : SCM_BOOL_F;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_message_get_uid, "mu-message-get-uid", 1, 0, 0,
- (SCM MESG),
- "Returns uid of the message MESG\n")
+ (SCM mesg),
+ "Returns UID of the message @var{mesg}\n")
#define FUNC_NAME s_scm_mu_message_get_uid
{
mu_message_t msg;
int status;
size_t uid;
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
status = mu_message_get_uid (msg, &uid);
if (status)
mu_scm_error (FUNC_NAME, status, "Cannot get message uid", SCM_BOOL_F);
diff --git a/libmu_scm/mu_mime.c b/libmu_scm/mu_mime.c
index c8f512b33..2c90037e3 100644
--- a/libmu_scm/mu_mime.c
+++ b/libmu_scm/mu_mime.c
@@ -90,65 +90,66 @@ mu_scm_is_mime (SCM scm)
/* Guile primitives */
SCM_DEFINE_PUBLIC (scm_mu_mime_create, "mu-mime-create", 0, 2, 0,
- (SCM FLAGS, SCM MESG),
+ (SCM flags, SCM mesg),
"Creates a new @acronym{MIME} object. Both arguments are optional.\n"
-"FLAGS specifies the type of the object to create (@samp{0} is a reasonable\n"
-"value). MESG gives the message to create the @acronym{MIME} object from.")
+"@var{Flags} specifies the type of the object to create (@samp{0} is a\n"
+"reasonable value). @var{mesg} gives the message to create the\n"
+"@acronym{MIME} object from.")
#define FUNC_NAME s_scm_mu_mime_create
{
mu_message_t msg = NULL;
mu_mime_t mime;
- int flags;
+ int fl;
int status;
- if (scm_is_bool (FLAGS))
+ if (scm_is_bool (flags))
{
- /*if (FLAGS == SCM_BOOL_F)*/
- flags = 0;
+ /*if (flags == SCM_BOOL_F)*/
+ fl = 0;
}
else
{
- SCM_ASSERT (scm_is_integer (FLAGS), FLAGS, SCM_ARG1, FUNC_NAME);
- flags = scm_to_int32 (FLAGS);
+ SCM_ASSERT (scm_is_integer (flags), flags, SCM_ARG1, FUNC_NAME);
+ fl = scm_to_int (flags);
}
- if (!SCM_UNBNDP (MESG))
+ if (!SCM_UNBNDP (mesg))
{
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME);
+ msg = mu_scm_message_get (mesg);
}
- status = mu_mime_create (&mime, msg, flags);
+ status = mu_mime_create (&mime, msg, fl);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot create MIME object", SCM_BOOL_F);
- return mu_scm_mime_create (MESG, mime);
+ return mu_scm_mime_create (mesg, mime);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mime_multipart_p, "mu-mime-multipart?", 1, 0, 0,
- (SCM MIME),
-"Returns @code{#t} if MIME is a multipart object.\n")
+ (SCM mime),
+"Returns @code{#t} if @var{mime} is a multipart object.\n")
#define FUNC_NAME s_scm_mu_mime_multipart_p
{
- SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME);
- return mu_mime_is_multipart (mu_scm_mime_get (MIME)) ? SCM_BOOL_T : SCM_BOOL_F;
+ SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
+ return mu_mime_is_multipart (mu_scm_mime_get (mime)) ? SCM_BOOL_T : SCM_BOOL_F;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0,
- (SCM MIME),
-"Returns number of parts in the @sc{mime} object MIME.")
+ (SCM mime),
+"Returns number of parts in the @acronym{MIME} object @var{mime}.")
#define FUNC_NAME s_scm_mu_mime_get_num_parts
{
- mu_mime_t mime;
+ mu_mime_t mimeobj;
size_t nparts;
int status;
- SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME);
- mime = mu_scm_mime_get (MIME);
- status = mu_mime_get_num_parts (mime, &nparts);
+ SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
+ mimeobj = mu_scm_mime_get (mime);
+ status = mu_mime_get_num_parts (mimeobj, &nparts);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot count MIME parts", SCM_BOOL_F);
@@ -157,71 +158,71 @@ SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mime_get_part, "mu-mime-get-part", 2, 0, 0,
- (SCM MIME, SCM NUM),
- "Returns NUMth part from the @sc{mime} object MIME.")
+ (SCM mime, SCM num),
+"Returns @var{num}th part from the @acronym{MIME} object @var{mime}.")
#define FUNC_NAME s_scm_mu_mime_get_part
{
mu_message_t msg = NULL;
int status;
- SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (scm_is_integer (NUM), NUM, SCM_ARG2, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (scm_is_integer (num), num, SCM_ARG2, FUNC_NAME);
- status = mu_mime_get_part (mu_scm_mime_get (MIME),
- scm_to_int32 (NUM), &msg);
+ status = mu_mime_get_part (mu_scm_mime_get (mime),
+ scm_to_int (num), &msg);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get part ~A from MIME object ~A",
- scm_list_2 (NUM, MIME));
+ scm_list_2 (num, mime));
- return mu_scm_message_create (MIME, msg);
+ return mu_scm_message_create (mime, msg);
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mime_add_part, "mu-mime-add-part", 2, 0, 0,
- (SCM MIME, SCM MESG),
- "Adds MESG to the @sc{mime} object MIME.")
+ (SCM mime, SCM mesg),
+"Adds message @var{mesg} to the @acronym{MIME} object @var{mime}.")
#define FUNC_NAME s_scm_mu_mime_add_part
{
- mu_mime_t mime;
+ mu_mime_t mimeobj;
mu_message_t msg;
int status;
- SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME);
- mime = mu_scm_mime_get (MIME);
- msg = mu_scm_message_get (MESG);
+ SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
+ SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME);
+ mimeobj = mu_scm_mime_get (mime);
+ msg = mu_scm_message_get (mesg);
- status = mu_mime_add_part (mime, msg);
+ status = mu_mime_add_part (mimeobj, msg);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot add new part to MIME object ~A",
- scm_list_1 (MIME));
+ scm_list_1 (mime));
- mu_scm_message_add_owner (MESG, MIME);
+ mu_scm_message_add_owner (mesg, mime);
return SCM_BOOL_T;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mime_get_message, "mu-mime-get-message", 1, 0, 0,
- (SCM MIME),
- "Converts @sc{mime} object MIME to a message.\n")
+ (SCM mime),
+"Converts @acronym{MIME} object @var{mime} to a message.\n")
#define FUNC_NAME s_scm_mu_mime_get_message
{
- mu_mime_t mime;
+ mu_mime_t mimeobj;
mu_message_t msg;
int status;
- SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME);
- mime = mu_scm_mime_get (MIME);
- status = mu_mime_get_message (mime, &msg);
+ SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
+ mimeobj = mu_scm_mime_get (mime);
+ status = mu_mime_get_message (mimeobj, &msg);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get message from MIME object ~A",
- scm_list_1 (MIME));
+ scm_list_1 (mime));
- return mu_scm_message_create (MIME, msg);
+ return mu_scm_message_create (mime, msg);
}
#undef FUNC_NAME
diff --git a/libmu_scm/mu_scm.c b/libmu_scm/mu_scm.c
index ddfa8d95a..f5d3f4c4e 100644
--- a/libmu_scm/mu_scm.c
+++ b/libmu_scm/mu_scm.c
@@ -89,7 +89,7 @@ register_format (const char *name)
SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
- (SCM REST),
+ (SCM rest),
"Registers desired mailutils formats. Any number of arguments can be given.\n"
"Each argument must be one of the following strings:\n\n"
"@multitable @columnfractions 0.3 0.6\n"
@@ -108,7 +108,7 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
{
int status;
- if (scm_is_null (REST))
+ if (scm_is_null (rest))
{
status = register_format (NULL);
if (status)
@@ -118,10 +118,10 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
}
else
{
- for (; !scm_is_null (REST); REST = SCM_CDR (REST))
+ for (; !scm_is_null (rest); rest = SCM_CDR (rest))
{
char *s;
- SCM scm = SCM_CAR (REST);
+ SCM scm = SCM_CAR (rest);
SCM_ASSERT (scm_is_string (scm), scm, SCM_ARGn, FUNC_NAME);
s = scm_to_locale_string (scm);
status = register_format (s);
@@ -137,13 +137,13 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_strerror, "mu-strerror", 1, 0, 0,
- (SCM ERR),
-"Return the error message corresponding to ERR, which must be\n"
+ (SCM err),
+"Return the error message corresponding to @var{err}, which must be\n"
"an integer value.\n")
#define FUNC_NAME s_scm_mu_strerror
{
- SCM_ASSERT (scm_is_integer (ERR), ERR, SCM_ARG1, FUNC_NAME);
- return scm_from_locale_string (mu_strerror (scm_to_int (ERR)));
+ SCM_ASSERT (scm_is_integer (err), err, SCM_ARG1, FUNC_NAME);
+ return scm_from_locale_string (mu_strerror (scm_to_int (err)));
}
#undef FUNC_NAME
diff --git a/libmu_scm/mu_util.c b/libmu_scm/mu_util.c
index bdf3aca78..8f3b2323a 100644
--- a/libmu_scm/mu_util.c
+++ b/libmu_scm/mu_util.c
@@ -20,8 +20,8 @@
#include "mu_scm.h"
SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0,
- (SCM USER),
-"Look up an entry in the user database. USER can be an integer,\n"
+ (SCM user),
+"Look up an entry in the user database. @var{User} can be an integer,\n"
"or a string, giving the behaviour of @code{mu_get_auth_by_uid} or\n"
"@code{mu_get_auth_by_name} respectively.\n"
"\n"
@@ -39,16 +39,16 @@ SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0,
&handle,
NULL, NULL);
- if (scm_is_integer (USER))
+ if (scm_is_integer (user))
{
- entry = mu_get_auth_by_uid (scm_to_int32 (USER));
+ entry = mu_get_auth_by_uid (scm_to_int (user));
}
else
{
char *s;
- SCM_VALIDATE_STRING (1, USER);
- s = scm_to_locale_string (USER);
+ SCM_VALIDATE_STRING (1, user);
+ s = scm_to_locale_string (user);
entry = mu_get_auth_by_name (s);
free (s);
}

Return to:

Send suggestions and report system problems to the System administrator.