Changeset View
Changeset View
Standalone View
Standalone View
src/app/Backends/IMAP.php
Show All 27 Lines | public static function verifyAccount(string $username): bool | ||||
} | } | ||||
return count($folders) > 0; | return count($folders) > 0; | ||||
} | } | ||||
/** | /** | ||||
* Check if a shared folder is set up. | * Check if a shared folder is set up. | ||||
* | * | ||||
* @param string $folder Folder name, eg. shared/Resources/Name@domain.tld | * @param string $folder Folder name, e.g. shared/Resources/Name@domain.tld | ||||
* | * | ||||
* @return bool True if a folder exists and is set up, False otherwise | * @return bool True if a folder exists and is set up, False otherwise | ||||
*/ | */ | ||||
public static function verifySharedFolder(string $folder): bool | public static function verifySharedFolder(string $folder): bool | ||||
{ | { | ||||
$config = self::getConfig(); | $config = self::getConfig(); | ||||
$imap = self::initIMAP($config); | $imap = self::initIMAP($config); | ||||
// Convert the folder from UTF8 to UTF7-IMAP | // Convert the folder from UTF8 to UTF7-IMAP | ||||
if (\preg_match('|^(shared/Resources/)(.*)(@[^@]+)$|', $folder, $matches)) { | if (\preg_match('#^(shared/|shared/Resources/)(.+)(@[^@]+)$#', $folder, $matches)) { | ||||
$folderName = \mb_convert_encoding($matches[2], 'UTF7-IMAP', 'UTF8'); | $folderName = \mb_convert_encoding($matches[2], 'UTF7-IMAP', 'UTF8'); | ||||
$folder = $matches[1] . $folderName . $matches[3]; | $folder = $matches[1] . $folderName . $matches[3]; | ||||
} | } | ||||
// FIXME: just listMailboxes() does not return shared folders at all | // FIXME: just listMailboxes() does not return shared folders at all | ||||
$metadata = $imap->getMetadata($folder, ['/shared/vendor/kolab/folder-type']); | $metadata = $imap->getMetadata($folder, ['/shared/vendor/kolab/folder-type']); | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |