diff --git a/lib/kolab_sync_storage_kolab4.php b/lib/kolab_sync_storage_kolab4.php --- a/lib/kolab_sync_storage_kolab4.php +++ b/lib/kolab_sync_storage_kolab4.php @@ -66,6 +66,9 @@ // Inject user+password to the URL, there's no other way to pass it to the DAV client $url = str_replace('://', '://' . rawurlencode($sync->username) . ':' . rawurlencode($sync->password) . '@', $url); + // The default matches e.g. /dav/calendars/user/john@kolab.org/Default/ + $this->defaultFolderRegex = $sync->config->get('activesync_dav_default_folder_regex', "/\/.*\/user\/.*\/Default\/$/"); + $this->davStorage = new kolab_storage_dav($url); // DAV $this->storage = $sync->get_storage(); // IMAP @@ -350,6 +353,11 @@ return parent::folder_data($folder, $type); } + // Dav doesn't have folder type annotations, so we find default folders by regex + if (preg_match($this->defaultFolderRegex, $folder->href)) { + $type = "$type.default"; + } + // DAV folders return [ 'serverId' => "DAV:{$type}:{$folder->id}", diff --git a/tests/Sync/FoldersTest.php b/tests/Sync/FoldersTest.php --- a/tests/Sync/FoldersTest.php +++ b/tests/Sync/FoldersTest.php @@ -76,15 +76,15 @@ if ($this->isStorageDriver('kolab4')) { $folders = [ - ['Calendar', Syncroton_Command_FolderSync::FOLDERTYPE_CALENDAR_USER_CREATED], + ['Calendar', Syncroton_Command_FolderSync::FOLDERTYPE_CALENDAR], // Note: Kolab 4 with Cyrus DAV uses Addressbook, but Kolab 3 with iRony would use 'Contacts' - ['/^(Contacts|Addressbook)$/', Syncroton_Command_FolderSync::FOLDERTYPE_CONTACT_USER_CREATED], + ['/^(Contacts|Addressbook)$/', Syncroton_Command_FolderSync::FOLDERTYPE_CONTACT], ['INBOX', Syncroton_Command_FolderSync::FOLDERTYPE_INBOX], ['Drafts', Syncroton_Command_FolderSync::FOLDERTYPE_DRAFTS], ['Sent', Syncroton_Command_FolderSync::FOLDERTYPE_SENTMAIL], ['Trash', Syncroton_Command_FolderSync::FOLDERTYPE_DELETEDITEMS], // Note: For now Kolab 4 uses the same Calendar folder for calendar and tasks - ['/^(Tasks|Calendar)$/', Syncroton_Command_FolderSync::FOLDERTYPE_TASK_USER_CREATED], + ['/^(Tasks|Calendar)$/', Syncroton_Command_FolderSync::FOLDERTYPE_TASK], ]; }