Fix composed email Date: header: Closes bug #714376

GMime documentation suggests its date conversion methods take a
time zone offset in hours, but it appears the number must be base-100
to get the right results (i.e. -7 becomes "-0700").
This commit is contained in:
Jim Nelson 2014-05-12 14:44:34 -07:00
parent b6cceac306
commit f38c8c70ca
2 changed files with 6 additions and 3 deletions

View file

@ -164,7 +164,11 @@ public class Geary.RFC822.Date : Geary.RFC822.MessageData, Geary.MessageData.Abs
* Returns the {@link Date} in ISO-8601 format.
*/
public virtual string serialize() {
return GMime.utils_header_format_date(as_time_t, 0);
// Although GMime documents its conversion methods as requiring the tz offset in hours,
// it appears the number is handed directly to the string (i.e. an offset of -7 becomes
// "-0007", whereas we want "-0700").
return GMime.utils_header_format_date(as_time_t,
(int) (value.get_utc_offset() / TimeSpan.HOUR) * 100);
}
public virtual uint hash() {

View file

@ -96,8 +96,7 @@ public class Geary.RFC822.Message : BaseObject {
date = new RFC822.Date.from_date_time(email.date);
message.set_sender(sender.to_rfc822_string());
message.set_date((time_t) email.date.to_unix(),
(int) (email.date.get_utc_offset() / TimeSpan.HOUR));
message.set_date_as_string(date.serialize());
if (message_id != null)
message.set_message_id(message_id);