/** * @param Folder $folder * @return bool */ function EmptySpam() { $result = false; if ($this->_account) { $folders =& $this->GetFolders(); if ($folders) { $spamFolder =& $folders->GetFolderByType(FOLDERTYPE_Spam); if ($spamFolder) { if ($this->_account->MailProtocol == MAILPROTOCOL_WMSERVER) { $result = $this->MailStorage->Connect() && $this->MailStorage->ClearFolder($spamFolder); if ($result && $this->DbStorage->Connect()) { $result &= $this->DbStorage->ClearDbFolder($spamFolder, $this->_account); $result &= $this->DbStorage->UpdateMailboxSize(); } } else { if ($this->_account->MailProtocol == MAILPROTOCOL_POP3 || $this->_account->MailProtocol == MAILPROTOCOL_IMAP4) { $result = $this->EmptyFolder($spamFolder); } } } } } return $result; }