[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Mailutils branch, master, updated. release-2.2-151-gf50c5d1
From: |
Sergey Poznyakoff |
Subject: |
[SCM] GNU Mailutils branch, master, updated. release-2.2-151-gf50c5d1 |
Date: |
Tue, 19 Oct 2010 19:21:23 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=f50c5d11f2775f11cb450c97008f9fa4b9e39fa1
The branch, master has been updated
via f50c5d11f2775f11cb450c97008f9fa4b9e39fa1 (commit)
from 2f6f7b4fc2230352e8ff742b9999672dec35236b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f50c5d11f2775f11cb450c97008f9fa4b9e39fa1
Author: Sergey Poznyakoff <address@hidden>
Date: Tue Oct 19 22:13:48 2010 +0300
Provide an easy way of setting sender/recipient addresses in smtp URLs.
* libmailutils/mailer/mailer.c (_set_from): Parameter from=
can be used to set the sender address explicitly.
(_set_to): New function. Parameter to= sets recipient
addresses explicitly.
(create_part): Use _set_to.
* libproto/mailer/mbox.c (remote_mbox_append_message): Use the
to= parameter.
-----------------------------------------------------------------------
Summary of changes:
libmailutils/mailer/mailer.c | 71 +++++++++++++++++++++++++++++++++++------
libproto/mailer/mbox.c | 2 +-
2 files changed, 61 insertions(+), 12 deletions(-)
diff --git a/libmailutils/mailer/mailer.c b/libmailutils/mailer/mailer.c
index 0ab690d..59559eb 100644
--- a/libmailutils/mailer/mailer.c
+++ b/libmailutils/mailer/mailer.c
@@ -338,25 +338,33 @@ _set_from (mu_address_t *pfrom, mu_message_t msg,
mu_address_t from,
{
int status = 0;
- /* Get MAIL_FROM from FROM, the message, or the environment. */
+ *pfrom = NULL;
+
+ /* Get MAIL_FROM from URL, envelope, headers, or the environment. */
if (!from)
{
const char *type;
mu_envelope_t env;
const char *mail_from;
- status = mu_message_get_envelope (msg, &env);
- if (status)
- return status;
+ status = mu_url_sget_param (mailer->url, "from", &mail_from);
- status = mu_envelope_sget_sender (env, &mail_from);
if (status)
{
- mu_header_t header;
- status = mu_message_get_header (msg, &header);
+ status = mu_message_get_envelope (msg, &env);
if (status)
return status;
- status = mu_header_sget_value (header, MU_HEADER_FROM, &mail_from);
+
+ status = mu_envelope_sget_sender (env, &mail_from);
+ if (status)
+ {
+ mu_header_t header;
+ status = mu_message_get_header (msg, &header);
+ if (status)
+ return status;
+ status = mu_header_sget_value (header, MU_HEADER_FROM,
+ &mail_from);
+ }
}
switch (status)
@@ -395,13 +403,47 @@ _set_from (mu_address_t *pfrom, mu_message_t msg,
mu_address_t from,
}
status = mu_address_create (pfrom, mail_from);
}
- else
- *pfrom = NULL;
return status;
}
static int
+_set_to (mu_address_t *paddr, mu_message_t msg, mu_address_t to,
+ mu_mailer_t mailer)
+{
+ int status = 0;
+
+ *paddr = NULL;
+ if (!to)
+ {
+ const char *rcpt_to;
+
+ status = mu_url_sget_param (mailer->url, "to", &rcpt_to);
+ switch (status)
+ {
+ case 0:
+ break;
+
+ case MU_ERR_NOENT:
+ /* FIXME: Get it from the message itself, at least if the
+ mailer is not SENDMAIL. */
+ return 0;
+
+ default:
+ return status;
+ }
+ MU_DEBUG1 (mailer->debug, MU_DEBUG_TRACE,
+ "mu_mailer_send_message(): using RCPT TO: %s\n",
+ rcpt_to);
+ status = mu_address_create (paddr, rcpt_to);
+ }
+
+ return status;
+}
+
+
+
+static int
create_part (mu_mime_t mime, mu_stream_t istr,
size_t fragsize, size_t n, size_t nparts, char *msgid)
{
@@ -536,7 +578,7 @@ mu_mailer_send_fragments (mu_mailer_t mailer,
mu_address_t from, mu_address_t to)
{
int status;
- mu_address_t sender_addr = NULL;
+ mu_address_t sender_addr = NULL, rcpt_addr = NULL;
if (mailer == NULL)
return EINVAL;
@@ -548,6 +590,12 @@ mu_mailer_send_fragments (mu_mailer_t mailer,
return status;
if (sender_addr)
from = sender_addr;
+
+ status = _set_to (&rcpt_addr, msg, from, mailer);
+ if (status)
+ return status;
+ if (rcpt_addr)
+ to = rcpt_addr;
if ((!from || (status = mu_mailer_check_from (from)) == 0)
&& (!to || (status = mu_mailer_check_to (to)) == 0))
@@ -589,6 +637,7 @@ mu_mailer_send_fragments (mu_mailer_t mailer,
}
}
mu_address_destroy (&sender_addr);
+ mu_address_destroy (&rcpt_addr);
return status;
}
diff --git a/libproto/mailer/mbox.c b/libproto/mailer/mbox.c
index 527ca20..1353d42 100644
--- a/libproto/mailer/mbox.c
+++ b/libproto/mailer/mbox.c
@@ -250,7 +250,7 @@ remote_mbox_append_message (mu_mailbox_t mbox, mu_message_t
msg)
{
char *rcpt;
- status = mu_url_aget_user (mbox->url, &rcpt);
+ status = mu_url_aget_param (mbox->url, "to", &rcpt);
if (status == MU_ERR_NOENT)
{
static char *hdrnames[] = {
hooks/post-receive
--
GNU Mailutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Mailutils branch, master, updated. release-2.2-151-gf50c5d1,
Sergey Poznyakoff <=