[Commits] [SCM] claws branch, master, updated. 3.14.0-23-gf4e8599

mones at claws-mail.org mones at claws-mail.org
Mon Aug 22 19:08:08 CEST 2016


The branch, master has been updated
       via  f4e859902a0541db982248ee4a59901e0568d381 (commit)
       via  3a89a270fcad59901d8fcdc901ac03523c6aeb03 (commit)
      from  8395c4c673c7d313f24050d030491412e808192c (commit)

Summary of changes:
 manual/advanced.xml |   10 ++++++++++
 src/common/utils.c  |   14 ++++++++++++--
 src/common/utils.h  |    2 ++
 src/compose.c       |   10 ++++++++--
 src/news.c          |    5 ++++-
 src/prefs_common.c  |    5 +++--
 src/prefs_common.h  |    2 +-
 7 files changed, 40 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit f4e859902a0541db982248ee4a59901e0568d381
Author: Ricardo Mones <ricardo at mones.org>
Date:   Mon Aug 22 19:07:36 2016 +0200

    Document the new hidden preference 'hide_timezone'

diff --git a/manual/advanced.xml b/manual/advanced.xml
index 223c9c9..12c12a0 100644
--- a/manual/advanced.xml
+++ b/manual/advanced.xml
@@ -697,6 +697,16 @@
 	</listitem>
       </varlistentry>
       <varlistentry>
+	<term><literal>hide_timezone</literal></term>
+	<listitem>
+	  <para>
+    If enabled ('1') the timezone in date headers is set to the
+    unknown timezone value, as specified in section 3 of the RFC
+    5322. Default value is '0'.
+	  </para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
 	<term><literal>hover_timeout</literal></term>
 	<listitem>
 	  <para>

commit 3a89a270fcad59901d8fcdc901ac03523c6aeb03
Author: Ricardo Mones <ricardo at mones.org>
Date:   Mon Aug 22 19:02:47 2016 +0200

    Fix bug #2975: Implement setting -0000 timezone to hide sender localtime
    
    This adds a new hidden preference, namely 'hide_timezone', that
    sets the timezone of date fields sent over the network to the
    unknown timezone value as specified in RFC 5322 §3.3.
    
    Default value is false (i.e., send available timezone information).

diff --git a/src/common/utils.c b/src/common/utils.c
index 182be8e..b8727e4 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -3557,7 +3557,7 @@ gchar *tzoffset(time_t *now)
 	return offset_string;
 }
 
-void get_rfc822_date(gchar *buf, gint len)
+static void _get_rfc822_date(gchar *buf, gint len, gboolean hidetz)
 {
 	struct tm *lt;
 	time_t t;
@@ -3573,7 +3573,17 @@ void get_rfc822_date(gchar *buf, gint len)
 	       day, mon, &dd, &hh, &mm, &ss, &yyyy);
 
 	g_snprintf(buf, len, "%s, %d %s %d %02d:%02d:%02d %s",
-		   day, dd, mon, yyyy, hh, mm, ss, tzoffset(&t));
+		   day, dd, mon, yyyy, hh, mm, ss, (hidetz? "-0000": tzoffset(&t)));
+}
+
+void get_rfc822_date(gchar *buf, gint len)
+{
+	_get_rfc822_date(buf, len, FALSE);
+}
+
+void get_rfc822_date_hide_tz(gchar *buf, gint len)
+{
+	_get_rfc822_date(buf, len, TRUE);
 }
 
 void debug_set_mode(gboolean mode)
diff --git a/src/common/utils.h b/src/common/utils.h
index 2279b86..e07fdd8 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -520,6 +520,8 @@ time_t tzoffset_sec		(time_t		*now);
 gchar *tzoffset			(time_t		*now);
 void get_rfc822_date		(gchar		*buf,
 				 gint		 len);
+void get_rfc822_date_hide_tz	(gchar		*buf,
+				 gint		 len);
 
 size_t fast_strftime		(gchar 			*buf, 
 				 gint 			 buflen, 
diff --git a/src/compose.c b/src/compose.c
index 498c560..8222066 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -5382,7 +5382,10 @@ static gint compose_redirect_write_headers(Compose *compose, FILE *fp)
 	cm_return_val_if_fail(compose->account->address != NULL, -1);
 
 	/* Resent-Date */
-	get_rfc822_date(buf, sizeof(buf));
+	if (prefs_common.hide_timezone)
+		get_rfc822_date_hide_tz(buf, sizeof(buf));
+	else
+		get_rfc822_date(buf, sizeof(buf));
 	err |= (fprintf(fp, "Resent-Date: %s\n", buf) < 0);
 
 	/* Resent-From */
@@ -6459,7 +6462,10 @@ static gchar *compose_get_header(Compose *compose)
 	header = g_string_sized_new(64);
 
 	/* Date */
-	get_rfc822_date(buf, sizeof(buf));
+	if (prefs_common.hide_timezone)
+		get_rfc822_date_hide_tz(buf, sizeof(buf));
+	else
+		get_rfc822_date(buf, sizeof(buf));
 	g_string_append_printf(header, "Date: %s\n", buf);
 
 	/* From */
diff --git a/src/news.c b/src/news.c
index af96e62..5081a0e 100644
--- a/src/news.c
+++ b/src/news.c
@@ -945,7 +945,10 @@ gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
 		g_warning("can't change file mode");
 	}
 	
-	get_rfc822_date(buf, sizeof(buf));
+	if (prefs_common.hide_timezone)
+		get_rfc822_date_hide_tz(buf, sizeof(buf));
+	else
+		get_rfc822_date(buf, sizeof(buf));
 	if (fprintf(tmpfp, "From: %s\r\n"
 		       "Newsgroups: %s\r\n"
 		       "Subject: cmsg cancel <%s>\r\n"
diff --git a/src/prefs_common.c b/src/prefs_common.c
index b1d937a..39d9a0b 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -199,9 +199,10 @@ static PrefParam param[] = {
 	 NULL, NULL, NULL},
 	{"outgoing_fallback_to_ascii", "TRUE", &prefs_common.outgoing_fallback_to_ascii, P_BOOL,
 	 NULL, NULL, NULL},
-        {"warn_empty_subj", "TRUE", &prefs_common.warn_empty_subj,
+	{"warn_empty_subj", "TRUE", &prefs_common.warn_empty_subj,
+	 P_BOOL, NULL, NULL, NULL},
+	{"hide_timezone", "FALSE", &prefs_common.hide_timezone,
 	 P_BOOL, NULL, NULL, NULL},
-
 	{"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana,
 	 P_BOOL, NULL, NULL, NULL},
 
diff --git a/src/prefs_common.h b/src/prefs_common.h
index f2fee5d..d3d9fa9 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -143,7 +143,7 @@ struct _PrefsCommon
 	TransferEncodingMethod encoding_method;
 	gboolean outgoing_fallback_to_ascii;
 	gboolean warn_empty_subj;
-
+	gboolean hide_timezone;
 	gboolean allow_jisx0201_kana;
 
 	/* Compose */

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list