summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-09-12 09:59:10 +0200
committerAleksander Machniak <alec@alec.pl>2012-09-12 09:59:10 +0200
commita04a74fec4b5e13e8464f1f3c9071fa0b56a13eb (patch)
treebb8a95c198ecb89afa89caafc641b5b2a12e03a7 /program/include/rcube_imap.php
parentc093dcc391ad886ab815e6e70630c8e252df06ab (diff)
Improvements in building criteria string for IMAP SEARCH
Diffstat (limited to 'program/include/rcube_imap.php')
-rw-r--r--program/include/rcube_imap.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 66b5c4bd6..0b2f84d4f 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1434,6 +1434,12 @@ class rcube_imap extends rcube_storage
$criteria = 'UNDELETED '.$criteria;
}
+ // unset CHARSET if criteria string is ASCII, this way
+ // SEARCH won't be re-sent after "unsupported charset" response
+ if ($charset && $charset != 'US-ASCII' && is_ascii($criteria)) {
+ $charset = 'US-ASCII';
+ }
+
if ($this->threading) {
$threads = $this->conn->thread($folder, $this->threading, $criteria, true, $charset);
@@ -1465,7 +1471,7 @@ class rcube_imap extends rcube_storage
}
$messages = $this->conn->search($folder,
- ($charset ? "CHARSET $charset " : '') . $criteria, true);
+ ($charset && $charset != 'US-ASCII' ? "CHARSET $charset " : '') . $criteria, true);
// Error, try with US-ASCII (some servers may support only US-ASCII)
if ($messages->is_error() && $charset && $charset != 'US-ASCII') {