strigi/src/streams
mailinputstream.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef STRIGI_MAILINPUTSTREAM_H
00021 #define STRIGI_MAILINPUTSTREAM_H
00022
00023 #include <strigi/strigiconfig.h>
00024 #include "streambase.h"
00025 #include "substreamprovider.h"
00026 #include <stack>
00027
00028 namespace Strigi {
00029
00030 class StringTerminatedSubStream;
00031
00037 class STREAMS_EXPORT MailInputStream : public SubStreamProvider {
00038 private:
00039 class Private;
00040 int64_t old1;
00041
00042 int32_t old2;
00043 int old3;
00044 const char* old4;
00045 const char* old5;
00046
00047 Private* const p;
00048 std::string m_subject;
00049 std::string m_from;
00050 std::string m_to;
00051 std::string m_cc;
00052 std::string m_bcc;
00053 std::string m_messageid;
00054 std::string m_inreplyto;
00055 std::string m_references;
00056 std::string m_contenttype;
00057 std::string old6;
00058 std::string old7;
00059
00060 std::stack<std::string> old8;
00061
00062 void readHeaderLine();
00063 void readHeader();
00064 void scanBody();
00065 void handleHeaderLine();
00066 bool handleBodyLine();
00067 bool lineIsEndOfBlock();
00068 bool checkHeaderLine() const;
00069 void clearHeaders();
00070 void ensureFileName();
00071 std::string value(const char* n, const std::string& headerline) const;
00072 public:
00073 explicit MailInputStream(InputStream* input);
00074 ~MailInputStream();
00075 InputStream* nextEntry();
00076 static bool checkHeader(const char* data, int32_t datasize);
00077 static SubStreamProvider* factory(InputStream* input) {
00078 return new MailInputStream(input);
00079 }
00080 const std::string& subject() { return m_subject; }
00081 const std::string& from() { return m_from; }
00082 const std::string& to() { return m_to; }
00083 const std::string& cc() { return m_cc; }
00084 const std::string& bcc() { return m_bcc; }
00085 const std::string& messageid() { return m_messageid; }
00086 const std::string& inreplyto() { return m_inreplyto; }
00087 const std::string& references() { return m_references; }
00088 const std::string& contentType() { return m_contenttype; }
00089 };
00090
00091 }
00092
00093 #endif