From 7581b2090a04a369faa766dc7a9b28377d57150c Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 20 Oct 2006 09:17:49 +0000 Subject: [PATCH] Move kolab getFolderList function to cyrus. They use the same methods to get the foldernames. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4908 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_mail-methods-cyrus.inc | 45 ++++++++++++++++++++++++++++ include/class_mail-methods-kolab.inc | 44 --------------------------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/include/class_mail-methods-cyrus.inc b/include/class_mail-methods-cyrus.inc index a3e03ef50..4e752abf6 100644 --- a/include/class_mail-methods-cyrus.inc +++ b/include/class_mail-methods-cyrus.inc @@ -23,6 +23,7 @@ class mailMethodCyrus extends mailMethod var $mbox= "-"; var $config; var $gosaMailServer= ""; +var $uattrib= "uid"; function mailMethodCyrus($config) { @@ -96,7 +97,51 @@ class mailMethodCyrus extends mailMethod return ($result); } + + /* return all folders of the users mailbox*/ function getMailboxList($folder, $uid= "") + { + global $config; + $result = array(); + + /* Get domain an mail address if uid is an mail address */ + $domain = ""; + if(preg_match("/@/",$folder)){ + $domain = "@".preg_replace("/^.*@/","",$folder); + $folder = preg_replace("/@.*$/","",$folder); + } + + /* Get list of mailboxes for combo box */ + $cfg= $this->config[$this->gosaMailServer]; + + /* Create search pattern + (user/kekse*@domain.de + user.kekse*@domain.de + user.kekse* ) + depending on given folder name) */ + $q = $folder."*".$domain; + $list = imap_listmailbox($this->mbox, $cfg["connect"], $q); + + /* Create list of returned folder names */ + if (is_array($list)){ + foreach ($list as $val){ + + /* Cut domain name */ + $val = preg_replace("/@.*$/","",$val); + $result[]=preg_replace ("/^.*".normalizePreg($folder)."/","INBOX", imap_utf7_decode ($val)); + } + } + + /* Append "INBOX" to the folder array if result is empty and request comes from user dialog */ + if(empty($result) && !empty($uid)){ + $result[] = "INBOX"; + } + + return ($result); + } + + + function getMailboxList2($folder, $uid= "") { /* Initialize depending on group or user mode */ if ($uid != ""){ diff --git a/include/class_mail-methods-kolab.inc b/include/class_mail-methods-kolab.inc index 0d1c7b98a..0cd0e15be 100644 --- a/include/class_mail-methods-kolab.inc +++ b/include/class_mail-methods-kolab.inc @@ -44,50 +44,6 @@ class mailMethodKolab extends mailMethodCyrus return (TRUE); } - /* return all folders of the users mailbox*/ - function getMailboxList($folder, $uid= "") - { - global $config; - $result = array(); - - /* Get domain an mail address if uid is an mail address */ - $domain = ""; - if(preg_match("/@/",$folder)){ - $domain = preg_replace("/^.*@/","",$folder); - $folder = preg_replace("/@.*$/","",$folder); - } - - /* Get list of mailboxes for combo box */ - $cfg= $this->config[$this->gosaMailServer]; - - /* Create search pattern - (user/kekse*@domain.de - user.kekse*@domain.de - user.kekse* ) - depending on given folder name) */ - $q = $folder."*@".$domain; - $list = imap_listmailbox($this->mbox, $cfg["connect"], $q); - - /* Create list of returned folder names */ - if (is_array($list)){ - foreach ($list as $val){ - - /* Cut domain name */ - $val = preg_replace("/@.*$/","",$val); - $result[]=preg_replace ("/^.*".normalizePreg($folder)."/","INBOX", imap_utf7_decode ($val)); - } - } - - /* Append "INBOX" to the folder array if result is empty and request comes from user dialog */ - if(empty($result) && !empty($uid)){ - $result[] = "INBOX"; - } - - return ($result); - } - - - /* Get quota and divide it by 1024, because in gosa we display in MB but we get Kb */ function getQuota($folder) -- 2.30.2