EIMS workaround. EIMS returns the SEARCH response as multiple untagged
SEARCH responses. That is against RFC3501 !!! example: A005 UID SEARCH UID 1:* * SEARCH 5949 8160 8401 8402 8413 8470 8471 8472 8497 8499 * SEARCH 8502 8504 8514 A005 OK SEARCH completed We only use that call in case of non server side sorting.
This commit is contained in:
parent
60b954870b
commit
dee1922ba6
1 changed files with 14 additions and 3 deletions
|
@ -211,7 +211,14 @@ function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) {
|
||||||
return $server_sort_array;
|
return $server_sort_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sort order from server if server does not have the SORT extension
|
||||||
|
* and return it as array for mailbox_display.
|
||||||
|
*
|
||||||
|
* @param resource $imap_stream
|
||||||
|
* @param array $mbxresponse response from a sqimap_mailbox_select
|
||||||
|
* @return array $php_sort_array
|
||||||
|
*/
|
||||||
function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) {
|
function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) {
|
||||||
global $uid_support;
|
global $uid_support;
|
||||||
|
|
||||||
|
@ -230,8 +237,12 @@ function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) {
|
||||||
$query = "SEARCH UID 1:$uidnext";
|
$query = "SEARCH UID 1:$uidnext";
|
||||||
$uids = sqimap_run_command ($imap_stream, $query, true, $response, $message, true);
|
$uids = sqimap_run_command ($imap_stream, $query, true, $response, $message, true);
|
||||||
if (isset($uids[0])) {
|
if (isset($uids[0])) {
|
||||||
if (preg_match("/^\* SEARCH (.+)$/", $uids[0], $regs)) {
|
$php_sort_array = array();
|
||||||
$php_sort_array = preg_split("/ /", trim($regs[1]));
|
// EIMS workaround. EIMS returns the result as multiple untagged SEARCH responses
|
||||||
|
foreach($uids as $line) {
|
||||||
|
if (preg_match("/^\* SEARCH (.+)$/", $line, $regs)) {
|
||||||
|
$php_sort_array += preg_split("/ /", trim($regs[1]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!preg_match("/OK/", $response)) {
|
if (!preg_match("/OK/", $response)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue