protected function _search($mailbox, $query = null, array $opts = array())
{
$mailbox = IMP_Mailbox::get($mailbox);
if (!empty($opts['sort']) && $mailbox->access_sort) {
/* If doing a from/to search, use display sorting if possible.
* Although there is a fallback to a PHP-based display sort, for
* performance reasons only do a display sort if it is supported
* on the server. */
foreach ($opts['sort'] as $key => $val) {
switch ($val) {
case Horde_Imap_Client::SORT_FROM:
$opts['sort'][$key] = Horde_Imap_Client::SORT_DISPLAYFROM_FALLBACK;
break;
case Horde_Imap_Client::SORT_TO:
$opts['sort'][$key] = Horde_Imap_Client::SORT_DISPLAYTO_FALLBACK;
break;
}
}
}
if (!is_null($query)) {
$query->charset('UTF-8', false);
}
return array($mailbox->imap_mbox_ob, $query, $opts);
}