X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_messages.php;h=a01ca6152010062117bbe03faf110d5bd25b9d53;hb=de1ebc4b317860aeaff8caa585c51e62c53088f6;hp=8eec107fc122892204fa5ba135dcba627c2b9746;hpb=b69a13a4d20bdca8f26831e005d4491ada7a0787;p=squirrelmail.git diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 8eec107f..a01ca615 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -17,14 +17,26 @@ /* obsolete */ function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) { global $uid_support; - $read = sqimap_run_command ($imap_stream, "COPY $start:$end \"$mailbox\"", true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "COPY $start:$end " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support); } +/** +* copy a range of messages ($id) to another mailbox ($mailbox) +*/ function sqimap_msgs_list_copy ($imap_stream, $id, $mailbox) { global $uid_support; $msgs_id = sqimap_message_list_squisher($id); - $read = sqimap_run_command ($imap_stream, "COPY $msgs_id \"$mailbox\"", true, $response, $message, $uid_support); - $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support); +} + +/** +* move a range of messages ($id) to another mailbox. Deletes the originals. +*/ +function sqimap_msgs_list_move ($imap_stream, $id, $mailbox) { + global $uid_support; + $msgs_id = sqimap_message_list_squisher($id); + $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response,$message, $uid_support); } @@ -39,11 +51,11 @@ function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) { sqimap_messages_flag ($imap_stream, $start, $end, "Deleted", true); } -function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id) { +function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id, $bypass_trash=false) { global $move_to_trash, $trash_folder, $uid_support; $msgs_id = sqimap_message_list_squisher($id); - if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) { - $read = sqimap_run_command ($imap_stream, "COPY $msgs_id \"$trash_folder\"", true, $response, $message, $uid_support); + if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder)) && ($bypass_trash != true)) { + $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($trash_folder), true, $response, $message, $uid_support); } $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support); } @@ -181,9 +193,12 @@ function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) { $sort_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, $uid_support); } if (isset($sort_test[0])) { - if (preg_match("/^\* SORT (.+)$/", $sort_test[0], $regs)) { + for ($i=0,$iCnt=count($sort_test);$i<$iCnt;++$i) { + if (preg_match("/^\* SORT (.+)$/", $sort_test[$i], $regs)) { $server_sort_array = preg_split("/ /", trim($regs[1])); + break; } + } } if ($sort == 0 || $sort == 2 || $sort == 4) { $server_sort_array = array_reverse($server_sort_array); @@ -352,9 +367,12 @@ function get_thread_sort ($imap_stream) { $query = "THREAD $sort_type ".strtoupper($default_charset)." ALL"; $thread_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, $uid_support); if (isset($thread_test[0])) { - if (preg_match("/^\* THREAD (.+)$/", $thread_test[0], $regs)) { - $thread_list = trim($regs[1]); - } + for ($i=0,$iCnt=count($thread_test);$i<$iCnt;++$i) { + if (preg_match("/^\* THREAD (.+)$/", $thread_test[$i], $regs)) { + $thread_list = trim($regs[1]); + break; + } + } } else { $thread_list = ""; @@ -500,7 +518,7 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) foreach ($read_list as $r) { $subject = _("(no subject)"); - $from = _("Unknown Sender"); + $from = _("Unknown sender"); $priority = 0; $messageid = '<>'; $cc = $to = $date = $type[0] = $type[1] = $inrepto = '';