summaryrefslogtreecommitdiff
path: root/plugins/managesieve
diff options
context:
space:
mode:
authorPaweł Słowik <pawel.slowik@iq.pl>2012-08-30 19:31:40 +0200
committerPaweł Słowik <pawel.slowik@iq.pl>2012-08-30 19:31:40 +0200
commit2ac00a258b9aa859ea78da25cd906e1709df5b75 (patch)
tree639e67b6e82fe2d9c7e25017947486be2e98dcc3 /plugins/managesieve
parent8598fcb2af0c768619dc95d19ba696bc954540a3 (diff)
Sieve enotify/notify - parser
Diffstat (limited to 'plugins/managesieve')
-rw-r--r--plugins/managesieve/lib/rcube_sieve_script.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/plugins/managesieve/lib/rcube_sieve_script.php b/plugins/managesieve/lib/rcube_sieve_script.php
index aa3b9ab6e..66bedb52b 100644
--- a/plugins/managesieve/lib/rcube_sieve_script.php
+++ b/plugins/managesieve/lib/rcube_sieve_script.php
@@ -403,6 +403,20 @@ class rcube_sieve_script
$action_script .= self::escape_string($action['name']) . ' ' . self::escape_string($action['value']);
break;
+ case 'notify':
+ array_push($exts, 'enotify');
+ $action_script .= 'notify';
+ foreach (array('from', 'importance', 'options', 'message') as $n_tag) {
+ if (!empty($action[$n_tag])) {
+ $action_script .= " :$n_tag " . self::escape_string($action[$n_tag]);
+ }
+ }
+ $method = (!empty($action['address']) && !empty($action['body'])) ?
+ sprintf('mailto:%s?body=%s', $action['address'], rawurlencode($action['body'])) :
+ $action['method'];
+ $action_script .= " " . self::escape_string($method);
+ break;
+
case 'vacation':
array_push($exts, 'vacation');
$action_script .= 'vacation';
@@ -840,6 +854,32 @@ class rcube_sieve_script
// $result[] = array('type' => 'require', 'target' => $tokens);
break;
+ case 'notify':
+ $notify = array('type' => 'notify', 'method' => array_pop($tokens));
+
+ // Parameters: :from, :importance, :options, :message
+ for ($i=0, $len=count($tokens); $i<$len; $i++) {
+ $tok = strtolower($tokens[$i]);
+ if ($tok[0] == ':') {
+ $notify[substr($tok, 1)] = $tokens[$i+1];
+ }
+ }
+ $method_components = parse_url($notify['method']);
+ if ($method_components['scheme'] == 'mailto') {
+ $notify['address'] = $method_components['path'];
+ $method_params = array();
+ parse_str($method_components['query'], $method_params);
+ $method_params = array_change_key_case($method_params, CASE_LOWER);
+ /* magic_quotes_gpc and magic_quotes_sybase affect the output of parse_str */
+ if (ini_get('magic_quotes_gpc') || ini_get('magic_quotes_sybase')) {
+ array_map('stripslashes', $method_params);
+ }
+ $notify['body'] = $method_params['body'];
+ }
+
+ $result[] = $notify;
+ break;
+
}
if ($separator == $end)