/** * @file operator-expunge.cc * @brief Implementation of the EXPUNGE command * @author Andreas Aardal Hanssen * @date 2002-2005 */ #include "depot.h" #include "imapparser.h" #include "mailbox.h" #include "operators.h" #include "pendingupdates.h" #include "recursivedescent.h" #include "session.h" #include using namespace Binc; ExpungeOperator::ExpungeOperator() {} ExpungeOperator::~ExpungeOperator() {} const std::string ExpungeOperator::getName() const { return "EXPUNGE"; } Session::State ExpungeOperator::getState() const { return Session::SELECTED; } Operator::ProcessResult ExpungeOperator::process(Depot &depot, Request &command) { Mailbox *mailbox = depot.getSelected(); mailbox->expungeMailbox(); pendingUpdates(mailbox, PendingUpdates::EXPUNGE | PendingUpdates::EXISTS | PendingUpdates::RECENT | PendingUpdates::FLAGS, true); return Operator::ProcessResult::OK; } Parser::ParseResult ExpungeOperator::parse(Request &c_in) { Session &session = Session::getInstance(); if (c_in.getUidMode()) return Parser::ParseResult::REJECT; Parser::ParseResult res; if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) { session.setLastError("Expected CRLF"); return res; } c_in.setName("EXPUNGE"); return Parser::ParseResult::ACCEPT; }