summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-03-10 09:58:45 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2011-03-10 09:58:45 +0200
commit0ac52e06cb1cb91602ee4dc4de32f66423e96b32 (patch)
tree9256c081ddffea363fcf2da1cc9ff4a6d4ee8370
parentac1262fb8a5d845c9e16a9679239142d0bf00522 (diff)
downloadmailutils-0ac52e06cb1cb91602ee4dc4de32f66423e96b32.tar.gz
mailutils-0ac52e06cb1cb91602ee4dc4de32f66423e96b32.tar.bz2
message_stream: deduce default envelope address from the current user email
* libmailutils/stream/message_stream.c: Unless specified otherwise, set envelope address based on the current user email. * mh/tests/burst.at: Remove all X-Envelope headers before comparison.
-rw-r--r--libmailutils/stream/message_stream.c14
-rw-r--r--mh/tests/burst.at18
2 files changed, 14 insertions, 18 deletions
diff --git a/libmailutils/stream/message_stream.c b/libmailutils/stream/message_stream.c
index ecef8bfe1..03e02603a 100644
--- a/libmailutils/stream/message_stream.c
+++ b/libmailutils/stream/message_stream.c
@@ -236,13 +236,15 @@ _message_open (mu_stream_t stream)
mu_address_t addr;
mu_address_create (&addr, from);
- if (!addr
- || mu_address_aget_email (addr, 1, &env_from))
- env_from = mu_strdup ("GNU-Mailutils");
- mu_address_destroy (&addr);
+ if (addr)
+ {
+ mu_address_aget_email (addr, 1, &env_from);
+ mu_address_destroy (&addr);
+ }
}
- else
- env_from = mu_strdup ("GNU-MH");
+
+ if (!env_from)
+ env_from = mu_get_user_email (NULL);
}
free (from);
diff --git a/mh/tests/burst.at b/mh/tests/burst.at
index 6e6a4f961..2e383a20e 100644
--- a/mh/tests/burst.at
+++ b/mh/tests/burst.at
@@ -40,16 +40,15 @@ Sergey
])
burst +inbox 1 || exit $?
-grep -v ^X-Envelope-Date Mail/inbox/2
-grep -v ^X-Envelope-Date Mail/inbox/3
-grep -v ^X-Envelope-Date Mail/inbox/4
+grep -v ^X-Envelope- Mail/inbox/2
+grep -v ^X-Envelope- Mail/inbox/3
+grep -v ^X-Envelope- Mail/inbox/4
],
[0],
[X-Burst-Part: 1 1 01
From: Sergey Poznyakoff <gray@example.net>
To: root@example.com
Subject: digest
-X-Envelope-Sender: gray@example.net
Initial text.
@@ -57,13 +56,11 @@ X-Burst-Part: 1 2 02
From: Puszcza hackers
To: Sergey Poznyakoff <gray@gnu.org>
Subject: Hello
-X-Envelope-Sender: GNU-Mailutils
Greetings
---------
How are you?
X-Burst-Part: 1 3 00
-X-Envelope-Sender: GNU-MH
Regards,
Sergey
@@ -93,16 +90,15 @@ Sergey
])
burst +inbox --length=7 1 || exit $?
-grep -v ^X-Envelope-Date Mail/inbox/2
-grep -v ^X-Envelope-Date Mail/inbox/3
-grep -v ^X-Envelope-Date Mail/inbox/4
+grep -v ^X-Envelope- Mail/inbox/2
+grep -v ^X-Envelope- Mail/inbox/3
+grep -v ^X-Envelope- Mail/inbox/4
],
[0],
[X-Burst-Part: 1 1 01
From: Sergey Poznyakoff <gray@example.net>
To: root@example.com
Subject: digest
-X-Envelope-Sender: gray@example.net
Initial text.
@@ -110,13 +106,11 @@ X-Burst-Part: 1 2 02
From: Puszcza hackers
To: Sergey Poznyakoff <gray@gnu.org>
Subject: Hello
-X-Envelope-Sender: GNU-Mailutils
Greetings
-----
How are you?
X-Burst-Part: 1 3 00
-X-Envelope-Sender: GNU-MH
Regards,
Sergey

Return to:

Send suggestions and report system problems to the System administrator.