summaryrefslogtreecommitdiff
path: root/plugins/managesieve
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/managesieve')
-rw-r--r--plugins/managesieve/Changelog5
-rw-r--r--plugins/managesieve/config.inc.php.dist5
-rw-r--r--plugins/managesieve/managesieve.php12
3 files changed, 21 insertions, 1 deletions
diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 358836f01..45abafa38 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,3 +1,8 @@
+* version 1.5 [2009-09-04]
+-----------------------------------------------------------
+- Added es_ES, ua_UA localizations
+- Added 'managesieve_mbox_encoding' option
+
* version 1.4 [2009-07-29]
-----------------------------------------------------------
- Updated PEAR::Net_Sieve to 1.1.7
diff --git a/plugins/managesieve/config.inc.php.dist b/plugins/managesieve/config.inc.php.dist
index d8e949a1f..1f0bdef65 100644
--- a/plugins/managesieve/config.inc.php.dist
+++ b/plugins/managesieve/config.inc.php.dist
@@ -14,6 +14,11 @@ $rcmail_config['managesieve_usetls'] = false;
// default contents of filters script (eg. default spam filter)
$rcmail_config['managesieve_default'] = '/etc/dovecot/sieve/global';
+// Sieve RFC says that we should use UTF-8 endcoding for mailbox names,
+// but some implementations does not covert UTF-8 to modified UTF-7.
+// Defaults to UTF7-IMAP for backward compatybility
+$rcmail_config['managesieve_mbox_encoding'] = 'UTF7-IMAP';
+
// I need this because my dovecot (with listescape plugin) uses
// ':' delimiter, but creates folders with dot delimiter
$rcmail_config['managesieve_replace_delimiter'] = '';
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 21d974da6..b2b52d40f 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -7,7 +7,7 @@
* It's clickable interface which operates on text scripts and communicates
* with server using managesieve protocol. Adds Filters tab in Settings.
*
- * @version 1.3
+ * @version 1.5
* @author Aleksander 'A.L.E.C' Machniak <alec@alec.pl>
*
* Configuration (see config.inc.php.dist):
@@ -744,6 +744,9 @@ class managesieve extends rcube_plugin
$a_folders = $this->rc->imap->list_mailboxes();
$delimiter = $this->rc->imap->get_hierarchy_delimiter();
+ // set mbox encoding
+ $mbox_encoding = $this->rc->config->get('managesieve_mbox_encoding', 'UTF7-IMAP');
+
if ($action['type'] == 'fileinto')
$mailbox = $action['target'];
else
@@ -758,6 +761,9 @@ class managesieve extends rcube_plugin
if ($replace_delimiter = $this->rc->config->get('managesieve_replace_delimiter'))
$utf7folder = str_replace($delimiter, $replace_delimiter, $utf7folder);
+ // convert to Sieve implementation encoding
+ $utf7folder = $this->mbox_encode($utf7folder, $mbox_encoding);
+
if ($folder_class = rcmail_folder_classname($name))
$foldername = $this->gettext($folder_class);
else
@@ -849,6 +855,10 @@ class managesieve extends rcube_plugin
return false;
}
+ private function mbox_encode($text, $encoding)
+ {
+ return rcube_charset_convert($text, 'UTF7-IMAP', $encoding);
+ }
}
?>