diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-03-05 09:52:04 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-03-05 09:52:04 +0000 |
commit | 8c298bd1f95c1be34fabb2f2983a37ef5c38ea01 (patch) | |
tree | 2bd791130f008410c86cb3c59ff64cd5715e236c | |
parent | 2edc1b1269719370346e304e3d65079e05983397 (diff) | |
download | mailutils-8c298bd1f95c1be34fabb2f2983a37ef5c38ea01.tar.gz mailutils-8c298bd1f95c1be34fabb2f2983a37ef5c38ea01.tar.bz2 |
(mail_from0): If `showto' is set and the
mail comes from the user that invoked the program, show
`To:' address instead of `From:'.
-rw-r--r-- | mail/from.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/mail/from.c b/mail/from.c index 2fe5a1b0d..fb62284ff 100644 --- a/mail/from.c +++ b/mail/from.c @@ -1,5 +1,6 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003, + 2005 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +42,31 @@ mail_from0 (msgset_t *mspec, message_t msg, void *data) if (address_create (&address, from) == 0) { char name[128]; - size_t len = strlen (from) + 1; + size_t len; + char *email; + + if (address_aget_email (address, 1, &email) == 0) + { + if (util_getenv (NULL, "showto", Mail_env_boolean, 0) == 0 + && mail_is_my_name (email)) + { + char *tmp; + + if (header_aget_value_unfold (hdr, MU_HEADER_TO, &tmp) == 0) + { + address_t addr_to; + if (address_create (&addr_to, tmp) == 0) + { + address_destroy (&address); + address = addr_to; + } + free (tmp); + } + } + free (email); + } + + len = strlen (from) + 1; *name = '\0'; address_get_personal (address, 1, name, sizeof name, NULL); if (*name && len) |