Code

Added additional check, to avoid connecting to unavailable server
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Mar 2007 08:32:06 +0000 (08:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Mar 2007 08:32:06 +0000 (08:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5870 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveManagement.inc

index 5c963d584f190805bf9e29bacbb6ae9b7b153128..d5701e3bb87e96683df4ecd2b3bd8aec0621c8ef 100644 (file)
@@ -127,24 +127,31 @@ class sieveManagement extends plugin
    */
   function get_sieve()
   {
+    
     /* Connect to sieve class and try to get all available sieve scripts */
-    $cfg=  $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer];
-    $this->Sieve_Error = "";
-  
-    /* Log into the mail server */
-    $this->sieve_handle= new sieve(
-        $cfg["sieve_server"], 
-        $cfg["sieve_port"], 
-        $this->parent->uid, 
-        $cfg["password"], 
-        $cfg["admin"]);
-
-    /* Try to login */
-    if (!$this->sieve_handle->sieve_login()){
-      $this->Sieve_Error = $this->sieve_handle->error_raw;
+    if(isset($this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer])){
+      $cfg=  $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer];
+      $this->Sieve_Error = "";
+
+      /* Log into the mail server */
+      $this->sieve_handle= new sieve(
+          $cfg["sieve_server"], 
+          $cfg["sieve_port"], 
+          $this->parent->uid, 
+          $cfg["password"], 
+          $cfg["admin"]);
+
+      /* Try to login */
+      if (!$this->sieve_handle->sieve_login()){
+        $this->Sieve_Error = $this->sieve_handle->error_raw;
+        return(FALSE);
+      }
+      return($this->sieve_handle);
+    }else{
+      $this->Sieve_Error = sprintf(_("The specified mail server '%s' does not exist within the GOsa configuration."),
+        $this->parent->gosaMailServer);
       return(FALSE);
     }
-    return($this->sieve_handle);
   }