thomascube
2006-08-04 42000a5d64ef92d3b85c71381654f3f8f6cb9cfd
program/include/rcube_imap.inc
@@ -827,13 +827,19 @@
   * @return array   search results as list of message ids
   * @access public
   */
  function search($mbox_name='', $criteria='ALL', $str=NULL)
  function search($mbox_name='', $criteria='ALL', $str=NULL, $charset=NULL)
    {
    $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
    if ($str && $criteria)
      {
      $criteria = 'CHARSET UTF-8 '.$criteria.' "'.UTF7EncodeString($str).'"';
      return $this->_search_index($mailbox, $criteria);
      $search = (!empty($charset) ? "CHARSET $charset " : '') . sprintf("%s {%d}\r\n%s", $criteria, strlen($str), $str);
      $results = $this->_search_index($mailbox, $search);
      // try search without charset (probably not supported by server)
      if (empty($results))
        $results = $this->_search_index($mailbox, "$criteria $str");
      return $results;
      }
    else
      return $this->_search_index($mailbox, $criteria);