Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gpanders.com header.i=@gpanders.com Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by mail-b.sr.ht (Postfix) with ESMTPS id 4F02311EEF1 for <~kevin8t8/mutt-dev@lists.sr.ht>; Sat, 15 May 2021 00:55:09 +0000 (UTC) Received: (Authenticated sender: greg@gpanders.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 7C4E71C0003; Sat, 15 May 2021 00:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpanders.com; s=gm1; t=1621040108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=euuM98rr2jCezUninY27zpJjXtM3pc18fHYfvhhls04=; b=cMse8/AnO5/zh9xg2DuZHufyS++P62m7tpauY8gfZKCd1A/yrxr4RtKy+w9YVop/Mg8LuE R+iAViBwwPx615zdfvIIDH5aGHUcHjBkUxdKDapvdD9O4jws87Lr5VD7JHbZd8Xhl/IpfD h0/JdP04HYGCNNdG7yk28ETajSSr5JHh/UVU4JlkwdkNQecqusA8TwpokR+lW5CAc69Hx0 oZMDY4qtH404hIK6YL41Evi+5gm2vihpFiL3IDblZ5IlYK+rKwIvHFAFFvxFYZkHjFZG4K kkLlAQW2dePdb55X59AfY+uxRDaQulfn7gLwoCRlXVgtKcdPMZdz498VFH1Chg== From: Gregory Anders To: ~kevin8t8/mutt-dev@lists.sr.ht Cc: Gregory Anders Subject: [PATCH v3] Add local_date_header option Date: Fri, 14 May 2021 18:55:00 -0600 Message-Id: <20210515005500.76492-1-greg@gpanders.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add an option to convert the date used in the Date header into the local (sender's) timezone. This is the current behavior and the option defaults to true. Unsetting this option causes the date in the Date header to be formatted using the GMT timezone. This option is useful for privacy-sensitive users who may not wish to divulge their sending timezone. --- init.h | 6 ++++++ mutt.h | 1 + sendlib.c | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/init.h b/init.h index 7590b315..acc7d8b2 100644 --- a/init.h +++ b/init.h @@ -1954,6 +1954,12 @@ struct option_t MuttVars[] = { ** from your spool mailbox to your $$mbox mailbox, or as a result of ** a ``$mbox-hook'' command. */ + { "local_date_header", DT_BOOL, R_NONE, {.l=OPTLOCALDATEHEADER}, {.l=1} }, + /* + ** .pp + ** If \fIset\fP, convert the date in the Date header of sent emails into local + ** (sender's) timezone. + */ { "mail_check", DT_NUM, R_NONE, {.p=&BuffyTimeout}, {.l=5} }, /* ** .pp diff --git a/mutt.h b/mutt.h index b7f9d234..88b71da5 100644 --- a/mutt.h +++ b/mutt.h @@ -480,6 +480,7 @@ enum OPTINCLUDEENCRYPTED, OPTINCLUDEONLYFIRST, OPTKEEPFLAGGED, + OPTLOCALDATEHEADER, OPTMUTTLISPINLINEEVAL, OPTMAILCAPSANITIZE, OPTMAILCHECKRECENT, diff --git a/sendlib.c b/sendlib.c index 36264aa0..1b5f3ee0 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1759,8 +1759,18 @@ BODY *mutt_remove_multipart_alternative (BODY *b) void mutt_make_date (BUFFER *s) { time_t t = time (NULL); - struct tm *l = localtime (&t); - time_t tz = mutt_local_tz (t); + struct tm *l; + time_t tz = 0; + + if (option (OPTLOCALDATEHEADER)) + { + l = localtime (&t); + tz = mutt_local_tz (t); + } + else + { + l = gmtime (&t); + } tz /= 60; -- 2.31.1