Code

Inluding tuned version of patch from #808
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 Dec 2009 15:06:18 +0000 (15:06 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 Dec 2009 15:06:18 +0000 (15:06 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14888 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc

index 97e742771eae3c32a04b7dd9be9fec21807132f7..a5cf20e2bdfb1dd5ba0ee2b41fb312081f2bc7e3 100644 (file)
@@ -247,10 +247,26 @@ class mailMethodCyrus extends mailMethod{
       if ($list === FALSE){
         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>".$this->account_id."</b>" , 
           "<b>IMAP: Add/Update account</b> 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) {
+            if(!imap_createmailbox($this->imap_handle, $cfg["connect"].$this->account_id.$cyrus_delim.$folder)) {
+              $this->error= imap_last_error();
+              return(FALSE);
+            }
+          }
+
+        }
       }
     }
     return(TRUE);