diff options
Diffstat (limited to 'vmime')
-rw-r--r-- | vmime/net/imap/IMAPMessage.hpp | 16 | ||||
-rw-r--r-- | vmime/net/imap/IMAPMessagePart.hpp (renamed from vmime/net/imap/IMAPPart.hpp) | 28 | ||||
-rw-r--r-- | vmime/net/imap/IMAPMessagePartContentHandler.hpp | 4 | ||||
-rw-r--r-- | vmime/net/imap/IMAPMessageStructure.hpp (renamed from vmime/net/imap/IMAPStructure.hpp) | 24 | ||||
-rw-r--r-- | vmime/net/maildir/maildirMessage.hpp | 10 | ||||
-rw-r--r-- | vmime/net/maildir/maildirMessagePart.hpp | 99 | ||||
-rw-r--r-- | vmime/net/maildir/maildirMessageStructure.hpp | 76 | ||||
-rw-r--r-- | vmime/net/message.hpp | 44 | ||||
-rw-r--r-- | vmime/net/pop3/POP3Message.hpp | 8 |
9 files changed, 245 insertions, 64 deletions
diff --git a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp index fb86696f..fdda139a 100644 --- a/vmime/net/imap/IMAPMessage.hpp +++ b/vmime/net/imap/IMAPMessage.hpp @@ -84,8 +84,8 @@ public: bool isExpunged() const; - ref <const structure> getStructure() const; - ref <structure> getStructure(); + ref <const messageStructure> getStructure() const; + ref <messageStructure> getStructure(); ref <const header> getHeader() const; @@ -93,9 +93,9 @@ public: void setFlags(const int flags, const int mode = FLAG_MODE_SET); void extract(utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; - void extractPart(ref <const part> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; + void extractPart(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; - void fetchPartHeader(ref <part> p); + void fetchPartHeader(ref <messagePart> p); ref <vmime::message> getParsedMessage(); @@ -107,7 +107,7 @@ private: * * @param str structure for which to fetch parts headers */ - void fetchPartHeaderForStructure(ref <structure> str); + void fetchPartHeaderForStructure(ref <messageStructure> str); /** Recursively contruct parsed message from structure. * Called by getParsedMessage(). @@ -116,7 +116,7 @@ private: * @param str structure for which to construct part * @param level current nesting level (0 is root) */ - void constructParsedMessage(ref <bodyPart> parentPart, ref <structure> str, int level = 0); + void constructParsedMessage(ref <bodyPart> parentPart, ref <messageStructure> str, int level = 0); enum ExtractFlags @@ -126,7 +126,7 @@ private: EXTRACT_PEEK = 0x10 }; - void extractImpl(ref <const part> p, utility::outputStream& os, utility::progressListener* progress, + void extractImpl(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress, const int start, const int length, const int extractFlags) const; @@ -145,7 +145,7 @@ private: vmime_uint64 m_modseq; ref <header> m_header; - ref <structure> m_structure; + ref <messageStructure> m_structure; }; diff --git a/vmime/net/imap/IMAPPart.hpp b/vmime/net/imap/IMAPMessagePart.hpp index 2422f5a1..5c38501d 100644 --- a/vmime/net/imap/IMAPPart.hpp +++ b/vmime/net/imap/IMAPMessagePart.hpp @@ -21,8 +21,8 @@ // the GNU General Public License cover the whole combination. // -#ifndef VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED -#define VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED +#ifndef VMIME_NET_IMAP_IMAPMESSAGEPART_HPP_INCLUDED +#define VMIME_NET_IMAP_IMAPMESSAGEPART_HPP_INCLUDED #include "vmime/config.hpp" @@ -41,24 +41,24 @@ namespace net { namespace imap { -class IMAPStructure; +class IMAPMessageStructure; -class VMIME_EXPORT IMAPPart : public part +class VMIME_EXPORT IMAPMessagePart : public messagePart { private: friend class vmime::creator; - IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_mpart* mpart); - IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_1part* part); + IMAPMessagePart(ref <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_mpart* mpart); + IMAPMessagePart(ref <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_1part* part); public: - ref <const structure> getStructure() const; - ref <structure> getStructure(); + ref <const messageStructure> getStructure() const; + ref <messageStructure> getStructure(); - ref <const IMAPPart> getParent() const; + ref <const IMAPMessagePart> getParent() const; const mediaType& getType() const; int getSize() const; @@ -67,16 +67,16 @@ public: ref <const header> getHeader() const; - static ref <IMAPPart> create - (ref <IMAPPart> parent, const int number, const IMAPParser::body* body); + static ref <IMAPMessagePart> create + (ref <IMAPMessagePart> parent, const int number, const IMAPParser::body* body); header& getOrCreateHeader(); private: - ref <IMAPStructure> m_structure; - weak_ref <IMAPPart> m_parent; + ref <IMAPMessageStructure> m_structure; + weak_ref <IMAPMessagePart> m_parent; ref <header> m_header; int m_number; @@ -92,5 +92,5 @@ private: #endif // VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_MESSAGING_PROTO_IMAP -#endif // VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED +#endif // VMIME_NET_IMAP_IMAPMESSAGEPART_HPP_INCLUDED diff --git a/vmime/net/imap/IMAPMessagePartContentHandler.hpp b/vmime/net/imap/IMAPMessagePartContentHandler.hpp index 602b0879..ac273151 100644 --- a/vmime/net/imap/IMAPMessagePartContentHandler.hpp +++ b/vmime/net/imap/IMAPMessagePartContentHandler.hpp @@ -44,7 +44,7 @@ class VMIME_EXPORT IMAPMessagePartContentHandler : public contentHandler { public: - IMAPMessagePartContentHandler(ref <IMAPMessage> msg, ref <class part> part, const vmime::encoding& encoding); + IMAPMessagePartContentHandler(ref <IMAPMessage> msg, ref <messagePart> part, const vmime::encoding& encoding); ref <contentHandler> clone() const; @@ -69,7 +69,7 @@ public: private: weak_ref <IMAPMessage> m_message; - weak_ref <part> m_part; + weak_ref <messagePart> m_part; vmime::encoding m_encoding; vmime::mediaType m_contentType; diff --git a/vmime/net/imap/IMAPStructure.hpp b/vmime/net/imap/IMAPMessageStructure.hpp index 95cdfcbf..e2a9f169 100644 --- a/vmime/net/imap/IMAPStructure.hpp +++ b/vmime/net/imap/IMAPMessageStructure.hpp @@ -21,8 +21,8 @@ // the GNU General Public License cover the whole combination. // -#ifndef VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED -#define VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED +#ifndef VMIME_NET_IMAP_IMAPMESSAGESTRUCTURE_HPP_INCLUDED +#define VMIME_NET_IMAP_IMAPMESSAGESTRUCTURE_HPP_INCLUDED #include "vmime/config.hpp" @@ -41,26 +41,26 @@ namespace net { namespace imap { -class IMAPPart; +class IMAPMessagePart; -class VMIME_EXPORT IMAPStructure : public structure +class VMIME_EXPORT IMAPMessageStructure : public messageStructure { public: - IMAPStructure(); - IMAPStructure(const IMAPParser::body* body); - IMAPStructure(ref <IMAPPart> parent, const std::vector <IMAPParser::body*>& list); + IMAPMessageStructure(); + IMAPMessageStructure(const IMAPParser::body* body); + IMAPMessageStructure(ref <IMAPMessagePart> parent, const std::vector <IMAPParser::body*>& list); - ref <const part> getPartAt(const size_t x) const; - ref <part> getPartAt(const size_t x); + ref <const messagePart> getPartAt(const size_t x) const; + ref <messagePart> getPartAt(const size_t x); size_t getPartCount() const; - static ref <IMAPStructure> emptyStructure(); + static ref <IMAPMessageStructure> emptyStructure(); private: - std::vector <ref <IMAPPart> > m_parts; + std::vector <ref <IMAPMessagePart> > m_parts; }; @@ -71,5 +71,5 @@ private: #endif // VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_MESSAGING_PROTO_IMAP -#endif // VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED +#endif // VMIME_NET_IMAP_IMAPMESSAGESTRUCTURE_HPP_INCLUDED diff --git a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMessage.hpp index de8c1751..08c13daa 100644 --- a/vmime/net/maildir/maildirMessage.hpp +++ b/vmime/net/maildir/maildirMessage.hpp @@ -68,8 +68,8 @@ public: bool isExpunged() const; - ref <const structure> getStructure() const; - ref <structure> getStructure(); + ref <const messageStructure> getStructure() const; + ref <messageStructure> getStructure(); ref <const header> getHeader() const; @@ -77,9 +77,9 @@ public: void setFlags(const int flags, const int mode = FLAG_MODE_SET); void extract(utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; - void extractPart(ref <const part> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; + void extractPart(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; - void fetchPartHeader(ref <part> p); + void fetchPartHeader(ref <messagePart> p); ref <vmime::message> getParsedMessage(); @@ -103,7 +103,7 @@ private: uid m_uid; ref <header> m_header; - ref <structure> m_structure; + ref <messageStructure> m_structure; }; diff --git a/vmime/net/maildir/maildirMessagePart.hpp b/vmime/net/maildir/maildirMessagePart.hpp new file mode 100644 index 00000000..f79804ca --- /dev/null +++ b/vmime/net/maildir/maildirMessagePart.hpp @@ -0,0 +1,99 @@ +// +// VMime library (http://www.vmime.org) +// Copyright (C) 2002-2013 Vincent Richard <[email protected]> +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 3 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// Linking this library statically or dynamically with other modules is making +// a combined work based on this library. Thus, the terms and conditions of +// the GNU General Public License cover the whole combination. +// + +#ifndef VMIME_NET_MAILDIR_MAILDIRMESSAGEPART_HPP_INCLUDED +#define VMIME_NET_MAILDIR_MAILDIRMESSAGEPART_HPP_INCLUDED + + +#include "vmime/config.hpp" + + +#if VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_MESSAGING_PROTO_MAILDIR + + +#include "vmime/net/message.hpp" + + +namespace vmime { +namespace net { +namespace maildir { + + +class maildirMessageStructure; + + +class maildirMessagePart : public messagePart +{ +public: + + maildirMessagePart(ref <maildirMessagePart> parent, const int number, const bodyPart& part); + ~maildirMessagePart(); + + + ref <const messageStructure> getStructure() const; + ref <messageStructure> getStructure(); + + weak_ref <const maildirMessagePart> getParent() const { return (m_parent); } + + const mediaType& getType() const; + int getSize() const; + int getNumber() const; + + ref <const header> getHeader() const; + + header& getOrCreateHeader(); + + int getHeaderParsedOffset() const; + int getHeaderParsedLength() const; + + int getBodyParsedOffset() const; + int getBodyParsedLength() const; + + void initStructure(const bodyPart& part); + +private: + + ref <maildirMessageStructure> m_structure; + weak_ref <maildirMessagePart> m_parent; + ref <header> m_header; + + int m_number; + int m_size; + mediaType m_mediaType; + + int m_headerParsedOffset; + int m_headerParsedLength; + + int m_bodyParsedOffset; + int m_bodyParsedLength; +}; + + +} // maildir +} // net +} // vmime + + +#endif // VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_MESSAGING_PROTO_MAILDIR + +#endif // VMIME_NET_MAILDIR_MAILDIRMESSAGEPART_HPP_INCLUDED diff --git a/vmime/net/maildir/maildirMessageStructure.hpp b/vmime/net/maildir/maildirMessageStructure.hpp new file mode 100644 index 00000000..6d62be2b --- /dev/null +++ b/vmime/net/maildir/maildirMessageStructure.hpp @@ -0,0 +1,76 @@ +// +// VMime library (http://www.vmime.org) +// Copyright (C) 2002-2013 Vincent Richard <[email protected]> +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 3 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// Linking this library statically or dynamically with other modules is making +// a combined work based on this library. Thus, the terms and conditions of +// the GNU General Public License cover the whole combination. +// + +#ifndef VMIME_NET_MAILDIR_MAILDIRMESSAGESTRUCTURE_HPP_INCLUDED +#define VMIME_NET_MAILDIR_MAILDIRMESSAGESTRUCTURE_HPP_INCLUDED + + +#include "vmime/config.hpp" + + +#if VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_MESSAGING_PROTO_MAILDIR + + +#include "vmime/net/message.hpp" + + +namespace vmime { +namespace net { +namespace maildir { + + +class maildirMessagePart; + + +class maildirMessageStructure : public messageStructure +{ +public: + + maildirMessageStructure(); + maildirMessageStructure(ref <maildirMessagePart> parent, const bodyPart& part); + maildirMessageStructure(ref <maildirMessagePart> parent, const std::vector <ref <const vmime::bodyPart> >& list); + + + ref <const messagePart> getPartAt(const size_t x) const; + ref <messagePart> getPartAt(const size_t x); + + size_t getPartCount() const; + + static ref <maildirMessageStructure> emptyStructure(); + +private: + + static ref <maildirMessageStructure> m_emptyStructure; + + std::vector <ref <maildirMessagePart> > m_parts; +}; + + +} // maildir +} // net +} // vmime + + +#endif // VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_MESSAGING_PROTO_MAILDIR + +#endif // VMIME_NET_MAILDIR_MAILDIRMESSAGESTRUCTURE_HPP_INCLUDED diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp index 3b94fbf3..a0f79aae 100644 --- a/vmime/net/message.hpp +++ b/vmime/net/message.hpp @@ -44,20 +44,20 @@ namespace vmime { namespace net { -class structure; +class messageStructure; /** A MIME part in a message. */ -class VMIME_EXPORT part : public object +class VMIME_EXPORT messagePart : public object { protected: - part() { } - part(const part&) : object() { } + messagePart() { } + messagePart(const messagePart&) : object() { } - virtual ~part() { } + virtual ~messagePart() { } public: @@ -65,13 +65,13 @@ public: * * @return structure of the part */ - virtual ref <const structure> getStructure() const = 0; + virtual ref <const messageStructure> getStructure() const = 0; /** Return the structure of this part. * * @return structure of the part */ - virtual ref <structure> getStructure() = 0; + virtual ref <messageStructure> getStructure() = 0; /** Return the header section for this part (you must fetch header * before using this function: see message::fetchPartHeader). @@ -105,7 +105,7 @@ public: * @param pos index of the sub-part * @return sub-part at position 'pos' */ - ref <const part> getPartAt(const size_t pos) const; + ref <const messagePart> getPartAt(const size_t pos) const; /** Return the sub-part at the specified position (zero is the * first part). @@ -113,7 +113,7 @@ public: * @param pos index of the sub-part * @return sub-part at position 'pos' */ - ref <part> getPartAt(const size_t pos); + ref <messagePart> getPartAt(const size_t pos); /** Return the number of sub-parts in this part. * @@ -126,16 +126,16 @@ public: /** Structure of a MIME part/message. */ -class VMIME_EXPORT structure : public object +class VMIME_EXPORT messageStructure : public object { protected: - structure() { } - structure(const structure&) : object() { } + messageStructure() { } + messageStructure(const messageStructure&) : object() { } public: - virtual ~structure() { } + virtual ~messageStructure() { } /** Return the part at the specified position (first * part is at position 0). @@ -143,7 +143,7 @@ public: * @param pos position * @return part at position 'pos' */ - virtual ref <const part> getPartAt(const size_t pos) const = 0; + virtual ref <const messagePart> getPartAt(const size_t pos) const = 0; /** Return the part at the specified position (first * part is at position 0). @@ -151,7 +151,7 @@ public: * @param pos position * @return part at position 'pos' */ - virtual ref <part> getPartAt(const size_t pos) = 0; + virtual ref <messagePart> getPartAt(const size_t pos) = 0; /** Return the number of parts in this part. * @@ -183,13 +183,13 @@ public: * * @return MIME structure of the message */ - virtual ref <const structure> getStructure() const = 0; + virtual ref <const messageStructure> getStructure() const = 0; /** Return the MIME structure of the message (must fetch before). * * @return MIME structure of the message */ - virtual ref <structure> getStructure() = 0; + virtual ref <messageStructure> getStructure() = 0; /** Return a reference to the header fields of the message (must fetch before). * @@ -289,13 +289,19 @@ public: * be supported by the protocol (IMAP supports this), but it will NOT throw * an exception if not supported. */ - virtual void extractPart(ref <const part> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const = 0; + virtual void extractPart + (ref <const messagePart> p, + utility::outputStream& os, + utility::progressListener* progress = NULL, + const int start = 0, + const int length = -1, + const bool peek = false) const = 0; /** Fetch the MIME header for the specified part. * * @param p the part for which to fetch the header */ - virtual void fetchPartHeader(ref <part> p) = 0; + virtual void fetchPartHeader(ref <messagePart> p) = 0; /** Get the RFC-822 message for this abstract message. * Warning: This may require getting some data (ie: structure and headers) from diff --git a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp index 31b26154..113d0e86 100644 --- a/vmime/net/pop3/POP3Message.hpp +++ b/vmime/net/pop3/POP3Message.hpp @@ -68,8 +68,8 @@ public: bool isExpunged() const; - ref <const structure> getStructure() const; - ref <structure> getStructure(); + ref <const messageStructure> getStructure() const; + ref <messageStructure> getStructure(); ref <const header> getHeader() const; @@ -77,9 +77,9 @@ public: void setFlags(const int flags, const int mode = FLAG_MODE_SET); void extract(utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; - void extractPart(ref <const part> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; + void extractPart(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const; - void fetchPartHeader(ref <part> p); + void fetchPartHeader(ref <messagePart> p); ref <vmime::message> getParsedMessage(); |