Code

Added mail domain detection to kolab 22 method
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Dec 2008 08:21:01 +0000 (08:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Dec 2008 08:21:01 +0000 (08:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13221 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab22.inc

index 19835b188f863448c6eff7857c790016f5b7f6a3..a5760ed92df4a904226a12d8ba45eb71aace5be9 100644 (file)
@@ -25,7 +25,27 @@ class mailMethodKolab22 extends mailMethodKolab
    */
   public function getMailDomains()
   {
-    return(array("gonicus.de"));
+    $domains = array();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=kolab)(k=kolab)(postfix-mydestination=*))",array("postfix-mydestination"));
+
+    if($ldap->count() == 1){
+      $attrs = $ldap->fetch();
+      for($i=0; $i <$attrs['postfix-mydestination']['count']; $i ++ ){
+        $domains[] = $attrs['postfix-mydestination'][$i];
+      }
+      @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>Found: ".trim(implode($domains,", "),", ")."</b>",
+          "Revceiving 'Mail domains for kolab22'.");
+    }elseif($ldap->count() == 0){
+      @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>No domains found. Check k=kolab and postfix-mydestination</b>",
+          "Revceiving 'Mail domains for kolab22'.");
+    }else{
+      @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>Found more than one kolab configuration object. Giving up.</b>",
+          "Revceiving 'Mail domains for kolab22'.");
+    }
+
+    return($domains);
   } 
 }