|
|
@ -1008,8 +1008,8 @@ class rcube_imap_generic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// message IDs
|
|
|
|
// message IDs
|
|
|
|
if (is_array($add))
|
|
|
|
if (!empty($add))
|
|
|
|
$add = $this->compressMessageSet(join(',', $add));
|
|
|
|
$add = $this->compressMessageSet($add);
|
|
|
|
|
|
|
|
|
|
|
|
list($code, $response) = $this->execute($is_uid ? 'UID SORT' : 'SORT',
|
|
|
|
list($code, $response) = $this->execute($is_uid ? 'UID SORT' : 'SORT',
|
|
|
|
array("($field)", $encoding, 'ALL' . (!empty($add) ? ' '.$add : '')));
|
|
|
|
array("($field)", $encoding, 'ALL' . (!empty($add) ? ' '.$add : '')));
|
|
|
@ -1026,7 +1026,7 @@ class rcube_imap_generic
|
|
|
|
function fetchHeaderIndex($mailbox, $message_set, $index_field='', $skip_deleted=true, $uidfetch=false)
|
|
|
|
function fetchHeaderIndex($mailbox, $message_set, $index_field='', $skip_deleted=true, $uidfetch=false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (is_array($message_set)) {
|
|
|
|
if (is_array($message_set)) {
|
|
|
|
if (!($message_set = $this->compressMessageSet(join(',', $message_set))))
|
|
|
|
if (!($message_set = $this->compressMessageSet($message_set)))
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
list($from_idx, $to_idx) = explode(':', $message_set);
|
|
|
|
list($from_idx, $to_idx) = explode(':', $message_set);
|
|
|
@ -1150,12 +1150,12 @@ class rcube_imap_generic
|
|
|
|
return $result;
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private function compressMessageSet($messages, $force=false)
|
|
|
|
static function compressMessageSet($messages, $force=false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// given a comma delimited list of independent mid's,
|
|
|
|
// given a comma delimited list of independent mid's,
|
|
|
|
// compresses by grouping sequences together
|
|
|
|
// compresses by grouping sequences together
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_array($message_set)) {
|
|
|
|
if (!is_array($messages)) {
|
|
|
|
// if less than 255 bytes long, let's not bother
|
|
|
|
// if less than 255 bytes long, let's not bother
|
|
|
|
if (!$force && strlen($messages)<255) {
|
|
|
|
if (!$force && strlen($messages)<255) {
|
|
|
|
return $messages;
|
|
|
|
return $messages;
|
|
|
@ -1199,6 +1199,23 @@ class rcube_imap_generic
|
|
|
|
return implode(',', $result);
|
|
|
|
return implode(',', $result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static function uncompressMessageSet($messages)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
$messages = explode(',', $messages);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($messages as $part) {
|
|
|
|
|
|
|
|
$items = explode(':', $part);
|
|
|
|
|
|
|
|
$max = max($items[0], $items[1]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ($x=$items[0]; $x<=$max; $x++) {
|
|
|
|
|
|
|
|
$result[] = $x;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns message sequence identifier
|
|
|
|
* Returns message sequence identifier
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -1265,9 +1282,6 @@ class rcube_imap_generic
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (is_array($message_set))
|
|
|
|
|
|
|
|
$message_set = join(',', $message_set);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$message_set = $this->compressMessageSet($message_set);
|
|
|
|
$message_set = $this->compressMessageSet($message_set);
|
|
|
|
|
|
|
|
|
|
|
|
if ($add)
|
|
|
|
if ($add)
|
|
|
@ -1824,7 +1838,7 @@ class rcube_imap_generic
|
|
|
|
if (in_array('MAX', $items))
|
|
|
|
if (in_array('MAX', $items))
|
|
|
|
$result['MAX'] = !empty($response) ? max($response) : 0;
|
|
|
|
$result['MAX'] = !empty($response) ? max($response) : 0;
|
|
|
|
if (in_array('ALL', $items))
|
|
|
|
if (in_array('ALL', $items))
|
|
|
|
$result['ALL'] = $this->compressMessageSet(implode(',', $response), true);
|
|
|
|
$result['ALL'] = $this->compressMessageSet($response, true);
|
|
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|