index 0d51b2d23ccae8f30d98d33d0dc4d0cb4151f4c9..c0606046b0c9094667c53e70d3b0bd4cc58b6d13 100644 (file)
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-require_once("class_mail-methods-cyrus.inc");
class mailMethodKolab extends mailMethodCyrus
{
class mailMethodKolab extends mailMethodCyrus
{
"gosaMailQuota" => "cyrus-userquota",
"gosaMailServer" => "kolabHomeServer");
"gosaMailQuota" => "cyrus-userquota",
"gosaMailServer" => "kolabHomeServer");
- function mailMethodKolab($config)
+ function mailMethodKolab(&$config)
{
$this->config= $config->data['SERVERS']['IMAP'];
}
{
$this->config= $config->data['SERVERS']['IMAP'];
}
- /* 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 updateMailbox($folder)
{
}
function updateMailbox($folder)
{
}
return (TRUE);
}
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' => '');
/* 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' => '');
+ /* Only use lower case folder names, if folder name is like "@domain.com" */
+ if(preg_match("/@/",$folder)){
+ $folder = strtolower($folder);
+ }
+
error_reporting(0);
/* Load quota settings */
error_reporting(0);
/* Load quota settings */
return(false);
}
return(false);
}
- error_reporting(E_ALL);
+ error_reporting(E_ALL | E_STRICT);
return ($result);
}
return ($result);
}
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"){
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);
+ $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
}
/* Convert attributes and objectClasses */
}
/* Convert attributes and objectClasses */
$mailObject->attrs[$dest]= $mailObject->attrs[$source];
$mailObject->$dest= $mailObject->attrs[$source];
$mailObject->attrs[$dest]= $mailObject->attrs[$source];
$mailObject->$dest= $mailObject->attrs[$source];
+ /* Ensure that cleanup will recognize the ampped attributes too */
+ if(isset($mailObject->saved_attributes)){
+ $mailObject->saved_attributes[$dest] = $mailObject->attrs[$source];
+ $mailObject->saved_attributes[$source] = $mailObject->attrs[$source];
+ }
+
unset ($mailObject->$dest['count']);
unset ($mailObject->attrs[$source]);
}
unset ($mailObject->$dest['count']);
unset ($mailObject->attrs[$source]);
}
}
/* Save shared folder target */
}
/* Save shared folder target */
- $mailObject->attrs['gosaSharedFolderTarget']= "kolab+shared.".$mailObject->uid;
+ $mailObject->attrs['gosaSharedFolderTarget']= "kolab+shared.".$mailObject->mail;
/* 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.
/* 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.
/* 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);
/* 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);
+ }else{
+ /* 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);
+
}
}
}
}
+
+ function deleteMailbox($folder)
+ {
+ /* Remove shared folders and skip removing users.
+ KolabD is not able to remove shared folders yet, so we do it instead */
+ if(preg_match("/^shared/",$folder)){
+ return mailMethodCyrus::deleteMailbox($folder);
+ }
+ return (TRUE);
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: