#include "__IMAP_EXPUNGE.h" #include "IMAPServer.h" namespace mail { int __IMAP_EXPUNGE::processCommand(coreutils::ZString &request, IMAPSession &session, IMAPServer &server) { if (session.state != IMAPSession::SELECTED) { session.out << session.tag << " NO No mailbox selected" << CRLF; return 1; } if (session.readOnly) { session.out << session.tag << " NO Mailbox is read-only" << CRLF; return 1; } // MailFolder::expunge() already returns each sequence number // pre-adjusted for the ones reported before it - see its own doc // comment for why that adjustment has to happen before, not // after, these get sent. for (uint32_t seqNum : session.mailbox.expunge()) session.out << "* " << (int)seqNum << " EXPUNGE" << CRLF; session.out << session.tag << " OK EXPUNGE completed" << CRLF; return 1; } }