Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mms] Use standardized 'enotify' sieve extension (RFC 5435) by defaul…
…t instead of deprecated 'notify' extension (Request #8784).
  • Loading branch information
slusarz committed Apr 14, 2014
1 parent 199448a commit f027799
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 10 deletions.
4 changes: 4 additions & 0 deletions ingo/config/backends.php
Expand Up @@ -282,6 +282,10 @@
// 'imap4flags'.
// 'imapflags' => true,

// If true, use the deprecated 'notify' extension instead of
// the newer, standardized 'enotify'.
// 'notify' => true,

// If using Dovecot or any other Sieve implementation that
// requires folder names to be UTF-8 encoded, set this
// parameter to true.
Expand Down
2 changes: 2 additions & 0 deletions ingo/docs/CHANGES
Expand Up @@ -2,6 +2,8 @@
v3.2.0-git
----------

[mms] Use standardized 'enotify' sieve extension (RFC 5435) by default instead
of deprecated 'notify' extension (Request #8784).
[mms] Use standardized 'imap4flags' sieve extension (RFC 5232) by default
instead of deprecated 'imapflags' extension (Request #8784).
[mms] Add ability to filter rules by mailbox.
Expand Down
8 changes: 6 additions & 2 deletions ingo/docs/UPGRADING
Expand Up @@ -55,9 +55,13 @@ e-mail address to pre-populate into a new rule.
Backend Configuration (backends.php)
------------------------------------

The Sieve driver now uses the 'enotify' extension by default. If using an
old version of Sieve that only supports the deprecated 'notify' setting, set
'notify' to true in the sieve script parameters (see backends.php).

The Sieve driver now uses 'imap4flags' by default to set flags. If using an
old version of Sieve that supports the deprecated 'imapflags' setting, set
'imapflags' to true in the sieve script parameters (see backends.php).
old version of Sieve that only supports the deprecated 'imapflags' setting,
set 'imapflags' to true in the sieve script parameters (see backends.php).


Configuration Options (conf.php)
Expand Down
6 changes: 5 additions & 1 deletion ingo/lib/Script/Sieve.php
Expand Up @@ -593,7 +593,11 @@ protected function _generate()
break;

case Ingo_Storage::ACTION_NOTIFY:
$action[] = new Ingo_Script_Sieve_Action_Notify(array('address' => $filter['action-value'], 'name' => $filter['name']));
$action[] = new Ingo_Script_Sieve_Action_Notify(array(
'address' => $filter['action-value'],
'name' => $filter['name'],
'notify' => !empty($this->_params['notify'])
));
break;

case Ingo_Storage::ACTION_WHITELIST:
Expand Down
26 changes: 19 additions & 7 deletions ingo/lib/Script/Sieve/Action/Notify.php
Expand Up @@ -15,6 +15,9 @@
/**
* The Ingo_Script_Sieve_Action_Notify class represents a notify action.
*
* It supports both enotify (RFC 5435) and the older, deprecated notify
* (draft-martin-sieve-notify-01) capabilities.
*
* @author Paul Wolstenholme <wolstena@sfu.ca>
* @author Jan Schneider <jan@horde.org>
* @category Horde
Expand All @@ -26,7 +29,11 @@ class Ingo_Script_Sieve_Action_Notify extends Ingo_Script_Sieve_Action
/**
* Constructor.
*
* @param array $vars Any required parameters.
* @param array $vars Required parameters:
* - address: (string) Address.
* - name: (string) Name.
* - notify: (boolean) If set, use notify instead of enotify.
*
*/
public function __construct($vars = array())
{
Expand All @@ -36,6 +43,7 @@ public function __construct($vars = array())
$this->_vars['name'] = isset($vars['name'])
? $vars['name']
: '';
$this->_vars['notify'] = !empty($vars['notify']);
}

/**
Expand All @@ -45,13 +53,15 @@ public function __construct($vars = array())
*/
public function generate()
{
return 'notify :method "mailto" :options "' .
Ingo_Script_Sieve::escapeString($this->_vars['address']) .
'" :message "' .
_("You have received a new message") . "\n" .
$addr = Ingo_Script_Sieve::escapeString($this->_vars['address']);
$msg = _("You have received a new message") . "\n" .
_("From:") . " \$from\$ \n" .
_("Subject:") . " \$subject\$ \n" .
_("Rule:") . ' ' . $this->_vars['name'] . '";';
_("Rule:") . ' ' . $this->_vars['name'];

return $this->_vars['notify']
? 'notify :method "mailto" :options "' . $addr . '" :message "' . $msg . '";'
: 'notify :message "' . $msg . '" "mailto:' . $addr . '";';
}

/**
Expand All @@ -75,6 +85,8 @@ public function check()
*/
public function requires()
{
return array('notify');
return $this->_vars['notify']
? array('notify')
: array('enotify');
}
}
1 change: 1 addition & 0 deletions ingo/package.xml
Expand Up @@ -33,6 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/apache">ASL</license>
<notes>
* [mms] Use standardized &apos;enotify&apos; sieve extension (RFC 5435) by default instead of deprecated &apos;notify&apos; extension (Request #8784).
* [mms] Use standardized &apos;imap4flags&apos; sieve extension (RFC 5232) by default instead of deprecated &apos;imapflags&apos; extension (Request #8784).
* [mms] Add ability to filter rules by mailbox.
* [mms] Add &apos;max_forward&apos; permission (Request #10332).
Expand Down

0 comments on commit f027799

Please sign in to comment.