From 05039d8ea34618b385736ae6d7578b1643fad3d2 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Mon, 2 Apr 2007 22:13:16 +0200 Subject: [PATCH] $from ... Signed-off-by: Pierre Habouzit --- alias.cpkg | 17 ++++++++++++++++- globals.h | 2 -- init.c | 3 --- init.h | 14 -------------- lib-lua/lua-token.sh | 1 + send.c | 4 ++-- 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/alias.cpkg b/alias.cpkg index 2efa1ef..c4e739e 100644 --- a/alias.cpkg +++ b/alias.cpkg @@ -88,6 +88,21 @@ rx_t *SubscribedLists = NULL, *UnSubscribedLists = NULL; */ path_t record = NULL; + /* + ** .pp + ** This variable contains a default from address. It + ** can be overridden using my_hdr (including from send-hooks) and + ** ``$$reverse_name''. This variable is ignored if ``$$use_from'' + ** is unset. + ** .pp + ** E.g. you can use + ** \fTsend-hook Madmutt-devel@lists.berlios.de 'my_hdr From: Foo Bar '\fP + ** when replying to the Madmutt developer's mailing list and Madmutt takes this email address. + ** .pp + ** Defaults to the contents of the environment variable \fT$$$EMAIL\fP. + */ + address_t from = rfc822_parse_adrlist(NULL, NONULL(getenv("EMAIL"))); + void alternates(rx_t rx) { rx_list_remove(&UnAlternates, rx); rx_list_add(&Alternates, rx); @@ -196,7 +211,7 @@ int mutt_addr_is_user(address_t *addr) || string_is_address(addr->mailbox, MCore.username, MCore.shorthost) || string_is_address(addr->mailbox, MCore.username, mutt_fqdn(0)) || string_is_address(addr->mailbox, MCore.username, mutt_fqdn(1)) - || (From && !ascii_strcasecmp(From->mailbox, addr->mailbox))) + || (MAlias.from && !ascii_strcasecmp(MAlias.from->mailbox, addr->mailbox))) { return 1; } diff --git a/globals.h b/globals.h index 0519dfb..bfdda5b 100644 --- a/globals.h +++ b/globals.h @@ -21,8 +21,6 @@ WHERE char AttachmentMarker[STRING]; WHERE char Quotebuf[STRING]; -WHERE address_t *From; - WHERE char *AttachSep; WHERE char *Attribution; WHERE char *AttachFormat; diff --git a/init.c b/init.c index a04efbd..d7ff973 100644 --- a/init.c +++ b/init.c @@ -1796,9 +1796,6 @@ void mutt_init (int skip_sys_rc, string_list_t * commands) p_delete(&token.data); } - if ((p = getenv ("EMAIL")) != NULL) - From = rfc822_parse_adrlist (NULL, p); - /* Set standard defaults */ hash_map (ConfigOptions, mutt_set_default, 0); hash_map (ConfigOptions, mutt_restore_default, 0); diff --git a/init.h b/init.h index 9133d82..5673a96 100644 --- a/init.h +++ b/init.h @@ -666,20 +666,6 @@ struct option_t MuttVars[] = { ** message (when ``$$mime_forward'' is \fIunset\fP) will be quoted using ** ``$$indent_string''. */ - {"from", DT_ADDR, R_NONE, UL &From, "" }, - /* - ** .pp - ** This variable contains a default from address. It - ** can be overridden using my_hdr (including from send-hooks) and - ** ``$$reverse_name''. This variable is ignored if ``$$use_from'' - ** is unset. - ** .pp - ** E.g. you can use - ** \fTsend-hook Madmutt-devel@lists.berlios.de 'my_hdr From: Foo Bar '\fP - ** when replying to the Madmutt developer's mailing list and Madmutt takes this email address. - ** .pp - ** Defaults to the contents of the environment variable \fT$$$EMAIL\fP. - */ #ifdef USE_NNTP {"nntp_group_index_format", DT_STR, R_BOTH, UL &GroupFormat, "%4C %M%N %5s %-45.45f %d"}, /* diff --git a/lib-lua/lua-token.sh b/lib-lua/lua-token.sh index e524119..17001f1 100644 --- a/lib-lua/lua-token.sh +++ b/lib-lua/lua-token.sh @@ -126,6 +126,7 @@ exit 0 ## editor ## envelope_from_address ## file_charset +## from ## gecos_mask ## hcache_backend ## homedir diff --git a/send.c b/send.c index 1c442a0..3bddf4e 100644 --- a/send.c +++ b/send.c @@ -1022,8 +1022,8 @@ address_t *mutt_default_from (void) * Is this the right thing to do? */ - if (From) - adr = address_dup(From); + if (MAlias.from) + adr = address_dup(MAlias.from); else if (MCore.use_domain) { const char *fqdn = mutt_fqdn (1); adr = address_new(); -- 2.20.1