Fixes off-by-one error and bitfield issue when fetching an email.
In prior revision, the email message that appeared didn't always match the header selected. This fixes that problem.
This commit is contained in:
parent
e06690a526
commit
8e62435dec
3 changed files with 10 additions and 4 deletions
|
|
@ -51,6 +51,10 @@ public class Geary.Email : Object {
|
|||
public inline bool fulfills(Field required_fields) {
|
||||
return is_all_set(required_fields);
|
||||
}
|
||||
|
||||
public inline bool require(Field required_fields) {
|
||||
return is_all_set(required_fields);
|
||||
}
|
||||
}
|
||||
|
||||
public Geary.EmailLocation location { get; private set; }
|
||||
|
|
|
|||
|
|
@ -199,14 +199,16 @@ public class Geary.Sqlite.Folder : Geary.AbstractFolder, Geary.LocalFolder, Gear
|
|||
to_string());
|
||||
}
|
||||
|
||||
if (!message_row.fields.fulfills(required_fields)) {
|
||||
// see if the message row fulfills everything but properties, which are held in
|
||||
// separate table
|
||||
if (!message_row.fields.fulfills(required_fields.clear(Geary.Email.Field.PROPERTIES))) {
|
||||
throw new EngineError.INCOMPLETE_MESSAGE(
|
||||
"Message at position %d in folder %s only fulfills %Xh fields", position, to_string(),
|
||||
message_row.fields);
|
||||
}
|
||||
|
||||
ImapMessagePropertiesRow? properties = null;
|
||||
if (required_fields.fulfills(Geary.Email.Field.PROPERTIES)) {
|
||||
if (required_fields.require(Geary.Email.Field.PROPERTIES)) {
|
||||
properties = yield imap_message_properties_table.fetch_async(location_row.message_id,
|
||||
cancellable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class Geary.Sqlite.MessageLocationTable : Geary.Sqlite.Table {
|
|||
assert(position >= 1);
|
||||
|
||||
query.bind_int64(0, folder_id);
|
||||
query.bind_int(1, position);
|
||||
query.bind_int(1, position - 1);
|
||||
|
||||
SQLHeavy.QueryResult results = yield query.execute_async(cancellable);
|
||||
if (results.finished)
|
||||
|
|
@ -153,7 +153,7 @@ public class Geary.Sqlite.MessageLocationTable : Geary.Sqlite.Table {
|
|||
"SELECT id, message_id, ordering FROM MessageLocationTable WHERE folder_id = ? "
|
||||
+ "ORDER BY ordering LIMIT 1 OFFSET ?");
|
||||
query.bind_int64(0, folder_id);
|
||||
query.bind_int(1, position);
|
||||
query.bind_int(1, position - 1);
|
||||
|
||||
SQLHeavy.QueryResult results = yield query.execute_async(cancellable);
|
||||
if (results.finished)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue