Projects
Kolab:Winterfell
kolab-syncroton
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 14
View file
kolab-syncroton-2.3.3.tar.gz/lib/kolab_sync.php -> kolab-syncroton-2.3.4.tar.gz/lib/kolab_sync.php
Changed
@@ -46,7 +46,7 @@ public $password; const CHARSET = 'UTF-8'; - const VERSION = "2.3.3"; + const VERSION = "2.3.4"; /**
View file
kolab-syncroton-2.3.3.tar.gz/lib/kolab_sync_backend.php -> kolab-syncroton-2.3.4.tar.gz/lib/kolab_sync_backend.php
Changed
@@ -142,10 +142,11 @@ * * @param string $deviceid Device identifier * @param string $type Folder type + * @param bool $flat_mode Enables flat-list mode * * @return array|bool List of mailbox folders, False on backend failure */ - public function folders_list($deviceid, $type) + public function folders_list($deviceid, $type, $flat_mode = false) { // get all folders of specified type $folders = (array) kolab_storage::list_folders('', '*', $type, false, $typedata); @@ -181,10 +182,70 @@ $folders_list$folder_id = $this->folder_data($folder, $folder_type); } + if ($flat_mode) { + $folders_list = $this->folders_list_flat($folders_list, $type, $typedata); + } + return $folders_list; } /** + * Converts list of folders to a "flat" list + */ + private function folders_list_flat($folders, $type, $typedata) + { + $delim = $this->storage->get_hierarchy_delimiter(); + + foreach ($folders as $idx => $folder) { + if ($folder'parentId') { + // for non-mail folders we make the list completely flat + if ($type != 'mail') { + $display_name = kolab_storage::object_name($folder'imap_name'); + $display_name = html_entity_decode($display_name, ENT_COMPAT, RCUBE_CHARSET); + + $folders$idx'parentId' = 0; + $folders$idx'displayName' = $display_name; + } + // for mail folders we modify only folders with non-existing parents + else if (!isset($folders$folder'parentId')) { + $items = explode($delim, $folder'imap_name'); + $parent = 0; + + // find existing parent + while (count($items) > 0) { + array_pop($items); + + $parent_name = implode($items, $delim); + $parent_type = $typedata$parent_name; + $parent_id = self::folder_id($parent_name, $parent_type); + + if (isset($folders$parent_id)) { + $parent = $parent_id; + break; + } + } + + if (!$parent) { + $display_name = kolab_storage::object_name($folder'imap_name'); + $display_name = html_entity_decode($display_name, ENT_COMPAT, RCUBE_CHARSET); + } + else { + $parent_name = $folders$parent_id'imap_name'; + $display_name = substr($folder'imap_name', strlen($parent_name)+1); + $display_name = rcube_charset::convert($display_name, 'UTF7-IMAP'); + $display_name = str_replace($delim, ' ยป ', $display_name); + } + + $folders$idx'parentId' = $parent; + $folders$idx'displayName' = $display_name; + } + } + } + + return $folders; + } + + /** * Getter for folder metadata * * @return array|bool Hash array with meta data for each folder, False on backend failure @@ -694,6 +755,9 @@ return ''; } + /** + * Returns folder data in Syncroton format + */ private function folder_data($folder, $type) { // Folder name parameters @@ -718,6 +782,8 @@ 'parentId' => count($items) ? self::folder_id(implode($delim, $items)) : 0, 'displayName' => rcube_charset::convert($name, 'UTF7-IMAP', kolab_sync::CHARSET), 'type' => $type, + // for internal use + 'imap_name' => $folder, ); }
View file
kolab-syncroton-2.3.3.tar.gz/lib/kolab_sync_data.php -> kolab-syncroton-2.3.4.tar.gz/lib/kolab_sync_data.php
Changed
@@ -1071,7 +1071,8 @@ protected function listFolders($parentid = null) { if (empty($this->imap_folders)) { - $this->imap_folders = $this->backend->folders_list($this->device->deviceid, $this->modelName); + $this->imap_folders = $this->backend->folders_list( + $this->device->deviceid, $this->modelName, $this->isMultiFolder()); } if ($parentid === null) {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.