aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-12-29 00:41:36 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2010-12-29 00:41:36 +0200
commitbb242e454d5cf8b0c6bb1ca5d009ec18e86c0c2b (patch)
treeb8774822f727c02f6243fdb0934f54a4d9468287
parent8b95dd9319aa0b3847b8b4baf99a90258c25051a (diff)
downloadwydawca-bb242e454d5cf8b0c6bb1ca5d009ec18e86c0c2b.tar.gz
wydawca-bb242e454d5cf8b0c6bb1ca5d009ec18e86c0c2b.tar.bz2
Switch to Mailutils 3.x
-rw-r--r--src/config.c8
-rw-r--r--src/mail.c78
2 files changed, 33 insertions, 53 deletions
diff --git a/src/config.c b/src/config.c
index e46c2f5..9c75df6 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1154,10 +1154,2 @@ cb_url (enum grecs_callback_command cmd,
}
- rc = mu_url_parse (url);
- if (rc)
- {
- grecs_error (locus, 0, _("cannot parse URL `%s': %s"),
- value->v.string, mu_strerror (rc));
- mu_url_destroy (&url);
- return rc;
- }
*purl = url;
diff --git a/src/mail.c b/src/mail.c
index 39dfe08..afcf29e 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -48,8 +48,2 @@ mail_init ()
-struct mu_stream_handle
-{
- mu_stream_t str;
- mu_off_t off;
-};
-
static ssize_t
@@ -57,3 +51,3 @@ mu_stream_data_read_cb (void *handle, void *buffer, size_t size)
{
- struct mu_stream_handle *mhp = handle;
+ mu_stream_t str = handle;
size_t nread;
@@ -61,3 +55,3 @@ mu_stream_data_read_cb (void *handle, void *buffer, size_t size)
- rc = mu_stream_read (mhp->str, buffer, size, mhp->off, &nread);
+ rc = mu_stream_read (str, buffer, size, &nread);
if (rc)
@@ -68,4 +62,2 @@ mu_stream_data_read_cb (void *handle, void *buffer, size_t size)
}
-
- mhp->off += nread;
return nread;
@@ -182,4 +174,3 @@ sign_message (mu_message_t *pmsg, const char *key)
mu_header_t hdr;
- struct mu_stream_handle mhn;
- mu_stream_t istr, ostr;
+ mu_stream_t istr, ostr, bodystr;
int rc;
@@ -209,3 +200,3 @@ sign_message (mu_message_t *pmsg, const char *key)
- if ((rc = mu_body_get_stream (body, &mhn.str)))
+ if ((rc = mu_body_get_streamref (body, &bodystr)))
{
@@ -215,5 +206,2 @@ sign_message (mu_message_t *pmsg, const char *key)
- mu_stream_seek (mhn.str, 0, SEEK_SET);
- mhn.off = 0;
-
memset (&cbs, 0, sizeof (cbs));
@@ -221,3 +209,3 @@ sign_message (mu_message_t *pmsg, const char *key)
- err = gpgme_data_new_from_cbs (&input, &cbs, &mhn);
+ err = gpgme_data_new_from_cbs (&input, &cbs, &bodystr);
if (err)
@@ -230,2 +218,3 @@ sign_message (mu_message_t *pmsg, const char *key)
rc = gpg_sign (&output, input, key);
+ mu_stream_unref (bodystr);
if (rc)
@@ -240,3 +229,3 @@ sign_message (mu_message_t *pmsg, const char *key)
mu_message_create (&newmsg, NULL);
- mu_message_get_stream (newmsg, &ostr);
+ mu_message_get_streamref (newmsg, &ostr);
@@ -244,17 +233,8 @@ sign_message (mu_message_t *pmsg, const char *key)
mu_message_get_header (msg, &hdr);
- mu_header_get_stream (hdr, &istr);
- mu_stream_seek (istr, 0, SEEK_SET);
- while ((rc = mu_stream_sequential_getline (istr, &buf, &size, &nread)) == 0
- && nread)
- {
- rc = mu_stream_sequential_write (ostr, buf, nread);
- if (rc)
- {
- logmsg (LOG_ERR, "mu_stream_sequential_write: %s",
- mu_strerror (rc));
- break;
- }
- }
+ mu_header_get_streamref (hdr, &istr);
- if (rc == 0)
+ rc = mu_stream_copy (ostr, istr, 0, NULL);
+ if (rc)
+ logmsg (LOG_ERR, "mu_stream_copy: %s", mu_strerror (rc));
+ else
{
@@ -262,7 +242,6 @@ sign_message (mu_message_t *pmsg, const char *key)
{
- rc = mu_stream_sequential_write (ostr, buf, nread);
+ rc = mu_stream_write (ostr, buf, nread, NULL);
if (rc)
{
- logmsg (LOG_ERR, "mu_stream_sequential_write: %s",
- mu_strerror (rc));
+ logmsg (LOG_ERR, "mu_stream_write: %s", mu_strerror (rc));
break;
@@ -277,2 +256,4 @@ sign_message (mu_message_t *pmsg, const char *key)
}
+ mu_stream_unref (istr);
+ mu_stream_unref (ostr);
@@ -294,3 +275,2 @@ mail_send_message (mu_address_t rcpt, const char *text,
mu_header_t hdr;
- int mailer_flags = 0;
static char *x_mailer = "wydawca (" PACKAGE_STRING ")";
@@ -299,7 +279,11 @@ mail_send_message (mu_address_t rcpt, const char *text,
const char *sval;
-
- mu_message_create (&msg, NULL);
- mu_message_get_stream (msg, &stream);
- mu_stream_write (stream, text, strlen (text), 0, NULL);
+ mu_static_memory_stream_create (&stream, text, strlen (text));
+ rc = mu_stream_to_message (stream, &msg);
+ mu_stream_unref (stream);
+ if (rc)
+ {
+ logmsg (LOG_CRIT, _("cannot create message: %s"), mu_strerror (rc));
+ return;
+ }
mu_message_get_header (msg, &hdr);
@@ -328,7 +312,10 @@ mail_send_message (mu_address_t rcpt, const char *text,
{
- mu_debug_t debug;
- mu_mailer_get_debug (mailer, &debug);
- mu_debug_set_level (debug, MU_DEBUG_TRACE | MU_DEBUG_PROT);
+ mu_debug_level_t level;
+
+ mu_debug_get_category_level (MU_DEBCAT_MAILER, &level);
+ level |= MU_DEBUG_LEVEL_MASK (MU_DEBUG_TRACE0) |
+ MU_DEBUG_LEVEL_MASK (MU_DEBUG_PROT);
if (debug_level > 2)
- mailer_flags = MAILER_FLAG_DEBUG_DATA;
+ level |= MU_DEBUG_LEVEL_MASK (MU_DEBUG_TRACE7);
+ mu_debug_set_category_level (MU_DEBCAT_MAILER, level);
}
@@ -337,3 +324,3 @@ mail_send_message (mu_address_t rcpt, const char *text,
{
- if ((rc = mu_mailer_open (mailer, mailer_flags)))
+ if ((rc = mu_mailer_open (mailer, 0)))
{
@@ -732 +719,2 @@ expand_email_owner (struct metadef *def, void *data)
}
+

Return to:

Send suggestions and report system problems to the System administrator.