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.
Showing
10 changed files
with
441 additions
and
445 deletions
gint @ 4254b059
... | @@ -98,4 +98,5 @@ install-data-hook: | ... | @@ -98,4 +98,5 @@ install-data-hook: |
98 | sitedir = @GUILE_SITE@/$(PACKAGE) | 98 | sitedir = @GUILE_SITE@/$(PACKAGE) |
99 | site_DATA = mailutils.scm | 99 | site_DATA = mailutils.scm |
100 | SUFFIXES= | 100 | SUFFIXES= |
101 | BUILT_SOURCES= | ||
101 | include ../gint/gint.mk | 102 | include ../gint/gint.mk | ... | ... |
... | @@ -19,30 +19,29 @@ | ... | @@ -19,30 +19,29 @@ |
19 | 19 | ||
20 | #include "mu_scm.h" | 20 | #include "mu_scm.h" |
21 | 21 | ||
22 | typedef int (*address_get_fp) (mu_address_t, size_t, char *, size_t, size_t *); | 22 | typedef int (*address_get_fp) (mu_address_t, size_t, char **); |
23 | 23 | ||
24 | static SCM | 24 | static SCM |
25 | _get_address_part (const char *func_name, address_get_fp fun, | 25 | _get_address_part (const char *func_name, address_get_fp fun, |
26 | SCM ADDRESS, SCM NUM) | 26 | SCM address, SCM num) |
27 | { | 27 | { |
28 | mu_address_t addr; | 28 | mu_address_t addr; |
29 | int length; | ||
30 | char *str; | 29 | char *str; |
31 | SCM ret; | 30 | SCM ret; |
32 | int num; | 31 | int n; |
33 | int status; | 32 | int status; |
34 | 33 | ||
35 | SCM_ASSERT (scm_is_string (ADDRESS), ADDRESS, SCM_ARG1, func_name); | 34 | SCM_ASSERT (scm_is_string (address), address, SCM_ARG1, func_name); |
36 | 35 | ||
37 | if (!SCM_UNBNDP (NUM)) | 36 | if (!SCM_UNBNDP (num)) |
38 | { | 37 | { |
39 | SCM_ASSERT (scm_is_integer (NUM), NUM, SCM_ARG1, func_name); | 38 | SCM_ASSERT (scm_is_integer (num), num, SCM_ARG1, func_name); |
40 | num = scm_to_int (NUM); | 39 | n = scm_to_int (num); |
41 | } | 40 | } |
42 | else | 41 | else |
43 | num = 1; | 42 | n = 1; |
44 | 43 | ||
45 | str = scm_to_locale_string (ADDRESS); | 44 | str = scm_to_locale_string (address); |
46 | if (!str[0]) | 45 | if (!str[0]) |
47 | { | 46 | { |
48 | free (str); | 47 | free (str); |
... | @@ -54,15 +53,7 @@ _get_address_part (const char *func_name, address_get_fp fun, | ... | @@ -54,15 +53,7 @@ _get_address_part (const char *func_name, address_get_fp fun, |
54 | if (status) | 53 | if (status) |
55 | mu_scm_error (func_name, status, "Cannot create address", SCM_BOOL_F); | 54 | mu_scm_error (func_name, status, "Cannot create address", SCM_BOOL_F); |
56 | 55 | ||
57 | str = malloc (length + 1); | 56 | status = (*fun) (addr, n, &str); |
58 | if (!str) | ||
59 | { | ||
60 | mu_address_destroy (&addr); | ||
61 | mu_scm_error (func_name, ENOMEM, | ||
62 | "Cannot allocate memory", SCM_BOOL_F); | ||
63 | } | ||
64 | |||
65 | status = (*fun) (addr, num, str, length + 1, NULL); | ||
66 | mu_address_destroy (&addr); | 57 | mu_address_destroy (&addr); |
67 | 58 | ||
68 | if (status == 0) | 59 | if (status == 0) |
... | @@ -79,58 +70,58 @@ _get_address_part (const char *func_name, address_get_fp fun, | ... | @@ -79,58 +70,58 @@ _get_address_part (const char *func_name, address_get_fp fun, |
79 | } | 70 | } |
80 | 71 | ||
81 | SCM_DEFINE_PUBLIC (scm_mu_address_get_personal, "mu-address-get-personal", 1, 1, 0, | 72 | SCM_DEFINE_PUBLIC (scm_mu_address_get_personal, "mu-address-get-personal", 1, 1, 0, |
82 | (SCM ADDRESS, SCM NUM), | 73 | (SCM address, SCM num), |
83 | "Return personal part of the NUMth email address from ADDRESS.\n") | 74 | "Return personal part of the @var{num}th email address from @var{address}.\n") |
84 | #define FUNC_NAME s_scm_mu_address_get_personal | 75 | #define FUNC_NAME s_scm_mu_address_get_personal |
85 | { | 76 | { |
86 | return _get_address_part (FUNC_NAME, | 77 | return _get_address_part (FUNC_NAME, |
87 | mu_address_get_personal, ADDRESS, NUM); | 78 | mu_address_aget_personal, address, num); |
88 | } | 79 | } |
89 | #undef FUNC_NAME | 80 | #undef FUNC_NAME |
90 | 81 | ||
91 | SCM_DEFINE_PUBLIC (scm_mu_address_get_comments, "mu-address-get-comments", 1, 1, 0, | 82 | SCM_DEFINE_PUBLIC (scm_mu_address_get_comments, "mu-address-get-comments", 1, 1, 0, |
92 | (SCM ADDRESS, SCM NUM), | 83 | (SCM address, SCM num), |
93 | "Return comment part of the NUMth email address from ADDRESS.\n") | 84 | "Return comment part of the @var{num}th email address from @var{address}.\n") |
94 | #define FUNC_NAME s_scm_mu_address_get_comments | 85 | #define FUNC_NAME s_scm_mu_address_get_comments |
95 | { | 86 | { |
96 | return _get_address_part (FUNC_NAME, | 87 | return _get_address_part (FUNC_NAME, |
97 | mu_address_get_comments, ADDRESS, NUM); | 88 | mu_address_aget_comments, address, num); |
98 | } | 89 | } |
99 | #undef FUNC_NAME | 90 | #undef FUNC_NAME |
100 | 91 | ||
101 | SCM_DEFINE_PUBLIC (scm_mu_address_get_email, "mu-address-get-email", 1, 1, 0, | 92 | SCM_DEFINE_PUBLIC (scm_mu_address_get_email, "mu-address-get-email", 1, 1, 0, |
102 | (SCM ADDRESS, SCM NUM), | 93 | (SCM address, SCM num), |
103 | "Return email part of the NUMth email address from ADDRESS.\n") | 94 | "Return email part of the @var{num}th email address from @var{address}.\n") |
104 | #define FUNC_NAME s_scm_mu_address_get_email | 95 | #define FUNC_NAME s_scm_mu_address_get_email |
105 | { | 96 | { |
106 | return _get_address_part (FUNC_NAME, | 97 | return _get_address_part (FUNC_NAME, |
107 | mu_address_get_email, ADDRESS, NUM); | 98 | mu_address_aget_email, address, num); |
108 | } | 99 | } |
109 | #undef FUNC_NAME | 100 | #undef FUNC_NAME |
110 | 101 | ||
111 | SCM_DEFINE_PUBLIC (scm_mu_address_get_domain, "mu-address-get-domain", 1, 1, 0, | 102 | SCM_DEFINE_PUBLIC (scm_mu_address_get_domain, "mu-address-get-domain", 1, 1, 0, |
112 | (SCM ADDRESS, SCM NUM), | 103 | (SCM address, SCM num), |
113 | "Return domain part of the NUMth email address from ADDRESS.\n") | 104 | "Return domain part of the @var{num}th email address from @var{address}.\n") |
114 | #define FUNC_NAME s_scm_mu_address_get_domain | 105 | #define FUNC_NAME s_scm_mu_address_get_domain |
115 | { | 106 | { |
116 | return _get_address_part (FUNC_NAME, | 107 | return _get_address_part (FUNC_NAME, |
117 | mu_address_get_domain, ADDRESS, NUM); | 108 | mu_address_aget_domain, address, num); |
118 | } | 109 | } |
119 | #undef FUNC_NAME | 110 | #undef FUNC_NAME |
120 | 111 | ||
121 | SCM_DEFINE_PUBLIC (scm_mu_address_get_local, "mu-address-get-local", 1, 1, 0, | 112 | SCM_DEFINE_PUBLIC (scm_mu_address_get_local, "mu-address-get-local", 1, 1, 0, |
122 | (SCM ADDRESS, SCM NUM), | 113 | (SCM address, SCM num), |
123 | "Return local part of the NUMth email address from ADDRESS.\n") | 114 | "Return local part of the @var{num}th email address from @var{address}.\n") |
124 | #define FUNC_NAME s_scm_mu_address_get_local | 115 | #define FUNC_NAME s_scm_mu_address_get_local |
125 | { | 116 | { |
126 | return _get_address_part (FUNC_NAME, | 117 | return _get_address_part (FUNC_NAME, |
127 | mu_address_get_local_part, ADDRESS, NUM); | 118 | mu_address_aget_local_part, address, num); |
128 | } | 119 | } |
129 | #undef FUNC_NAME | 120 | #undef FUNC_NAME |
130 | 121 | ||
131 | SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, | 122 | SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, |
132 | (SCM ADDRESS), | 123 | (SCM address), |
133 | "Return number of parts in email address ADDRESS.\n") | 124 | "Return number of parts in email address @var{address}.\n") |
134 | #define FUNC_NAME s_scm_mu_address_get_count | 125 | #define FUNC_NAME s_scm_mu_address_get_count |
135 | { | 126 | { |
136 | mu_address_t addr; | 127 | mu_address_t addr; |
... | @@ -138,15 +129,15 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, | ... | @@ -138,15 +129,15 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, |
138 | int status; | 129 | int status; |
139 | char *str; | 130 | char *str; |
140 | 131 | ||
141 | SCM_ASSERT (scm_is_string (ADDRESS), ADDRESS, SCM_ARG1, FUNC_NAME); | 132 | SCM_ASSERT (scm_is_string (address), address, SCM_ARG1, FUNC_NAME); |
142 | 133 | ||
143 | str = scm_to_locale_string (ADDRESS); | 134 | str = scm_to_locale_string (address); |
144 | status = mu_address_create (&addr, str); | 135 | status = mu_address_create (&addr, str); |
145 | free (str); | 136 | free (str); |
146 | if (status) | 137 | if (status) |
147 | mu_scm_error (FUNC_NAME, status, | 138 | mu_scm_error (FUNC_NAME, status, |
148 | "Cannot create address for ~A", | 139 | "Cannot create address for ~A", |
149 | scm_list_1 (ADDRESS)); | 140 | scm_list_1 (address)); |
150 | 141 | ||
151 | mu_address_get_count (addr, &count); | 142 | mu_address_get_count (addr, &count); |
152 | mu_address_destroy (&addr); | 143 | mu_address_destroy (&addr); |
... | @@ -155,29 +146,29 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, | ... | @@ -155,29 +146,29 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, |
155 | #undef FUNC_NAME | 146 | #undef FUNC_NAME |
156 | 147 | ||
157 | SCM_DEFINE_PUBLIC (scm_mu_username_to_email, "mu-username->email", 0, 1, 0, | 148 | SCM_DEFINE_PUBLIC (scm_mu_username_to_email, "mu-username->email", 0, 1, 0, |
158 | (SCM NAME), | 149 | (SCM name), |
159 | "Deduce user's email address from his username. If NAME is omitted, \n" | 150 | "Deduce user's email address from his username. If @var{name} is omitted, \n" |
160 | "current username is assumed\n") | 151 | "current username is assumed\n") |
161 | #define FUNC_NAME s_scm_mu_username_to_email | 152 | #define FUNC_NAME s_scm_mu_username_to_email |
162 | { | 153 | { |
163 | char *name; | 154 | char *username; |
164 | char *email; | 155 | char *email; |
165 | SCM ret; | 156 | SCM ret; |
166 | 157 | ||
167 | if (SCM_UNBNDP (NAME)) | 158 | if (SCM_UNBNDP (name)) |
168 | name = NULL; | 159 | username = NULL; |
169 | else | 160 | else |
170 | { | 161 | { |
171 | SCM_ASSERT (scm_is_string (NAME), NAME, SCM_ARG1, FUNC_NAME); | 162 | SCM_ASSERT (scm_is_string (name), name, SCM_ARG1, FUNC_NAME); |
172 | name = scm_to_locale_string (NAME); | 163 | username = scm_to_locale_string (name); |
173 | } | 164 | } |
174 | 165 | ||
175 | email = mu_get_user_email (name); | 166 | email = mu_get_user_email (username); |
176 | free (name); | 167 | free (username); |
177 | if (!email) | 168 | if (!email) |
178 | mu_scm_error (FUNC_NAME, 0, | 169 | mu_scm_error (FUNC_NAME, 0, |
179 | "Cannot get user email for ~A", | 170 | "Cannot get user email for ~A", |
180 | scm_list_1 (NAME)); | 171 | scm_list_1 (name)); |
181 | 172 | ||
182 | ret = scm_from_locale_string (email); | 173 | ret = scm_from_locale_string (email); |
183 | free (email); | 174 | free (email); | ... | ... |
... | @@ -103,16 +103,16 @@ mu_scm_body_create (SCM msg, mu_body_t body) | ... | @@ -103,16 +103,16 @@ mu_scm_body_create (SCM msg, mu_body_t body) |
103 | /* Guile primitives */ | 103 | /* Guile primitives */ |
104 | 104 | ||
105 | SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, | 105 | SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, |
106 | (SCM BODY), | 106 | (SCM body), |
107 | "Read next line from the BODY.") | 107 | "Read next line from the @var{body}.") |
108 | #define FUNC_NAME s_scm_mu_body_read_line | 108 | #define FUNC_NAME s_scm_mu_body_read_line |
109 | { | 109 | { |
110 | struct mu_body *mbp; | 110 | struct mu_body *mbp; |
111 | size_t n, nread; | 111 | size_t n, nread; |
112 | int status; | 112 | int status; |
113 | 113 | ||
114 | SCM_ASSERT (mu_scm_is_body (BODY), BODY, SCM_ARG1, FUNC_NAME); | 114 | SCM_ASSERT (mu_scm_is_body (body), body, SCM_ARG1, FUNC_NAME); |
115 | mbp = (struct mu_body *) SCM_CDR (BODY); | 115 | mbp = (struct mu_body *) SCM_CDR (body); |
116 | 116 | ||
117 | if (!mbp->stream) | 117 | if (!mbp->stream) |
118 | { | 118 | { |
... | @@ -164,8 +164,8 @@ SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, | ... | @@ -164,8 +164,8 @@ SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, |
164 | #undef FUNC_NAME | 164 | #undef FUNC_NAME |
165 | 165 | ||
166 | SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, | 166 | SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, |
167 | (SCM BODY, SCM TEXT), | 167 | (SCM body, SCM text), |
168 | "Append TEXT to message BODY.") | 168 | "Append @var{text} to message @var{body}.") |
169 | #define FUNC_NAME s_scm_mu_body_write | 169 | #define FUNC_NAME s_scm_mu_body_write |
170 | { | 170 | { |
171 | char *ptr; | 171 | char *ptr; |
... | @@ -173,9 +173,9 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, | ... | @@ -173,9 +173,9 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, |
173 | struct mu_body *mbp; | 173 | struct mu_body *mbp; |
174 | int status; | 174 | int status; |
175 | 175 | ||
176 | SCM_ASSERT (mu_scm_is_body (BODY), BODY, SCM_ARG1, FUNC_NAME); | 176 | SCM_ASSERT (mu_scm_is_body (body), body, SCM_ARG1, FUNC_NAME); |
177 | mbp = (struct mu_body *) SCM_CDR (BODY); | 177 | mbp = (struct mu_body *) SCM_CDR (body); |
178 | SCM_ASSERT (scm_is_string (TEXT), TEXT, SCM_ARG2, FUNC_NAME); | 178 | SCM_ASSERT (scm_is_string (text), text, SCM_ARG2, FUNC_NAME); |
179 | 179 | ||
180 | if (!mbp->stream) | 180 | if (!mbp->stream) |
181 | { | 181 | { |
... | @@ -185,9 +185,10 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, | ... | @@ -185,9 +185,10 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, |
185 | "Cannot get body stream", SCM_BOOL_F); | 185 | "Cannot get body stream", SCM_BOOL_F); |
186 | } | 186 | } |
187 | 187 | ||
188 | ptr = SCM_STRING_CHARS (TEXT); | 188 | ptr = scm_to_locale_string (text); |
189 | len = strlen (ptr); | 189 | len = strlen (ptr); |
190 | status = mu_stream_write (mbp->stream, ptr, len, mbp->offset, &n); | 190 | status = mu_stream_write (mbp->stream, ptr, len, mbp->offset, &n); |
191 | free (ptr); | ||
191 | mu_scm_error (FUNC_NAME, status, | 192 | mu_scm_error (FUNC_NAME, status, |
192 | "Error writing to stream", SCM_BOOL_F); | 193 | "Error writing to stream", SCM_BOOL_F); |
193 | mbp->offset += n; | 194 | mbp->offset += n; | ... | ... |
... | @@ -24,37 +24,37 @@ | ... | @@ -24,37 +24,37 @@ |
24 | static char *log_tag; | 24 | static char *log_tag; |
25 | 25 | ||
26 | SCM_DEFINE_PUBLIC (scm_mu_openlog, "mu-openlog", 3, 0, 0, | 26 | SCM_DEFINE_PUBLIC (scm_mu_openlog, "mu-openlog", 3, 0, 0, |
27 | (SCM IDENT, SCM OPTION, SCM FACILITY), | 27 | (SCM ident, SCM option, SCM facility), |
28 | "Opens a connection to the system logger for Guile program.\n" | 28 | "Opens a connection to the system logger for Guile program.\n" |
29 | "IDENT, OPTION and FACILITY have the same meaning as in openlog(3)") | 29 | "@var{ident}, @var{option} and @var{facility} have the same meaning as in openlog(3)") |
30 | #define FUNC_NAME s_scm_mu_openlog | 30 | #define FUNC_NAME s_scm_mu_openlog |
31 | { | 31 | { |
32 | SCM_ASSERT (scm_is_string (IDENT), IDENT, SCM_ARG1, FUNC_NAME); | 32 | SCM_ASSERT (scm_is_string (ident), ident, SCM_ARG1, FUNC_NAME); |
33 | if (log_tag) | 33 | if (log_tag) |
34 | free (log_tag); | 34 | free (log_tag); |
35 | log_tag = scm_to_locale_string(IDENT); | 35 | log_tag = scm_to_locale_string (ident); |
36 | 36 | ||
37 | SCM_ASSERT (scm_is_integer (OPTION), OPTION, SCM_ARG2, FUNC_NAME); | 37 | SCM_ASSERT (scm_is_integer (option), option, SCM_ARG2, FUNC_NAME); |
38 | SCM_ASSERT (scm_is_integer (FACILITY), FACILITY, SCM_ARG3, FUNC_NAME); | 38 | SCM_ASSERT (scm_is_integer (facility), facility, SCM_ARG3, FUNC_NAME); |
39 | openlog (log_tag, scm_to_int (OPTION), scm_to_int (FACILITY)); | 39 | openlog (log_tag, scm_to_int (option), scm_to_int (facility)); |
40 | return SCM_UNSPECIFIED; | 40 | return SCM_UNSPECIFIED; |
41 | } | 41 | } |
42 | #undef FUNC_NAME | 42 | #undef FUNC_NAME |
43 | 43 | ||
44 | SCM_DEFINE_PUBLIC (scm_mu_logger, "mu-logger", 2, 0, 0, | 44 | SCM_DEFINE_PUBLIC (scm_mu_logger, "mu-logger", 2, 0, 0, |
45 | (SCM PRIO, SCM TEXT), | 45 | (SCM prio, SCM text), |
46 | "Distributes TEXT via syslogd priority PRIO.") | 46 | "Distributes @var{text} via the syslog priority @var{prio}.") |
47 | #define FUNC_NAME s_scm_mu_logger | 47 | #define FUNC_NAME s_scm_mu_logger |
48 | { | 48 | { |
49 | int prio; | 49 | int nprio; |
50 | char *str; | 50 | char *str; |
51 | 51 | ||
52 | SCM_ASSERT (scm_is_integer (PRIO), PRIO, SCM_ARG1, FUNC_NAME); | 52 | SCM_ASSERT (scm_is_integer (prio), prio, SCM_ARG1, FUNC_NAME); |
53 | prio = scm_to_int (PRIO); | 53 | nprio = scm_to_int (prio); |
54 | 54 | ||
55 | SCM_ASSERT (scm_is_string (TEXT), TEXT, SCM_ARG2, FUNC_NAME); | 55 | SCM_ASSERT (scm_is_string (text), text, SCM_ARG2, FUNC_NAME); |
56 | str = scm_to_locale_string (TEXT); | 56 | str = scm_to_locale_string (text); |
57 | syslog (prio, "%s", str); | 57 | syslog (nprio, "%s", str); |
58 | free (str); | 58 | free (str); |
59 | return SCM_UNSPECIFIED; | 59 | return SCM_UNSPECIFIED; |
60 | } | 60 | } | ... | ... |
... | @@ -138,34 +138,34 @@ mu_scm_is_mailbox (SCM scm) | ... | @@ -138,34 +138,34 @@ mu_scm_is_mailbox (SCM scm) |
138 | /* Guile primitives */ | 138 | /* Guile primitives */ |
139 | 139 | ||
140 | SCM_DEFINE_PUBLIC (scm_mu_mail_directory, "mu-mail-directory", 0, 1, 0, | 140 | SCM_DEFINE_PUBLIC (scm_mu_mail_directory, "mu-mail-directory", 0, 1, 0, |
141 | (SCM URL), | 141 | (SCM url), |
142 | "Do not use this function. Use mu-user-mailbox-url instead.") | 142 | "Do not use this function. Use mu-user-mailbox-url instead.") |
143 | #define FUNC_NAME s_scm_mu_mail_directory | 143 | #define FUNC_NAME s_scm_mu_mail_directory |
144 | { | 144 | { |
145 | mu_scm_error (FUNC_NAME, ENOSYS, | 145 | mu_scm_error (FUNC_NAME, ENOSYS, |
146 | "This function is deprecated. Use mu-user-mailbox-url instead.", | 146 | "This function is deprecated. Use mu-user-mailbox-url instead.", |
147 | scm_list_1 (URL)); | 147 | scm_list_1 (url)); |
148 | return SCM_EOL; | 148 | return SCM_EOL; |
149 | } | 149 | } |
150 | #undef FUNC_NAME | 150 | #undef FUNC_NAME |
151 | 151 | ||
152 | SCM_DEFINE_PUBLIC (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0, | 152 | SCM_DEFINE_PUBLIC (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0, |
153 | (SCM USER), | 153 | (SCM user), |
154 | "") | 154 | "Return URL of the default mailbox for user @var{user}.") |
155 | #define FUNC_NAME s_scm_mu_user_mailbox_url | 155 | #define FUNC_NAME s_scm_mu_user_mailbox_url |
156 | { | 156 | { |
157 | int rc; | 157 | int rc; |
158 | char *p, *str; | 158 | char *p, *str; |
159 | SCM ret; | 159 | SCM ret; |
160 | 160 | ||
161 | SCM_ASSERT (scm_is_string (USER), USER, SCM_ARG1, FUNC_NAME); | 161 | SCM_ASSERT (scm_is_string (user), user, SCM_ARG1, FUNC_NAME); |
162 | str = scm_to_locale_string (USER); | 162 | str = scm_to_locale_string (user); |
163 | rc = mu_construct_user_mailbox_url (&p, str); | 163 | rc = mu_construct_user_mailbox_url (&p, str); |
164 | free (str); | 164 | free (str); |
165 | if (rc) | 165 | if (rc) |
166 | mu_scm_error (FUNC_NAME, rc, | 166 | mu_scm_error (FUNC_NAME, rc, |
167 | "Cannot construct mailbox URL for ~A", | 167 | "Cannot construct mailbox URL for ~A", |
168 | scm_list_1 (USER)); | 168 | scm_list_1 (user)); |
169 | ret = scm_from_locale_string (p); | 169 | ret = scm_from_locale_string (p); |
170 | free (p); | 170 | free (p); |
171 | return ret; | 171 | return ret; |
... | @@ -173,17 +173,17 @@ SCM_DEFINE_PUBLIC (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0, | ... | @@ -173,17 +173,17 @@ SCM_DEFINE_PUBLIC (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0, |
173 | #undef FUNC_NAME | 173 | #undef FUNC_NAME |
174 | 174 | ||
175 | SCM_DEFINE_PUBLIC (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0, | 175 | SCM_DEFINE_PUBLIC (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0, |
176 | (SCM URL), | 176 | (SCM url), |
177 | "If URL is given, sets it as a name of the user's folder directory.\n" | 177 | "If @var{url} is given, sets it as a name of the user's folder directory.\n" |
178 | "Returns the current value of the folder directory.") | 178 | "Returns the current value of the folder directory.") |
179 | #define FUNC_NAME s_scm_mu_folder_directory | 179 | #define FUNC_NAME s_scm_mu_folder_directory |
180 | { | 180 | { |
181 | if (!SCM_UNBNDP (URL)) | 181 | if (!SCM_UNBNDP (url)) |
182 | { | 182 | { |
183 | char *s; | 183 | char *s; |
184 | 184 | ||
185 | SCM_ASSERT (scm_is_string (URL), URL, SCM_ARG1, FUNC_NAME); | 185 | SCM_ASSERT (scm_is_string (url), url, SCM_ARG1, FUNC_NAME); |
186 | s = scm_to_locale_string (URL); | 186 | s = scm_to_locale_string (url); |
187 | mu_set_folder_directory (s); | 187 | mu_set_folder_directory (s); |
188 | free (s); | 188 | free (s); |
189 | } | 189 | } |
... | @@ -192,12 +192,12 @@ SCM_DEFINE_PUBLIC (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0, | ... | @@ -192,12 +192,12 @@ SCM_DEFINE_PUBLIC (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0, |
192 | #undef FUNC_NAME | 192 | #undef FUNC_NAME |
193 | 193 | ||
194 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0, | 194 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0, |
195 | (SCM URL, SCM MODE), | 195 | (SCM url, SCM mode), |
196 | "Opens the mailbox specified by URL. MODE is a string, consisting of\n" | 196 | "Opens the mailbox specified by @var{url}. @var{mode} is a string, consisting of\n" |
197 | "the characters described below, giving the access mode for the mailbox\n" | 197 | "the characters described below, giving the access mode for the mailbox\n" |
198 | "\n" | 198 | "\n" |
199 | "@multitable @columnfractions 0.20 0.70\n" | 199 | "@multitable @columnfractions 0.20 0.70\n" |
200 | "@headitem MODE @tab Meaning\n" | 200 | "@headitem @var{mode} @tab Meaning\n" |
201 | "@item r @tab Open for reading.\n" | 201 | "@item r @tab Open for reading.\n" |
202 | "@item w @tab Open for writing.\n" | 202 | "@item w @tab Open for writing.\n" |
203 | "@item a @tab Open for appending to the end of the mailbox.\n" | 203 | "@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, | ... | @@ -208,54 +208,54 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0, |
208 | { | 208 | { |
209 | mu_mailbox_t mbox = NULL; | 209 | mu_mailbox_t mbox = NULL; |
210 | char *mode_str; | 210 | char *mode_str; |
211 | int mode = 0; | 211 | int mode_bits = 0; |
212 | int status; | 212 | int status; |
213 | SCM ret; | 213 | SCM ret; |
214 | 214 | ||
215 | SCM_ASSERT (scm_is_string (URL), URL, SCM_ARG1, FUNC_NAME); | 215 | SCM_ASSERT (scm_is_string (url), url, SCM_ARG1, FUNC_NAME); |
216 | SCM_ASSERT (scm_is_string (MODE), MODE, SCM_ARG2, FUNC_NAME); | 216 | SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME); |
217 | 217 | ||
218 | scm_dynwind_begin (0); | 218 | scm_dynwind_begin (0); |
219 | 219 | ||
220 | mode_str = scm_to_locale_string (MODE); | 220 | mode_str = scm_to_locale_string (mode); |
221 | scm_dynwind_free (mode_str); | 221 | scm_dynwind_free (mode_str); |
222 | for (; *mode_str; mode_str++) | 222 | for (; *mode_str; mode_str++) |
223 | switch (*mode_str) | 223 | switch (*mode_str) |
224 | { | 224 | { |
225 | case 'r': | 225 | case 'r': |
226 | mode |= MU_STREAM_READ; | 226 | mode_bits |= MU_STREAM_READ; |
227 | break; | 227 | break; |
228 | case 'w': | 228 | case 'w': |
229 | mode |= MU_STREAM_WRITE; | 229 | mode_bits |= MU_STREAM_WRITE; |
230 | break; | 230 | break; |
231 | case 'a': | 231 | case 'a': |
232 | mode |= MU_STREAM_APPEND; | 232 | mode_bits |= MU_STREAM_APPEND; |
233 | break; | 233 | break; |
234 | case 'c': | 234 | case 'c': |
235 | mode |= MU_STREAM_CREAT; | 235 | mode_bits |= MU_STREAM_CREAT; |
236 | break; | 236 | break; |
237 | } | 237 | } |
238 | 238 | ||
239 | if (mode & MU_STREAM_READ && mode & MU_STREAM_WRITE) | 239 | if (mode_bits & MU_STREAM_READ && mode_bits & MU_STREAM_WRITE) |
240 | mode = (mode & ~(MU_STREAM_READ | MU_STREAM_WRITE)) | MU_STREAM_RDWR; | 240 | mode_bits = (mode_bits & ~(MU_STREAM_READ | MU_STREAM_WRITE)) | MU_STREAM_RDWR; |
241 | 241 | ||
242 | mode_str = scm_to_locale_string (URL); | 242 | mode_str = scm_to_locale_string (url); |
243 | scm_dynwind_free (mode_str); | 243 | scm_dynwind_free (mode_str); |
244 | 244 | ||
245 | status = mu_mailbox_create_default (&mbox, mode_str); | 245 | status = mu_mailbox_create_default (&mbox, mode_str); |
246 | if (status) | 246 | if (status) |
247 | mu_scm_error (FUNC_NAME, status, | 247 | mu_scm_error (FUNC_NAME, status, |
248 | "Cannot create default mailbox ~A", | 248 | "Cannot create default mailbox ~A", |
249 | scm_list_1 (URL)); | 249 | scm_list_1 (url)); |
250 | 250 | ||
251 | 251 | ||
252 | status = mu_mailbox_open (mbox, mode); | 252 | status = mu_mailbox_open (mbox, mode_bits); |
253 | if (status) | 253 | if (status) |
254 | { | 254 | { |
255 | mu_mailbox_destroy (&mbox); | 255 | mu_mailbox_destroy (&mbox); |
256 | mu_scm_error (FUNC_NAME, status, | 256 | mu_scm_error (FUNC_NAME, status, |
257 | "Cannot open default mailbox ~A", | 257 | "Cannot open default mailbox ~A", |
258 | scm_list_1 (URL)); | 258 | scm_list_1 (url)); |
259 | } | 259 | } |
260 | ret = mu_scm_mailbox_create (mbox); | 260 | ret = mu_scm_mailbox_create (mbox); |
261 | scm_dynwind_end (); | 261 | scm_dynwind_end (); |
... | @@ -264,13 +264,14 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0, | ... | @@ -264,13 +264,14 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 2, 0, 0, |
264 | #undef FUNC_NAME | 264 | #undef FUNC_NAME |
265 | 265 | ||
266 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_close, "mu-mailbox-close", 1, 0, 0, | 266 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_close, "mu-mailbox-close", 1, 0, 0, |
267 | (SCM MBOX), "Closes mailbox MBOX.") | 267 | (SCM mbox), |
268 | "Closes mailbox @var{mbox}.") | ||
268 | #define FUNC_NAME s_scm_mu_mailbox_close | 269 | #define FUNC_NAME s_scm_mu_mailbox_close |
269 | { | 270 | { |
270 | struct mu_mailbox *mum; | 271 | struct mu_mailbox *mum; |
271 | 272 | ||
272 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 273 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
273 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 274 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
274 | mu_mailbox_close (mum->mbox); | 275 | mu_mailbox_close (mum->mbox); |
275 | mu_mailbox_destroy (&mum->mbox); | 276 | mu_mailbox_destroy (&mum->mbox); |
276 | return SCM_UNSPECIFIED; | 277 | return SCM_UNSPECIFIED; |
... | @@ -278,16 +279,16 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_close, "mu-mailbox-close", 1, 0, 0, | ... | @@ -278,16 +279,16 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_close, "mu-mailbox-close", 1, 0, 0, |
278 | #undef FUNC_NAME | 279 | #undef FUNC_NAME |
279 | 280 | ||
280 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0, | 281 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0, |
281 | (SCM MBOX), | 282 | (SCM mbox), |
282 | "Returns url of the mailbox MBOX.") | 283 | "Returns URL of the mailbox @var{MBOX}.") |
283 | #define FUNC_NAME s_scm_mu_mailbox_get_url | 284 | #define FUNC_NAME s_scm_mu_mailbox_get_url |
284 | { | 285 | { |
285 | struct mu_mailbox *mum; | 286 | struct mu_mailbox *mum; |
286 | mu_url_t url; | 287 | mu_url_t url; |
287 | int status; | 288 | int status; |
288 | 289 | ||
289 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 290 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
290 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 291 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
291 | status = mu_mailbox_get_url (mum->mbox, &url); | 292 | status = mu_mailbox_get_url (mum->mbox, &url); |
292 | if (status) | 293 | if (status) |
293 | mu_scm_error (FUNC_NAME, status, | 294 | 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, | ... | @@ -299,9 +300,9 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0, |
299 | #undef FUNC_NAME | 300 | #undef FUNC_NAME |
300 | 301 | ||
301 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0, | 302 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0, |
302 | (SCM MBOX, SCM MODE), | 303 | (SCM mbox, SCM mode), |
303 | "Returns a port associated with the contents of the MBOX.\n" | 304 | "Returns a port associated with the contents of the @var{mbox},\n" |
304 | "MODE is a string defining operation mode of the stream. It may\n" | 305 | "which is a string defining operation mode of the stream. It may\n" |
305 | "contain any of the two characters: @samp{r} for reading, @samp{w} for\n" | 306 | "contain any of the two characters: @samp{r} for reading, @samp{w} for\n" |
306 | "writing.\n") | 307 | "writing.\n") |
307 | #define FUNC_NAME s_scm_mu_mailbox_get_port | 308 | #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, | ... | @@ -312,105 +313,105 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0, |
312 | char *s; | 313 | char *s; |
313 | SCM ret; | 314 | SCM ret; |
314 | 315 | ||
315 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 316 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
316 | SCM_ASSERT (scm_is_string (MODE), MODE, SCM_ARG2, FUNC_NAME); | 317 | SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME); |
317 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 318 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
318 | status = mu_mailbox_get_stream (mum->mbox, &stream); | 319 | status = mu_mailbox_get_stream (mum->mbox, &stream); |
319 | if (status) | 320 | if (status) |
320 | mu_scm_error (FUNC_NAME, status, | 321 | mu_scm_error (FUNC_NAME, status, |
321 | "Cannot get mailbox stream", | 322 | "Cannot get mailbox stream", |
322 | scm_list_1 (MBOX)); | 323 | scm_list_1 (mbox)); |
323 | s = scm_to_locale_string (MODE); | 324 | s = scm_to_locale_string (mode); |
324 | ret = mu_port_make_from_stream (MBOX, stream, scm_mode_bits (s)); | 325 | ret = mu_port_make_from_stream (mbox, stream, scm_mode_bits (s)); |
325 | free (s); | 326 | free (s); |
326 | return ret; | 327 | return ret; |
327 | } | 328 | } |
328 | #undef FUNC_NAME | 329 | #undef FUNC_NAME |
329 | 330 | ||
330 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_message, "mu-mailbox-get-message", 2, 0, 0, | 331 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_message, "mu-mailbox-get-message", 2, 0, 0, |
331 | (SCM MBOX, SCM MSGNO), | 332 | (SCM mbox, SCM msgno), |
332 | "Retrieve from message #MSGNO from the mailbox MBOX.") | 333 | "Retrieve from message #@var{msgno} from the mailbox @var{mbox}.") |
333 | #define FUNC_NAME s_scm_mu_mailbox_get_message | 334 | #define FUNC_NAME s_scm_mu_mailbox_get_message |
334 | { | 335 | { |
335 | size_t msgno; | 336 | size_t n; |
336 | struct mu_mailbox *mum; | 337 | struct mu_mailbox *mum; |
337 | mu_message_t msg; | 338 | mu_message_t msg; |
338 | int status; | 339 | int status; |
339 | 340 | ||
340 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 341 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
341 | SCM_ASSERT (scm_is_integer (MSGNO), MSGNO, SCM_ARG2, FUNC_NAME); | 342 | SCM_ASSERT (scm_is_integer (msgno), msgno, SCM_ARG2, FUNC_NAME); |
342 | 343 | ||
343 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 344 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
344 | msgno = scm_to_int32 (MSGNO); | 345 | n = scm_to_size_t (msgno); |
345 | 346 | ||
346 | status = mu_mailbox_get_message (mum->mbox, msgno, &msg); | 347 | status = mu_mailbox_get_message (mum->mbox, n, &msg); |
347 | if (status) | 348 | if (status) |
348 | mu_scm_error (FUNC_NAME, status, | 349 | mu_scm_error (FUNC_NAME, status, |
349 | "Cannot get message ~A from mailbox ~A", | 350 | "Cannot get message ~A from mailbox ~A", |
350 | scm_list_2 (MSGNO, MBOX)); | 351 | scm_list_2 (msgno, mbox)); |
351 | 352 | ||
352 | return mu_scm_message_create (MBOX, msg); | 353 | return mu_scm_message_create (mbox, msg); |
353 | } | 354 | } |
354 | #undef FUNC_NAME | 355 | #undef FUNC_NAME |
355 | 356 | ||
356 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_messages_count, "mu-mailbox-messages-count", 1, 0, 0, | 357 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_messages_count, "mu-mailbox-messages-count", 1, 0, 0, |
357 | (SCM MBOX), | 358 | (SCM mbox), |
358 | "Returns number of messages in the mailbox MBOX.") | 359 | "Returns number of messages in the mailbox @var{mbox}.") |
359 | #define FUNC_NAME s_scm_mu_mailbox_messages_count | 360 | #define FUNC_NAME s_scm_mu_mailbox_messages_count |
360 | { | 361 | { |
361 | struct mu_mailbox *mum; | 362 | struct mu_mailbox *mum; |
362 | size_t nmesg; | 363 | size_t nmesg; |
363 | int status; | 364 | int status; |
364 | 365 | ||
365 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 366 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
366 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 367 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
367 | 368 | ||
368 | status = mu_mailbox_messages_count (mum->mbox, &nmesg); | 369 | status = mu_mailbox_messages_count (mum->mbox, &nmesg); |
369 | if (status) | 370 | if (status) |
370 | mu_scm_error (FUNC_NAME, status, | 371 | mu_scm_error (FUNC_NAME, status, |
371 | "Cannot count messages in mailbox ~A", | 372 | "Cannot count messages in mailbox ~A", |
372 | scm_list_1 (MBOX)); | 373 | scm_list_1 (mbox)); |
373 | return scm_from_size_t (nmesg); | 374 | return scm_from_size_t (nmesg); |
374 | } | 375 | } |
375 | #undef FUNC_NAME | 376 | #undef FUNC_NAME |
376 | 377 | ||
377 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_expunge, "mu-mailbox-expunge", 1, 0, 0, | 378 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_expunge, "mu-mailbox-expunge", 1, 0, 0, |
378 | (SCM MBOX), | 379 | (SCM mbox), |
379 | "Expunges deleted messages from the mailbox MBOX.") | 380 | "Expunges deleted messages from the mailbox @var{mbox}.") |
380 | #define FUNC_NAME s_scm_mu_mailbox_expunge | 381 | #define FUNC_NAME s_scm_mu_mailbox_expunge |
381 | { | 382 | { |
382 | struct mu_mailbox *mum; | 383 | struct mu_mailbox *mum; |
383 | int status; | 384 | int status; |
384 | 385 | ||
385 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 386 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
386 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 387 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
387 | status = mu_mailbox_expunge (mum->mbox); | 388 | status = mu_mailbox_expunge (mum->mbox); |
388 | if (status) | 389 | if (status) |
389 | mu_scm_error (FUNC_NAME, status, | 390 | mu_scm_error (FUNC_NAME, status, |
390 | "Cannot expunge messages in mailbox ~A", | 391 | "Cannot expunge messages in mailbox ~A", |
391 | scm_list_1 (MBOX)); | 392 | scm_list_1 (mbox)); |
392 | return SCM_BOOL_T; | 393 | return SCM_BOOL_T; |
393 | } | 394 | } |
394 | #undef FUNC_NAME | 395 | #undef FUNC_NAME |
395 | 396 | ||
396 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_append_message, "mu-mailbox-append-message", 2, 0, 0, | 397 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_append_message, "mu-mailbox-append-message", 2, 0, 0, |
397 | (SCM MBOX, SCM MESG), | 398 | (SCM mbox, SCM mesg), |
398 | "Appends message MESG to the mailbox MBOX.") | 399 | "Appends message @var{mesg} to the mailbox @var{mbox}.") |
399 | #define FUNC_NAME s_scm_mu_mailbox_append_message | 400 | #define FUNC_NAME s_scm_mu_mailbox_append_message |
400 | { | 401 | { |
401 | struct mu_mailbox *mum; | 402 | struct mu_mailbox *mum; |
402 | mu_message_t msg; | 403 | mu_message_t msg; |
403 | int status; | 404 | int status; |
404 | 405 | ||
405 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 406 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
406 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME); | 407 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME); |
407 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 408 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
408 | msg = mu_scm_message_get (MESG); | 409 | msg = mu_scm_message_get (mesg); |
409 | status = mu_mailbox_append_message (mum->mbox, msg); | 410 | status = mu_mailbox_append_message (mum->mbox, msg); |
410 | if (status) | 411 | if (status) |
411 | mu_scm_error (FUNC_NAME, status, | 412 | mu_scm_error (FUNC_NAME, status, |
412 | "Cannot append message ~A to mailbox ~A", | 413 | "Cannot append message ~A to mailbox ~A", |
413 | scm_list_2 (MESG, MBOX)); | 414 | scm_list_2 (mesg, mbox)); |
414 | return SCM_BOOL_T; | 415 | return SCM_BOOL_T; |
415 | } | 416 | } |
416 | #undef FUNC_NAME | 417 | #undef FUNC_NAME |
... | @@ -425,56 +426,56 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_append_message, "mu-mailbox-append-message", 2 | ... | @@ -425,56 +426,56 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_append_message, "mu-mailbox-append-message", 2 |
425 | if (status) \ | 426 | if (status) \ |
426 | mu_scm_error (FUNC_NAME, status, \ | 427 | mu_scm_error (FUNC_NAME, status, \ |
427 | "~A: " descr ": ~A", \ | 428 | "~A: " descr ": ~A", \ |
428 | scm_list_2 (MBOX, \ | 429 | scm_list_2 (mbox, \ |
429 | scm_from_locale_string (mu_strerror (status)))); \ | 430 | scm_from_locale_string (mu_strerror (status)))); \ |
430 | } \ | 431 | } \ |
431 | while (0) | 432 | while (0) |
432 | 433 | ||
433 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_first_message, "mu-mailbox-first-message", 1, 0, 0, | 434 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_first_message, "mu-mailbox-first-message", 1, 0, 0, |
434 | (SCM MBOX), | 435 | (SCM mbox), |
435 | "Returns first message from the mailbox.") | 436 | "Returns first message from the mailbox @var{mbox}.") |
436 | #define FUNC_NAME s_scm_mu_mailbox_first_message | 437 | #define FUNC_NAME s_scm_mu_mailbox_first_message |
437 | { | 438 | { |
438 | struct mu_mailbox *mum; | 439 | struct mu_mailbox *mum; |
439 | int status; | 440 | int status; |
440 | mu_message_t msg; | 441 | mu_message_t msg; |
441 | 442 | ||
442 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 443 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
443 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 444 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
444 | if (!mum->itr) | 445 | if (!mum->itr) |
445 | { | 446 | { |
446 | status = mu_mailbox_get_iterator (mum->mbox, &mum->itr); | 447 | status = mu_mailbox_get_iterator (mum->mbox, &mum->itr); |
447 | if (status) | 448 | if (status) |
448 | mu_scm_error (FUNC_NAME, status, | 449 | mu_scm_error (FUNC_NAME, status, |
449 | "~A: cannot create iterator: ~A", | 450 | "~A: cannot create iterator: ~A", |
450 | scm_list_2 (MBOX, | 451 | scm_list_2 (mbox, |
451 | scm_from_locale_string (mu_strerror (status)))); | 452 | scm_from_locale_string (mu_strerror (status)))); |
452 | } | 453 | } |
453 | ITROP (mu_iterator_first (mum->itr), "moving to the first message"); | 454 | ITROP (mu_iterator_first (mum->itr), "moving to the first message"); |
454 | ITROP (mu_iterator_current (mum->itr, (void**)&msg), | 455 | ITROP (mu_iterator_current (mum->itr, (void**)&msg), |
455 | "getting current message"); | 456 | "getting current message"); |
456 | return mu_scm_message_create (MBOX, msg); | 457 | return mu_scm_message_create (mbox, msg); |
457 | } | 458 | } |
458 | #undef FUNC_NAME | 459 | #undef FUNC_NAME |
459 | 460 | ||
460 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_next_message, "mu-mailbox-next-message", 1, 0, 0, | 461 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_next_message, "mu-mailbox-next-message", 1, 0, 0, |
461 | (SCM MBOX), | 462 | (SCM mbox), |
462 | "Returns next message from the mailbox.") | 463 | "Returns next message from the mailbox @var{mbox}.") |
463 | #define FUNC_NAME s_scm_mu_mailbox_next_message | 464 | #define FUNC_NAME s_scm_mu_mailbox_next_message |
464 | { | 465 | { |
465 | struct mu_mailbox *mum; | 466 | struct mu_mailbox *mum; |
466 | int status; | 467 | int status; |
467 | mu_message_t msg; | 468 | mu_message_t msg; |
468 | 469 | ||
469 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 470 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
470 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 471 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
471 | if (!mum->itr) | 472 | if (!mum->itr) |
472 | { | 473 | { |
473 | status = mu_mailbox_get_iterator (mum->mbox, &mum->itr); | 474 | status = mu_mailbox_get_iterator (mum->mbox, &mum->itr); |
474 | if (status) | 475 | if (status) |
475 | mu_scm_error (FUNC_NAME, status, | 476 | mu_scm_error (FUNC_NAME, status, |
476 | "~A: cannot create iterator: ~A", | 477 | "~A: cannot create iterator: ~A", |
477 | scm_list_2 (MBOX, | 478 | scm_list_2 (mbox, |
478 | scm_from_locale_string (mu_strerror (status)))); | 479 | scm_from_locale_string (mu_strerror (status)))); |
479 | ITROP (mu_iterator_first (mum->itr), "moving to the first message"); | 480 | ITROP (mu_iterator_first (mum->itr), "moving to the first message"); |
480 | } | 481 | } |
... | @@ -483,27 +484,31 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_next_message, "mu-mailbox-next-message", 1, 0, | ... | @@ -483,27 +484,31 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_next_message, "mu-mailbox-next-message", 1, 0, |
483 | 484 | ||
484 | ITROP (mu_iterator_current (mum->itr, (void**)&msg), | 485 | ITROP (mu_iterator_current (mum->itr, (void**)&msg), |
485 | "getting current message"); | 486 | "getting current message"); |
486 | return mu_scm_message_create (MBOX, msg); | 487 | return mu_scm_message_create (mbox, msg); |
487 | } | 488 | } |
488 | #undef FUNC_NAME | 489 | #undef FUNC_NAME |
489 | 490 | ||
490 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_more_messages_p, "mu-mailbox-more-messages?", 1, 0, 0, | 491 | SCM_DEFINE_PUBLIC (scm_mu_mailbox_more_messages_p, "mu-mailbox-more-messages?", 1, 0, 0, |
491 | (SCM MBOX), | 492 | (SCM mbox), |
492 | "Returns next message from the mailbox.") | 493 | "Returns @samp{#t} if there are more messages in the mailbox @var{mbox}\n" |
494 | "ahead of current iterator position. Usually this function is used after\n" | ||
495 | "a call to @samp{mu-mailbox-first-message} or @samp{mu-mailbox-next-message}.\n" | ||
496 | "If not, it initializes the iterator and points it to the first message inn" | ||
497 | "the mailbox.") | ||
493 | #define FUNC_NAME s_scm_mu_mailbox_more_messages_p | 498 | #define FUNC_NAME s_scm_mu_mailbox_more_messages_p |
494 | { | 499 | { |
495 | struct mu_mailbox *mum; | 500 | struct mu_mailbox *mum; |
496 | int status; | 501 | int status; |
497 | 502 | ||
498 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | 503 | SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME); |
499 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | 504 | mum = (struct mu_mailbox *) SCM_CDR (mbox); |
500 | if (!mum->itr) | 505 | if (!mum->itr) |
501 | { | 506 | { |
502 | status = mu_mailbox_get_iterator (mum->mbox, &mum->itr); | 507 | status = mu_mailbox_get_iterator (mum->mbox, &mum->itr); |
503 | if (status) | 508 | if (status) |
504 | mu_scm_error (FUNC_NAME, status, | 509 | mu_scm_error (FUNC_NAME, status, |
505 | "~A: cannot create iterator: ~A", | 510 | "~A: cannot create iterator: ~A", |
506 | scm_list_2 (MBOX, | 511 | scm_list_2 (mbox, |
507 | scm_from_locale_string (mu_strerror (status)))); | 512 | scm_from_locale_string (mu_strerror (status)))); |
508 | status = mu_iterator_first (mum->itr); | 513 | status = mu_iterator_first (mum->itr); |
509 | if (status == MU_ERR_NOENT) | 514 | if (status == MU_ERR_NOENT) |
... | @@ -511,7 +516,7 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_more_messages_p, "mu-mailbox-more-messages?", | ... | @@ -511,7 +516,7 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_more_messages_p, "mu-mailbox-more-messages?", |
511 | if (status) | 516 | if (status) |
512 | mu_scm_error (FUNC_NAME, status, | 517 | mu_scm_error (FUNC_NAME, status, |
513 | "~A: cannot set iterator to the first message: ~A", | 518 | "~A: cannot set iterator to the first message: ~A", |
514 | scm_list_2 (MBOX, | 519 | scm_list_2 (mbox, |
515 | scm_from_locale_string (mu_strerror (status)))); | 520 | scm_from_locale_string (mu_strerror (status)))); |
516 | } | 521 | } |
517 | return scm_from_bool (!!mu_iterator_is_done (mum->itr)); | 522 | return scm_from_bool (!!mu_iterator_is_done (mum->itr)); | ... | ... |
... | @@ -177,8 +177,8 @@ mu_scm_is_message (SCM scm) | ... | @@ -177,8 +177,8 @@ mu_scm_is_message (SCM scm) |
177 | /* Guile primitives */ | 177 | /* Guile primitives */ |
178 | 178 | ||
179 | SCM_DEFINE_PUBLIC (scm_mu_message_create, "mu-message-create", 0, 0, 0, | 179 | SCM_DEFINE_PUBLIC (scm_mu_message_create, "mu-message-create", 0, 0, 0, |
180 | (), | 180 | (), |
181 | "Creates an empty message.\n") | 181 | "Creates an empty message.\n") |
182 | #define FUNC_NAME s_scm_mu_message_create | 182 | #define FUNC_NAME s_scm_mu_message_create |
183 | { | 183 | { |
184 | mu_message_t msg; | 184 | mu_message_t msg; |
... | @@ -189,8 +189,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_create, "mu-message-create", 0, 0, 0, | ... | @@ -189,8 +189,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_create, "mu-message-create", 0, 0, 0, |
189 | 189 | ||
190 | /* FIXME: This changes envelope date */ | 190 | /* FIXME: This changes envelope date */ |
191 | SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0, | 191 | SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0, |
192 | (SCM MESG), | 192 | (SCM mesg), |
193 | "Creates the copy of the message MESG.\n") | 193 | "Creates a copy of the message @var{mesg}.\n") |
194 | #define FUNC_NAME s_scm_mu_message_copy | 194 | #define FUNC_NAME s_scm_mu_message_copy |
195 | { | 195 | { |
196 | mu_message_t msg, newmsg; | 196 | mu_message_t msg, newmsg; |
... | @@ -199,14 +199,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0, | ... | @@ -199,14 +199,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0, |
199 | size_t off, n; | 199 | size_t off, n; |
200 | int status; | 200 | int status; |
201 | 201 | ||
202 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 202 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
203 | msg = mu_scm_message_get (MESG); | 203 | msg = mu_scm_message_get (mesg); |
204 | 204 | ||
205 | status = mu_message_get_stream (msg, &in); | 205 | status = mu_message_get_stream (msg, &in); |
206 | if (status) | 206 | if (status) |
207 | mu_scm_error (FUNC_NAME, status, | 207 | mu_scm_error (FUNC_NAME, status, |
208 | "Cannot get input stream from message ~A", | 208 | "Cannot get input stream from message ~A", |
209 | scm_list_1 (MESG)); | 209 | scm_list_1 (mesg)); |
210 | 210 | ||
211 | status = mu_message_create (&newmsg, NULL); | 211 | status = mu_message_create (&newmsg, NULL); |
212 | if (status) | 212 | if (status) |
... | @@ -250,44 +250,44 @@ SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0, | ... | @@ -250,44 +250,44 @@ SCM_DEFINE_PUBLIC (scm_mu_message_copy, "mu-message-copy", 1, 0, 0, |
250 | #undef FUNC_NAME | 250 | #undef FUNC_NAME |
251 | 251 | ||
252 | SCM_DEFINE_PUBLIC (scm_mu_message_destroy, "mu-message-destroy", 1, 0, 0, | 252 | SCM_DEFINE_PUBLIC (scm_mu_message_destroy, "mu-message-destroy", 1, 0, 0, |
253 | (SCM MESG), | 253 | (SCM mesg), |
254 | "Destroys the message MESG.") | 254 | "Destroys the message @var{mesg}.") |
255 | #define FUNC_NAME s_scm_mu_message_destroy | 255 | #define FUNC_NAME s_scm_mu_message_destroy |
256 | { | 256 | { |
257 | struct mu_message *mum; | 257 | struct mu_message *mum; |
258 | 258 | ||
259 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 259 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
260 | mum = (struct mu_message *) SCM_CDR (MESG); | 260 | mum = (struct mu_message *) SCM_CDR (mesg); |
261 | mu_message_destroy (&mum->msg, mu_message_get_owner (mum->msg)); | 261 | mu_message_destroy (&mum->msg, mu_message_get_owner (mum->msg)); |
262 | return SCM_UNSPECIFIED; | 262 | return SCM_UNSPECIFIED; |
263 | } | 263 | } |
264 | #undef FUNC_NAME | 264 | #undef FUNC_NAME |
265 | 265 | ||
266 | SCM_DEFINE_PUBLIC (scm_mu_message_set_header, "mu-message-set-header", 3, 1, 0, | 266 | SCM_DEFINE_PUBLIC (scm_mu_message_set_header, "mu-message-set-header", 3, 1, 0, |
267 | (SCM MESG, SCM HEADER, SCM VALUE, SCM REPLACE), | 267 | (SCM mesg, SCM header, SCM value, SCM replace), |
268 | "Sets new VALUE to the header HEADER of the message MESG.\n" | 268 | "Sets header @var{header} of the message @var{mesg} to new @var{value}.\n" |
269 | "If HEADER is already present in the message its value\n" | 269 | "If @var{header} is already present in the message, its value\n" |
270 | "is replaced with the suplied one iff the optional REPLACE is\n" | 270 | "is replaced with the suplied one iff the optional @var{replace} is\n" |
271 | "#t. Otherwise, a new header is created and appended.") | 271 | "@code{#t}. Otherwise, a new header is created and appended.") |
272 | #define FUNC_NAME s_scm_mu_message_set_header | 272 | #define FUNC_NAME s_scm_mu_message_set_header |
273 | { | 273 | { |
274 | mu_message_t msg; | 274 | mu_message_t msg; |
275 | mu_header_t hdr; | 275 | mu_header_t hdr; |
276 | int replace = 0; | 276 | int repl = 0; |
277 | int status; | 277 | int status; |
278 | char *hdr_c, *val_c; | 278 | char *hdr_c, *val_c; |
279 | 279 | ||
280 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 280 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
281 | msg = mu_scm_message_get (MESG); | 281 | msg = mu_scm_message_get (mesg); |
282 | SCM_ASSERT (scm_is_string (HEADER), HEADER, SCM_ARG2, FUNC_NAME); | 282 | SCM_ASSERT (scm_is_string (header), header, SCM_ARG2, FUNC_NAME); |
283 | 283 | ||
284 | if (scm_is_bool (VALUE)) | 284 | if (scm_is_bool (value)) |
285 | return SCM_UNSPECIFIED; | 285 | return SCM_UNSPECIFIED;/*FIXME: Exception*/ |
286 | 286 | ||
287 | SCM_ASSERT (scm_is_string (VALUE), VALUE, SCM_ARG3, FUNC_NAME); | 287 | SCM_ASSERT (scm_is_string (value), value, SCM_ARG3, FUNC_NAME); |
288 | if (!SCM_UNBNDP (REPLACE)) | 288 | if (!SCM_UNBNDP (replace)) |
289 | { | 289 | { |
290 | replace = REPLACE == SCM_BOOL_T; | 290 | repl = replace == SCM_BOOL_T; |
291 | } | 291 | } |
292 | 292 | ||
293 | status = mu_message_get_header (msg, &hdr); | 293 | 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, | ... | @@ -295,52 +295,52 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header, "mu-message-set-header", 3, 1, 0, |
295 | mu_scm_error (FUNC_NAME, status, | 295 | mu_scm_error (FUNC_NAME, status, |
296 | "Cannot get message headers", SCM_BOOL_F); | 296 | "Cannot get message headers", SCM_BOOL_F); |
297 | 297 | ||
298 | hdr_c = scm_to_locale_string (HEADER); | 298 | hdr_c = scm_to_locale_string (header); |
299 | val_c = scm_to_locale_string (VALUE); | 299 | val_c = scm_to_locale_string (value); |
300 | status = mu_header_set_value (hdr, hdr_c, val_c, replace); | 300 | status = mu_header_set_value (hdr, hdr_c, val_c, repl); |
301 | free (hdr_c); | 301 | free (hdr_c); |
302 | free (val_c); | 302 | free (val_c); |
303 | 303 | ||
304 | if (status) | 304 | if (status) |
305 | mu_scm_error (FUNC_NAME, status, | 305 | mu_scm_error (FUNC_NAME, status, |
306 | "Cannot set header \"~A: ~A\" in message ~A", | 306 | "Cannot set header \"~A: ~A\" in message ~A", |
307 | scm_list_3 (HEADER, VALUE, MESG)); | 307 | scm_list_3 (header, value, mesg)); |
308 | 308 | ||
309 | return SCM_UNSPECIFIED; | 309 | return SCM_UNSPECIFIED; |
310 | } | 310 | } |
311 | #undef FUNC_NAME | 311 | #undef FUNC_NAME |
312 | 312 | ||
313 | SCM_DEFINE_PUBLIC (scm_mu_message_get_size, "mu-message-get-size", 1, 0, 0, | 313 | SCM_DEFINE_PUBLIC (scm_mu_message_get_size, "mu-message-get-size", 1, 0, 0, |
314 | (SCM MESG), | 314 | (SCM mesg), |
315 | "Returns the size of the message MESG\n.") | 315 | "Returns size of the message @var{mesg}\n.") |
316 | #define FUNC_NAME s_scm_mu_message_get_size | 316 | #define FUNC_NAME s_scm_mu_message_get_size |
317 | { | 317 | { |
318 | mu_message_t msg; | 318 | mu_message_t msg; |
319 | size_t size; | 319 | size_t size; |
320 | 320 | ||
321 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 321 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
322 | msg = mu_scm_message_get (MESG); | 322 | msg = mu_scm_message_get (mesg); |
323 | mu_message_size (msg, &size); | 323 | mu_message_size (msg, &size); |
324 | return scm_from_size_t (size); | 324 | return scm_from_size_t (size); |
325 | } | 325 | } |
326 | #undef FUNC_NAME | 326 | #undef FUNC_NAME |
327 | 327 | ||
328 | SCM_DEFINE_PUBLIC (scm_mu_message_get_lines, "mu-message-get-lines", 1, 0, 0, | 328 | SCM_DEFINE_PUBLIC (scm_mu_message_get_lines, "mu-message-get-lines", 1, 0, 0, |
329 | (SCM MESG), | 329 | (SCM mesg), |
330 | "Returns number of lines in the given message.\n") | 330 | "Returns number of lines in the message @var{msg}.\n") |
331 | #define FUNC_NAME s_scm_mu_message_get_lines | 331 | #define FUNC_NAME s_scm_mu_message_get_lines |
332 | { | 332 | { |
333 | mu_message_t msg; | 333 | mu_message_t msg; |
334 | size_t lines; | 334 | size_t lines; |
335 | int status; | 335 | int status; |
336 | 336 | ||
337 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 337 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
338 | msg = mu_scm_message_get (MESG); | 338 | msg = mu_scm_message_get (mesg); |
339 | status = mu_message_lines (msg, &lines); | 339 | status = mu_message_lines (msg, &lines); |
340 | if (status) | 340 | if (status) |
341 | mu_scm_error (FUNC_NAME, status, | 341 | mu_scm_error (FUNC_NAME, status, |
342 | "Cannot get number of lines in message ~A", | 342 | "Cannot get number of lines in message ~A", |
343 | scm_list_1 (MESG)); | 343 | scm_list_1 (mesg)); |
344 | 344 | ||
345 | return scm_from_size_t (lines); | 345 | return scm_from_size_t (lines); |
346 | } | 346 | } |
... | @@ -368,8 +368,8 @@ filltime (struct tm *bd_time, int zoff, const char *zname) | ... | @@ -368,8 +368,8 @@ filltime (struct tm *bd_time, int zoff, const char *zname) |
368 | } | 368 | } |
369 | 369 | ||
370 | SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0, 0, | 370 | SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0, 0, |
371 | (SCM MESG), | 371 | (SCM mesg), |
372 | "Returns envelope date of the message MESG.\n") | 372 | "Returns envelope date of the message @var{mesg}.\n") |
373 | #define FUNC_NAME s_scm_mu_message_get_envelope | 373 | #define FUNC_NAME s_scm_mu_message_get_envelope |
374 | { | 374 | { |
375 | mu_message_t msg; | 375 | mu_message_t msg; |
... | @@ -379,20 +379,20 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0, | ... | @@ -379,20 +379,20 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0, |
379 | const char *date; | 379 | const char *date; |
380 | size_t dlen; | 380 | size_t dlen; |
381 | 381 | ||
382 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 382 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
383 | msg = mu_scm_message_get (MESG); | 383 | msg = mu_scm_message_get (mesg); |
384 | status = mu_message_get_envelope (msg, &env); | 384 | status = mu_message_get_envelope (msg, &env); |
385 | if (status) | 385 | if (status) |
386 | mu_scm_error (FUNC_NAME, status, "cannot get envelope", | 386 | mu_scm_error (FUNC_NAME, status, "cannot get envelope", |
387 | scm_list_1 (MESG)); | 387 | scm_list_1 (mesg)); |
388 | status = mu_envelope_sget_sender (env, &sender); | 388 | status = mu_envelope_sget_sender (env, &sender); |
389 | if (status) | 389 | if (status) |
390 | mu_scm_error (FUNC_NAME, status, "cannot get envelope sender", | 390 | mu_scm_error (FUNC_NAME, status, "cannot get envelope sender", |
391 | scm_list_1 (MESG)); | 391 | scm_list_1 (mesg)); |
392 | status = mu_envelope_sget_date (env, &date); | 392 | status = mu_envelope_sget_date (env, &date); |
393 | if (status) | 393 | if (status) |
394 | mu_scm_error (FUNC_NAME, status, "cannot get envelope date", | 394 | mu_scm_error (FUNC_NAME, status, "cannot get envelope date", |
395 | scm_list_1 (MESG)); | 395 | scm_list_1 (mesg)); |
396 | dlen = strlen (date); | 396 | dlen = strlen (date); |
397 | if (date[dlen-1] == '\n') | 397 | if (date[dlen-1] == '\n') |
398 | dlen--; | 398 | dlen--; |
... | @@ -403,8 +403,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0, | ... | @@ -403,8 +403,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope, "mu-message-get-envelope", 1, 0, |
403 | #undef FUNC_NAME | 403 | #undef FUNC_NAME |
404 | 404 | ||
405 | SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-date", 1, 0, 0, | 405 | SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-date", 1, 0, 0, |
406 | (SCM MESG), | 406 | (SCM mesg), |
407 | "Returns envelope date of the message MESG.\n") | 407 | "Returns envelope date of the message @var{mesg}.\n") |
408 | #define FUNC_NAME s_scm_mu_message_get_envelope_date | 408 | #define FUNC_NAME s_scm_mu_message_get_envelope_date |
409 | { | 409 | { |
410 | mu_message_t msg; | 410 | mu_message_t msg; |
... | @@ -414,16 +414,16 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-da | ... | @@ -414,16 +414,16 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-da |
414 | struct tm tm; | 414 | struct tm tm; |
415 | mu_timezone tz; | 415 | mu_timezone tz; |
416 | 416 | ||
417 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 417 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
418 | msg = mu_scm_message_get (MESG); | 418 | msg = mu_scm_message_get (mesg); |
419 | status = mu_message_get_envelope (msg, &env); | 419 | status = mu_message_get_envelope (msg, &env); |
420 | if (status) | 420 | if (status) |
421 | mu_scm_error (FUNC_NAME, status, "cannot get envelope", | 421 | mu_scm_error (FUNC_NAME, status, "cannot get envelope", |
422 | scm_list_1 (MESG)); | 422 | scm_list_1 (mesg)); |
423 | status = mu_envelope_sget_date (env, &sdate); | 423 | status = mu_envelope_sget_date (env, &sdate); |
424 | if (status) | 424 | if (status) |
425 | mu_scm_error (FUNC_NAME, status, "cannot get envelope date", | 425 | mu_scm_error (FUNC_NAME, status, "cannot get envelope date", |
426 | scm_list_1 (MESG)); | 426 | scm_list_1 (mesg)); |
427 | status = mu_parse_ctime_date_time (&sdate, &tm, &tz); | 427 | status = mu_parse_ctime_date_time (&sdate, &tm, &tz); |
428 | if (status) | 428 | if (status) |
429 | mu_scm_error (FUNC_NAME, status, "invalid envelope date", | 429 | 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 | ... | @@ -433,8 +433,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_envelope_date, "mu-message-get-envelope-da |
433 | #undef FUNC_NAME | 433 | #undef FUNC_NAME |
434 | 434 | ||
435 | SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, | 435 | SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, |
436 | (SCM MESG), | 436 | (SCM mesg), |
437 | "Returns email address of the sender of the message MESG.\n") | 437 | "Returns email address of the sender of the message @var{mesg}.\n") |
438 | #define FUNC_NAME s_scm_mu_message_get_sender | 438 | #define FUNC_NAME s_scm_mu_message_get_sender |
439 | { | 439 | { |
440 | mu_message_t msg; | 440 | mu_message_t msg; |
... | @@ -442,8 +442,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, | ... | @@ -442,8 +442,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, |
442 | int status; | 442 | int status; |
443 | SCM ret; | 443 | SCM ret; |
444 | 444 | ||
445 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 445 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
446 | msg = mu_scm_message_get (MESG); | 446 | msg = mu_scm_message_get (mesg); |
447 | status = mu_message_get_envelope (msg, &env); | 447 | status = mu_message_get_envelope (msg, &env); |
448 | if (status == 0) | 448 | if (status == 0) |
449 | { | 449 | { |
... | @@ -454,14 +454,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, | ... | @@ -454,14 +454,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, |
454 | else | 454 | else |
455 | mu_scm_error (FUNC_NAME, status, | 455 | mu_scm_error (FUNC_NAME, status, |
456 | "Cannot get envelope of message ~A", | 456 | "Cannot get envelope of message ~A", |
457 | scm_list_1 (MESG)); | 457 | scm_list_1 (mesg)); |
458 | return ret; | 458 | return ret; |
459 | } | 459 | } |
460 | #undef FUNC_NAME | 460 | #undef FUNC_NAME |
461 | 461 | ||
462 | SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, | 462 | SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, |
463 | (SCM MESG, SCM HEADER), | 463 | (SCM mesg, SCM header), |
464 | "Returns value of the header HEADER from the message MESG.\n") | 464 | "Returns value of the header @var{header} from the message @var{mesg}.\n") |
465 | #define FUNC_NAME s_scm_mu_message_get_header | 465 | #define FUNC_NAME s_scm_mu_message_get_header |
466 | { | 466 | { |
467 | mu_message_t msg; | 467 | mu_message_t msg; |
... | @@ -471,15 +471,15 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, | ... | @@ -471,15 +471,15 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, |
471 | SCM ret; | 471 | SCM ret; |
472 | int status; | 472 | int status; |
473 | 473 | ||
474 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 474 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
475 | msg = mu_scm_message_get (MESG); | 475 | msg = mu_scm_message_get (mesg); |
476 | SCM_ASSERT (scm_is_string (HEADER), HEADER, SCM_ARG2, FUNC_NAME); | 476 | SCM_ASSERT (scm_is_string (header), header, SCM_ARG2, FUNC_NAME); |
477 | status = mu_message_get_header (msg, &hdr); | 477 | status = mu_message_get_header (msg, &hdr); |
478 | if (status) | 478 | if (status) |
479 | mu_scm_error (FUNC_NAME, status, | 479 | mu_scm_error (FUNC_NAME, status, |
480 | "Cannot get message headers", SCM_BOOL_F); | 480 | "Cannot get message headers", SCM_BOOL_F); |
481 | 481 | ||
482 | header_string = scm_to_locale_string (HEADER); | 482 | header_string = scm_to_locale_string (header); |
483 | status = mu_header_aget_value (hdr, header_string, &value); | 483 | status = mu_header_aget_value (hdr, header_string, &value); |
484 | free (header_string); | 484 | free (header_string); |
485 | switch (status) | 485 | switch (status) |
... | @@ -496,7 +496,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, | ... | @@ -496,7 +496,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, |
496 | default: | 496 | default: |
497 | mu_scm_error (FUNC_NAME, status, | 497 | mu_scm_error (FUNC_NAME, status, |
498 | "Cannot get header ~A from message ~A", | 498 | "Cannot get header ~A from message ~A", |
499 | scm_list_2 (HEADER, MESG)); | 499 | scm_list_2 (header, mesg)); |
500 | } | 500 | } |
501 | 501 | ||
502 | return ret; | 502 | return ret; |
... | @@ -518,25 +518,23 @@ string_sloppy_member (SCM lst, char *name) | ... | @@ -518,25 +518,23 @@ string_sloppy_member (SCM lst, char *name) |
518 | } | 518 | } |
519 | 519 | ||
520 | SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, 1, 0, | 520 | SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, 1, 0, |
521 | (SCM MESG, SCM HEADERS), | 521 | (SCM mesg, SCM headers), |
522 | "Returns the list of headers in the message MESG. Optional argument\n" | 522 | "Returns list of headers in the message @var{mesg}. optional argument\n" |
523 | "HEADERS gives a list of header names to restrict return value to.\n") | 523 | "@var{headers} gives a list of header names to restrict return value to.\n") |
524 | #define FUNC_NAME s_scm_mu_message_get_header_fields | 524 | #define FUNC_NAME s_scm_mu_message_get_header_fields |
525 | { | 525 | { |
526 | size_t i, nfields = 0; | 526 | size_t i, nfields = 0; |
527 | mu_message_t msg; | 527 | mu_message_t msg; |
528 | mu_header_t hdr = NULL; | 528 | mu_header_t hdr = NULL; |
529 | SCM scm_first = SCM_EOL, scm_last = SCM_EOL; | 529 | SCM scm_first = SCM_EOL, scm_last = SCM_EOL; |
530 | SCM headers = SCM_EOL; | ||
531 | int status; | 530 | int status; |
532 | 531 | ||
533 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 532 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
534 | msg = mu_scm_message_get (MESG); | 533 | msg = mu_scm_message_get (mesg); |
535 | if (!SCM_UNBNDP (HEADERS)) | 534 | if (SCM_UNBNDP (headers)) |
536 | { | 535 | headers = SCM_EOL; |
537 | SCM_ASSERT (scm_is_pair (HEADERS), HEADERS, SCM_ARG2, FUNC_NAME); | 536 | else |
538 | headers = HEADERS; | 537 | SCM_ASSERT (scm_is_pair (headers), headers, SCM_ARG2, FUNC_NAME); |
539 | } | ||
540 | 538 | ||
541 | status = mu_message_get_header (msg, &hdr); | 539 | status = mu_message_get_header (msg, &hdr); |
542 | if (status) | 540 | if (status) |
... | @@ -556,7 +554,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel | ... | @@ -556,7 +554,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel |
556 | if (status) | 554 | if (status) |
557 | mu_scm_error (FUNC_NAME, status, | 555 | mu_scm_error (FUNC_NAME, status, |
558 | "Cannot get header field ~A, message ~A", | 556 | "Cannot get header field ~A, message ~A", |
559 | scm_list_2 (scm_from_size_t (i), MESG)); | 557 | scm_list_2 (scm_from_size_t (i), mesg)); |
560 | 558 | ||
561 | if (!scm_is_null (headers) && string_sloppy_member (headers, name) == 0) | 559 | if (!scm_is_null (headers) && string_sloppy_member (headers, name) == 0) |
562 | continue; | 560 | continue; |
... | @@ -564,7 +562,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel | ... | @@ -564,7 +562,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel |
564 | if (status) | 562 | if (status) |
565 | mu_scm_error (FUNC_NAME, status, | 563 | mu_scm_error (FUNC_NAME, status, |
566 | "Cannot get header value ~A, message ~A", | 564 | "Cannot get header value ~A, message ~A", |
567 | scm_list_2 (scm_from_size_t (i), MESG)); | 565 | scm_list_2 (scm_from_size_t (i), mesg)); |
568 | 566 | ||
569 | scm_name = scm_from_locale_string (name); | 567 | scm_name = scm_from_locale_string (name); |
570 | scm_value = scm_from_locale_string (value); | 568 | 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 | ... | @@ -584,29 +582,27 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_header_fields, "mu-message-get-header-fiel |
584 | #undef FUNC_NAME | 582 | #undef FUNC_NAME |
585 | 583 | ||
586 | SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fields", 2, 1, 0, | 584 | SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fields", 2, 1, 0, |
587 | (SCM MESG, SCM LIST, SCM REPLACE), | 585 | (SCM mesg, SCM list, SCM replace), |
588 | "Set the headers in the message MESG from LIST\n" | 586 | "Set headers in the message @var{mesg} to those listed in @var{list},\n" |
589 | "LIST is a list of conses (cons HEADER VALUE). The function sets\n" | 587 | "which is a list of conses @code{(cons @var{header} @var{value})}.\n\n" |
590 | "these headers in the message MESG.\n" | 588 | "Optional parameter @var{replace} specifies whether new header\n" |
591 | "Optional parameter REPLACE specifies whether the new header\n" | ||
592 | "values should replace the headers already present in the\n" | 589 | "values should replace the headers already present in the\n" |
593 | "message.") | 590 | "message.") |
594 | #define FUNC_NAME s_scm_mu_message_set_header_fields | 591 | #define FUNC_NAME s_scm_mu_message_set_header_fields |
595 | { | 592 | { |
596 | mu_message_t msg; | 593 | mu_message_t msg; |
597 | mu_header_t hdr; | 594 | mu_header_t hdr; |
598 | SCM list; | 595 | int repl = 0; |
599 | int replace = 0; | ||
600 | int status; | 596 | int status; |
601 | 597 | ||
602 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 598 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
603 | msg = mu_scm_message_get (MESG); | 599 | msg = mu_scm_message_get (mesg); |
604 | SCM_ASSERT (scm_is_null (LIST) || scm_is_pair (LIST), | 600 | SCM_ASSERT (scm_is_null (list) || scm_is_pair (list), |
605 | LIST, SCM_ARG2, FUNC_NAME); | 601 | list, SCM_ARG2, FUNC_NAME); |
606 | if (!SCM_UNBNDP (REPLACE)) | 602 | if (!SCM_UNBNDP (replace)) |
607 | { | 603 | { |
608 | SCM_ASSERT (scm_is_bool (REPLACE), REPLACE, SCM_ARG3, FUNC_NAME); | 604 | SCM_ASSERT (scm_is_bool (replace), replace, SCM_ARG3, FUNC_NAME); |
609 | replace = REPLACE == SCM_BOOL_T; | 605 | repl = replace == SCM_BOOL_T; |
610 | } | 606 | } |
611 | 607 | ||
612 | status = mu_message_get_header (msg, &hdr); | 608 | 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 | ... | @@ -614,7 +610,7 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel |
614 | mu_scm_error (FUNC_NAME, status, | 610 | mu_scm_error (FUNC_NAME, status, |
615 | "Cannot get message headers", SCM_BOOL_F); | 611 | "Cannot get message headers", SCM_BOOL_F); |
616 | 612 | ||
617 | for (list = LIST; !scm_is_null (list); list = SCM_CDR (list)) | 613 | for (; !scm_is_null (list); list = SCM_CDR (list)) |
618 | { | 614 | { |
619 | SCM cell = SCM_CAR (list); | 615 | SCM cell = SCM_CAR (list); |
620 | SCM car, cdr; | 616 | SCM car, cdr; |
... | @@ -627,13 +623,13 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel | ... | @@ -627,13 +623,13 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel |
627 | SCM_ASSERT (scm_is_string (cdr), cdr, SCM_ARGn, FUNC_NAME); | 623 | SCM_ASSERT (scm_is_string (cdr), cdr, SCM_ARGn, FUNC_NAME); |
628 | hdr_c = scm_to_locale_string (car); | 624 | hdr_c = scm_to_locale_string (car); |
629 | val_c = scm_to_locale_string (cdr); | 625 | val_c = scm_to_locale_string (cdr); |
630 | status = mu_header_set_value (hdr, hdr_c, val_c, replace); | 626 | status = mu_header_set_value (hdr, hdr_c, val_c, repl); |
631 | free (hdr_c); | 627 | free (hdr_c); |
632 | free (val_c); | 628 | free (val_c); |
633 | if (status) | 629 | if (status) |
634 | mu_scm_error (FUNC_NAME, status, | 630 | mu_scm_error (FUNC_NAME, status, |
635 | "Cannot set header value: message ~A, header ~A, value ~A", | 631 | "Cannot set header value: message ~A, header ~A, value ~A", |
636 | scm_list_3 (MESG, car, cdr)); | 632 | scm_list_3 (mesg, car, cdr)); |
637 | 633 | ||
638 | } | 634 | } |
639 | return SCM_UNSPECIFIED; | 635 | return SCM_UNSPECIFIED; |
... | @@ -641,10 +637,10 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel | ... | @@ -641,10 +637,10 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_header_fields, "mu-message-set-header-fiel |
641 | #undef FUNC_NAME | 637 | #undef FUNC_NAME |
642 | 638 | ||
643 | SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, | 639 | SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, |
644 | (SCM MESG, SCM FLAG), | 640 | (SCM mesg, SCM flag), |
645 | "Mark the message MESG as deleted. Optional argument FLAG allows to toggle\n" | 641 | "Mark message @var{mesg} as deleted. Optional argument @var{flag} allows to\n" |
646 | "deletion mark. The message is deleted if it is @code{#t} and undeleted if\n" | 642 | "toggle the deletion mark. The message is deleted if it is @code{#t} and\n" |
647 | "it is @code{#f}") | 643 | "undeleted if it is @code{#f}.") |
648 | #define FUNC_NAME s_scm_mu_message_delete | 644 | #define FUNC_NAME s_scm_mu_message_delete |
649 | { | 645 | { |
650 | mu_message_t msg; | 646 | mu_message_t msg; |
... | @@ -652,12 +648,12 @@ SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, | ... | @@ -652,12 +648,12 @@ SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, |
652 | int delete = 1; | 648 | int delete = 1; |
653 | int status; | 649 | int status; |
654 | 650 | ||
655 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 651 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
656 | msg = mu_scm_message_get (MESG); | 652 | msg = mu_scm_message_get (mesg); |
657 | if (!SCM_UNBNDP (FLAG)) | 653 | if (!SCM_UNBNDP (flag)) |
658 | { | 654 | { |
659 | SCM_ASSERT (scm_is_bool (FLAG), FLAG, SCM_ARG2, FUNC_NAME); | 655 | SCM_ASSERT (scm_is_bool (flag), flag, SCM_ARG2, FUNC_NAME); |
660 | delete = FLAG == SCM_BOOL_T; | 656 | delete = flag == SCM_BOOL_T; |
661 | } | 657 | } |
662 | status = mu_message_get_attribute (msg, &attr); | 658 | status = mu_message_get_attribute (msg, &attr); |
663 | if (status) | 659 | if (status) |
... | @@ -678,8 +674,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, | ... | @@ -678,8 +674,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, |
678 | #undef FUNC_NAME | 674 | #undef FUNC_NAME |
679 | 675 | ||
680 | SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0, | 676 | SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0, |
681 | (SCM MESG, SCM FLAG), | 677 | (SCM mesg, SCM flag), |
682 | "Return value of the attribute FLAG of the message MESG.") | 678 | "Return the value of the attribute @var{flag} of the message @var{mesg}.") |
683 | #define FUNC_NAME s_scm_mu_message_get_flag | 679 | #define FUNC_NAME s_scm_mu_message_get_flag |
684 | { | 680 | { |
685 | mu_message_t msg; | 681 | mu_message_t msg; |
... | @@ -687,16 +683,16 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0, | ... | @@ -687,16 +683,16 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0, |
687 | int ret = 0; | 683 | int ret = 0; |
688 | int status; | 684 | int status; |
689 | 685 | ||
690 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 686 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
691 | msg = mu_scm_message_get (MESG); | 687 | msg = mu_scm_message_get (mesg); |
692 | SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME); | 688 | SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME); |
693 | 689 | ||
694 | status = mu_message_get_attribute (msg, &attr); | 690 | status = mu_message_get_attribute (msg, &attr); |
695 | if (status) | 691 | if (status) |
696 | mu_scm_error (FUNC_NAME, status, | 692 | mu_scm_error (FUNC_NAME, status, |
697 | "Cannot get message attribute", SCM_BOOL_F); | 693 | "Cannot get message attribute", SCM_BOOL_F); |
698 | 694 | ||
699 | switch (scm_to_int32 (FLAG)) | 695 | switch (scm_to_int (flag)) |
700 | { | 696 | { |
701 | case MU_ATTRIBUTE_ANSWERED: | 697 | case MU_ATTRIBUTE_ANSWERED: |
702 | ret = mu_attribute_is_answered (attr); | 698 | 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, | ... | @@ -732,31 +728,31 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_flag, "mu-message-get-flag", 2, 0, 0, |
732 | 728 | ||
733 | default: | 729 | default: |
734 | mu_attribute_get_flags (attr, &ret); | 730 | mu_attribute_get_flags (attr, &ret); |
735 | ret &= scm_to_int32 (FLAG); | 731 | ret &= scm_to_int (flag); |
736 | } | 732 | } |
737 | return ret ? SCM_BOOL_T : SCM_BOOL_F; | 733 | return ret ? SCM_BOOL_T : SCM_BOOL_F; |
738 | } | 734 | } |
739 | #undef FUNC_NAME | 735 | #undef FUNC_NAME |
740 | 736 | ||
741 | SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0, | 737 | SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0, |
742 | (SCM MESG, SCM FLAG, SCM VALUE), | 738 | (SCM mesg, SCM flag, SCM value), |
743 | "Set the attribute FLAG of the message MESG. If optional VALUE is #f, the\n" | 739 | "Set the attribute @var{flag} in message @var{mesg}. If optional @var{value}\n" |
744 | "attribute is unset.") | 740 | "is @samp{#f}, the attribute is unset.\n") |
745 | #define FUNC_NAME s_scm_mu_message_set_flag | 741 | #define FUNC_NAME s_scm_mu_message_set_flag |
746 | { | 742 | { |
747 | mu_message_t msg; | 743 | mu_message_t msg; |
748 | mu_attribute_t attr; | 744 | mu_attribute_t attr; |
749 | int value = 1; | 745 | int val = 1; |
750 | int status; | 746 | int status; |
751 | 747 | ||
752 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 748 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
753 | msg = mu_scm_message_get (MESG); | 749 | msg = mu_scm_message_get (mesg); |
754 | SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME); | 750 | SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME); |
755 | 751 | ||
756 | if (!SCM_UNBNDP (VALUE)) | 752 | if (!SCM_UNBNDP (value)) |
757 | { | 753 | { |
758 | SCM_ASSERT (scm_is_bool (VALUE), VALUE, SCM_ARG3, FUNC_NAME); | 754 | SCM_ASSERT (scm_is_bool (value), value, SCM_ARG3, FUNC_NAME); |
759 | value = VALUE == SCM_BOOL_T; | 755 | val = value == SCM_BOOL_T; |
760 | } | 756 | } |
761 | 757 | ||
762 | status = mu_message_get_attribute (msg, &attr); | 758 | 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, | ... | @@ -765,67 +761,67 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0, |
765 | "Cannot get message attribute", SCM_BOOL_F); | 761 | "Cannot get message attribute", SCM_BOOL_F); |
766 | 762 | ||
767 | status = 0; | 763 | status = 0; |
768 | switch (scm_to_int32 (FLAG)) | 764 | switch (scm_to_int (flag)) |
769 | { | 765 | { |
770 | case MU_ATTRIBUTE_ANSWERED: | 766 | case MU_ATTRIBUTE_ANSWERED: |
771 | if (value) | 767 | if (val) |
772 | status = mu_attribute_set_answered (attr); | 768 | status = mu_attribute_set_answered (attr); |
773 | else | 769 | else |
774 | status = mu_attribute_unset_answered (attr); | 770 | status = mu_attribute_unset_answered (attr); |
775 | break; | 771 | break; |
776 | 772 | ||
777 | case MU_ATTRIBUTE_FLAGGED: | 773 | case MU_ATTRIBUTE_FLAGGED: |
778 | if (value) | 774 | if (val) |
779 | status = mu_attribute_set_flagged (attr); | 775 | status = mu_attribute_set_flagged (attr); |
780 | else | 776 | else |
781 | status = mu_attribute_unset_flagged (attr); | 777 | status = mu_attribute_unset_flagged (attr); |
782 | break; | 778 | break; |
783 | 779 | ||
784 | case MU_ATTRIBUTE_DELETED: | 780 | case MU_ATTRIBUTE_DELETED: |
785 | if (value) | 781 | if (val) |
786 | status = mu_attribute_set_deleted (attr); | 782 | status = mu_attribute_set_deleted (attr); |
787 | else | 783 | else |
788 | status = mu_attribute_unset_deleted (attr); | 784 | status = mu_attribute_unset_deleted (attr); |
789 | break; | 785 | break; |
790 | 786 | ||
791 | case MU_ATTRIBUTE_DRAFT: | 787 | case MU_ATTRIBUTE_DRAFT: |
792 | if (value) | 788 | if (val) |
793 | status = mu_attribute_set_draft (attr); | 789 | status = mu_attribute_set_draft (attr); |
794 | else | 790 | else |
795 | status = mu_attribute_unset_draft (attr); | 791 | status = mu_attribute_unset_draft (attr); |
796 | break; | 792 | break; |
797 | 793 | ||
798 | case MU_ATTRIBUTE_SEEN: | 794 | case MU_ATTRIBUTE_SEEN: |
799 | if (value) | 795 | if (val) |
800 | status = mu_attribute_set_seen (attr); | 796 | status = mu_attribute_set_seen (attr); |
801 | else | 797 | else |
802 | status = mu_attribute_unset_seen (attr); | 798 | status = mu_attribute_unset_seen (attr); |
803 | break; | 799 | break; |
804 | 800 | ||
805 | case MU_ATTRIBUTE_READ: | 801 | case MU_ATTRIBUTE_READ: |
806 | if (value) | 802 | if (val) |
807 | status = mu_attribute_set_read (attr); | 803 | status = mu_attribute_set_read (attr); |
808 | else | 804 | else |
809 | status = mu_attribute_unset_read (attr); | 805 | status = mu_attribute_unset_read (attr); |
810 | break; | 806 | break; |
811 | 807 | ||
812 | case MU_ATTRIBUTE_MODIFIED: | 808 | case MU_ATTRIBUTE_MODIFIED: |
813 | if (value) | 809 | if (val) |
814 | status = mu_attribute_set_modified (attr); | 810 | status = mu_attribute_set_modified (attr); |
815 | else | 811 | else |
816 | status = mu_attribute_clear_modified (attr); | 812 | status = mu_attribute_clear_modified (attr); |
817 | break; | 813 | break; |
818 | 814 | ||
819 | case MU_ATTRIBUTE_RECENT: | 815 | case MU_ATTRIBUTE_RECENT: |
820 | if (value) | 816 | if (val) |
821 | status = mu_attribute_set_recent (attr); | 817 | status = mu_attribute_set_recent (attr); |
822 | else | 818 | else |
823 | status = mu_attribute_unset_recent (attr); | 819 | status = mu_attribute_unset_recent (attr); |
824 | break; | 820 | break; |
825 | 821 | ||
826 | default: | 822 | default: |
827 | if (value) | 823 | if (val) |
828 | status = mu_attribute_set_flags (attr, scm_to_int32 (FLAG)); | 824 | status = mu_attribute_set_flags (attr, scm_to_int (flag)); |
829 | } | 825 | } |
830 | 826 | ||
831 | if (status) | 827 | if (status) |
... | @@ -837,31 +833,31 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0, | ... | @@ -837,31 +833,31 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0, |
837 | #undef FUNC_NAME | 833 | #undef FUNC_NAME |
838 | 834 | ||
839 | SCM_DEFINE_PUBLIC (scm_mu_message_get_user_flag, "mu-message-get-user-flag", 2, 0, 0, | 835 | SCM_DEFINE_PUBLIC (scm_mu_message_get_user_flag, "mu-message-get-user-flag", 2, 0, 0, |
840 | (SCM MESG, SCM FLAG), | 836 | (SCM mesg, SCM flag), |
841 | "Return the value of the user attribute FLAG from the message MESG.") | 837 | "Return value of the user-defined attribute @var{flag} from the message @var{mesg}.") |
842 | #define FUNC_NAME s_scm_mu_message_get_user_flag | 838 | #define FUNC_NAME s_scm_mu_message_get_user_flag |
843 | { | 839 | { |
844 | mu_message_t msg; | 840 | mu_message_t msg; |
845 | mu_attribute_t attr; | 841 | mu_attribute_t attr; |
846 | int status; | 842 | int status; |
847 | 843 | ||
848 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 844 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
849 | msg = mu_scm_message_get (MESG); | 845 | msg = mu_scm_message_get (mesg); |
850 | SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME); | 846 | SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME); |
851 | status = mu_message_get_attribute (msg, &attr); | 847 | status = mu_message_get_attribute (msg, &attr); |
852 | if (status) | 848 | if (status) |
853 | mu_scm_error (FUNC_NAME, status, | 849 | mu_scm_error (FUNC_NAME, status, |
854 | "Cannot get message attribute", SCM_BOOL_F); | 850 | "Cannot get message attribute", SCM_BOOL_F); |
855 | return mu_attribute_is_userflag (attr, scm_to_int32 (FLAG)) ? | 851 | return mu_attribute_is_userflag (attr, scm_to_int (flag)) ? |
856 | SCM_BOOL_T : SCM_BOOL_F; | 852 | SCM_BOOL_T : SCM_BOOL_F; |
857 | } | 853 | } |
858 | #undef FUNC_NAME | 854 | #undef FUNC_NAME |
859 | 855 | ||
860 | 856 | ||
861 | SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, 1, 0, | 857 | SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, 1, 0, |
862 | (SCM MESG, SCM FLAG, SCM VALUE), | 858 | (SCM mesg, SCM flag, SCM value), |
863 | "Set the given user attribute FLAG in the message MESG. If optional argumen\n" | 859 | "Set user-defined attribute @var{flag} in the message @var{mesg}.\n" |
864 | "VALUE is @samp{#f}, the attribute is unset.") | 860 | "If optional argumen @var{value} is @samp{#f}, the attribute is unset.") |
865 | #define FUNC_NAME s_scm_mu_message_set_user_flag | 861 | #define FUNC_NAME s_scm_mu_message_set_user_flag |
866 | { | 862 | { |
867 | mu_message_t msg; | 863 | mu_message_t msg; |
... | @@ -869,14 +865,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, | ... | @@ -869,14 +865,14 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, |
869 | int set = 1; | 865 | int set = 1; |
870 | int status; | 866 | int status; |
871 | 867 | ||
872 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 868 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
873 | msg = mu_scm_message_get (MESG); | 869 | msg = mu_scm_message_get (mesg); |
874 | SCM_ASSERT (scm_is_integer (FLAG), FLAG, SCM_ARG2, FUNC_NAME); | 870 | SCM_ASSERT (scm_is_integer (flag), flag, SCM_ARG2, FUNC_NAME); |
875 | 871 | ||
876 | if (!SCM_UNBNDP (VALUE)) | 872 | if (!SCM_UNBNDP (value)) |
877 | { | 873 | { |
878 | SCM_ASSERT (scm_is_bool (VALUE), VALUE, SCM_ARG3, FUNC_NAME); | 874 | SCM_ASSERT (scm_is_bool (value), value, SCM_ARG3, FUNC_NAME); |
879 | set = VALUE == SCM_BOOL_T; | 875 | set = value == SCM_BOOL_T; |
880 | } | 876 | } |
881 | 877 | ||
882 | status = mu_message_get_attribute (msg, &attr); | 878 | 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, | ... | @@ -885,19 +881,19 @@ SCM_DEFINE_PUBLIC (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, |
885 | "Cannot get message attribute", SCM_BOOL_F); | 881 | "Cannot get message attribute", SCM_BOOL_F); |
886 | 882 | ||
887 | if (set) | 883 | if (set) |
888 | mu_attribute_set_userflag (attr, scm_to_int32 (FLAG)); | 884 | mu_attribute_set_userflag (attr, scm_to_int (flag)); |
889 | else | 885 | else |
890 | mu_attribute_unset_userflag (attr, scm_to_int32 (FLAG)); | 886 | mu_attribute_unset_userflag (attr, scm_to_int (flag)); |
891 | return SCM_UNSPECIFIED; | 887 | return SCM_UNSPECIFIED; |
892 | } | 888 | } |
893 | #undef FUNC_NAME | 889 | #undef FUNC_NAME |
894 | 890 | ||
895 | SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, | 891 | SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, |
896 | (SCM MESG, SCM MODE, SCM FULL), | 892 | (SCM mesg, SCM mode, SCM full), |
897 | "Returns a port associated with the given MESG. MODE is a string\n" | 893 | "Returns a port associated with the message @var{mesg}. The @var{mode} is a\n" |
898 | "defining operation mode of the stream. It may contain any of the\n" | 894 | "string defining operation mode of the stream. It may contain any of the\n" |
899 | "two characters: @samp{r} for reading, @samp{w} for writing.\n" | 895 | "two characters: @samp{r} for reading, @samp{w} for writing.\n" |
900 | "If optional argument FULL is specified, it should be a boolean value.\n" | 896 | "If optional argument @var{full} is specified, it should be a boolean value.\n" |
901 | "If it is @samp{#t} then the returned port will allow access to any\n" | 897 | "If it is @samp{#t} then the returned port will allow access to any\n" |
902 | "part of the message (including headers). If it is @code{#f} then the port\n" | 898 | "part of the message (including headers). If it is @code{#f} then the port\n" |
903 | "accesses only the message body (the default).\n") | 899 | "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, | ... | @@ -909,15 +905,15 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, |
909 | char *str; | 905 | char *str; |
910 | SCM ret; | 906 | SCM ret; |
911 | 907 | ||
912 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 908 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
913 | SCM_ASSERT (scm_is_string (MODE), MODE, SCM_ARG2, FUNC_NAME); | 909 | SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME); |
914 | 910 | ||
915 | msg = mu_scm_message_get (MESG); | 911 | msg = mu_scm_message_get (mesg); |
916 | 912 | ||
917 | if (!SCM_UNBNDP (FULL)) | 913 | if (!SCM_UNBNDP (full)) |
918 | { | 914 | { |
919 | SCM_ASSERT (scm_is_bool (FULL), FULL, SCM_ARG3, FUNC_NAME); | 915 | SCM_ASSERT (scm_is_bool (full), full, SCM_ARG3, FUNC_NAME); |
920 | if (FULL == SCM_BOOL_T) | 916 | if (full == SCM_BOOL_T) |
921 | { | 917 | { |
922 | status = mu_message_get_stream (msg, &stream); | 918 | status = mu_message_get_stream (msg, &stream); |
923 | if (status) | 919 | if (status) |
... | @@ -940,8 +936,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, | ... | @@ -940,8 +936,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, |
940 | SCM_BOOL_F); | 936 | SCM_BOOL_F); |
941 | } | 937 | } |
942 | 938 | ||
943 | str = scm_to_locale_string (MODE); | 939 | str = scm_to_locale_string (mode); |
944 | ret = mu_port_make_from_stream (MESG, stream, scm_mode_bits (str)); | 940 | ret = mu_port_make_from_stream (mesg, stream, scm_mode_bits (str)); |
945 | free (str); | 941 | free (str); |
946 | return ret; | 942 | return ret; |
947 | } | 943 | } |
... | @@ -949,42 +945,42 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, | ... | @@ -949,42 +945,42 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, |
949 | 945 | ||
950 | 946 | ||
951 | SCM_DEFINE_PUBLIC (scm_mu_message_get_body, "mu-message-get-body", 1, 0, 0, | 947 | SCM_DEFINE_PUBLIC (scm_mu_message_get_body, "mu-message-get-body", 1, 0, 0, |
952 | (SCM MESG), | 948 | (SCM mesg), |
953 | "Returns the message body for the message MESG.") | 949 | "Returns message body for the message @var{mesg}.") |
954 | #define FUNC_NAME s_scm_mu_message_get_body | 950 | #define FUNC_NAME s_scm_mu_message_get_body |
955 | { | 951 | { |
956 | mu_message_t msg; | 952 | mu_message_t msg; |
957 | mu_body_t body = NULL; | 953 | mu_body_t body = NULL; |
958 | int status; | 954 | int status; |
959 | 955 | ||
960 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 956 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
961 | msg = mu_scm_message_get (MESG); | 957 | msg = mu_scm_message_get (mesg); |
962 | status = mu_message_get_body (msg, &body); | 958 | status = mu_message_get_body (msg, &body); |
963 | if (status) | 959 | if (status) |
964 | mu_scm_error (FUNC_NAME, status, "Cannot get message body", SCM_BOOL_F); | 960 | mu_scm_error (FUNC_NAME, status, "Cannot get message body", SCM_BOOL_F); |
965 | return mu_scm_body_create (MESG, body); | 961 | return mu_scm_body_create (mesg, body); |
966 | } | 962 | } |
967 | #undef FUNC_NAME | 963 | #undef FUNC_NAME |
968 | 964 | ||
969 | SCM_DEFINE_PUBLIC (scm_mu_message_multipart_p, "mu-message-multipart?", 1, 0, 0, | 965 | SCM_DEFINE_PUBLIC (scm_mu_message_multipart_p, "mu-message-multipart?", 1, 0, 0, |
970 | (SCM MESG), | 966 | (SCM mesg), |
971 | "Returns @code{#t} if MESG is a multipart @acronym{MIME} message.") | 967 | "Returns @code{#t} if @var{mesg} is a multipart @acronym{MIME} message.") |
972 | #define FUNC_NAME s_scm_mu_message_multipart_p | 968 | #define FUNC_NAME s_scm_mu_message_multipart_p |
973 | { | 969 | { |
974 | mu_message_t msg; | 970 | mu_message_t msg; |
975 | int ismime = 0; | 971 | int ismime = 0; |
976 | 972 | ||
977 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 973 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
978 | msg = mu_scm_message_get (MESG); | 974 | msg = mu_scm_message_get (mesg); |
979 | mu_message_is_multipart (msg, &ismime); | 975 | mu_message_is_multipart (msg, &ismime); |
980 | return ismime ? SCM_BOOL_T : SCM_BOOL_F; | 976 | return ismime ? SCM_BOOL_T : SCM_BOOL_F; |
981 | } | 977 | } |
982 | #undef FUNC_NAME | 978 | #undef FUNC_NAME |
983 | 979 | ||
984 | SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, 0, 0, | 980 | SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, 0, 0, |
985 | (SCM MESG), | 981 | (SCM mesg), |
986 | "Returns number of parts in a multipart @acronym{MIME} message. Returns\n" | 982 | "Returns number of parts in a multipart @acronym{MIME} message @var{mesg}.\n" |
987 | "@code{#f} if the argument is not a multipart message.") | 983 | "Returns @code{#f} if the argument is not a multipart message.") |
988 | #define FUNC_NAME s_scm_mu_message_get_num_parts | 984 | #define FUNC_NAME s_scm_mu_message_get_num_parts |
989 | { | 985 | { |
990 | mu_message_t msg; | 986 | mu_message_t msg; |
... | @@ -992,8 +988,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, | ... | @@ -992,8 +988,8 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, |
992 | size_t nparts = 0; | 988 | size_t nparts = 0; |
993 | int status; | 989 | int status; |
994 | 990 | ||
995 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 991 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
996 | msg = mu_scm_message_get (MESG); | 992 | msg = mu_scm_message_get (mesg); |
997 | mu_message_is_multipart (msg, &ismime); | 993 | mu_message_is_multipart (msg, &ismime); |
998 | if (!ismime) | 994 | if (!ismime) |
999 | return SCM_BOOL_F; | 995 | return SCM_BOOL_F; |
... | @@ -1002,58 +998,59 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, | ... | @@ -1002,58 +998,59 @@ SCM_DEFINE_PUBLIC (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, |
1002 | if (status) | 998 | if (status) |
1003 | mu_scm_error (FUNC_NAME, status, | 999 | mu_scm_error (FUNC_NAME, status, |
1004 | "Cannot get number of parts in the message ~A", | 1000 | "Cannot get number of parts in the message ~A", |
1005 | scm_list_1 (MESG)); | 1001 | scm_list_1 (mesg)); |
1006 | return scm_from_size_t (nparts); | 1002 | return scm_from_size_t (nparts); |
1007 | } | 1003 | } |
1008 | #undef FUNC_NAME | 1004 | #undef FUNC_NAME |
1009 | 1005 | ||
1010 | SCM_DEFINE_PUBLIC (scm_mu_message_get_part, "mu-message-get-part", 2, 0, 0, | 1006 | SCM_DEFINE_PUBLIC (scm_mu_message_get_part, "mu-message-get-part", 2, 0, 0, |
1011 | (SCM MESG, SCM PART), | 1007 | (SCM mesg, SCM part), |
1012 | "Returns part #PART from a multipart @acronym{MIME} message MESG.") | 1008 | "Returns part #@var{part} of a multipart @acronym{MIME} message @var{mesg}.") |
1013 | #define FUNC_NAME s_scm_mu_message_get_part | 1009 | #define FUNC_NAME s_scm_mu_message_get_part |
1014 | { | 1010 | { |
1015 | mu_message_t msg, submsg; | 1011 | mu_message_t msg, submsg; |
1016 | int ismime = 0; | 1012 | int ismime = 0; |
1017 | int status; | 1013 | int status; |
1018 | 1014 | ||
1019 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 1015 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
1020 | SCM_ASSERT (scm_is_integer (PART), PART, SCM_ARG2, FUNC_NAME); | 1016 | SCM_ASSERT (scm_is_integer (part), part, SCM_ARG2, FUNC_NAME); |
1021 | 1017 | ||
1022 | msg = mu_scm_message_get (MESG); | 1018 | msg = mu_scm_message_get (mesg); |
1023 | mu_message_is_multipart (msg, &ismime); | 1019 | mu_message_is_multipart (msg, &ismime); |
1024 | if (!ismime) | 1020 | if (!ismime) |
1025 | return SCM_BOOL_F; | 1021 | return SCM_BOOL_F; |
1026 | 1022 | ||
1027 | status = mu_message_get_part (msg, scm_to_int32 (PART), &submsg); | 1023 | status = mu_message_get_part (msg, scm_to_size_t (part), &submsg); |
1028 | if (status) | 1024 | if (status) |
1029 | mu_scm_error (FUNC_NAME, status, | 1025 | mu_scm_error (FUNC_NAME, status, |
1030 | "Cannot get number of part ~A from the message ~A", | 1026 | "Cannot get number of part ~A from the message ~A", |
1031 | scm_list_2 (PART, MESG)); | 1027 | scm_list_2 (part, mesg)); |
1032 | 1028 | ||
1033 | return mu_scm_message_create (MESG, submsg); | 1029 | return mu_scm_message_create (mesg, submsg); |
1034 | } | 1030 | } |
1035 | #undef FUNC_NAME | 1031 | #undef FUNC_NAME |
1036 | 1032 | ||
1037 | SCM_DEFINE_PUBLIC (scm_mu_message_send, "mu-message-send", 1, 3, 0, | 1033 | SCM_DEFINE_PUBLIC (scm_mu_message_send, "mu-message-send", 1, 3, 0, |
1038 | (SCM MESG, SCM MAILER, SCM FROM, SCM TO), | 1034 | (SCM mesg, SCM mailer, SCM from, SCM to), |
1039 | "Sends the message MESG. Optional MAILER overrides default mailer settings\n" | 1035 | "Sends message @var{mesg}. Optional @var{mailer} overrides default mailer\n" |
1040 | "in mu-mailer. Optional FROM and TO give sender and recever addresses.\n") | 1036 | "settings. Optional @var{from} and @var{to} give sender and recever\n" |
1037 | "addresses, respectively.\n") | ||
1041 | #define FUNC_NAME s_scm_mu_message_send | 1038 | #define FUNC_NAME s_scm_mu_message_send |
1042 | { | 1039 | { |
1043 | char *mailer_name; | 1040 | char *mailer_name; |
1044 | mu_address_t from = NULL; | 1041 | mu_address_t from_addr = NULL; |
1045 | mu_address_t to = NULL; | 1042 | mu_address_t to_addr = NULL; |
1046 | mu_mailer_t mailer = NULL; | 1043 | mu_mailer_t mailer_c = NULL; |
1047 | mu_message_t msg; | 1044 | mu_message_t msg; |
1048 | int status; | 1045 | int status; |
1049 | 1046 | ||
1050 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 1047 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
1051 | msg = mu_scm_message_get (MESG); | 1048 | msg = mu_scm_message_get (mesg); |
1052 | 1049 | ||
1053 | if (!SCM_UNBNDP (MAILER) && MAILER != SCM_BOOL_F) | 1050 | if (!SCM_UNBNDP (mailer) && mailer != SCM_BOOL_F) |
1054 | { | 1051 | { |
1055 | SCM_ASSERT (scm_is_string (MAILER), MAILER, SCM_ARG2, FUNC_NAME); | 1052 | SCM_ASSERT (scm_is_string (mailer), mailer, SCM_ARG2, FUNC_NAME); |
1056 | mailer_name = scm_to_locale_string (MAILER); | 1053 | mailer_name = scm_to_locale_string (mailer); |
1057 | } | 1054 | } |
1058 | else | 1055 | else |
1059 | { | 1056 | { |
... | @@ -1061,74 +1058,74 @@ SCM_DEFINE_PUBLIC (scm_mu_message_send, "mu-message-send", 1, 3, 0, | ... | @@ -1061,74 +1058,74 @@ SCM_DEFINE_PUBLIC (scm_mu_message_send, "mu-message-send", 1, 3, 0, |
1061 | mailer_name = scm_to_locale_string (val); | 1058 | mailer_name = scm_to_locale_string (val); |
1062 | } | 1059 | } |
1063 | 1060 | ||
1064 | if (!SCM_UNBNDP (FROM) && FROM != SCM_BOOL_F) | 1061 | if (!SCM_UNBNDP (from) && from != SCM_BOOL_F) |
1065 | { | 1062 | { |
1066 | char *s; | 1063 | char *s; |
1067 | int rc; | 1064 | int rc; |
1068 | 1065 | ||
1069 | SCM_ASSERT (scm_is_string (FROM), FROM, SCM_ARG3, FUNC_NAME); | 1066 | SCM_ASSERT (scm_is_string (from), from, SCM_ARG3, FUNC_NAME); |
1070 | s = scm_to_locale_string (FROM); | 1067 | s = scm_to_locale_string (from); |
1071 | rc = mu_address_create (&from, s); | 1068 | rc = mu_address_create (&from_addr, s); |
1072 | free (s); | 1069 | free (s); |
1073 | if (rc) | 1070 | if (rc) |
1074 | mu_scm_error (FUNC_NAME, rc, "cannot create address", | 1071 | mu_scm_error (FUNC_NAME, rc, "cannot create address", |
1075 | scm_list_1 (FROM)); | 1072 | scm_list_1 (from)); |
1076 | } | 1073 | } |
1077 | 1074 | ||
1078 | if (!SCM_UNBNDP (TO) && TO != SCM_BOOL_F) | 1075 | if (!SCM_UNBNDP (to) && to != SCM_BOOL_F) |
1079 | { | 1076 | { |
1080 | char *s; | 1077 | char *s; |
1081 | int rc; | 1078 | int rc; |
1082 | 1079 | ||
1083 | SCM_ASSERT (scm_is_string (TO), TO, SCM_ARG4, FUNC_NAME); | 1080 | SCM_ASSERT (scm_is_string (to), to, SCM_ARG4, FUNC_NAME); |
1084 | s = scm_to_locale_string (TO); | 1081 | s = scm_to_locale_string (to); |
1085 | rc = mu_address_create (&to, s); | 1082 | rc = mu_address_create (&to_addr, s); |
1086 | free (s); | 1083 | free (s); |
1087 | if (rc) | 1084 | if (rc) |
1088 | mu_scm_error (FUNC_NAME, rc, "cannot create address", | 1085 | mu_scm_error (FUNC_NAME, rc, "cannot create address", |
1089 | scm_list_1 (TO)); | 1086 | scm_list_1 (to)); |
1090 | } | 1087 | } |
1091 | 1088 | ||
1092 | status = mu_mailer_create (&mailer, mailer_name); | 1089 | status = mu_mailer_create (&mailer_c, mailer_name); |
1093 | free (mailer_name); | 1090 | free (mailer_name); |
1094 | if (status) | 1091 | if (status) |
1095 | mu_scm_error (FUNC_NAME, status, "Cannot get create mailer", SCM_BOOL_F); | 1092 | mu_scm_error (FUNC_NAME, status, "Cannot get create mailer", SCM_BOOL_F); |
1096 | 1093 | ||
1097 | if (scm_to_int32 (MU_SCM_SYMBOL_VALUE ("mu-debug"))) | 1094 | if (scm_to_int (MU_SCM_SYMBOL_VALUE ("mu-debug"))) |
1098 | { | 1095 | { |
1099 | mu_debug_t debug = NULL; | 1096 | mu_debug_t debug = NULL; |
1100 | mu_mailer_get_debug (mailer, &debug); | 1097 | mu_mailer_get_debug (mailer_c, &debug); |
1101 | mu_debug_set_level (debug, MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); | 1098 | mu_debug_set_level (debug, MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); |
1102 | } | 1099 | } |
1103 | 1100 | ||
1104 | status = mu_mailer_open (mailer, MU_STREAM_RDWR); | 1101 | status = mu_mailer_open (mailer_c, MU_STREAM_RDWR); |
1105 | if (status == 0) | 1102 | if (status == 0) |
1106 | { | 1103 | { |
1107 | status = mu_mailer_send_message (mailer, msg, from, to); | 1104 | status = mu_mailer_send_message (mailer_c, msg, from_addr, to_addr); |
1108 | if (status) | 1105 | if (status) |
1109 | mu_scm_error (FUNC_NAME, status, "Cannot send message", SCM_BOOL_F); | 1106 | mu_scm_error (FUNC_NAME, status, "Cannot send message", SCM_BOOL_F); |
1110 | 1107 | ||
1111 | mu_mailer_close (mailer); | 1108 | mu_mailer_close (mailer_c); |
1112 | } | 1109 | } |
1113 | else | 1110 | else |
1114 | mu_scm_error (FUNC_NAME, status, "Cannot open mailer", SCM_BOOL_F); | 1111 | mu_scm_error (FUNC_NAME, status, "Cannot open mailer", SCM_BOOL_F); |
1115 | mu_mailer_destroy (&mailer); | 1112 | mu_mailer_destroy (&mailer_c); |
1116 | 1113 | ||
1117 | return status == 0 ? SCM_BOOL_T : SCM_BOOL_F; | 1114 | return status == 0 ? SCM_BOOL_T : SCM_BOOL_F; |
1118 | } | 1115 | } |
1119 | #undef FUNC_NAME | 1116 | #undef FUNC_NAME |
1120 | 1117 | ||
1121 | SCM_DEFINE_PUBLIC (scm_mu_message_get_uid, "mu-message-get-uid", 1, 0, 0, | 1118 | SCM_DEFINE_PUBLIC (scm_mu_message_get_uid, "mu-message-get-uid", 1, 0, 0, |
1122 | (SCM MESG), | 1119 | (SCM mesg), |
1123 | "Returns uid of the message MESG\n") | 1120 | "Returns UID of the message @var{mesg}\n") |
1124 | #define FUNC_NAME s_scm_mu_message_get_uid | 1121 | #define FUNC_NAME s_scm_mu_message_get_uid |
1125 | { | 1122 | { |
1126 | mu_message_t msg; | 1123 | mu_message_t msg; |
1127 | int status; | 1124 | int status; |
1128 | size_t uid; | 1125 | size_t uid; |
1129 | 1126 | ||
1130 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 1127 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG1, FUNC_NAME); |
1131 | msg = mu_scm_message_get (MESG); | 1128 | msg = mu_scm_message_get (mesg); |
1132 | status = mu_message_get_uid (msg, &uid); | 1129 | status = mu_message_get_uid (msg, &uid); |
1133 | if (status) | 1130 | if (status) |
1134 | mu_scm_error (FUNC_NAME, status, "Cannot get message uid", SCM_BOOL_F); | 1131 | mu_scm_error (FUNC_NAME, status, "Cannot get message uid", SCM_BOOL_F); | ... | ... |
... | @@ -90,65 +90,66 @@ mu_scm_is_mime (SCM scm) | ... | @@ -90,65 +90,66 @@ mu_scm_is_mime (SCM scm) |
90 | /* Guile primitives */ | 90 | /* Guile primitives */ |
91 | 91 | ||
92 | SCM_DEFINE_PUBLIC (scm_mu_mime_create, "mu-mime-create", 0, 2, 0, | 92 | SCM_DEFINE_PUBLIC (scm_mu_mime_create, "mu-mime-create", 0, 2, 0, |
93 | (SCM FLAGS, SCM MESG), | 93 | (SCM flags, SCM mesg), |
94 | "Creates a new @acronym{MIME} object. Both arguments are optional.\n" | 94 | "Creates a new @acronym{MIME} object. Both arguments are optional.\n" |
95 | "FLAGS specifies the type of the object to create (@samp{0} is a reasonable\n" | 95 | "@var{Flags} specifies the type of the object to create (@samp{0} is a\n" |
96 | "value). MESG gives the message to create the @acronym{MIME} object from.") | 96 | "reasonable value). @var{mesg} gives the message to create the\n" |
97 | "@acronym{MIME} object from.") | ||
97 | #define FUNC_NAME s_scm_mu_mime_create | 98 | #define FUNC_NAME s_scm_mu_mime_create |
98 | { | 99 | { |
99 | mu_message_t msg = NULL; | 100 | mu_message_t msg = NULL; |
100 | mu_mime_t mime; | 101 | mu_mime_t mime; |
101 | int flags; | 102 | int fl; |
102 | int status; | 103 | int status; |
103 | 104 | ||
104 | if (scm_is_bool (FLAGS)) | 105 | if (scm_is_bool (flags)) |
105 | { | 106 | { |
106 | /*if (FLAGS == SCM_BOOL_F)*/ | 107 | /*if (flags == SCM_BOOL_F)*/ |
107 | flags = 0; | 108 | fl = 0; |
108 | } | 109 | } |
109 | else | 110 | else |
110 | { | 111 | { |
111 | SCM_ASSERT (scm_is_integer (FLAGS), FLAGS, SCM_ARG1, FUNC_NAME); | 112 | SCM_ASSERT (scm_is_integer (flags), flags, SCM_ARG1, FUNC_NAME); |
112 | flags = scm_to_int32 (FLAGS); | 113 | fl = scm_to_int (flags); |
113 | } | 114 | } |
114 | 115 | ||
115 | if (!SCM_UNBNDP (MESG)) | 116 | if (!SCM_UNBNDP (mesg)) |
116 | { | 117 | { |
117 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME); | 118 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME); |
118 | msg = mu_scm_message_get (MESG); | 119 | msg = mu_scm_message_get (mesg); |
119 | } | 120 | } |
120 | 121 | ||
121 | status = mu_mime_create (&mime, msg, flags); | 122 | status = mu_mime_create (&mime, msg, fl); |
122 | if (status) | 123 | if (status) |
123 | mu_scm_error (FUNC_NAME, status, | 124 | mu_scm_error (FUNC_NAME, status, |
124 | "Cannot create MIME object", SCM_BOOL_F); | 125 | "Cannot create MIME object", SCM_BOOL_F); |
125 | 126 | ||
126 | return mu_scm_mime_create (MESG, mime); | 127 | return mu_scm_mime_create (mesg, mime); |
127 | } | 128 | } |
128 | #undef FUNC_NAME | 129 | #undef FUNC_NAME |
129 | 130 | ||
130 | SCM_DEFINE_PUBLIC (scm_mu_mime_multipart_p, "mu-mime-multipart?", 1, 0, 0, | 131 | SCM_DEFINE_PUBLIC (scm_mu_mime_multipart_p, "mu-mime-multipart?", 1, 0, 0, |
131 | (SCM MIME), | 132 | (SCM mime), |
132 | "Returns @code{#t} if MIME is a multipart object.\n") | 133 | "Returns @code{#t} if @var{mime} is a multipart object.\n") |
133 | #define FUNC_NAME s_scm_mu_mime_multipart_p | 134 | #define FUNC_NAME s_scm_mu_mime_multipart_p |
134 | { | 135 | { |
135 | SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); | 136 | SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME); |
136 | return mu_mime_is_multipart (mu_scm_mime_get (MIME)) ? SCM_BOOL_T : SCM_BOOL_F; | 137 | return mu_mime_is_multipart (mu_scm_mime_get (mime)) ? SCM_BOOL_T : SCM_BOOL_F; |
137 | } | 138 | } |
138 | #undef FUNC_NAME | 139 | #undef FUNC_NAME |
139 | 140 | ||
140 | SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0, | 141 | SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0, |
141 | (SCM MIME), | 142 | (SCM mime), |
142 | "Returns number of parts in the @sc{mime} object MIME.") | 143 | "Returns number of parts in the @acronym{MIME} object @var{mime}.") |
143 | #define FUNC_NAME s_scm_mu_mime_get_num_parts | 144 | #define FUNC_NAME s_scm_mu_mime_get_num_parts |
144 | { | 145 | { |
145 | mu_mime_t mime; | 146 | mu_mime_t mimeobj; |
146 | size_t nparts; | 147 | size_t nparts; |
147 | int status; | 148 | int status; |
148 | 149 | ||
149 | SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); | 150 | SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME); |
150 | mime = mu_scm_mime_get (MIME); | 151 | mimeobj = mu_scm_mime_get (mime); |
151 | status = mu_mime_get_num_parts (mime, &nparts); | 152 | status = mu_mime_get_num_parts (mimeobj, &nparts); |
152 | if (status) | 153 | if (status) |
153 | mu_scm_error (FUNC_NAME, status, | 154 | mu_scm_error (FUNC_NAME, status, |
154 | "Cannot count MIME parts", SCM_BOOL_F); | 155 | "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, | ... | @@ -157,71 +158,71 @@ SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0, |
157 | #undef FUNC_NAME | 158 | #undef FUNC_NAME |
158 | 159 | ||
159 | SCM_DEFINE_PUBLIC (scm_mu_mime_get_part, "mu-mime-get-part", 2, 0, 0, | 160 | SCM_DEFINE_PUBLIC (scm_mu_mime_get_part, "mu-mime-get-part", 2, 0, 0, |
160 | (SCM MIME, SCM NUM), | 161 | (SCM mime, SCM num), |
161 | "Returns NUMth part from the @sc{mime} object MIME.") | 162 | "Returns @var{num}th part from the @acronym{MIME} object @var{mime}.") |
162 | #define FUNC_NAME s_scm_mu_mime_get_part | 163 | #define FUNC_NAME s_scm_mu_mime_get_part |
163 | { | 164 | { |
164 | mu_message_t msg = NULL; | 165 | mu_message_t msg = NULL; |
165 | int status; | 166 | int status; |
166 | 167 | ||
167 | SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); | 168 | SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME); |
168 | SCM_ASSERT (scm_is_integer (NUM), NUM, SCM_ARG2, FUNC_NAME); | 169 | SCM_ASSERT (scm_is_integer (num), num, SCM_ARG2, FUNC_NAME); |
169 | 170 | ||
170 | status = mu_mime_get_part (mu_scm_mime_get (MIME), | 171 | status = mu_mime_get_part (mu_scm_mime_get (mime), |
171 | scm_to_int32 (NUM), &msg); | 172 | scm_to_int (num), &msg); |
172 | if (status) | 173 | if (status) |
173 | mu_scm_error (FUNC_NAME, status, | 174 | mu_scm_error (FUNC_NAME, status, |
174 | "Cannot get part ~A from MIME object ~A", | 175 | "Cannot get part ~A from MIME object ~A", |
175 | scm_list_2 (NUM, MIME)); | 176 | scm_list_2 (num, mime)); |
176 | 177 | ||
177 | return mu_scm_message_create (MIME, msg); | 178 | return mu_scm_message_create (mime, msg); |
178 | } | 179 | } |
179 | #undef FUNC_NAME | 180 | #undef FUNC_NAME |
180 | 181 | ||
181 | SCM_DEFINE_PUBLIC (scm_mu_mime_add_part, "mu-mime-add-part", 2, 0, 0, | 182 | SCM_DEFINE_PUBLIC (scm_mu_mime_add_part, "mu-mime-add-part", 2, 0, 0, |
182 | (SCM MIME, SCM MESG), | 183 | (SCM mime, SCM mesg), |
183 | "Adds MESG to the @sc{mime} object MIME.") | 184 | "Adds message @var{mesg} to the @acronym{MIME} object @var{mime}.") |
184 | #define FUNC_NAME s_scm_mu_mime_add_part | 185 | #define FUNC_NAME s_scm_mu_mime_add_part |
185 | { | 186 | { |
186 | mu_mime_t mime; | 187 | mu_mime_t mimeobj; |
187 | mu_message_t msg; | 188 | mu_message_t msg; |
188 | int status; | 189 | int status; |
189 | 190 | ||
190 | SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); | 191 | SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME); |
191 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME); | 192 | SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME); |
192 | mime = mu_scm_mime_get (MIME); | 193 | mimeobj = mu_scm_mime_get (mime); |
193 | msg = mu_scm_message_get (MESG); | 194 | msg = mu_scm_message_get (mesg); |
194 | 195 | ||
195 | status = mu_mime_add_part (mime, msg); | 196 | status = mu_mime_add_part (mimeobj, msg); |
196 | if (status) | 197 | if (status) |
197 | mu_scm_error (FUNC_NAME, status, | 198 | mu_scm_error (FUNC_NAME, status, |
198 | "Cannot add new part to MIME object ~A", | 199 | "Cannot add new part to MIME object ~A", |
199 | scm_list_1 (MIME)); | 200 | scm_list_1 (mime)); |
200 | 201 | ||
201 | mu_scm_message_add_owner (MESG, MIME); | 202 | mu_scm_message_add_owner (mesg, mime); |
202 | 203 | ||
203 | return SCM_BOOL_T; | 204 | return SCM_BOOL_T; |
204 | } | 205 | } |
205 | #undef FUNC_NAME | 206 | #undef FUNC_NAME |
206 | 207 | ||
207 | SCM_DEFINE_PUBLIC (scm_mu_mime_get_message, "mu-mime-get-message", 1, 0, 0, | 208 | SCM_DEFINE_PUBLIC (scm_mu_mime_get_message, "mu-mime-get-message", 1, 0, 0, |
208 | (SCM MIME), | 209 | (SCM mime), |
209 | "Converts @sc{mime} object MIME to a message.\n") | 210 | "Converts @acronym{MIME} object @var{mime} to a message.\n") |
210 | #define FUNC_NAME s_scm_mu_mime_get_message | 211 | #define FUNC_NAME s_scm_mu_mime_get_message |
211 | { | 212 | { |
212 | mu_mime_t mime; | 213 | mu_mime_t mimeobj; |
213 | mu_message_t msg; | 214 | mu_message_t msg; |
214 | int status; | 215 | int status; |
215 | 216 | ||
216 | SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); | 217 | SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME); |
217 | mime = mu_scm_mime_get (MIME); | 218 | mimeobj = mu_scm_mime_get (mime); |
218 | status = mu_mime_get_message (mime, &msg); | 219 | status = mu_mime_get_message (mimeobj, &msg); |
219 | if (status) | 220 | if (status) |
220 | mu_scm_error (FUNC_NAME, status, | 221 | mu_scm_error (FUNC_NAME, status, |
221 | "Cannot get message from MIME object ~A", | 222 | "Cannot get message from MIME object ~A", |
222 | scm_list_1 (MIME)); | 223 | scm_list_1 (mime)); |
223 | 224 | ||
224 | return mu_scm_message_create (MIME, msg); | 225 | return mu_scm_message_create (mime, msg); |
225 | } | 226 | } |
226 | #undef FUNC_NAME | 227 | #undef FUNC_NAME |
227 | 228 | ... | ... |
... | @@ -89,7 +89,7 @@ register_format (const char *name) | ... | @@ -89,7 +89,7 @@ register_format (const char *name) |
89 | 89 | ||
90 | 90 | ||
91 | SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, | 91 | SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, |
92 | (SCM REST), | 92 | (SCM rest), |
93 | "Registers desired mailutils formats. Any number of arguments can be given.\n" | 93 | "Registers desired mailutils formats. Any number of arguments can be given.\n" |
94 | "Each argument must be one of the following strings:\n\n" | 94 | "Each argument must be one of the following strings:\n\n" |
95 | "@multitable @columnfractions 0.3 0.6\n" | 95 | "@multitable @columnfractions 0.3 0.6\n" |
... | @@ -108,7 +108,7 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, | ... | @@ -108,7 +108,7 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, |
108 | { | 108 | { |
109 | int status; | 109 | int status; |
110 | 110 | ||
111 | if (scm_is_null (REST)) | 111 | if (scm_is_null (rest)) |
112 | { | 112 | { |
113 | status = register_format (NULL); | 113 | status = register_format (NULL); |
114 | if (status) | 114 | if (status) |
... | @@ -118,10 +118,10 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, | ... | @@ -118,10 +118,10 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, |
118 | } | 118 | } |
119 | else | 119 | else |
120 | { | 120 | { |
121 | for (; !scm_is_null (REST); REST = SCM_CDR (REST)) | 121 | for (; !scm_is_null (rest); rest = SCM_CDR (rest)) |
122 | { | 122 | { |
123 | char *s; | 123 | char *s; |
124 | SCM scm = SCM_CAR (REST); | 124 | SCM scm = SCM_CAR (rest); |
125 | SCM_ASSERT (scm_is_string (scm), scm, SCM_ARGn, FUNC_NAME); | 125 | SCM_ASSERT (scm_is_string (scm), scm, SCM_ARGn, FUNC_NAME); |
126 | s = scm_to_locale_string (scm); | 126 | s = scm_to_locale_string (scm); |
127 | status = register_format (s); | 127 | status = register_format (s); |
... | @@ -137,13 +137,13 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, | ... | @@ -137,13 +137,13 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, |
137 | #undef FUNC_NAME | 137 | #undef FUNC_NAME |
138 | 138 | ||
139 | SCM_DEFINE_PUBLIC (scm_mu_strerror, "mu-strerror", 1, 0, 0, | 139 | SCM_DEFINE_PUBLIC (scm_mu_strerror, "mu-strerror", 1, 0, 0, |
140 | (SCM ERR), | 140 | (SCM err), |
141 | "Return the error message corresponding to ERR, which must be\n" | 141 | "Return the error message corresponding to @var{err}, which must be\n" |
142 | "an integer value.\n") | 142 | "an integer value.\n") |
143 | #define FUNC_NAME s_scm_mu_strerror | 143 | #define FUNC_NAME s_scm_mu_strerror |
144 | { | 144 | { |
145 | SCM_ASSERT (scm_is_integer (ERR), ERR, SCM_ARG1, FUNC_NAME); | 145 | SCM_ASSERT (scm_is_integer (err), err, SCM_ARG1, FUNC_NAME); |
146 | return scm_from_locale_string (mu_strerror (scm_to_int (ERR))); | 146 | return scm_from_locale_string (mu_strerror (scm_to_int (err))); |
147 | } | 147 | } |
148 | #undef FUNC_NAME | 148 | #undef FUNC_NAME |
149 | 149 | ... | ... |
... | @@ -20,8 +20,8 @@ | ... | @@ -20,8 +20,8 @@ |
20 | #include "mu_scm.h" | 20 | #include "mu_scm.h" |
21 | 21 | ||
22 | SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, | 22 | SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, |
23 | (SCM USER), | 23 | (SCM user), |
24 | "Look up an entry in the user database. USER can be an integer,\n" | 24 | "Look up an entry in the user database. @var{User} can be an integer,\n" |
25 | "or a string, giving the behaviour of @code{mu_get_auth_by_uid} or\n" | 25 | "or a string, giving the behaviour of @code{mu_get_auth_by_uid} or\n" |
26 | "@code{mu_get_auth_by_name} respectively.\n" | 26 | "@code{mu_get_auth_by_name} respectively.\n" |
27 | "\n" | 27 | "\n" |
... | @@ -39,16 +39,16 @@ SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, | ... | @@ -39,16 +39,16 @@ SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, |
39 | &handle, | 39 | &handle, |
40 | NULL, NULL); | 40 | NULL, NULL); |
41 | 41 | ||
42 | if (scm_is_integer (USER)) | 42 | if (scm_is_integer (user)) |
43 | { | 43 | { |
44 | entry = mu_get_auth_by_uid (scm_to_int32 (USER)); | 44 | entry = mu_get_auth_by_uid (scm_to_int (user)); |
45 | } | 45 | } |
46 | else | 46 | else |
47 | { | 47 | { |
48 | char *s; | 48 | char *s; |
49 | 49 | ||
50 | SCM_VALIDATE_STRING (1, USER); | 50 | SCM_VALIDATE_STRING (1, user); |
51 | s = scm_to_locale_string (USER); | 51 | s = scm_to_locale_string (user); |
52 | entry = mu_get_auth_by_name (s); | 52 | entry = mu_get_auth_by_name (s); |
53 | free (s); | 53 | free (s); |
54 | } | 54 | } | ... | ... |
-
Please register or sign in to post a comment