Geary.RFC822: Clean up message data interfaces and classes
Split Geary.RFC822.MessageData interface up into DecodedMessageData and EncodedMessageData so the difference between the two is clear and they can't be used interchangeably. Add `DecodedMessageData::to_rfc822_string` to provide a common interface for round-tripping decoded data. Update all classes to implement one of these and follow the same general API patterns.
This commit is contained in:
parent
5b253cbee6
commit
6e7631b8d3
10 changed files with 138 additions and 78 deletions
|
|
@ -434,7 +434,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
references.message_id
|
||||
);
|
||||
}
|
||||
email.set_send_date(new Geary.RFC822.Date.from_date_time(now));
|
||||
email.set_send_date(new RFC822.Date(now));
|
||||
email.set_email_properties(new MockEmailProperties(now));
|
||||
email.set_full_references(mid, null, refs_list);
|
||||
return email;
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ class Geary.App.ConversationSetTest : TestCase {
|
|||
references.message_id
|
||||
);
|
||||
}
|
||||
email.set_send_date(new Geary.RFC822.Date.from_date_time(now));
|
||||
email.set_send_date(new RFC822.Date(now));
|
||||
email.set_email_properties(new MockEmailProperties(now));
|
||||
email.set_full_references(mid, null, refs_list);
|
||||
return email;
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ class Geary.App.ConversationTest : TestCase {
|
|||
);
|
||||
email.set_full_references(mid, null, null);
|
||||
email.set_email_properties(new MockEmailProperties(now));
|
||||
email.set_send_date(new Geary.RFC822.Date.from_date_time(now));
|
||||
email.set_send_date(new RFC822.Date(now));
|
||||
return email;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class Geary.RFC822.MessageDataTest : TestCase {
|
|||
|
||||
public void date_from_rfc822() throws GLib.Error {
|
||||
const string FULL_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 -0100";
|
||||
Date full_hour_tz = new Date(FULL_HOUR_TZ);
|
||||
Date full_hour_tz = new Date.from_rfc822_string(FULL_HOUR_TZ);
|
||||
assert_int64(
|
||||
((int64) (-1 * 3600)) * 1000 * 1000,
|
||||
full_hour_tz.value.get_utc_offset(),
|
||||
|
|
@ -81,7 +81,7 @@ class Geary.RFC822.MessageDataTest : TestCase {
|
|||
);
|
||||
|
||||
const string HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 +1030";
|
||||
Date half_hour_tz = new Date(HALF_HOUR_TZ);
|
||||
Date half_hour_tz = new Date.from_rfc822_string(HALF_HOUR_TZ);
|
||||
assert_int64(
|
||||
((int64) (10.5 * 3600)) * 1000 * 1000,
|
||||
half_hour_tz.value.get_utc_offset()
|
||||
|
|
@ -96,15 +96,15 @@ class Geary.RFC822.MessageDataTest : TestCase {
|
|||
|
||||
public void date_to_rfc822() throws GLib.Error {
|
||||
const string FULL_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 -0100";
|
||||
Date full_hour_tz = new Date(FULL_HOUR_TZ);
|
||||
Date full_hour_tz = new Date.from_rfc822_string(FULL_HOUR_TZ);
|
||||
assert_string(FULL_HOUR_TZ, full_hour_tz.to_rfc822_string());
|
||||
|
||||
const string HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 +1030";
|
||||
Date half_hour_tz = new Date(HALF_HOUR_TZ);
|
||||
Date half_hour_tz = new Date.from_rfc822_string(HALF_HOUR_TZ);
|
||||
assert_string(HALF_HOUR_TZ, half_hour_tz.to_rfc822_string());
|
||||
|
||||
const string NEG_HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 -1030";
|
||||
Date neg_half_hour_tz = new Date(NEG_HALF_HOUR_TZ);
|
||||
Date neg_half_hour_tz = new Date.from_rfc822_string(NEG_HALF_HOUR_TZ);
|
||||
assert_string(NEG_HALF_HOUR_TZ, neg_half_hour_tz.to_rfc822_string());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue