From 2f9ca91a635a5832486a7975d119955f7b819692 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 2 Feb 2019 16:35:46 +1100 Subject: [PATCH 1/2] Bump agressive keep-alive interval down to 2 minutes This makes the Inbox poll for new messages for services that do not support IMAP IDLE (like Yahoo) much more often, so new mail shows up quicker. --- src/engine/imap/transport/imap-client-session.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/imap/transport/imap-client-session.vala b/src/engine/imap/transport/imap-client-session.vala index e296c8db..4a8f2de5 100644 --- a/src/engine/imap/transport/imap-client-session.vala +++ b/src/engine/imap/transport/imap-client-session.vala @@ -50,7 +50,7 @@ public class Geary.Imap.ClientSession : BaseObject { * new messages or status updates, this is a useful timeout for * polling for changes. */ - public const uint AGGRESSIVE_KEEPALIVE_SEC = 5 * 60; + public const uint AGGRESSIVE_KEEPALIVE_SEC = 2 * 60; /** * Default keep-alive interval in the Selected state. From cd050baa0398f1e77d661ca23db24c8f9f1cda3a Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sat, 2 Feb 2019 16:37:12 +1100 Subject: [PATCH 2/2] Don't hard-code special-use mailbox names for Yahoo accounts Desipte Yahoo's IMAP CAPABILITIES not claiming to support SPECIAL-USE, its LIST results actually include the appropriate flags, so just use those. --- .../yahoo/imap-engine-yahoo-account.vala | 46 ++++++++----------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala index cf0d6bc0..a754bff0 100644 --- a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala +++ b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala @@ -9,9 +9,6 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount { - private static Gee.HashMap? special_map = null; - - public static void setup_service(ServiceInformation service) { switch (service.protocol) { case Protocol.IMAP: @@ -34,33 +31,26 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount { Endpoint incoming_remote, Endpoint outgoing_remote) { base(config, local, incoming_remote, outgoing_remote); - - if (special_map == null) { - special_map = new Gee.HashMap(); - - FolderRoot root = this.local.imap_folder_root; - special_map.set( - this.local.imap_folder_root.inbox, Geary.SpecialFolderType.INBOX - ); - special_map.set( - root.get_child("Sent"), Geary.SpecialFolderType.SENT - ); - special_map.set( - root.get_child("Draft"), Geary.SpecialFolderType.DRAFTS - ); - special_map.set( - root.get_child("Bulk Mail"), Geary.SpecialFolderType.SPAM - ); - special_map.set( - root.get_child("Trash"), Geary.SpecialFolderType.TRASH - ); - } } protected override MinimalFolder new_folder(ImapDB.Folder local_folder) { - Geary.FolderPath path = local_folder.get_path(); - SpecialFolderType special_folder_type = special_map.has_key(path) ? special_map.get(path) - : Geary.SpecialFolderType.NONE; - return new YahooFolder(this, local_folder, special_folder_type); + FolderPath path = local_folder.get_path(); + SpecialFolderType type; + if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) { + type = SpecialFolderType.INBOX; + } else { + // Despite Yahoo not advertising that it supports + // SPECIAL-USE via its CAPABILITIES, it lists the + // appropriate attributes in LIST results anyway, so we + // can just consult that. :| + type = local_folder.get_properties().attrs.get_special_folder_type(); + // There can be only one Inbox + if (type == SpecialFolderType.INBOX) { + type = SpecialFolderType.NONE; + } + } + + return new YahooFolder(this, local_folder, type); } + }