From 0b683e2fb15696d0effcdf5fd021e0962b2caa68 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 16 Mar 2007 13:26:46 +0000 Subject: [PATCH] Fixed sieve handle git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5803 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/sieve/class_sieveManagement.inc | 35 ++++++++----------- .../templates/object_container_clear.tpl | 11 ++++++ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/include/sieve/class_sieveManagement.inc b/include/sieve/class_sieveManagement.inc index d25cdfa2e..94b8a1116 100644 --- a/include/sieve/class_sieveManagement.inc +++ b/include/sieve/class_sieveManagement.inc @@ -285,8 +285,8 @@ class sieveManagement extends plugin /* Try to activate the given script and update * class script array. */ - if(!$this->sieve_handle->sieve_setactivescript($this->scripts[$script]['NAME'])){ - print_red(sprintf(_("Can't activate sieve script on server. Server says '%s'."),to_string($this->sieve_handle->error_raw))); + if(!$sieve->sieve_setactivescript($this->scripts[$script]['NAME'])){ + print_red(sprintf(_("Can't activate sieve script on server. Server says '%s'."),to_string($sieve->error_raw))); }else{ foreach($this->scripts as $key => $data){ if($key == $script){ @@ -328,7 +328,7 @@ class sieveManagement extends plugin } if(!$sieve->sieve_deletescript($this->scripts[$this->script_to_delete]['NAME'])){ - print_red(sprintf(_("Can't remove sieve script from server. Server says '%s'."),to_string($this->sieve_handle->error_raw))); + print_red(sprintf(_("Can't remove sieve script from server. Server says '%s'."),to_string($sieve->error_raw))); }else{ unset($this->scripts[$this->script_to_delete]); } @@ -596,7 +596,7 @@ class sieveManagement extends plugin } } - if($add_else_elsif){ + if($add_else_elsif && $this->add_above_below == "below"){ $element_types['sieve_else'] = _("Else"); $element_types['sieve_elsif'] = _("Else if"); } @@ -806,19 +806,12 @@ class sieveManagement extends plugin function save() { - /* Connect to sieve class and try to get all available sieve scripts */ - $cfg= $this->config->data['SERVERS']['IMAP'][$this->parent->gosaMailServer]; - - $this->sieve_handle= - new sieve( $cfg["sieve_server"], - $cfg["sieve_port"], - $this->parent->mail, - $cfg["password"], - $cfg["admin"]); - - if (!$this->sieve_handle->sieve_login()){ - print_red(sprintf(_("Can't log into SIEVE server. Server says '%s'."),to_string($this->sieve_handle->error_raw))); - return; + /* Get sieve */ + if(!$sieve = $this->get_sieve()){ + print_red( + sprintf( + _("Can't log into SIEVE server. Server says '%s'."), + to_string($this->Sieve_Error))); } $everything_went_fine = TRUE; @@ -826,13 +819,13 @@ class sieveManagement extends plugin foreach($this->scripts as $key => $script){ if($script['EDITED']){ $data = $this->scripts[$key]['SCRIPT']; - if(!$this->sieve_handle->sieve_sendscript($script['NAME'], $data)){ - gosa_log("Failed to save sieve script named '".$script['NAME']."': ".to_string($this->sieve_handle->error_raw)); + if(!$sieve->sieve_sendscript($script['NAME'], $data)){ + gosa_log("Failed to save sieve script named '".$script['NAME']."': ".to_string($sieve->error_raw)); $everything_went_fine = FALSE; - print_red(to_string($this->sieve_handle->error_raw)); + print_red(to_string($sieve->error_raw)); $this->scripts[$key]['MSG'] = "". _("Failed to save sieve script").": ". - to_string($this->sieve_handle->error_raw). + to_string($sieve->error_raw). ""; } } diff --git a/include/sieve/templates/object_container_clear.tpl b/include/sieve/templates/object_container_clear.tpl index aefc8b10a..371683354 100644 --- a/include/sieve/templates/object_container_clear.tpl +++ b/include/sieve/templates/object_container_clear.tpl @@ -1,4 +1,15 @@ + + + +
+   + +   + +