Update Geary.Outbox.EmailIdentifier variant type marker

Use 'o' instead of 's' to avoid confusion with search ids. Add test.
This commit is contained in:
Michael Gratton 2019-10-30 14:17:44 +11:00
parent bf4f5c4780
commit 94e0736cfd
3 changed files with 5 additions and 2 deletions

View file

@ -416,7 +416,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
char type = (char) serialised.get_child_value(0).get_byte();
if (type == 'i')
return new ImapDB.EmailIdentifier.from_variant(serialised);
if (type == 's')
if (type == 'o')
return new Outbox.EmailIdentifier.from_variant(serialised);
throw new EngineError.BAD_PARAMETERS("Unknown serialised type: %c", type);

View file

@ -45,7 +45,7 @@ private class Geary.Outbox.EmailIdentifier : Geary.EmailIdentifier {
// Return a tuple to satisfy the API contract, add an 's' to
// inform GenericAccount that it's an SMTP id.
return new GLib.Variant.tuple(new Variant[] {
new GLib.Variant.byte('s'),
new GLib.Variant.byte('o'),
new GLib.Variant.int64(this.message_id),
new GLib.Variant.int64(this.ordering)
});

View file

@ -88,6 +88,9 @@ public class Geary.ImapEngine.GenericAccountTest : TestCase {
assert_non_null(
test_article.to_email_identifier(new GLib.Variant("(yxx)", 'i', 1, 2))
);
assert_non_null(
test_article.to_email_identifier(new GLib.Variant("(yxx)", 'o', 1, 2))
);
}
}