diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/managesieve/Changelog | 3 | ||||
-rw-r--r-- | plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php | 78 | ||||
-rw-r--r-- | plugins/managesieve/package.xml | 14 | ||||
-rw-r--r-- | plugins/newmail_notifier/config.inc.php.dist | 3 | ||||
-rw-r--r-- | plugins/newmail_notifier/localization/en_US.inc | 1 | ||||
-rw-r--r-- | plugins/newmail_notifier/newmail_notifier.js | 14 | ||||
-rw-r--r-- | plugins/newmail_notifier/newmail_notifier.php | 25 | ||||
-rw-r--r-- | plugins/newmail_notifier/package.xml | 4 | ||||
-rw-r--r-- | plugins/password/config.inc.php.dist | 3 | ||||
-rw-r--r-- | plugins/password/drivers/virtualmin.php | 4 |
10 files changed, 111 insertions, 38 deletions
diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 60b2f1831..e660ee1ee 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,3 +1,5 @@ +* version 7.0 [2013-09-09] +----------------------------------------------------------- - Add vacation-seconds extension support (RFC 6131) - Several script parser code improvements - Support string list arguments in filter form (#1489018) @@ -5,6 +7,7 @@ - Split plugin file into two files - Fix handling of &, <, > characters in scripts/filter names (#1489208) - Support 'keep' action (#1489226) +- Add common headers to header selector (#1489271) * version 6.2 [2013-02-17] ----------------------------------------------------------- diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index bbbfa9d91..e4efef5b3 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -195,7 +195,7 @@ class rcube_sieve_engine } else { $this->exts = $this->sieve->get_extensions(); - $this->script = $this->sieve->script->as_array(); + $this->init_script(); $this->rc->output->set_env('currentset', $this->sieve->current); $_SESSION['managesieve_current'] = $this->sieve->current; } @@ -742,13 +742,22 @@ class rcube_sieve_engine $cust_header = (is_array($headers) && count($headers) == 1) ? $headers[0] : $headers; } + $header = $header == '...' ? $cust_header : $header; + + if (is_array($header)) { + foreach ($header as $h_index => $val) { + if (isset($this->headers[$val])) { + $header[$h_index] = $this->headers[$val]; + } + } + } + if ($type == 'exists') { $this->form['tests'][$i]['test'] = 'exists'; - $this->form['tests'][$i]['arg'] = $header == '...' ? $cust_header : $header; + $this->form['tests'][$i]['arg'] = $header; } else { - $test = 'header'; - $header = $header == '...' ? $cust_header : $header; + $test = 'header'; if ($mod == 'address' || $mod == 'envelope') { $found = false; @@ -1258,27 +1267,33 @@ class rcube_sieve_engine $select_header = new html_select(array('name' => "_header[]", 'id' => 'header'.$id, 'onchange' => 'rule_header_select(' .$id .')')); - foreach ($this->headers as $name => $val) - $select_header->add(rcube::Q($this->plugin->gettext($name)), Q($val)); - $select_header->add(rcube::Q($this->plugin->gettext('...')), '...'); + foreach ($this->headers as $index => $header) { + $header = $this->rc->text_exists($index) ? $this->plugin->gettext($index) : $header; + $select_header->add($header, $index); + } + $select_header->add($this->plugin->gettext('...'), '...'); if (in_array('body', $this->exts)) - $select_header->add(rcube::Q($this->plugin->gettext('body')), 'body'); - $select_header->add(rcube::Q($this->plugin->gettext('size')), 'size'); + $select_header->add($this->plugin->gettext('body'), 'body'); + $select_header->add($this->plugin->gettext('size'), 'size'); if (in_array('date', $this->exts)) { - $select_header->add(rcube::Q($this->plugin->gettext('datetest')), 'date'); - $select_header->add(rcube::Q($this->plugin->gettext('currdate')), 'currentdate'); + $select_header->add($this->plugin->gettext('datetest'), 'date'); + $select_header->add($this->plugin->gettext('currdate'), 'currentdate'); } if (isset($rule['test'])) { if (in_array($rule['test'], array('header', 'address', 'envelope')) - && !is_array($rule['arg1']) && in_array($rule['arg1'], $this->headers) + && !is_array($rule['arg1']) + && ($header = strtolower($rule['arg1'])) + && isset($this->headers[$header]) ) { - $test = $rule['arg1']; + $test = $header; } else if ($rule['test'] == 'exists' - && !is_array($rule['arg']) && in_array($rule['arg'], $this->headers) + && !is_array($rule['arg']) + && ($header = strtolower($rule['arg'])) + && isset($this->headers[$header]) ) { - $test = $rule['arg']; + $test = $header; } else if (in_array($rule['test'], array('size', 'body', 'date', 'currentdate'))) { $test = $rule['test']; @@ -2120,4 +2135,37 @@ class rcube_sieve_engine return $result; } + + /** + * Initializes internal script data + */ + private function init_script() + { + $this->script = $this->sieve->script->as_array(); + + if (!$this->script) { + return; + } + + $headers = array(); + + // find common headers used in script, will be added to the list + // of available (predefined) headers (#1489271) + foreach ($this->script as $rule) { + foreach ((array) $rule['tests'] as $test) { + if ($test['test'] == 'header') { + foreach ((array) $test['arg1'] as $header) { + $lc_header = strtolower($header); + if (!isset($this->headers[$lc_header]) && !isset($headers[$lc_header])) { + $headers[$lc_header] = $header; + } + } + } + } + } + + ksort($headers); + + $this->headers += $headers; + } } diff --git a/plugins/managesieve/package.xml b/plugins/managesieve/package.xml index 9c02957a5..6ae53c250 100644 --- a/plugins/managesieve/package.xml +++ b/plugins/managesieve/package.xml @@ -17,10 +17,10 @@ <email>alec@alec.pl</email> <active>yes</active> </lead> - <date>2013-02-17</date> + <date>2013-09-09</date> <version> - <release>6.2</release> - <api>6.0</api> + <release>7.0</release> + <api>7.0</api> </version> <stability> <release>stable</release> @@ -38,6 +38,10 @@ <tasks:replace from="@name@" to="name" type="package-info"/> <tasks:replace from="@package_version@" to="version" type="package-info"/> </file> + <file name="lib/Roundcube/rcube_sieve.php" role="php"></file> + <file name="lib/Roundcube/rcube_sieve_engine.php" role="php"></file> + <file name="lib/Roundcube/rcube_sieve_script.php" role="php"></file> + <file name="lib/Net/Sieve.php" role="php"></file> <file name="localization/be_BE.inc" role="data"></file> <file name="localization/bg_BG.inc" role="data"></file> <file name="localization/bs_BA.inc" role="data"></file> @@ -106,10 +110,6 @@ <file name="skins/larry/images/down_small.gif" role="data"></file> <file name="skins/larry/images/erase.png" role="data"></file> <file name="skins/larry/images/up_small.gif" role="data"></file> - <file name="lib/Roundcube/rcube_sieve.php" role="php"></file> - <file name="lib/Roundcube/rcube_sieve_engine.php" role="php"></file> - <file name="lib/Roundcube/rcube_sieve_script.php" role="php"></file> - <file name="lib/Net/Sieve.php" role="php"></file> <file name="config.inc.php.dist" role="data"></file> </dir> <!-- / --> diff --git a/plugins/newmail_notifier/config.inc.php.dist b/plugins/newmail_notifier/config.inc.php.dist index cdb563c40..1a7c0d74f 100644 --- a/plugins/newmail_notifier/config.inc.php.dist +++ b/plugins/newmail_notifier/config.inc.php.dist @@ -9,4 +9,7 @@ $config['newmail_notifier_sound'] = false; // Enables desktop notification $config['newmail_notifier_desktop'] = false; +// Desktop notification close timeout in seconds +$config['newmail_notifier_desktop_timeout'] = 10; + ?> diff --git a/plugins/newmail_notifier/localization/en_US.inc b/plugins/newmail_notifier/localization/en_US.inc index 7c1c5cf3f..1c4054615 100644 --- a/plugins/newmail_notifier/localization/en_US.inc +++ b/plugins/newmail_notifier/localization/en_US.inc @@ -25,5 +25,6 @@ $labels['body'] = 'You\'ve received a new message.'; $labels['testbody'] = 'This is a test notification.'; $labels['desktopdisabled'] = 'Desktop notifications are disabled in your browser.'; $labels['desktopunsupported'] = 'Your browser does not support desktop notifications.'; +$labels['desktoptimeout'] = 'Close desktop notification'; ?> diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js index b00f33d10..846bc94c3 100644 --- a/plugins/newmail_notifier/newmail_notifier.js +++ b/plugins/newmail_notifier/newmail_notifier.js @@ -90,13 +90,11 @@ function newmail_notifier_sound() // - Require Chrome or Firefox latest version (22+) / 21.0 or older with a plugin function newmail_notifier_desktop(body) { + var timeout = rcmail.env.newmail_notifier_timeout || 10; -/** - * Fix: As of 17 June 2013, Chrome/Chromium does not implement Notification.permission correctly that - * it gives 'undefined' until an object has been created: - * https://code.google.com/p/chromium/issues/detail?id=163226 - * - */ + // As of 17 June 2013, Chrome/Chromium does not implement Notification.permission correctly that + // it gives 'undefined' until an object has been created: + // https://code.google.com/p/chromium/issues/detail?id=163226 try { if (Notification.permission == 'granted' || Notification.permission == undefined) { var popup = new Notification(rcmail.gettext('title', 'newmail_notifier'), { @@ -109,7 +107,7 @@ function newmail_notifier_desktop(body) popup.onclick = function() { this.close(); } - setTimeout(function() { popup.close(); }, 10000); // close after 10 seconds + setTimeout(function() { popup.close(); }, timeout * 1000); if (popup.permission == 'granted') return true; } } @@ -125,7 +123,7 @@ function newmail_notifier_desktop(body) this.cancel(); } popup.show(); - setTimeout(function() { popup.cancel(); }, 10000); // close after 10 seconds + setTimeout(function() { popup.cancel(); }, timeout * 1000); rcmail.newmail_popup = popup; return true; } diff --git a/plugins/newmail_notifier/newmail_notifier.php b/plugins/newmail_notifier/newmail_notifier.php index ca1c2ff67..20c542f58 100644 --- a/plugins/newmail_notifier/newmail_notifier.php +++ b/plugins/newmail_notifier/newmail_notifier.php @@ -123,6 +123,23 @@ class newmail_notifier extends rcube_plugin } } + $type = 'desktop_timeout'; + $key = 'newmail_notifier_' . $type; + if (!in_array($key, $dont_override)) { + $field_id = '_' . $key; + $select = new html_select(array('name' => $field_id, 'id' => $field_id)); + + foreach (array(5, 10, 15, 30, 45, 60) as $sec) { + $label = $this->rc->gettext(array('name' => 'afternseconds', 'vars' => array('n' => $sec))); + $select->add($label, $sec); + } + + $args['blocks']['new_message']['options'][$key] = array( + 'title' => html::label($field_id, rcube::Q($this->gettext('desktoptimeout'))), + 'content' => $select->show((int) $this->rc->config->get($key)) + ); + } + return $args; } @@ -148,6 +165,13 @@ class newmail_notifier extends rcube_plugin } } + $option = 'newmail_notifier_desktop_timeout'; + if (!in_array($option, $dont_override)) { + if ($value = (int) rcube_utils::get_input_value('_' . $option, rcube_utils::INPUT_POST)) { + $args['prefs'][$option] = $value; + } + } + return $args; } @@ -180,6 +204,7 @@ class newmail_notifier extends rcube_plugin if ($unseen->count()) { $this->notified = true; + $this->rc->output->set_env('newmail_notifier_timeout', $this->rc->config->get('newmail_notifier_desktop_timeout')); $this->rc->output->command('plugin.newmail_notifier', array( 'basic' => $this->opt['basic'], diff --git a/plugins/newmail_notifier/package.xml b/plugins/newmail_notifier/package.xml index b8ef34933..e46c9bc92 100644 --- a/plugins/newmail_notifier/package.xml +++ b/plugins/newmail_notifier/package.xml @@ -19,9 +19,9 @@ <email>alec@alec.pl</email> <active>yes</active> </lead> - <date>2013-03-16</date> + <date>2013-09-12</date> <version> - <release>0.5</release> + <release>0.6</release> <api>0.5</api> </version> <stability> diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist index 82f6617e5..bfea52918 100644 --- a/plugins/password/config.inc.php.dist +++ b/plugins/password/config.inc.php.dist @@ -320,8 +320,7 @@ $config['hmailserver_server'] = array( // 5: domain-username // 6: username_domain // 7: domain_username -// 8: username@domain; mbox.username -$config['password_virtualmin_format'] = 8; +$config['password_virtualmin_format'] = 0; // pw_usermod Driver options diff --git a/plugins/password/drivers/virtualmin.php b/plugins/password/drivers/virtualmin.php index 2c7aee617..2d2f73f97 100644 --- a/plugins/password/drivers/virtualmin.php +++ b/plugins/password/drivers/virtualmin.php @@ -48,10 +48,6 @@ class rcube_virtualmin_password $pieces = explode("_", $username); $domain = $pieces[0]; break; - case 8: // domain taken from alias, username left as it was - $email = $rcmail->user->data['alias']; - $domain = substr(strrchr($email, "@"), 1); - break; default: // username@domain $domain = substr(strrchr($username, "@"), 1); } |