diff options
Diffstat (limited to 'src/operator-expunge.cc')
-rw-r--r-- | src/operator-expunge.cc | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/operator-expunge.cc b/src/operator-expunge.cc new file mode 100644 index 0000000..24904d5 --- /dev/null +++ b/src/operator-expunge.cc @@ -0,0 +1,73 @@ +/** -------------------------------------------------------------------- + * @file operator-expunge.cc + * @brief Implementation of the EXPUNGE command + * @author Andreas Aardal Hanssen + * @date 2002-2005 + * ----------------------------------------------------------------- **/ +#include <string> + +#include "depot.h" +#include "mailbox.h" +#include "operators.h" +#include "imapparser.h" +#include "recursivedescent.h" +#include "pendingupdates.h" +#include "session.h" + +using namespace ::std; +using namespace Binc; + +//---------------------------------------------------------------------- +ExpungeOperator::ExpungeOperator(void) +{ +} + +//---------------------------------------------------------------------- +ExpungeOperator::~ExpungeOperator(void) +{ +} + +//---------------------------------------------------------------------- +const string ExpungeOperator::getName(void) const +{ + return "EXPUNGE"; +} + +//---------------------------------------------------------------------- +int ExpungeOperator::getState(void) 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 OK; +} + +//---------------------------------------------------------------------- +Operator::ParseResult ExpungeOperator::parse(Request &c_in) const +{ + Session &session = Session::getInstance(); + + if (c_in.getUidMode()) + return REJECT; + + Operator::ParseResult res; + if ((res = expectCRLF()) != ACCEPT) { + session.setLastError("Expected CRLF"); + return res; + } + + c_in.setName("EXPUNGE"); + return ACCEPT; +} |