| | |
| | | */ |
| | | |
| | | |
| | | require_once('lib/mime.inc'); |
| | | require_once('lib/tnef_decoder.inc'); |
| | | |
| | | |
| | | /** |
| | | * Interface class for accessing an IMAP server |
| | | * |
| | |
| | | $this->set_rootdir($this->conn->rootdir); |
| | | if (empty($this->delimiter)) |
| | | $this->get_hierarchy_delimiter(); |
| | | |
| | | return true; |
| | | } |
| | | // write error log |
| | | else if ($this->conn->error) { |
| | |
| | | 'message' => $this->conn->error), true, false); |
| | | } |
| | | |
| | | return $this->conn ? true : false; |
| | | return false; |
| | | } |
| | | |
| | | |
| | |
| | | return $a_messages; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Direct (real and simple) SEARCH request to IMAP server, |
| | | * without result sorting and caching |
| | | * |
| | | * @param string Mailbox name to search in |
| | | * @param string Search string |
| | | * @param boolean True if UIDs should be returned |
| | | * @return array Search results as list of message IDs or UIDs |
| | | * @access public |
| | | */ |
| | | function search_once($mbox_name='', $str=NULL, $ret_uid=false) |
| | | { |
| | | if (!$str) |
| | | return false; |
| | | |
| | | $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | |
| | | return $this->conn->search($mailbox, $str, $ret_uid); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sort thread |
| | |
| | | return $headers->structure; |
| | | } |
| | | |
| | | if (!$structure_str) |
| | | if (!$structure_str) { |
| | | $structure_str = $this->conn->fetchStructureString($this->mailbox, $uid, true); |
| | | $structure = iml_GetRawStructureArray($structure_str); |
| | | } |
| | | $structure = rcube_mime_struct::parseStructure($structure_str); |
| | | $struct = false; |
| | | |
| | | // parse structure and add headers |
| | |
| | | // get part encoding if not provided |
| | | if (!is_object($o_part)) { |
| | | $structure_str = $this->conn->fetchStructureString($this->mailbox, $uid, true); |
| | | $structure = iml_GetRawStructureArray($structure_str); |
| | | $structure = new rcube_mime_struct(); |
| | | // error or message not found |
| | | if (empty($structure)) |
| | | if (!$structure->loadStructure($structure_str)) { |
| | | return false; |
| | | } |
| | | |
| | | $part_type = iml_GetPartTypeCode($structure, $part); |
| | | $o_part = new rcube_message_part; |
| | | $o_part->ctype_primary = $part_type==0 ? 'text' : ($part_type==2 ? 'message' : 'other'); |
| | | $o_part->encoding = strtolower(iml_GetPartEncodingString($structure, $part)); |
| | | $o_part->charset = iml_GetPartCharset($structure, $part); |
| | | $o_part->ctype_primary = strtolower($structure->getPartType($part)); |
| | | $o_part->encoding = strtolower($structure->getPartEncoding($part)); |
| | | $o_part->charset = $structure->getPartCharset($part); |
| | | } |
| | | |
| | | // TODO: Add caching for message parts |
| | |
| | | if (!isset($part->body)) |
| | | $part->body = $this->get_message_part($uid, $part->mime_id, $part); |
| | | |
| | | require_once('lib/tnef_decoder.inc'); |
| | | |
| | | $pid = 0; |
| | | $tnef_parts = array(); |
| | | $tnef_arr = tnef_decode($part->body); |