Commit c7b56db1 authored by Jim Nelson's avatar Jim Nelson

Fix regression where folders were not regularly updated w/ STATUS info

Now that Imap.Folders are being preserved, need to update their
FolderProperties w/ STATUS results whenever listed.
parent 0e6e97c7
......@@ -227,13 +227,6 @@ private class Geary.Imap.Account : BaseObject {
Gee.Map<StatusCommand, MailboxSpecifier> cmd_map = new Gee.HashMap<
StatusCommand, MailboxSpecifier>();
foreach (MailboxInformation mailbox_info in child_info) {
// if already have an Imap.Folder for this mailbox, use that
if (folders.has_key(mailbox_info.path)) {
child_folders.add(folders.get(mailbox_info.path));
continue;
}
// if new mailbox is unselectable, don't bother doing a STATUS command
if (mailbox_info.attrs.contains(MailboxAttribute.NO_SELECT)) {
Imap.Folder folder = new Imap.Folder.unselectable(session_mgr, mailbox_info);
......@@ -286,8 +279,15 @@ private class Geary.Imap.Account : BaseObject {
status_results.remove(found_status);
Imap.Folder folder = new Imap.Folder(session_mgr, found_status, mailbox_info);
folders.set(folder.path, folder);
// if already have an Imap.Folder for this mailbox, use that
Imap.Folder? folder = folders.get(mailbox_info.path);
if (folder != null) {
folder.properties.update_status(found_status);
} else {
folder = new Imap.Folder(session_mgr, found_status, mailbox_info);
folders.set(folder.path, folder);
}
child_folders.add(folder);
}
......
......@@ -169,6 +169,19 @@ public class Geary.Imap.FolderProperties : Geary.FolderProperties {
is_openable = Trillian.from_boolean(!attrs.contains(MailboxAttribute.NO_SELECT));
}
/**
* Update an existing {@link FolderProperties} with fresh {@link StatusData}.
*
* This will force the {@link email_total} property to match the {@link status_messages} value.
*/
public void update_status(StatusData status) {
set_status_message_count(status.messages, true);
set_status_unseen(status.unseen);
recent = status.recent;
uid_validity = status.uid_validity;
uid_next = status.uid_next;
}
public void set_status_message_count(int messages, bool force) {
if (messages < 0)
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment