mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-16 13:03:16 +01:00
* Mail: fix sieve rules for moving mails into folder containing non-ascii chars (Dovecot requires sieve rules in utf8, while Cyrus needs utf7-imap)
This commit is contained in:
parent
e3748b2e95
commit
77e592da0f
@ -205,4 +205,22 @@ class emailadmin_imap_cyrus extends emailadmin_imap
|
||||
}
|
||||
$this->disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy former bosieve methods to internal emailadmin_sieve instance
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $params
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __call($name,array $params=null)
|
||||
{
|
||||
switch($name)
|
||||
{
|
||||
case 'setRules': // call setRules with 3. param of true, to enable utf7imap fileinto for Cyrus
|
||||
$params += array(null, null, true);
|
||||
break;
|
||||
}
|
||||
return parent::__call($name, $params);
|
||||
}
|
||||
}
|
||||
|
@ -234,8 +234,13 @@ class emailadmin_script {
|
||||
}
|
||||
|
||||
|
||||
// update and save sieve script
|
||||
function updateScript ($connection)
|
||||
/**
|
||||
* update and save sieve script
|
||||
*
|
||||
* @param emailadmin_imap $connection
|
||||
* @param boolean $utf7imap_fileinto =false true: encode foldernames with utf7imap, default utf8
|
||||
*/
|
||||
function updateScript ($connection, $utf7imap_fileinto=false)
|
||||
{
|
||||
#global $_SESSION,$default,$sieve;
|
||||
global $default,$sieve;
|
||||
@ -383,7 +388,8 @@ class emailadmin_script {
|
||||
if (!$rule['unconditional']) $newruletext .= ") {\n\t";
|
||||
|
||||
if (preg_match("/folder/i",$rule['action'])) {
|
||||
$newruletext .= "fileinto \"" . $rule['action_arg'] . "\";";
|
||||
$newruletext .= "fileinto \"" . ($utf7imap_fileinto ?
|
||||
translation::convert($rule['action_arg'],'utf-8', 'utf7-imap') : $rule['action_arg']) . "\";";
|
||||
}
|
||||
if (preg_match("/reject/i",$rule['action'])) {
|
||||
$newruletext .= "reject text: \n" . $rule['action_arg'] . "\n.\n;";
|
||||
|
@ -569,13 +569,14 @@ class emailadmin_sieve extends Net_Sieve
|
||||
*
|
||||
* @param array $_rules
|
||||
* @param string $_scriptName
|
||||
* @param boolean $utf7imap_fileinto =false true: encode foldernames with utf7imap, default utf8
|
||||
*/
|
||||
function setRules(array $_rules, $_scriptName=null)
|
||||
function setRules(array $_rules, $_scriptName=null, $utf7imap_fileinto=false)
|
||||
{
|
||||
$script = $this->retrieveRules($_scriptName);
|
||||
$script->debug = $this->debug;
|
||||
$script->rules = $_rules;
|
||||
$ret = $script->updateScript($this);
|
||||
$ret = $script->updateScript($this, $utf7imap_fileinto);
|
||||
$this->error = $script->errstr;
|
||||
return $ret;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ class mail_sieve
|
||||
switch ($rules['action'])
|
||||
{
|
||||
case 'folder':
|
||||
$content['action_folder_text'][] = translation::convert($rules['action_arg'],'utf-8','utf7-imap');
|
||||
$content['action_folder_text'][] = $rules['action_arg'];
|
||||
|
||||
break;
|
||||
case 'address':
|
||||
@ -285,7 +285,7 @@ class mail_sieve
|
||||
switch ($content['action'])
|
||||
{
|
||||
case 'folder':
|
||||
$newRule['action_arg'] = translation::convert(implode($content['action_folder_text']), 'utf7-imap', 'utf-8');
|
||||
$newRule['action_arg'] = implode($content['action_folder_text']);
|
||||
break;
|
||||
case 'address':
|
||||
$newRule['action_arg'] = implode(',',$content['action_address_text']);
|
||||
|
Loading…
Reference in New Issue
Block a user