index 957c35863a89f87ec88690435dcc47d170151ae3..18e55fa6d2810d93dba2bdddaa582aa711c49b60 100644 (file)
var $mbox= "-";
var $config;
var $gosaMailServer= "";
+var $uattrib= "uid";
function mailMethodCyrus($config)
{
}
}elseif(!$quota_value){
/* If there is no quota defined for this account, the function imap_get_quota returns false. */
- return(array());
+ return(array("quotaUsage"=>"","gosaMailQuota"=>""));
}
error_reporting (E_ALL);
return ($result);
}
+
+ /* return all folders of the users mailbox*/
function getMailboxList($folder, $uid= "")
{
- /* Initialize depending on group or user mode */
- if ($uid != ""){
- $result= array("INBOX");
- } else {
- $result= array();
+ 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];
- $list = imap_listmailbox($this->mbox, $cfg["connect"], $folder.".*");
+
+ /* 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){
- $result[]=preg_replace ("/.*user\.".$uid."\./",
- "INBOX.", imap_utf7_decode ($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 updateMailbox($folder)
{
/* Check if mailbox exists */