From 40dfeaddf8ae05604f803b55f9f5c69c04a764a6 Mon Sep 17 00:00:00 2001 From: alecpl Date: Sat, 11 Jul 2009 14:34:48 +0000 Subject: - Performance improvements by use UID commands (#1485690) --- program/lib/imap.inc | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'program/lib') diff --git a/program/lib/imap.inc b/program/lib/imap.inc index a8f858ea6..0ab2b7fc8 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -2190,14 +2190,14 @@ function iil_C_FetchMIMEHeaders(&$conn, $mailbox, $id, $parts) { 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; @@ -2224,7 +2224,7 @@ function iil_C_HandlePartBody(&$conn, $mailbox, $id, $part='', $encoding=NULL, $ // 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; @@ -2346,14 +2346,6 @@ function iil_C_HandlePartBody(&$conn, $mailbox, $id, $part='', $encoding=NULL, $ 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) { $fp = $conn->fp; if (iil_PutLine($fp, 'c CREATE "' . iil_Escape($folder) . '"')) { @@ -2477,14 +2469,14 @@ function iil_C_AppendFromFile(&$conn, $folder, $path) { 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); -- cgit v1.2.3