mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 16:29:22 +01:00
Switch sieve from oldimap class to new imap
This commit is contained in:
parent
b25724e7ed
commit
1c31dad881
@ -57,21 +57,13 @@ class mail_sieve
|
|||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
$this->displayCharset = translation::charset();
|
||||||
if(empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName']))
|
|
||||||
{
|
|
||||||
$GLOBALS['egw']->preferences->add('mail','sieveScriptName','felamimail', 'forced');
|
|
||||||
$GLOBALS['egw']->preferences->save_repository();
|
|
||||||
}
|
|
||||||
$this->scriptName = (!empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'])) ? $GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'] : 'felamimail' ;
|
|
||||||
$this->displayCharset = $GLOBALS['egw']->translation->charset();
|
|
||||||
$this->botranslation =& $GLOBALS['egw']->translation;
|
|
||||||
$profileID = 0;
|
$profileID = 0;
|
||||||
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
|
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
|
||||||
{
|
{
|
||||||
$profileID = (int) $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
|
$profileID = (int) $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
|
||||||
}
|
}
|
||||||
$this->mailbo = mail_bo::getInstance(false, $profileID, false, $oldIMAPObject=true);
|
$this->mailbo = mail_bo::getInstance(false, $profileID, false,false);
|
||||||
|
|
||||||
$this->mailPreferences =& $this->mailbo->mailPreferences;
|
$this->mailPreferences =& $this->mailbo->mailPreferences;
|
||||||
$this->mailConfig = config::read('mail');
|
$this->mailConfig = config::read('mail');
|
||||||
@ -80,19 +72,8 @@ class mail_sieve
|
|||||||
$this->currentIdentity = $allIdentities[$defaultIdentity];
|
$this->currentIdentity = $allIdentities[$defaultIdentity];
|
||||||
$this->currentIdentity['identity_string'] = mail_bo::generateIdentityString($allIdentities[$defaultIdentity],true);
|
$this->currentIdentity['identity_string'] = mail_bo::generateIdentityString($allIdentities[$defaultIdentity],true);
|
||||||
$this->restoreSessionData();
|
$this->restoreSessionData();
|
||||||
$icServer = $this->mailbo->icServer;
|
$this->bosieve = $this->mailbo->icServer;
|
||||||
if(($icServer instanceof defaultimap) && $icServer->enableSieve)
|
$this->timed_vacation = $this->bosieve->enableSieve && $this->bosieve->acc_imap_administration;
|
||||||
{
|
|
||||||
$this->bosieve = $icServer;
|
|
||||||
$serverclass = get_class($icServer);
|
|
||||||
$classsupportstimedsieve = false;
|
|
||||||
if (!empty($serverclass) && stripos(constant($serverclass . '::CAPABILITIES'), 'timedsieve') !== false)
|
|
||||||
{
|
|
||||||
$classsupportstimedsieve = true;
|
|
||||||
}
|
|
||||||
$this->timed_vacation = $classsupportstimedsieve && $icServer->enableCyrusAdmin &&
|
|
||||||
$icServer->adminUsername && $icServer->adminPassword;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +127,7 @@ class mail_sieve
|
|||||||
{
|
{
|
||||||
//Instantiate an etemplate_new object, representing sieve.emailNotification
|
//Instantiate an etemplate_new object, representing sieve.emailNotification
|
||||||
$eNotitmpl = new etemplate_new('mail.sieve.emailNotification');
|
$eNotitmpl = new etemplate_new('mail.sieve.emailNotification');
|
||||||
|
|
||||||
if ($this->mailbo->icServer->enableSieve)
|
if ($this->mailbo->icServer->enableSieve)
|
||||||
{
|
{
|
||||||
$eNotification = $this->getEmailNotification();
|
$eNotification = $this->getEmailNotification();
|
||||||
@ -203,7 +184,7 @@ class mail_sieve
|
|||||||
if ($button === 'apply')
|
if ($button === 'apply')
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
egw_framework::window_close();
|
egw_framework::window_close();
|
||||||
@ -405,7 +386,7 @@ class mail_sieve
|
|||||||
if(!(empty($this->mailPreferences['prefpreventnotificationformailviaemail']) || $this->mailPreferences['prefpreventnotificationformailviaemail'] == 0))
|
if(!(empty($this->mailPreferences['prefpreventnotificationformailviaemail']) || $this->mailPreferences['prefpreventnotificationformailviaemail'] == 0))
|
||||||
{
|
{
|
||||||
throw new egw_exception_no_permission();
|
throw new egw_exception_no_permission();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->bosieve->getScript($this->scriptName))
|
if($this->bosieve->getScript($this->scriptName))
|
||||||
{
|
{
|
||||||
@ -440,7 +421,7 @@ class mail_sieve
|
|||||||
function getVacation(&$vacation,&$msg)
|
function getVacation(&$vacation,&$msg)
|
||||||
{
|
{
|
||||||
//$response->call('app.mail.sieve_vac_response_addresses');
|
//$response->call('app.mail.sieve_vac_response_addresses');
|
||||||
|
|
||||||
if(!(empty($this->mailPreferences['prefpreventabsentnotice']) || $this->mailPreferences['prefpreventabsentnotice'] == 0))
|
if(!(empty($this->mailPreferences['prefpreventabsentnotice']) || $this->mailPreferences['prefpreventabsentnotice'] == 0))
|
||||||
{
|
{
|
||||||
throw new egw_exception_no_permission();
|
throw new egw_exception_no_permission();
|
||||||
@ -468,10 +449,6 @@ class mail_sieve
|
|||||||
$defaultIdentity = $this->mailbo->getDefaultIdentity();
|
$defaultIdentity = $this->mailbo->getDefaultIdentity();
|
||||||
foreach($allIdentities as &$singleIdentity)
|
foreach($allIdentities as &$singleIdentity)
|
||||||
{
|
{
|
||||||
if((empty($vacation))&& !empty($singleIdentity['ident_email']) && $singleIdentity['ident_email']==$allIdentities[$defaultIdentity]['ident_email'])
|
|
||||||
{
|
|
||||||
$selectedAddresses[$singleIdentity['ident_email']] = $singleIdentity['ident_email'];
|
|
||||||
}
|
|
||||||
$predefinedAddresses[$singleIdentity['ident_email']] = $singleIdentity['ident_email'];
|
$predefinedAddresses[$singleIdentity['ident_email']] = $singleIdentity['ident_email'];
|
||||||
}
|
}
|
||||||
asort($predefinedAddresses);
|
asort($predefinedAddresses);
|
||||||
@ -479,7 +456,7 @@ class mail_sieve
|
|||||||
return array(
|
return array(
|
||||||
'vacation' =>$vacation,
|
'vacation' =>$vacation,
|
||||||
'aliases' => array_values($predefinedAddresses),
|
'aliases' => array_values($predefinedAddresses),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -532,7 +509,6 @@ class mail_sieve
|
|||||||
//$this->timed_vacation=true;//this could force the timed vacation thingy even if not supported ;-)
|
//$this->timed_vacation=true;//this could force the timed vacation thingy even if not supported ;-)
|
||||||
if ($this->timed_vacation)
|
if ($this->timed_vacation)
|
||||||
{
|
{
|
||||||
include_once(EGW_API_INC.'/class.jscalendar.inc.php');
|
|
||||||
$ByDate = array('by_date' => lang('By date'));
|
$ByDate = array('by_date' => lang('By date'));
|
||||||
}
|
}
|
||||||
if (!is_array($content))
|
if (!is_array($content))
|
||||||
@ -623,7 +599,7 @@ class mail_sieve
|
|||||||
if (!isset($newVacation['scriptName']) || empty($newVacation['scriptName']))
|
if (!isset($newVacation['scriptName']) || empty($newVacation['scriptName']))
|
||||||
{
|
{
|
||||||
$newVacation['scriptName'] = $this->scriptName;
|
$newVacation['scriptName'] = $this->scriptName;
|
||||||
}
|
}
|
||||||
$this->bosieve->setAsyncJob($newVacation);
|
$this->bosieve->setAsyncJob($newVacation);
|
||||||
$msg = lang('Vacation notice sucessfully updated.');
|
$msg = lang('Vacation notice sucessfully updated.');
|
||||||
}
|
}
|
||||||
@ -639,7 +615,7 @@ class mail_sieve
|
|||||||
if ($button === 'apply' || $this->bosieve->error !=="")
|
if ($button === 'apply' || $this->bosieve->error !=="")
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
@ -751,7 +727,7 @@ class mail_sieve
|
|||||||
{
|
{
|
||||||
$orders[$keys] = $orders[$keys] -1;
|
$orders[$keys] = $orders[$keys] -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getRules(null);
|
$this->getRules(null);
|
||||||
|
|
||||||
$newrules = $this->rules;
|
$newrules = $this->rules;
|
||||||
|
@ -2456,22 +2456,19 @@ unset($query['actions']);
|
|||||||
$vacation = $this->mail_bo->icServer->acc_sieve_enabled && ($this->mail_bo->icServer->acc_sieve_host||$this->mail_bo->icServer->acc_imap_host);
|
$vacation = $this->mail_bo->icServer->acc_sieve_enabled && ($this->mail_bo->icServer->acc_sieve_host||$this->mail_bo->icServer->acc_imap_host);
|
||||||
//error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Sieve Enabled:'.array2string($vacation));
|
//error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Sieve Enabled:'.array2string($vacation));
|
||||||
if($vacation) {
|
if($vacation) {
|
||||||
$sieveServerClass = mail_bo::getInstance(false, self::$icServerID, false, $oldIMAPObject=true);
|
$sieveServer = $this->mail_bo->icServer;
|
||||||
$sieveServer = $sieveServerClass->icServer;
|
|
||||||
//error_log(__METHOD__.__LINE__.' Sieve Server:'.self::$icServerID.' InstanceOf:'.array2string(($sieveServer instanceof defaultimap)|| ($sieveServer instanceof emailadmin_oldimap)).':'.array2string($sieveServerClass));
|
//error_log(__METHOD__.__LINE__.' Sieve Server:'.self::$icServerID.' InstanceOf:'.array2string(($sieveServer instanceof defaultimap)|| ($sieveServer instanceof emailadmin_oldimap)).':'.array2string($sieveServerClass));
|
||||||
if(($sieveServer instanceof defaultimap) || ($sieveServer instanceof emailadmin_oldimap)) {
|
$scriptName = (!empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'])) ? $GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'] : 'felamimail';
|
||||||
$scriptName = (!empty($GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'])) ? $GLOBALS['egw_info']['user']['preferences']['mail']['sieveScriptName'] : 'felamimail';
|
$sieveServer->getScript($scriptName);
|
||||||
$sieveServer->getScript($scriptName);
|
$rules = $sieveServer->retrieveRules($sieveServer->scriptName,true);
|
||||||
$rules = $sieveServer->retrieveRules($sieveServer->scriptName,true);
|
$vacation = $sieveServer->getVacation($sieveServer->scriptName);
|
||||||
$vacation = $sieveServer->getVacation($sieveServer->scriptName);
|
$isSieveError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*15);
|
||||||
$isSieveError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*15);
|
if ($isSieveError[self::$icServerID])
|
||||||
if ($isSieveError[self::$icServerID])
|
{
|
||||||
{
|
$vacation = false;
|
||||||
$vacation = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Vacation retrieved:'.array2string($vacation));
|
|
||||||
}
|
}
|
||||||
|
//error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Vacation retrieved:'.array2string($vacation));
|
||||||
return $vacation;
|
return $vacation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user