// Copyright (c) 2010 Martin Knafve / hMailServer.com. // http://www.hmailserver.com #pragma once #include "IMAPCommandRangeAction.h" #include "../Common/MIME/Mime.h" #include "IMAPFetchParser.h" namespace HM { class IMAPConnection; class Message; class ByteBuffer; class IMAPFetchParser; class IMAPFetch : public IMAPCommandRangeAction { public: IMAPFetch(); virtual ~IMAPFetch(); virtual IMAPResult DoAction(std::shared_ptr pConnection, int messageIndex, std::shared_ptr pMessage, const std::shared_ptr pArgument); private: String CreateEnvelopeStructure_(MimeHeader& oHeader); String GetPartStructure_(std::shared_ptr oPart, bool includeExtensionData, int iRecursion); String IteratePartRecursive_(std::shared_ptr oPart, bool includeExtensionData, int iRecursion); String CreateEmailStructure_(const String &sField); std::shared_ptrGetMessagePartByPartNo_(std::shared_ptrpBody, long iPartNo); std::shared_ptr GetByteBufferByBodyPart_(const String &messageFileName, std::shared_ptr pBodyPart, IMAPFetchParser::BodyPart &oPart); std::shared_ptr GetBodyPartByRecursiveIdentifier_(std::shared_ptr pBody, const String &sName); void GetBytesToSend_(int iBufferSize, IMAPFetchParser::BodyPart &oPart, int &iOutStart, int &iOutCount); void ReportCriticalError_(const String &messageFileName, const String &sMessage); void AppendOutput_(String &sOutput, const String &sAppend); void SendAndReset_(std::shared_ptr pConnection, String &sOutput); std::shared_ptr LoadMimeBody_(std::shared_ptr pParser, const String &fileName); bool GetMessageBodyNeeded_(std::shared_ptr pParser); bool append_space_; std::shared_ptr parser_; }; }