From 44f73828f1cac462b30a3cc1c190081c1ff95e8c Mon Sep 17 00:00:00 2001 From: djmaze Date: Wed, 13 Oct 2021 15:40:16 +0200 Subject: [PATCH] Kolab folders are not selectable --- .../v/0.0.0/app/libraries/MailSo/Mail/Folder.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php index 066c12ee4..a3d394d42 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Folder.php @@ -171,7 +171,8 @@ class Folder implements \JsonSerializable public function IsSelectable() : bool { - return $this->bExists && $this->oImapFolder->IsSelectable(); + $type = $this->getKolabFolderType(); + return $this->bExists && $this->oImapFolder->IsSelectable() && (!$type || 0 === \strpos($type, 'mail.')); } /** @@ -225,11 +226,15 @@ class Folder implements \JsonSerializable case \in_array('\\all', $aFlags): case \in_array('\\allmail', $aFlags): return \MailSo\Imap\Enumerations\FolderType::ALL; + + // TODO +// case 'Templates' === $this->FullNameRaw(): +// return \MailSo\Imap\Enumerations\FolderType::TEMPLATES; } /* // TODO: Kolab - switch ($this->oImapFolder->GetMetadata(MetadataKeys::KOLAB_CTYPE) ?: $this->oImapFolder->GetMetadata(MetadataKeys::KOLAB_CTYPE_SHARED)) { + switch ($this->getKolabFolderType()) { { case 'event': return \MailSo\Imap\Enumerations\FolderType::CALENDAR; @@ -286,4 +291,9 @@ class Folder implements \JsonSerializable 'Metadata' => $this->oImapFolder->Metadata() ); } + + protected function getKolabFolderType() : ?string + { + return $this->GetMetadata(MetadataKeys::KOLAB_CTYPE) ?: $this->GetMetadata(MetadataKeys::KOLAB_CTYPE_SHARED); + } }