// Copyright (c) 2010 Martin Knafve / hMailServer.com. // http://www.hmailserver.com #include "stdafx.h" #include "StaticIMAPCommandHandlers.h" #include "IMAPCommandAuthenticate.h" #include "IMAPCommandLogin.h" #include "IMAPCommandCheck.h" #include "IMAPCommandSelect.h" #include "IMAPCommandClose.h" #include "IMAPCommandCreate.h" #include "IMAPCommandDelete.h" #include "IMAPCommandExamine.h" #include "IMAPCommandExpunge.h" #include "IMAPCommandSubscribe.h" #include "IMAPCommandUnsubscribe.h" #include "IMAPCommandStatus.h" #include "IMAPCommandRename.h" #include "IMAPCommandList.h" #include "IMAPCommandLsub.h" #include "IMAPCommandCopy.h" #include "IMAPCommandFetch.h" #include "IMAPCommandCapability.h" #include "IMAPCommandStore.h" #include "IMAPCommandLogout.h" #include "IMAPCommandNamespace.h" #include "IMAPCommandMyRights.h" #include "IMAPCommandGetAcl.h" #include "IMAPCommandDeleteAcl.h" #include "IMAPCommandSetAcl.h" #include "IMAPCommandListRights.h" #include "IMAPCommandStartTls.h" // IMAP QUOTA EXTENSION #include "IMAPCommandGetQuota.h" #include "IMAPCommandGetQuotaRoot.h" #ifdef _DEBUG #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define new DEBUG_NEW #endif namespace HM { std::map > StaticIMAPCommandHandlers::mapCommandHandlers; StaticIMAPCommandHandlers::StaticIMAPCommandHandlers() { mapCommandHandlers[IMAPConnection::IMAP_LOGIN] = std::shared_ptr(new IMAPCommandLOGIN()); mapCommandHandlers[IMAPConnection::IMAP_CHECK] = std::shared_ptr(new IMAPCommandCHECK()); mapCommandHandlers[IMAPConnection::IMAP_SELECT] = std::shared_ptr(new IMAPCommandSELECT()); mapCommandHandlers[IMAPConnection::IMAP_CLOSE] = std::shared_ptr(new IMAPCommandCLOSE()); mapCommandHandlers[IMAPConnection::IMAP_CREATE] = std::shared_ptr(new IMAPCommandCREATE()); mapCommandHandlers[IMAPConnection::IMAP_DELETE] = std::shared_ptr(new IMAPCommandDELETE()); mapCommandHandlers[IMAPConnection::IMAP_EXAMINE] = std::shared_ptr(new IMAPCommandEXAMINE()); mapCommandHandlers[IMAPConnection::IMAP_EXPUNGE] = std::shared_ptr(new IMAPCommandEXPUNGE()); mapCommandHandlers[IMAPConnection::IMAP_UNSUBSCRIBE] = std::shared_ptr(new IMAPCommandUNSUBSCRIBE()); mapCommandHandlers[IMAPConnection::IMAP_SUBSCRIBE] = std::shared_ptr(new IMAPCommandSUBSCRIBE()); mapCommandHandlers[IMAPConnection::IMAP_STATUS] = std::shared_ptr(new IMAPCommandSTATUS()); mapCommandHandlers[IMAPConnection::IMAP_RENAME] = std::shared_ptr(new IMAPCommandRENAME()); mapCommandHandlers[IMAPConnection::IMAP_LIST] = std::shared_ptr(new IMAPCommandLIST()); mapCommandHandlers[IMAPConnection::IMAP_LSUB] = std::shared_ptr(new IMAPCommandLSUB()); mapCommandHandlers[IMAPConnection::IMAP_COPY] = std::shared_ptr(new IMAPCommandCOPY()); mapCommandHandlers[IMAPConnection::IMAP_FETCH] = std::shared_ptr(new IMAPCommandFETCH()); mapCommandHandlers[IMAPConnection::IMAP_CAPABILITY] = std::shared_ptr(new IMAPCommandCapability()); mapCommandHandlers[IMAPConnection::IMAP_STORE] = std::shared_ptr(new IMAPCommandStore()); mapCommandHandlers[IMAPConnection::IMAP_AUTHENTICATE] = std::shared_ptr(new IMAPCommandAUTHENTICATE()); mapCommandHandlers[IMAPConnection::IMAP_NOOP] = std::shared_ptr(new IMAPCommandNOOP()); mapCommandHandlers[IMAPConnection::IMAP_LOGOUT] = std::shared_ptr(new IMAPCommandLOGOUT()); mapCommandHandlers[IMAPConnection::IMAP_UNKNOWN] = std::shared_ptr(new IMAPCommandUNKNOWN()); mapCommandHandlers[IMAPConnection::IMAP_GETQUOTAROOT] = std::shared_ptr(new IMAPCommandGetQuotaRoot()); mapCommandHandlers[IMAPConnection::IMAP_GETQUOTA] = std::shared_ptr(new IMAPCommandGetQuota()); mapCommandHandlers[IMAPConnection::IMAP_NAMESPACE] = std::shared_ptr(new IMAPCommandNamespace()); mapCommandHandlers[IMAPConnection::IMAP_MYRIGHTS] = std::shared_ptr(new IMAPCommandMyRights()); mapCommandHandlers[IMAPConnection::IMAP_GETACL] = std::shared_ptr(new IMAPCommandGetAcl()); mapCommandHandlers[IMAPConnection::IMAP_DELETEACL] = std::shared_ptr(new IMAPCommandDeleteAcl()); mapCommandHandlers[IMAPConnection::IMAP_SETACL] = std::shared_ptr(new IMAPCommandSetAcl()); mapCommandHandlers[IMAPConnection::IMAP_LISTRIGHTS] = std::shared_ptr(new IMAPCommandListRights()); mapCommandHandlers[IMAPConnection::IMAP_STARTTLS] = std::shared_ptr(new IMAPCommandStartTls()); } // Tiny commands IMAPResult IMAPCommandUNKNOWN::ExecuteCommand(std::shared_ptr pConnection, std::shared_ptr pArgument) { pConnection->SendResponseString(pArgument->Tag(), "BAD", "Unknown or NULL command"); return IMAPResult(); } IMAPResult IMAPCommandNOOP::ExecuteCommand(std::shared_ptr pConnection, std::shared_ptr pArgument) { pConnection->SendAsciiData(pArgument->Tag() + " OK NOOP completed\r\n"); return IMAPResult(); } }