Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a button to force sync mailboxes #5166

Open
miaulalala opened this issue Jun 10, 2021 · 6 comments
Open

Add a button to force sync mailboxes #5166

miaulalala opened this issue Jun 10, 2021 · 6 comments
Labels
1. to develop enhancement papercut Annoying recurring issue with possibly simple fix.

Comments

@miaulalala
Copy link
Contributor

Currently, there is a two hour delay when creating a mailbox or folder in another mail program before it appears in Mail.

Add a button that force syncs mailboxes and folders from IMAP.

@miaulalala miaulalala self-assigned this Jun 10, 2021
@miaulalala miaulalala added 1. to develop papercut Annoying recurring issue with possibly simple fix. and removed 0. to triage labels Jun 10, 2021
@miaulalala
Copy link
Contributor Author

Fixes #4869, #5164

@ChristophWurst ChristophWurst changed the title Add a button to force sync folders Add a button to force sync mailboxes Jun 10, 2021
@kesselb
Copy link
Contributor

kesselb commented Jun 15, 2021

I run into this "issue" today. I knew that a mailbox should be there so I tried to create the folder again to trigger a sync.

Unfortunately that does not work for now.

Index: lib/IMAP/FolderMapper.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/IMAP/FolderMapper.php b/lib/IMAP/FolderMapper.php
--- a/lib/IMAP/FolderMapper.php	(revision 80b6634c52accb49c0bea94c22dedea51615ed75)
+++ b/lib/IMAP/FolderMapper.php	(date 1623745385082)
@@ -23,16 +23,16 @@
 
 namespace OCA\Mail\IMAP;
 
-use function array_filter;
-use function array_map;
-use function in_array;
-use function reset;
 use Horde_Imap_Client;
 use Horde_Imap_Client_Exception;
 use Horde_Imap_Client_Socket;
 use OCA\Mail\Account;
 use OCA\Mail\Exception\ServiceException;
 use OCA\Mail\Folder;
+use function array_filter;
+use function array_map;
+use function in_array;
+use function reset;
 
 class FolderMapper {
 
@@ -92,7 +92,14 @@
 	public function createFolder(Horde_Imap_Client_Socket $client,
 								 Account $account,
 								 string $name): Folder {
-		$client->createMailbox($name);
+
+		try {
+			$client->createMailbox($name);
+		} catch (Horde_Imap_Client_Exception $e) {
+			if ($e->getCode() !== 22) {
+				throw $e;
+			}
+		}
 
 		$list = $client->listMailboxes($name, Horde_Imap_Client::MBOX_ALL_SUBSCRIBED, [
 			'delimiter' => true,

If we catch the error "mailbox already exist" like above it seems to work. I'm not sure if there are side effect 🤷‍♂️

@StCyr
Copy link
Collaborator

StCyr commented Jun 24, 2021

I think it's there already in the master branch:

image

@ChristophWurst
Copy link
Member

That button is to refresh the current mailbox. But what we want additionally is a way to refresh the list of mailboxes.

@mat-m
Copy link

mat-m commented Oct 31, 2021

@ChristophWurst Do you confirm it will also work for folder removal ?

@ChristophWurst
Copy link
Member

ChristophWurst commented Oct 31, 2021

It will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop enhancement papercut Annoying recurring issue with possibly simple fix.
Projects
Status: 🧭 Planning evaluation
Development

No branches or pull requests

5 participants