index d25cdfa2eaa1634925890663888e1e2c1f41065f..94b8a1116a3667a421f0d85af585fe721261282f 100644 (file)
/* 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){
}
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]);
}
}
}
- if($add_else_elsif){
+ if($add_else_elsif && $this->add_above_below == "below"){
$element_types['sieve_else'] = _("Else");
$element_types['sieve_elsif'] = _("Else if");
}
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;
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'] = "<font color='red'>".
_("Failed to save sieve script").": ".
- to_string($this->sieve_handle->error_raw).
+ to_string($sieve->error_raw).
"</font>";
}
}