summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-07-06 16:26:24 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-07-06 16:26:24 +0000
commit848d87216572555dc88e5af834838da1f977a2b6 (patch)
tree35d3d243974f9857fbd0d1b2899d2396b9840b53 /plugins
parent1ae7bba637456278418d0b2a92d17d7fb5c911d6 (diff)
- Added support for copying and copy sending of messages (COPY extension)
git-svn-id: https://svn.roundcube.net/trunk@3805 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/managesieve/Changelog3
-rw-r--r--plugins/managesieve/lib/rcube_sieve.php46
-rw-r--r--plugins/managesieve/localization/en_US.inc2
-rw-r--r--plugins/managesieve/localization/pl_PL.inc2
-rw-r--r--plugins/managesieve/managesieve.php25
-rw-r--r--plugins/managesieve/skins/default/templates/filteredit.html4
6 files changed, 65 insertions, 17 deletions
diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 137fd09b1..2f48ab36c 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,4 +1,7 @@
+* version 2.7 [2010-07-06]
+-----------------------------------------------------------
- Update Net_Sieve to version 1.3.0 (fixes LOGIN athentication)
+- Added support for copying and copy sending of messages (COPY extension)
* version 2.6 [2010-06-03]
-----------------------------------------------------------
diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php
index 2ecf6f1e7..2a79f7f14 100644
--- a/plugins/managesieve/lib/rcube_sieve.php
+++ b/plugins/managesieve/lib/rcube_sieve.php
@@ -382,6 +382,7 @@ class rcube_sieve_script
'fileinto',
'reject',
'ereject',
+ 'copy', // RFC3894
'vacation', // RFC5230
// TODO: (most wanted first) body, imapflags, notify, regex
);
@@ -532,15 +533,25 @@ class rcube_sieve_script
foreach ($rule['actions'] as $action) {
switch ($action['type']) {
case 'fileinto':
- $extension = 'fileinto';
- $script .= "\tfileinto \"" . $this->_escape_string($action['target']) . "\";\n";
+ array_push($exts, 'fileinto');
+ $script .= "\tfileinto ";
+ if ($action['copy']) {
+ $script .= ':copy ';
+ array_push($exts, 'copy');
+ }
+ $script .= "\"" . $this->_escape_string($action['target']) . "\";\n";
break;
case 'redirect':
- $script .= "\tredirect \"" . $this->_escape_string($action['target']) . "\";\n";
+ $script .= "\tredirect ";
+ if ($action['copy']) {
+ $script .= ':copy ';
+ array_push($exts, 'copy');
+ }
+ $script .= "\"" . $this->_escape_string($action['target']) . "\";\n";
break;
case 'reject':
case 'ereject':
- $extension = $action['type'];
+ array_push($exts, $action['type']);
if (strpos($action['target'], "\n")!==false)
$script .= "\t".$action['type']." text:\n" . $action['target'] . "\n.\n;\n";
else
@@ -552,7 +563,7 @@ class rcube_sieve_script
$script .= "\t" . $action['type'] .";\n";
break;
case 'vacation':
- $extension = 'vacation';
+ array_push($exts, 'vacation');
$script .= "\tvacation";
if ($action['days'])
$script .= " :days " . $action['days'];
@@ -572,9 +583,6 @@ class rcube_sieve_script
$script .= " \"" . $this->_escape_string($action['reason']) . "\";\n";
break;
}
-
- if ($extension && !isset($exts[$extension]))
- $exts[$extension] = $extension;
}
$script .= "}\n";
@@ -582,8 +590,8 @@ class rcube_sieve_script
}
// requires
- if (sizeof($exts))
- $script = 'require ["' . implode('","', $exts) . "\"];\n" . $script;
+ if (!empty($exts))
+ $script = 'require ["' . implode('","', array_unique($exts)) . "\"];\n" . $script;
return $script;
}
@@ -714,10 +722,24 @@ class rcube_sieve_script
$result[] = array('type' => $matches[1]);
}
else if(preg_match('/^fileinto/', $content)) {
- $result[] = array('type' => 'fileinto', 'target' => $this->_parse_string($m[sizeof($m)-1]));
+ $target = $m[sizeof($m)-1];
+ $copy = false;
+ if (preg_match('/^:copy\s+/', $target)) {
+ $target = preg_replace('/^:copy\s+/', '', $target);
+ $copy = true;
+ }
+ $result[] = array('type' => 'fileinto', 'copy' => $copy,
+ 'target' => $this->_parse_string($target));
}
else if(preg_match('/^redirect/', $content)) {
- $result[] = array('type' => 'redirect', 'target' => $this->_parse_string($m[sizeof($m)-1]));
+ $target = $m[sizeof($m)-1];
+ $copy = false;
+ if (preg_match('/^:copy\s+/', $target)) {
+ $target = preg_replace('/^:copy\s+/', '', $target);
+ $copy = true;
+ }
+ $result[] = array('type' => 'redirect', 'copy' => $copy,
+ 'target' => $this->_parse_string($target));
}
else if(preg_match('/^(reject|ereject)\s+(.*);$/sm', $content, $matches)) {
$result[] = array('type' => $matches[1], 'target' => $this->_parse_string($matches[2]));
diff --git a/plugins/managesieve/localization/en_US.inc b/plugins/managesieve/localization/en_US.inc
index 577911134..65fd70a70 100644
--- a/plugins/managesieve/localization/en_US.inc
+++ b/plugins/managesieve/localization/en_US.inc
@@ -23,6 +23,8 @@ $labels['addrule'] = 'Add rule';
$labels['delrule'] = 'Delete rule';
$labels['messagemoveto'] = 'Move message to';
$labels['messageredirect'] = 'Redirect message to';
+$labels['messagecopyto'] = 'Copy message to';
+$labels['messagesendcopy'] = 'Send message copy to';
$labels['messagereply'] = 'Reply with message';
$labels['messagedelete'] = 'Delete message';
$labels['messagediscard'] = 'Discard with message';
diff --git a/plugins/managesieve/localization/pl_PL.inc b/plugins/managesieve/localization/pl_PL.inc
index f10468115..3a7fc9e47 100644
--- a/plugins/managesieve/localization/pl_PL.inc
+++ b/plugins/managesieve/localization/pl_PL.inc
@@ -25,6 +25,8 @@ $labels['delrule'] = 'Usuń regułę';
$labels['messagemoveto'] = 'Przenieś wiadomość do';
$labels['messageredirect'] = 'Przekaż wiadomość na konto';
$labels['messagereply'] = 'Odpowiedz wiadomością o treści';
+$labels['messagecopyto'] = 'Skopiuj wiadomość do';
+$labels['messagesendcopy'] = 'Wyślij kopię do';
$labels['messagedelete'] = 'Usuń wiadomość';
$labels['messagediscard'] = 'Odrzuć z komunikatem';
$labels['messagesrules'] = 'W stosunku do przychodzących wiadomości:';
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index d6e3a363c..504c35677 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -468,12 +468,15 @@ class managesieve extends rcube_plugin
$type = $this->strip_value($type);
$target = $this->strip_value($act_targets[$idx]);
- $this->form['actions'][$i]['type'] = $type;
-
switch ($type) {
case 'fileinto':
+ case 'fileinto_copy':
$mailbox = $this->strip_value($mailboxes[$idx]);
$this->form['actions'][$i]['target'] = $mailbox;
+ if ($type == 'fileinto_copy') {
+ $type = 'fileinto';
+ $this->form['actions'][$i]['copy'] = true;
+ }
break;
case 'reject':
case 'ereject':
@@ -484,12 +487,18 @@ class managesieve extends rcube_plugin
// $this->errors['actions'][$i]['targetarea'] = $this->gettext('cannotbeempty');
break;
case 'redirect':
+ case 'redirect_copy':
$this->form['actions'][$i]['target'] = $target;
if ($this->form['actions'][$i]['target'] == '')
$this->errors['actions'][$i]['target'] = $this->gettext('cannotbeempty');
else if (!check_email($this->form['actions'][$i]['target']))
$this->errors['actions'][$i]['target'] = $this->gettext('noemailwarning');
+
+ if ($type == 'redirect_copy') {
+ $type = 'redirect';
+ $this->form['actions'][$i]['copy'] = true;
+ }
break;
case 'vacation':
$reason = $this->strip_value($reasons[$idx]);
@@ -518,6 +527,7 @@ class managesieve extends rcube_plugin
break;
}
+ $this->form['actions'][$i]['type'] = $type;
$i++;
}
@@ -941,7 +951,11 @@ class managesieve extends rcube_plugin
'onchange' => 'action_type_select(' .$id .')'));
if (in_array('fileinto', $this->exts))
$select_action->add(Q($this->gettext('messagemoveto')), 'fileinto');
+ if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts))
+ $select_action->add(Q($this->gettext('messagecopyto')), 'fileinto_copy');
$select_action->add(Q($this->gettext('messageredirect')), 'redirect');
+ if (in_array('copy', $this->exts))
+ $select_action->add(Q($this->gettext('messagesendcopy')), 'redirect_copy');
if (in_array('reject', $this->exts))
$select_action->add(Q($this->gettext('messagediscard')), 'reject');
else if (in_array('ereject', $this->exts))
@@ -951,7 +965,12 @@ class managesieve extends rcube_plugin
$select_action->add(Q($this->gettext('messagedelete')), 'discard');
$select_action->add(Q($this->gettext('rulestop')), 'stop');
- $out .= $select_action->show($action['type']);
+ $select_type = $action['type'];
+ if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) {
+ $select_type .= '_copy';
+ }
+
+ $out .= $select_action->show($select_type);
$out .= '</td>';
// actions target inputs
diff --git a/plugins/managesieve/skins/default/templates/filteredit.html b/plugins/managesieve/skins/default/templates/filteredit.html
index 881fd4f81..556d99621 100644
--- a/plugins/managesieve/skins/default/templates/filteredit.html
+++ b/plugins/managesieve/skins/default/templates/filteredit.html
@@ -51,14 +51,14 @@ function action_type_select(id)
{
var obj = document.getElementById('action_type'+id);
- if (obj.value == 'fileinto')
+ if (obj.value == 'fileinto' || obj.value == 'fileinto_copy')
{
document.getElementById('action_mailbox' + id).style.display = 'inline';
document.getElementById('action_target' + id).style.display = 'none';
document.getElementById('action_target_area' + id).style.display = 'none';
document.getElementById('action_vacation' + id).style.display = 'none';
}
- else if (obj.value == 'redirect')
+ else if (obj.value == 'redirect' || obj.value == 'redirect_copy')
{
document.getElementById('action_target' + id).style.display = 'inline';
document.getElementById('action_mailbox' + id).style.display = 'none';