X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fmail%2Fpersonal%2Fmail%2Fclass_mail-methods-cyrus.inc;h=367917671e66b495d6afa983988031b47bab66b4;hb=4f9f3bf3404420ec2018894f95ccfc09259a3c78;hp=e054fa29ef85ecd45e0456e9e1a40e4eb6127e78;hpb=7a56f9b6e25572359b057e22ff79e71d8a95659a;p=gosa.git
diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc
index e054fa29e..367917671 100644
--- a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc
+++ b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc
@@ -247,10 +247,28 @@ class mailMethodCyrus extends mailMethod{
if ($list === FALSE){
@DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "".$this->account_id."" ,
"IMAP: Add/Update account on server :".$this->MailServer);
- if (!imap_createmailbox($this->imap_handle, $cfg["connect"]. $this->account_id)){
+ if (!imap_createmailbox($this->imap_handle, $cfg["connect"].$this->account_id)){
$this->error = imap_last_error();
return(FALSE);
}
+
+ /* Autocreate configured default folders */
+ $folders= $this->config->get_cfg_value("cyrusAutocreateFolders", null);
+ if ($folders) {
+ $foldersToCreate= explode(",", $folders);
+ $cyrus_delim= $this->cyrusUseSlashes?"/":".";
+
+ // Walk thru list of specified folders
+ foreach ($foldersToCreate as $folder) {
+ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "".$this->account_id."" ,
+ "IMAP: Add/Update account folder ".$folder." on server :".$this->MailServer);
+ if(!imap_createmailbox($this->imap_handle, $cfg["connect"].$this->account_id.$cyrus_delim.$folder)) {
+ $this->error= imap_last_error();
+ return(FALSE);
+ }
+ }
+
+ }
}
}
return(TRUE);
@@ -270,9 +288,16 @@ class mailMethodCyrus extends mailMethod{
$cfg= $this->ServerList[$this->MailServer];
@imap_setacl ($this->imap_handle, $this->account_id, $cfg["admin"], "lrswipcda");
- if (!imap_deletemailbox($this->imap_handle, $cfg["connect"].$this->account_id)){
- $this->error = imap_last_error();
- return (FALSE);
+
+ if ($this->config->get_cfg_value("cyrusDeleteMailbox", "true") == "true"){
+ if (!imap_deletemailbox($this->imap_handle, $cfg["connect"].$this->account_id)){
+ $this->error = imap_last_error();
+ return (FALSE);
+ }
+ } else{
+ msg_dialog::display(_("Mail info"),
+ sprintf(_("LDAP entry has been removed but cyrus mailbox (%s) is kept.\nPlease delete it manually!"),
+ $this->account_id), INFO_DIALOG);
}
return (TRUE);
}
@@ -523,7 +548,7 @@ class mailMethodCyrus extends mailMethod{
$script= "";
if (is_integer(strpos($gosaMailDeliveryMode, "R")) ||
is_integer(strpos($gosaMailDeliveryMode, "C")) ||
- !is_integer(strpos($gosaMailDeliveryMode, "L")) ||
+ !is_integer(strpos($gosaMailDeliveryMode, "I")) ||
is_integer(strpos($gosaMailDeliveryMode, "V")) ||
is_integer(strpos($gosaMailDeliveryMode, "S"))){
@@ -562,7 +587,7 @@ class mailMethodCyrus extends mailMethod{
}
/* If no local delivery is wanted, tell the script to discard the mail */
- if (!is_integer(strpos($gosaMailDeliveryMode, "L"))){
+ if (!is_integer(strpos($gosaMailDeliveryMode, "I"))){
$text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-discard.txt")));
eval ("\$script.=\"$text\";");
}