X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_mail-methods-kolab.inc;h=2dc40c17fb77e4b9695caf110670cc3884563818;hb=439b82d99aeef6e804007bb36dcf472431a07b9f;hp=59e9aceb5b661adfbe1df3cec6819ba8c55b02d5;hpb=01bd9c6eedc08b9489af21f84681b9a7f040eafa;p=gosa.git diff --git a/include/class_mail-methods-kolab.inc b/include/class_mail-methods-kolab.inc index 59e9aceb5..2dc40c17f 100644 --- a/include/class_mail-methods-kolab.inc +++ b/include/class_mail-methods-kolab.inc @@ -44,15 +44,51 @@ class mailMethodKolab extends mailMethodCyrus return (TRUE); } - function deleteMailbox($folder) { return (TRUE); } + /* Get quota and divide it by 1024, because in gosa we display in MB + but we get Kb */ + function getQuota($folder) + { + $result= array('quotaUsage' => '', 'gosaMailQuota' => ''); + + error_reporting(0); + + /* Load quota settings */ + $quota_value = @imap_get_quota($this->mbox, $folder); + if(is_array($quota_value)) { + if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){ + /* use for PHP >= 4.3 */ + $result['quotaUsage']= (int) ($quota_value["STORAGE"]['usage'] / 1024); + $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024); + } else { + /* backward icompatible */ + $result['quotaUsage']= (int) ($quota_value['usage'] / 1024); + $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024); + } + }elseif(!$quota_value){ + return(false); + } + + error_reporting(E_ALL); + + return ($result); + } + + function fixAttributesOnLoad(&$mailObject) { + /* Kolab shared folder names are like ' shared.uid@server.de ' + So overwrite uid to match these folder names. Else we can't read quota settings etc. + #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/ + if(get_class($mailObject) == "mailgroup"){ + $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail); + } + /* Convert attributes and objectClasses */ foreach ($this->attribute_map as $dest => $source){ /* Hickert 11.11.05 : Alternate email addresses were saved, but not displayed again. @@ -84,6 +120,12 @@ class mailMethodKolab extends mailMethodCyrus function fixAttributesOnStore(&$mailObject) { global $config; + + /* If quota is empty, remove quota restrictions by setting quota to 0 */ + if(isset($mailObject->gosaMailQuota) && (empty($mailObject->gosaMailQuota))){ + $mailObject->attrs['gosaMailQuota'] = 0; + } + /* Convert attributes and objectClasses */ foreach ($this->attribute_map as $source => $dest){ if (isset($mailObject->attrs[$source])){ @@ -161,6 +203,14 @@ class mailMethodKolab extends mailMethodCyrus } } } + + /* Save shared folder target */ + $mailObject->attrs['gosaSharedFolderTarget']= "kolab+shared.".$mailObject->uid; + + /* Kolab shared folder names are like ' shared.uid@server.de ' + So overwrite uid to match these folder names. Else we can't read quota settings etc. + #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/ + $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail); /* Assign new acls */ $mailObject->attrs['acl']= array(); @@ -184,7 +234,11 @@ class mailMethodKolab extends mailMethodCyrus foreach($this->attribute_map as $kolabAttr){ $mailObject->attrs[$kolabAttr] = array(); } - //$mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer); + + /* Only add kolab delete Flag in case of an user.mailAccount */ + if(!in_array("posixGroup", $mailObject->attrs['objectClass'])){ + $mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer); + } } }