diff options
Diffstat (limited to 'src/operator-capability.cc')
-rw-r--r-- | src/operator-capability.cc | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/operator-capability.cc b/src/operator-capability.cc index 73f5a26..6be3e79 100644 --- a/src/operator-capability.cc +++ b/src/operator-capability.cc @@ -1,9 +1,10 @@ -/** -------------------------------------------------------------------- +/** * @file bincimapd-capability.cc * @brief Implementation of the CAPABILITY command * @author Andreas Aardal Hanssen, Erwin Hoffmann * @date 2002-2005, 2023 - * ----------------------------------------------------------------- **/ + */ + #include "depot.h" #include "globals.h" #include "iodevice.h" @@ -14,34 +15,28 @@ #include <string> -using namespace ::std; using namespace Binc; +using std::string; -//---------------------------------------------------------------------- CapabilityOperator::CapabilityOperator(void) {} -//---------------------------------------------------------------------- CapabilityOperator::~CapabilityOperator(void) {} -//---------------------------------------------------------------------- const string CapabilityOperator::getName(void) const { return "CAPABILITY"; } -//---------------------------------------------------------------------- int CapabilityOperator::getState(void) const { return Session::NONAUTHENTICATED | Session::AUTHENTICATED | Session::SELECTED; } -//---------------------------------------------------------------------- void CapabilityOperator::addCapability(const string &cap) { capabilities.push_back(cap); } -//---------------------------------------------------------------------- Operator::ProcessResult CapabilityOperator::process(Depot &depot, Request &command) { Session &session = Session::getInstance(); @@ -49,34 +44,34 @@ Operator::ProcessResult CapabilityOperator::process(Depot &depot, Request &comma bincClient << "* CAPABILITY " << IMAP_VERSION; if (session.getState() == Session::NONAUTHENTICATED) { - if (getenv("UCSPITLS")) + if (getenv("UCSPITLS")) { if (!session.command.ssl) bincClient << " STARTTLS"; + } const string authmethods = session.getEnv("BINCIMAP_LOGIN"); auto cram = authmethods.find("+CRAM-MD5"); - if (session.command.ssl || session.hasEnv("ALLOW_NONSSL_PLAINTEXT_LOGINS")) { + if (session.command.ssl || session.hasEnv("ALLOW_NONSSL_PLAINTEXT_LOGINS")) if (cram != string::npos) bincClient << " AUTH=LOGIN AUTH=PLAIN AUTH=CRAM-MD5"; else bincClient << " AUTH=LOGIN AUTH=PLAIN"; - } else + else bincClient << " LOGINDISABLED"; } bincClient << " IDLE LITERAL+ NAMESPACE CHILDREN"; - vector<string>::const_iterator i = capabilities.begin(); + std::vector<string>::const_iterator i = capabilities.begin(); while (i != capabilities.end()) { bincClient << " " << *i; ++i; } - bincClient << endl; + bincClient << std::endl; return OK; } -//---------------------------------------------------------------------- Operator::ParseResult CapabilityOperator::parse(Request &c_in) const { Session &session = Session::getInstance(); |