Page MenuHomePhorge

D4719.1775218131.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D4719.1775218131.diff

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,12 +353,19 @@
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)) {
+ $defaultType = "$type.default";
+ } else {
+ $defaultType = "$type";
+ }
+
// DAV folders
return [
'serverId' => "DAV:{$type}:{$folder->id}",
'parentId' => 0, // TODO: Folder hierarchy
'displayName' => $folder->get_name(),
- 'type' => $this->type_kolab2activesync($type),
+ 'type' => $this->type_kolab2activesync($defaultType),
];
}
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],
];
}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 12:08 PM (5 h, 18 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823995
Default Alt Text
D4719.1775218131.diff (2 KB)

Event Timeline