Remove scriptName which is no longer neccessary to be set, as we set it in emailadmin_seive anyway

This commit is contained in:
Hadi Nategh 2014-05-20 17:22:52 +00:00
parent 467c715ddc
commit 8bbba434c2

View File

@ -191,7 +191,7 @@ class mail_sieve
} }
if (isset($content['externalEmail']) && !empty($content['externalEmail'])) if (isset($content['externalEmail']) && !empty($content['externalEmail']))
{ {
if (!$this->account->imapServer()->setEmailNotification($this->scriptName, $newEmailNotification)) if (!$this->account->imapServer()->setEmailNotification(null, $newEmailNotification))
{ {
$msg = lang("email notification update failed")."<br />"; $msg = lang("email notification update failed")."<br />";
break; break;
@ -334,7 +334,7 @@ class mail_sieve
if($newRule['action'] && $this->rulesByID['priority']) if($newRule['action'] && $this->rulesByID['priority'])
{ {
$this->rules[$ruleID] = $newRule; $this->rules[$ruleID] = $newRule;
$ret = $this->account->imapServer()->setRules($this->scriptName, $this->rules); $ret = $this->account->imapServer()->setRules(null, $this->rules);
if (!$ret && !empty($this->account->imapServer()->error)) if (!$ret && !empty($this->account->imapServer()->error))
{ {
$msg .= lang("Saving the rule failed:")."<br />".$this->account->imapServer()->error."<br />"; $msg .= lang("Saving the rule failed:")."<br />".$this->account->imapServer()->error."<br />";
@ -415,25 +415,17 @@ class mail_sieve
throw new egw_exception_no_permission(); throw new egw_exception_no_permission();
} }
if($this->account->imapServer()->getScript($this->scriptName)) if(PEAR::isError($error = $this->account->imapServer()->retrieveRules()) )
{ {
if(PEAR::isError($error = $this->account->imapServer()->retrieveRules($this->scriptName)) ) $rules = array();
{ $emailNotification = array();
$rules = array();
$emailNotification = array();
}
else
{
$rules = $this->account->imapServer()->getRules($this->scriptName);
$emailNotification = $this->account->imapServer()->getEmailNotification($this->scriptName);
}
} }
else else
{ {
// something went wrong $rules = $this->account->imapServer()->getRules();
error_log(__METHOD__.__LINE__.' failed'); $emailNotification = $this->account->imapServer()->getEmailNotification();
return false;
} }
return $emailNotification; return $emailNotification;
} }
@ -459,7 +451,7 @@ class mail_sieve
else else
{ {
$icServer = $this->account->imapServer(); $icServer = $this->account->imapServer();
$icServer->retrieveRules($this->scriptName); $icServer->retrieveRules();
$vacation = $icServer->getVacation(); $vacation = $icServer->getVacation();
} }
} }
@ -637,10 +629,6 @@ class mail_sieve
} }
else else
{ {
if (!isset($newVacation['scriptName']) || empty($newVacation['scriptName']))
{
$newVacation['scriptName'] = $this->scriptName;
}
$icServer->setAsyncJob($newVacation); $icServer->setAsyncJob($newVacation);
$msg = lang('Vacation notice sucessfully updated.'); $msg = lang('Vacation notice sucessfully updated.');
} }
@ -1091,31 +1079,20 @@ class mail_sieve
*/ */
function getRules($ruleID = null) function getRules($ruleID = null)
{ {
if(($script = $this->account->imapServer()->getScript($this->scriptName))) if(PEAR::isError($error = $this->account->imapServer()->retrieveRules()) )
{ {
$this->scriptToEdit = $this->scriptName; error_log(__METHOD__.__LINE__.$error->message);
if(PEAR::isError($error = $this->account->imapServer()->retrieveRules($this->scriptName)) ) $this->rules = array();
{ $this->rulesByID = array();
error_log(__METHOD__.__LINE__.$error->message); $this->vacation = array();
$this->rules = array();
$this->rulesByID = array();
$this->vacation = array();
}
else
{
$this->rules = $this->account->imapServer()->getRules($this->scriptName);
$this->rulesByID = $this->rules[$ruleID];
$this->vacation = $this->account->imapServer()->getVacation($this->scriptName);
}
return true;
} }
else else
{ {
// something went wrong $this->rules = $this->account->imapServer()->getRules();
error_log(__METHOD__.__LINE__.' failed'); $this->rulesByID = $this->rules[$ruleID];
return false; $this->vacation = $this->account->imapServer()->getVacation();
} }
//error_log(__METHOD__.array2string( $script)); return true;
} }