plugins/managesieve/lib/rcube_sieve_script.php | ●●●●● patch | view | raw | blame | history | |
plugins/managesieve/localization/en_GB.inc | ●●●●● patch | view | raw | blame | history | |
plugins/managesieve/localization/en_US.inc | ●●●●● patch | view | raw | blame | history | |
plugins/managesieve/localization/pl_PL.inc | ●●●●● patch | view | raw | blame | history | |
plugins/managesieve/managesieve.js | ●●●●● patch | view | raw | blame | history | |
plugins/managesieve/managesieve.php | ●●●●● patch | view | raw | blame | history | |
plugins/managesieve/tests/src/parser_notify_a | ●●●●● patch | view | raw | blame | history | |
plugins/managesieve/tests/src/parser_notify_b | ●●●●● patch | view | raw | blame | history |
plugins/managesieve/lib/rcube_sieve_script.php
@@ -403,6 +403,26 @@ $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]); } } if (!empty($action['address'])) { $method = 'mailto:' . $action['address']; if (!empty($action['body'])) { $method .= '?body=' . rawurlencode($action['body']); } } else { $method = $action['method']; } $action_script .= " " . self::escape_string($method); break; case 'vacation': array_push($exts, 'vacation'); $action_script .= 'vacation'; @@ -840,6 +860,34 @@ // $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(); if (array_key_exists('query', $method_components)) { 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'] = (array_key_exists('body', $method_params)) ? $method_params['body'] : ''; } $result[] = $notify; break; } if ($separator == $end) plugins/managesieve/localization/en_GB.inc
@@ -97,6 +97,15 @@ $labels['setvarname'] = 'Variable name:'; $labels['setvarvalue'] = 'Variable value:'; $labels['setvarmodifiers'] = 'Modifiers:'; $labels['notify'] = 'Send notification'; $labels['notifyaddress'] = 'To e-mail address:'; $labels['notifybody'] = 'Notification body:'; $labels['notifysubject'] = 'Notification subject:'; $labels['notifyfrom'] = 'Notification sender:'; $labels['notifyimportance'] = 'Importance:'; $labels['notifyimportancelow'] = 'low'; $labels['notifyimportancenormal'] = 'normal'; $labels['notifyimportancehigh'] = 'high'; $labels['filtercreate'] = 'Create filter'; $labels['usedata'] = 'Use following data in the filter:'; $labels['nextstep'] = 'Next Step'; plugins/managesieve/localization/en_US.inc
@@ -88,6 +88,15 @@ $labels['varupperfirst'] = 'first character upper-case'; $labels['varquotewildcard'] = 'quote special characters'; $labels['varlength'] = 'length'; $labels['notify'] = 'Send notification'; $labels['notifyaddress'] = 'To e-mail address:'; $labels['notifybody'] = 'Notification body:'; $labels['notifysubject'] = 'Notification subject:'; $labels['notifyfrom'] = 'Notification sender:'; $labels['notifyimportance'] = 'Importance:'; $labels['notifyimportancelow'] = 'low'; $labels['notifyimportancenormal'] = 'normal'; $labels['notifyimportancehigh'] = 'high'; $labels['filtercreate'] = 'Create filter'; $labels['usedata'] = 'Use following data in the filter:'; $labels['nextstep'] = 'Next Step'; plugins/managesieve/localization/pl_PL.inc
@@ -103,6 +103,15 @@ $labels['varupperfirst'] = 'pierwsza litera duża (:upperfirst)'; $labels['varquotewildcard'] = 'anulowane znaki specjalne (:quotewildcard)'; $labels['varlength'] = 'długość (:length)'; $labels['notify'] = 'Wyślij powiadomienie'; $labels['notifyaddress'] = 'Na adres e-mail:'; $labels['notifybody'] = 'Treść powiadomienia:'; $labels['notifysubject'] = 'Temat powiadomienia:'; $labels['notifyfrom'] = 'Nadawca powiadomienia:'; $labels['notifyimportance'] = 'Priorytet:'; $labels['notifyimportancelow'] = 'niski'; $labels['notifyimportancenormal'] = 'normalny'; $labels['notifyimportancehigh'] = 'wysoki'; $labels['filtercreate'] = 'Utwórz filtr'; $labels['usedata'] = 'Użyj następujących danych do utworzenia filtra:'; $labels['nextstep'] = 'Następny krok'; plugins/managesieve/managesieve.js
@@ -639,7 +639,8 @@ target_area: document.getElementById('action_target_area' + id), flags: document.getElementById('action_flags' + id), vacation: document.getElementById('action_vacation' + id), set: document.getElementById('action_set' + id) set: document.getElementById('action_set' + id), notify: document.getElementById('action_notify' + id) }; if (obj.value == 'fileinto' || obj.value == 'fileinto_copy') { @@ -660,6 +661,9 @@ else if (obj.value == 'set') { enabled.set = 1; } else if (obj.value == 'notify') { enabled.notify = 1; } for (var x in elems) { elems[x].style.display = !enabled[x] ? 'none' : 'inline'; plugins/managesieve/managesieve.php
@@ -625,6 +625,11 @@ $varnames = get_input_value('_action_varname', RCUBE_INPUT_POST); $varvalues = get_input_value('_action_varvalue', RCUBE_INPUT_POST); $varmods = get_input_value('_action_varmods', RCUBE_INPUT_POST); $notifyaddrs = get_input_value('_action_notifyaddress', RCUBE_INPUT_POST); $notifybodies = get_input_value('_action_notifybody', RCUBE_INPUT_POST); $notifymessages = get_input_value('_action_notifymessage', RCUBE_INPUT_POST); $notifyfrom = get_input_value('_action_notifyfrom', RCUBE_INPUT_POST); $notifyimp = get_input_value('_action_notifyimportance', RCUBE_INPUT_POST); // we need a "hack" for radiobuttons foreach ($sizeitems as $item) @@ -877,6 +882,23 @@ if (!isset($varvalues[$idx]) || $varvalues[$idx] === '') { $this->errors['actions'][$i]['value'] = $this->gettext('cannotbeempty'); } break; case 'notify': if (empty($notifyaddrs[$idx])) { $this->errors['actions'][$i]['address'] = $this->gettext('cannotbeempty'); } else if (!check_email($notifyaddrs[$idx])) { $this->errors['actions'][$i]['address'] = $this->gettext('noemailwarning'); } if (!empty($notifyfrom[$idx]) && !check_email($notifyfrom[$idx])) { $this->errors['actions'][$i]['from'] = $this->gettext('noemailwarning'); } $this->form['actions'][$i]['address'] = $notifyaddrs[$idx]; $this->form['actions'][$i]['body'] = $notifybodies[$idx]; $this->form['actions'][$i]['message'] = $notifymessages[$idx]; $this->form['actions'][$i]['from'] = $notifyfrom[$idx]; $this->form['actions'][$i]['importance'] = $notifyimp[$idx]; break; } @@ -1479,6 +1501,9 @@ if (in_array('variables', $this->exts)) { $select_action->add(Q($this->gettext('setvariable')), 'set'); } if (in_array('enotify', $this->exts)) { $select_action->add(Q($this->gettext('notify')), 'notify'); } $select_action->add(Q($this->gettext('rulestop')), 'stop'); $select_type = $action['type']; @@ -1571,6 +1596,41 @@ } $out .= '</div>'; // notify // skip :options tag - not used by the mailto method $out .= '<div id="action_notify' .$id.'" style="display:' .($action['type']=='notify' ? 'inline' : 'none') .'">'; $out .= '<span class="label">' .Q($this->gettext('notifyaddress')) . '</span><br />' .'<input type="text" name="_action_notifyaddress['.$id.']" id="action_notifyaddress'.$id.'" ' .'value="' . Q($action['address']) . '" size="35" ' . $this->error_class($id, 'action', 'address', 'action_notifyaddress') .' />'; $out .= '<br /><span class="label">'. Q($this->gettext('notifybody')) .'</span><br />' .'<textarea name="_action_notifybody['.$id.']" id="action_notifybody' .$id. '" ' .'rows="3" cols="35" '. $this->error_class($id, 'action', 'method', 'action_notifybody') . '>' . Q($action['body'], 'strict', false) . "</textarea>\n"; $out .= '<br /><span class="label">' .Q($this->gettext('notifysubject')) . '</span><br />' .'<input type="text" name="_action_notifymessage['.$id.']" id="action_notifymessage'.$id.'" ' .'value="' . Q($action['message']) . '" size="35" ' . $this->error_class($id, 'action', 'message', 'action_notifymessage') .' />'; $out .= '<br /><span class="label">' .Q($this->gettext('notifyfrom')) . '</span><br />' .'<input type="text" name="_action_notifyfrom['.$id.']" id="action_notifyfrom'.$id.'" ' .'value="' . Q($action['from']) . '" size="35" ' . $this->error_class($id, 'action', 'from', 'action_notifyfrom') .' />'; $importance_options = array( 3 => 'notifyimportancelow', 2 => 'notifyimportancenormal', 1 => 'notifyimportancehigh' ); $select_importance = new html_select(array( 'name' => '_action_notifyimportance[' . $id . ']', 'id' => '_action_notifyimportance' . $id, 'class' => $this->error_class($id, 'action', 'importance', 'action_notifyimportance'))); foreach ($importance_options as $io_v => $io_n) { $select_importance->add(Q($this->gettext($io_n)), $io_v); } $out .= '<br /><span class="label">' . Q($this->gettext('notifyimportance')) . '</span><br />'; $out .= $select_importance->show(array(intval($action['importance']))); $out .= '</div>'; // mailbox select if ($action['type'] == 'fileinto') $mailbox = $this->mod_mailbox($action['target'], 'out'); plugins/managesieve/tests/src/parser_notify_a
New file @@ -0,0 +1,19 @@ require ["enotify","variables"]; # rule:[notify1] if header :contains "from" "boss@example.org" { notify :importance "1" :message "This is probably very important" "mailto:alm@example.com"; stop; } # rule:[subject] if header :matches "Subject" "*" { set "subject" "${1}"; } # rule:[from notify2] if header :matches "From" "*" { set "from" "${1}"; notify :importance "3" :message "${from}: ${subject}" "mailto:alm@example.com"; } plugins/managesieve/tests/src/parser_notify_b
New file @@ -0,0 +1,18 @@ require ["envelope","variables","enotify"]; # rule:[from] if envelope :all :matches "from" "*" { set "env_from" " [really: ${1}]"; } # rule:[subject] if header :matches "Subject" "*" { set "subject" "${1}"; } # rule:[from notify] if address :all :matches "from" "*" { set "from_addr" "${1}"; notify :message "${from_addr}${env_from}: ${subject}" "mailto:alm@example.com"; }