- Performance improvements by use UID commands (#1485690)
| | |
| | | CHANGELOG RoundCube Webmail |
| | | =========================== |
| | | |
| | | - Performance improvements by use UID commands (#1485690) |
| | | - Fix HTML editor tabIndex setting (#1485972) |
| | | - Added 'imap_debug' option |
| | | - Support strftime's format modifiers in date_* options (#1484806) |
| | |
| | | return $headers->structure; |
| | | } |
| | | |
| | | // resolve message sequence number |
| | | if (!($msg_id = $this->_uid2id($uid))) { |
| | | return FALSE; |
| | | } |
| | | |
| | | if (!$structure_str) |
| | | $structure_str = iil_C_FetchStructureString($this->conn, $this->mailbox, $msg_id); |
| | | $structure_str = iil_C_FetchStructureString($this->conn, $this->mailbox, $uid, true); |
| | | $structure = iml_GetRawStructureArray($structure_str); |
| | | $struct = false; |
| | | |
| | | // parse structure and add headers |
| | | if (!empty($structure)) |
| | | { |
| | | $this->_msg_id = $msg_id; |
| | | $headers = $this->get_headers($uid); |
| | | $this->_msg_id = $headers->id; |
| | | |
| | | // set message charset from message headers |
| | | if ($headers->charset) |
| | |
| | | // fetch message headers if message/rfc822 or named part (could contain Content-Location header) |
| | | if ($struct->ctype_primary == 'message' || ($struct->ctype_parameters['name'] && !$struct->content_id)) { |
| | | if (empty($raw_headers)) |
| | | $raw_headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id); |
| | | $raw_headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $struct->mime_id); |
| | | $struct->headers = $this->_parse_headers($raw_headers) + $struct->headers; |
| | | } |
| | | |
| | |
| | | // we must fetch and parse headers "manually" |
| | | if ($i<2) { |
| | | if (!$headers) |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id); |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); |
| | | $filename_mime = ''; |
| | | $i = 0; |
| | | while (preg_match('/filename\*'.$i.'\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) { |
| | |
| | | } |
| | | if ($i<2) { |
| | | if (!$headers) |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id); |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); |
| | | $filename_encoded = ''; |
| | | $i = 0; $matches = array(); |
| | | while (preg_match('/filename\*'.$i.'\*\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) { |
| | |
| | | } |
| | | if ($i<2) { |
| | | if (!$headers) |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id); |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); |
| | | $filename_mime = ''; |
| | | $i = 0; $matches = array(); |
| | | while (preg_match('/\s+name\*'.$i.'\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) { |
| | |
| | | } |
| | | if ($i<2) { |
| | | if (!$headers) |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id); |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); |
| | | $filename_encoded = ''; |
| | | $i = 0; $matches = array(); |
| | | while (preg_match('/\s+name\*'.$i.'\*\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) { |
| | |
| | | */ |
| | | function &get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL) |
| | | { |
| | | if (!($msg_id = $this->_uid2id($uid))) |
| | | return FALSE; |
| | | |
| | | // get part encoding if not provided |
| | | if (!is_object($o_part)) |
| | | { |
| | | $structure_str = iil_C_FetchStructureString($this->conn, $this->mailbox, $msg_id); |
| | | $structure_str = iil_C_FetchStructureString($this->conn, $this->mailbox, $uid, true); |
| | | $structure = iml_GetRawStructureArray($structure_str); |
| | | $part_type = iml_GetPartTypeCode($structure, $part); |
| | | $o_part = new rcube_message_part; |
| | |
| | | |
| | | if (!$part) $part = 'TEXT'; |
| | | |
| | | $body = iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, $part, |
| | | $body = iil_C_HandlePartBody($this->conn, $this->mailbox, $uid, true, $part, |
| | | $o_part->encoding, $print, $fp); |
| | | |
| | | if ($fp || $print) |
| | |
| | | */ |
| | | function &get_raw_body($uid) |
| | | { |
| | | if (!($msg_id = $this->_uid2id($uid))) |
| | | return FALSE; |
| | | |
| | | return iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id); |
| | | return iil_C_HandlePartBody($this->conn, $this->mailbox, $uid, true); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | function &get_raw_headers($uid) |
| | | { |
| | | if (!($msg_id = $this->_uid2id($uid))) |
| | | return FALSE; |
| | | |
| | | $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $msg_id, NULL); |
| | | |
| | | return $headers; |
| | | return iil_C_FetchPartHeader($this->conn, $this->mailbox, $uid, true); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | function print_raw_body($uid) |
| | | { |
| | | if (!($msg_id = $this->_uid2id($uid))) |
| | | return FALSE; |
| | | |
| | | iil_C_HandlePartBody($this->conn, $this->mailbox, $msg_id, NULL, NULL, true); |
| | | iil_C_HandlePartBody($this->conn, $this->mailbox, $uid, true, NULL, NULL, true); |
| | | } |
| | | |
| | | |
| | |
| | | return $result; |
| | | } |
| | | |
| | | function iil_C_FetchPartHeader(&$conn, $mailbox, $id, $part) { |
| | | function iil_C_FetchPartHeader(&$conn, $mailbox, $id, $is_uid=false, $part=NULL) { |
| | | |
| | | $part = empty($part) ? 'HEADER' : $part.'.MIME'; |
| | | |
| | | return iil_C_HandlePartBody($conn, $mailbox, $id, $part); |
| | | return iil_C_HandlePartBody($conn, $mailbox, $id, $is_uid, $part); |
| | | } |
| | | |
| | | function iil_C_HandlePartBody(&$conn, $mailbox, $id, $part='', $encoding=NULL, $print=NULL, $file=NULL) { |
| | | function iil_C_HandlePartBody(&$conn, $mailbox, $id, $is_uid=false, $part='', $encoding=NULL, $print=NULL, $file=NULL) { |
| | | |
| | | $fp = $conn->fp; |
| | | $result = false; |
| | |
| | | |
| | | // format request |
| | | $key = 'ftch0'; |
| | | $request = $key . " FETCH $id (BODY.PEEK[$part])"; |
| | | $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])"; |
| | | // send request |
| | | if (!iil_PutLine($fp, $request)) { |
| | | return false; |
| | |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | function iil_C_FetchPartBody(&$conn, $mailbox, $id, $part, $file=NULL) { |
| | | return iil_C_HandlePartBody($conn, $mailbox, $id, $part, NULL, NULL, $file); |
| | | } |
| | | |
| | | function iil_C_PrintPartBody(&$conn, $mailbox, $id, $part) { |
| | | iil_C_HandlePartBody($conn, $mailbox, $id, $part, NULL, true, NULL); |
| | | } |
| | | |
| | | function iil_C_CreateFolder(&$conn, $folder) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | function iil_C_FetchStructureString(&$conn, $folder, $id) { |
| | | function iil_C_FetchStructureString(&$conn, $folder, $id, $is_uid=false) { |
| | | $fp = $conn->fp; |
| | | $result = false; |
| | | |
| | | if (iil_C_Select($conn, $folder)) { |
| | | $key = 'F1247'; |
| | | |
| | | if (iil_PutLine($fp, "$key FETCH $id (BODYSTRUCTURE)")) { |
| | | if (iil_PutLine($fp, $key . ($is_uid ? ' UID' : '') ." FETCH $id (BODYSTRUCTURE)")) { |
| | | do { |
| | | $line = iil_ReadLine($fp, 5000); |
| | | $line = iil_MultLine($fp, $line); |