From: tokul Date: Sun, 22 Jan 2006 12:08:33 +0000 (+0000) Subject: don't issue imap commands when target mailbox is same as source mailbox. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=821651ff0516e15a35d63227b625a4fd811eaf0b;p=squirrelmail.git don't issue imap commands when target mailbox is same as source mailbox. reduces number of imap calls and fixes mailbox caching issues (message is not visible on message list until cache is updated). might fix imap server locking on MacOS cyrus (#1409453). git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10555 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_messages.php b/functions/imap_messages.php index b4c62084..6aab5cf7 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -39,9 +39,14 @@ function sqimap_msgs_list_copy($imap_stream, $id, $mailbox, $handle_errors = tru * @param string $id The list of messages to move * @param string $mailbox The destination to move to * @param bool $handle_errors Show error messages in case of a NO, BAD or BYE response + * @param string $source_mailbox (since 1.5.1) name of source mailbox. It is used to + * validate that target mailbox != source mailbox. * @return bool If the move completed without errors */ -function sqimap_msgs_list_move($imap_stream, $id, $mailbox, $handle_errors = true) { +function sqimap_msgs_list_move($imap_stream, $id, $mailbox, $handle_errors = true, $source_mailbox = false) { + if ($source_mailbox!==false && $source_mailbox==$mailbox) { + return false; + } $msgs_id = sqimap_message_list_squisher($id); if (sqimap_msgs_list_copy ($imap_stream, $id, $mailbox, $handle_errors)) { return sqimap_toggle_flag($imap_stream, $id, '\\Deleted', true, true); diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index f2474c73..ea999a96 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -1270,7 +1270,7 @@ function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = ar $aUpdatedMsgs = sqimap_toggle_flag($imapConnection, $aUid, $sFlag, $bSet, true); break; case 'move': - $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection,$aUid,$targetMailbox); + $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection,$aUid,$targetMailbox,true,$mailbox); sqsession_register($targetMailbox,'lastTargetMailbox'); $bExpunge = true; break;