Code

Updated phoneAccount.
[gosa.git] / include / class_mail-methods-kolab.inc
index 0ab22b92f6f4849b6832c74fd8ae594a14a98271..61d15c47fdf5b50c6936521383fb3dd670802dd0 100644 (file)
@@ -32,6 +32,18 @@ class mailMethodKolab extends mailMethodCyrus
 
   function mailMethodKolab($config)
   {
+    /* Check if the mail account identification attribute
+       is overridden in the configuration file
+     */
+    if(isset($config->current['MAIL_ATTRIB']) && !empty($config->current['MAIL_ATTRIB'])){
+      $new_uattrib= strtolower($config->current['MAIL_ATTRIB']);
+      if(in_array($new_uattrib,array("mail","uid"))){
+        $this->uattrib = $new_uattrib;
+      }else{
+        trigger_error(sprintf("Unsupported MAIL_ATTRIB in gosa configuration specified, use 'mail' or 'uid', instead of '%s'.",            $new_uattrib));
+      }
+    }
+
     $this->config= $config->data['SERVERS']['IMAP'];
   }
 
@@ -101,6 +113,12 @@ class mailMethodKolab extends mailMethodCyrus
         $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]);
       }
@@ -204,7 +222,7 @@ class mailMethodKolab extends mailMethodCyrus
       }
  
       /* 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.