Bug 793915 - Option to convert UTC time to local time in Reply credits

This commit is contained in:
Milan Crha
2018-03-12 14:26:31 +01:00
parent a791b0a789
commit ae559e669c
2 changed files with 29 additions and 1 deletions

View File

@ -220,6 +220,11 @@
<_summary>Wrap quoted text in replies</_summary>
<_description>If set to “true” quoted text in replies will be wrapped.</_description>
</key>
<key name="composer-reply-credits-utc-to-localtime" type="b">
<default>false</default>
<_summary>Convert UTC time in reply credits to local time</_summary>
<_description>Whether the time in reply credits should be converted to local time when it's in UTC in the message.</_description>
</key>
<key name="display-content-disposition-inline" type="b">
<default>true</default>
<_summary>Whether to obey Content-Disposition:inline message header hint</_summary>

View File

@ -54,9 +54,13 @@
#ifdef gmtime_r
#undef gmtime_r
#endif
#ifdef localtime_r
#undef localtime_r
#endif
/* The gmtime() in Microsoft's C library is MT-safe */
/* The gmtime() and localtime() in Microsoft's C library are MT-safe */
#define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
#define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
#endif
typedef struct _AsyncContext AsyncContext;
@ -3325,6 +3329,25 @@ attribution_format (CamelMimeMessage *message)
/* That didn't work either, use current time */
time (&date);
tzone = 0;
} else if (tzone == 0) {
GSettings *settings;
settings = e_util_ref_settings ("org.gnome.evolution.mail");
if (g_settings_get_boolean (settings, "composer-reply-credits-utc-to-localtime")) {
struct tm gmtm, lctm;
time_t gmtt, lctt;
gmtime_r (&date, &gmtm);
localtime_r (&date, &lctm);
gmtt = mktime (&gmtm);
lctt = mktime (&lctm);
tzone = (lctt - gmtt) * 100 / 3600;
}
g_clear_object (&settings);
}
/* Convert to UTC */