/** * @param Folder $folder * @return bool */ function EmptyFolder(&$folder) { $result = true; $messageUidSet = array(); if ($this->DbStorage->Connect()) { $messageUidSet = $this->DbStorage->SelectAllMessagesUidSetByFolder($folder); } if ($folder->SyncType != FOLDERSYNC_DirectMode) { if ($this->DbStorage->Connect()) { $result &= $this->DbStorage->PurgeFolder($folder, true); $result &= $this->DbStorage->UpdateMailboxSize(); } } switch ($this->_account->MailProtocol) { case MAILPROTOCOL_IMAP4: if ($folder->SyncType != FOLDERSYNC_DontSync) { if ($this->MailStorage->Connect()) { $result &= $this->MailStorage->SetMessagesFlags($messageUidSet, true, $folder, MESSAGEFLAGS_Deleted, ACTION_Set); $result &= $this->MailStorage->PurgeFolder($folder); } } break; case MAILPROTOCOL_POP3: case MAILPROTOCOL_WMSERVER: if ($this->_account->MailMode == MAILMODE_DeleteMessageWhenItsRemovedFromTrash || $this->_account->MailMode == MAILMODE_KeepMessagesOnServerAndDeleteMessageWhenItsRemovedFromTrash) { $result &= $this->MailStorage->Connect() && $this->MailStorage->DeleteMessages($messageUidSet, true, $folder); } break; } //$fs->DeleteAccountDirs(); return $result; }