aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/address.cpp8
-rw-r--r--src/address.hpp81
-rw-r--r--src/addressList.cpp8
-rw-r--r--src/addressList.hpp168
-rw-r--r--src/attachment.hpp83
-rw-r--r--src/base.cpp30
-rw-r--r--src/base.hpp169
-rw-r--r--src/body.cpp12
-rw-r--r--src/body.hpp266
-rw-r--r--src/bodyPart.cpp2
-rw-r--r--src/bodyPart.hpp103
-rw-r--r--src/charset.cpp8
-rw-r--r--src/charset.hpp134
-rw-r--r--src/component.cpp4
-rw-r--r--src/component.hpp133
-rw-r--r--src/constants.cpp2
-rw-r--r--src/constants.hpp185
-rw-r--r--src/contentDisposition.cpp4
-rw-r--r--src/contentDisposition.hpp88
-rw-r--r--src/contentDispositionField.cpp6
-rw-r--r--src/contentDispositionField.hpp66
-rw-r--r--src/contentHandler.cpp2
-rw-r--r--src/contentHandler.hpp125
-rw-r--r--src/contentTypeField.cpp6
-rw-r--r--src/contentTypeField.hpp57
-rw-r--r--src/dateTime.cpp6
-rw-r--r--src/dateTime.hpp243
-rw-r--r--src/defaultAttachment.cpp4
-rw-r--r--src/defaultAttachment.hpp76
-rw-r--r--src/encoder.cpp4
-rw-r--r--src/encoder.hpp98
-rw-r--r--src/encoder7bit.cpp2
-rw-r--r--src/encoder7bit.hpp45
-rw-r--r--src/encoder8bit.cpp2
-rw-r--r--src/encoder8bit.hpp45
-rw-r--r--src/encoderB64.cpp4
-rw-r--r--src/encoderB64.hpp55
-rw-r--r--src/encoderBinary.cpp2
-rw-r--r--src/encoderBinary.hpp45
-rw-r--r--src/encoderDefault.cpp2
-rw-r--r--src/encoderDefault.hpp48
-rw-r--r--src/encoderFactory.cpp16
-rw-r--r--src/encoderFactory.hpp148
-rw-r--r--src/encoderQP.cpp4
-rw-r--r--src/encoderQP.hpp55
-rw-r--r--src/encoderUUE.cpp4
-rw-r--r--src/encoderUUE.hpp50
-rw-r--r--src/encoding.cpp6
-rw-r--r--src/encoding.hpp118
-rw-r--r--src/exception.cpp2
-rw-r--r--src/exception.hpp745
-rw-r--r--src/fileAttachment.cpp4
-rw-r--r--src/fileAttachment.hpp170
-rw-r--r--src/genericField.hpp94
-rw-r--r--src/genericParameter.hpp94
-rw-r--r--src/header.cpp4
-rw-r--r--src/header.hpp237
-rw-r--r--src/headerField.cpp4
-rw-r--r--src/headerField.hpp103
-rw-r--r--src/headerFieldFactory.cpp12
-rw-r--r--src/headerFieldFactory.hpp77
-rw-r--r--src/htmlTextPart.cpp4
-rw-r--r--src/htmlTextPart.hpp184
-rw-r--r--src/mailbox.cpp4
-rw-r--r--src/mailbox.hpp108
-rw-r--r--src/mailboxField.cpp4
-rw-r--r--src/mailboxField.hpp50
-rw-r--r--src/mailboxGroup.cpp6
-rw-r--r--src/mailboxGroup.hpp178
-rw-r--r--src/mailboxList.cpp4
-rw-r--r--src/mailboxList.hpp152
-rw-r--r--src/mediaType.cpp4
-rw-r--r--src/mediaType.hpp110
-rw-r--r--src/message.cpp4
-rw-r--r--src/message.hpp55
-rw-r--r--src/messageBuilder.cpp4
-rw-r--r--src/messageBuilder.hpp219
-rw-r--r--src/messageId.cpp8
-rw-r--r--src/messageId.hpp115
-rw-r--r--src/messageParser.cpp6
-rw-r--r--src/messageParser.hpp159
-rw-r--r--src/messaging/IMAPConnection.cpp12
-rw-r--r--src/messaging/IMAPConnection.hpp111
-rw-r--r--src/messaging/IMAPFolder.cpp18
-rw-r--r--src/messaging/IMAPFolder.hpp155
-rw-r--r--src/messaging/IMAPMessage.cpp12
-rw-r--r--src/messaging/IMAPMessage.hpp105
-rw-r--r--src/messaging/IMAPParser.hpp5077
-rw-r--r--src/messaging/IMAPStore.cpp10
-rw-r--r--src/messaging/IMAPStore.hpp117
-rw-r--r--src/messaging/IMAPTag.cpp2
-rw-r--r--src/messaging/IMAPTag.hpp64
-rw-r--r--src/messaging/IMAPUtils.cpp4
-rw-r--r--src/messaging/IMAPUtils.hpp66
-rw-r--r--src/messaging/POP3Folder.cpp8
-rw-r--r--src/messaging/POP3Folder.hpp143
-rw-r--r--src/messaging/POP3Message.cpp6
-rw-r--r--src/messaging/POP3Message.hpp89
-rw-r--r--src/messaging/POP3Store.cpp12
-rw-r--r--src/messaging/POP3Store.hpp116
-rw-r--r--src/messaging/SMTPTransport.cpp14
-rw-r--r--src/messaging/SMTPTransport.hpp96
-rw-r--r--src/messaging/authHelper.cpp6
-rw-r--r--src/messaging/authHelper.hpp38
-rw-r--r--src/messaging/authenticationInfos.cpp2
-rw-r--r--src/messaging/authenticationInfos.hpp64
-rw-r--r--src/messaging/authenticator.cpp2
-rw-r--r--src/messaging/authenticator.hpp53
-rw-r--r--src/messaging/builtinServices.inl8
-rw-r--r--src/messaging/defaultAuthenticator.cpp2
-rw-r--r--src/messaging/defaultAuthenticator.hpp57
-rw-r--r--src/messaging/events.cpp2
-rw-r--r--src/messaging/events.hpp180
-rw-r--r--src/messaging/folder.cpp2
-rw-r--r--src/messaging/folder.hpp375
-rw-r--r--src/messaging/maildirFolder.cpp16
-rw-r--r--src/messaging/maildirFolder.hpp174
-rw-r--r--src/messaging/maildirMessage.cpp12
-rw-r--r--src/messaging/maildirMessage.hpp100
-rw-r--r--src/messaging/maildirStore.cpp10
-rw-r--r--src/messaging/maildirStore.hpp107
-rw-r--r--src/messaging/maildirUtils.cpp6
-rw-r--r--src/messaging/maildirUtils.hpp149
-rw-r--r--src/messaging/message.cpp2
-rw-r--r--src/messaging/message.hpp286
-rw-r--r--src/messaging/progressionListener.hpp75
-rw-r--r--src/messaging/service.cpp4
-rw-r--r--src/messaging/service.hpp149
-rw-r--r--src/messaging/serviceFactory.cpp10
-rw-r--r--src/messaging/serviceFactory.hpp186
-rw-r--r--src/messaging/serviceInfos.hpp78
-rw-r--r--src/messaging/session.cpp8
-rw-r--r--src/messaging/session.hpp134
-rw-r--r--src/messaging/simpleAuthenticator.cpp2
-rw-r--r--src/messaging/simpleAuthenticator.hpp62
-rw-r--r--src/messaging/socket.hpp104
-rw-r--r--src/messaging/store.hpp102
-rw-r--r--src/messaging/timeoutHandler.hpp74
-rw-r--r--src/messaging/transport.hpp76
-rw-r--r--src/messaging/url.cpp8
-rw-r--r--src/messaging/url.hpp188
-rw-r--r--src/messaging/urlUtils.cpp2
-rw-r--r--src/messaging/urlUtils.hpp54
-rw-r--r--src/options.cpp2
-rw-r--r--src/options.hpp94
-rw-r--r--src/parameter.cpp4
-rw-r--r--src/parameter.hpp87
-rw-r--r--src/parameterFactory.cpp6
-rw-r--r--src/parameterFactory.hpp77
-rw-r--r--src/parameterizedHeaderField.cpp8
-rw-r--r--src/parameterizedHeaderField.hpp181
-rw-r--r--src/parserHelpers.hpp81
-rw-r--r--src/plainTextPart.cpp6
-rw-r--r--src/plainTextPart.hpp61
-rw-r--r--src/platformDependant.cpp2
-rw-r--r--src/platformDependant.hpp158
-rw-r--r--src/platforms/posix/file.cpp4
-rw-r--r--src/platforms/posix/file.hpp205
-rw-r--r--src/platforms/posix/handler.cpp2
-rw-r--r--src/platforms/posix/handler.hpp87
-rw-r--r--src/platforms/posix/socket.cpp4
-rw-r--r--src/platforms/posix/socket.hpp75
-rw-r--r--src/propertySet.cpp2
-rw-r--r--src/propertySet.hpp335
-rw-r--r--src/relay.cpp6
-rw-r--r--src/relay.hpp97
-rw-r--r--src/standardFields.hpp82
-rw-r--r--src/standardParams.hpp56
-rw-r--r--src/text.cpp10
-rw-r--r--src/text.hpp217
-rw-r--r--src/textPart.hpp92
-rw-r--r--src/textPartFactory.cpp8
-rw-r--r--src/textPartFactory.hpp76
-rw-r--r--src/typeAdapter.cpp2
-rw-r--r--src/typeAdapter.hpp132
-rw-r--r--src/types.hpp43
-rw-r--r--src/utility/file.hpp257
-rw-r--r--src/utility/md5.cpp2
-rw-r--r--src/utility/md5.hpp68
-rw-r--r--src/utility/path.cpp2
-rw-r--r--src/utility/path.hpp161
-rw-r--r--src/utility/random.cpp4
-rw-r--r--src/utility/random.hpp77
-rw-r--r--src/utility/singleton.cpp2
-rw-r--r--src/utility/singleton.hpp92
-rw-r--r--src/utility/smartPtr.hpp166
-rw-r--r--src/utility/stream.cpp4
-rw-r--r--src/utility/stream.hpp274
-rw-r--r--src/utility/stringProxy.cpp2
-rw-r--r--src/utility/stringProxy.hpp90
-rw-r--r--src/utility/stringUtils.cpp2
-rw-r--r--src/utility/stringUtils.hpp131
-rw-r--r--src/vmime92
-rw-r--r--src/word.cpp2
-rw-r--r--src/word.hpp116
195 files changed, 255 insertions, 18553 deletions
diff --git a/src/address.cpp b/src/address.cpp
index f37918f5..d8a35cf4 100644
--- a/src/address.cpp
+++ b/src/address.cpp
@@ -17,12 +17,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "address.hpp"
+#include "vmime/address.hpp"
-#include "mailbox.hpp"
-#include "mailboxGroup.hpp"
+#include "vmime/mailbox.hpp"
+#include "vmime/mailboxGroup.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/address.hpp b/src/address.hpp
deleted file mode 100644
index 5fc00541..00000000
--- a/src/address.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ADDRESS_HPP_INCLUDED
-#define VMIME_ADDRESS_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** Abstract class representing a mailbox or a group of mailboxes.
- *
- * This class define a common behaviour for the mailbox
- * and mailboxGroup classes.
- */
-
-class address : public component
-{
- friend class addressList;
-
-protected:
-
- address();
-
-public:
-
- /** Check whether this address is empty (no mailboxes specified
- * if this is a mailboxGroup -or- no email specified if this is
- * a mailbox).
- *
- * @return true if this address is empty
- */
- virtual const bool isEmpty() const = 0;
-
- /** Test whether this is object is a mailboxGroup.
- *
- * @return true if this is a mailboxGroup, false otherwise
- */
- virtual const bool isGroup() const = 0;
-
- virtual address* clone() const = 0;
-
-protected:
-
- /** Parse an address from an input buffer.
- *
- * @param buffer input buffer
- * @param position position in the input buffer
- * @param end end position in the input buffer
- * @param newPosition will receive the new position in the input buffer
- * @return a new address object, or null if no more address is available in the input buffer
- */
- static address* parseNext(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ADDRESS_HPP_INCLUDED
diff --git a/src/addressList.cpp b/src/addressList.cpp
index 2ac24776..0bee2f09 100644
--- a/src/addressList.cpp
+++ b/src/addressList.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "addressList.hpp"
-#include "parserHelpers.hpp"
-#include "exception.hpp"
-#include "mailboxList.hpp"
+#include "vmime/addressList.hpp"
+#include "vmime/parserHelpers.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/mailboxList.hpp"
namespace vmime
diff --git a/src/addressList.hpp b/src/addressList.hpp
deleted file mode 100644
index 5d7ef18d..00000000
--- a/src/addressList.hpp
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ADDRESSLIST_HPP_INCLUDED
-#define VMIME_ADDRESSLIST_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-#include "address.hpp"
-
-
-namespace vmime
-{
-
-
-class mailboxList;
-
-
-/** A list of addresses.
- */
-
-class addressList : public component
-{
-public:
-
- addressList();
- addressList(const addressList& addrList);
-
- ~addressList();
-
-
- addressList* clone() const;
- void copyFrom(const component& other);
- addressList& operator=(const addressList& other);
- addressList& operator=(const mailboxList& other);
-
- const std::vector <const component*> getChildComponents() const;
-
-
- /** Add a address at the end of the list.
- *
- * @param addr address to append
- */
- void appendAddress(address* addr);
-
- /** Insert a new address before the specified address.
- *
- * @param beforeAddress address before which the new address will be inserted
- * @param addr address to insert
- * @throw exceptions::no_such_address if the address is not in the list
- */
- void insertAddressBefore(address* beforeAddress, address* addr);
-
- /** Insert a new address before the specified position.
- *
- * @param pos position at which to insert the new address (0 to insert at
- * the beginning of the list)
- * @param addr address to insert
- */
- void insertAddressBefore(const int pos, address* addr);
-
- /** Insert a new address after the specified address.
- *
- * @param afterAddress address after which the new address will be inserted
- * @param addr address to insert
- * @throw exceptions::no_such_address if the address is not in the list
- */
- void insertAddressAfter(address* afterAddress, address* addr);
-
- /** Insert a new address after the specified position.
- *
- * @param pos position of the address before the new address
- * @param addr address to insert
- */
- void insertAddressAfter(const int pos, address* addr);
-
- /** Remove the specified address from the list.
- *
- * @param addr address to remove
- * @throw exceptions::no_such_address if the address is not in the list
- */
- void removeAddress(address* addr);
-
- /** Remove the address at the specified position.
- *
- * @param pos position of the address to remove
- */
- void removeAddress(const int pos);
-
- /** Remove all addresses from the list.
- */
- void removeAllAddresses();
-
- /** Return the number of addresses in the list.
- *
- * @return number of addresses
- */
- const int getAddressCount() const;
-
- /** Tests whether the list of addresses is empty.
- *
- * @return true if there is no address, false otherwise
- */
- const bool isEmpty() const;
-
- /** Return the address at the specified position.
- *
- * @param pos position
- * @return address at position 'pos'
- */
- address* getAddressAt(const int pos);
-
- /** Return the address at the specified position.
- *
- * @param pos position
- * @return address at position 'pos'
- */
- const address* const getAddressAt(const int pos) const;
-
- /** Return the address list.
- *
- * @return list of addresses
- */
- const std::vector <const address*> getAddressList() const;
-
- /** Return the address list.
- *
- * @return list of addresses
- */
- const std::vector <address*> getAddressList();
-
-private:
-
- std::vector <address*> m_list;
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ADDRESSLIST_HPP_INCLUDED
diff --git a/src/attachment.hpp b/src/attachment.hpp
deleted file mode 100644
index 2b4ad6e9..00000000
--- a/src/attachment.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ATTACHMENT_HPP_INCLUDED
-#define VMIME_ATTACHMENT_HPP_INCLUDED
-
-
-#include "base.hpp"
-
-#include "bodyPart.hpp"
-#include "mediaType.hpp"
-#include "text.hpp"
-#include "contentHandler.hpp"
-#include "encoding.hpp"
-
-
-namespace vmime
-{
-
-
-/** Base class for all types of attachment.
- */
-
-class attachment
-{
- friend class messageBuilder;
- friend class messageParser;
-
-protected:
-
- attachment() { }
-
-public:
-
- virtual ~attachment() { }
-
- /** Return the media type of this attachment.
- * @return content type of the attachment
- */
- virtual const mediaType& getType() const = 0;
-
- /** Return the description of this attachment.
- * @return attachment description
- */
- virtual const text& getDescription() const = 0;
-
- /** Return the data contained in this attachment.
- * @return attachment data
- */
- virtual const contentHandler& getData() const = 0;
-
- /** Return the encoding used for this attachment.
- * @return attachment data encoding
- */
- virtual const encoding& getEncoding() const = 0;
-
- /** Generate the attachment in the specified body part.
- * @param parent body part in which to generate the attachment
- */
- virtual void generateIn(bodyPart& parent) const = 0;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ATTACHMENT_HPP_INCLUDED
diff --git a/src/base.cpp b/src/base.cpp
index b6d752d3..9c9d73de 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -17,30 +17,30 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "config.hpp"
+#include "vmime/config.hpp"
-#include "charset.hpp"
-#include "base.hpp"
+#include "vmime/charset.hpp"
+#include "vmime/base.hpp"
-#include "encoder.hpp"
-#include "encoderB64.hpp"
-#include "encoderQP.hpp"
+#include "vmime/encoder.hpp"
+#include "vmime/encoderB64.hpp"
+#include "vmime/encoderQP.hpp"
-#include "text.hpp"
+#include "vmime/text.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/parserHelpers.hpp"
-#include "utility/stringUtils.hpp"
+#include "vmime/utility/stringUtils.hpp"
// For initializing
-#include "encoderFactory.hpp"
-#include "headerFieldFactory.hpp"
-#include "parameterFactory.hpp"
-#include "textPartFactory.hpp"
-#include "options.hpp"
+#include "vmime/encoderFactory.hpp"
+#include "vmime/headerFieldFactory.hpp"
+#include "vmime/parameterFactory.hpp"
+#include "vmime/textPartFactory.hpp"
+#include "vmime/options.hpp"
#if VMIME_HAVE_MESSAGING_FEATURES
- #include "messaging/serviceFactory.hpp"
+ #include "vmime/messaging/serviceFactory.hpp"
#endif
diff --git a/src/base.hpp b/src/base.hpp
deleted file mode 100644
index 9e06bba6..00000000
--- a/src/base.hpp
+++ /dev/null
@@ -1,169 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_BASE_HPP_INCLUDED
-#define VMIME_BASE_HPP_INCLUDED
-
-
-#include <string>
-#include <vector>
-#include <map>
-#include <sstream>
-#include <locale>
-
-#include "config.hpp"
-#include "types.hpp"
-#include "constants.hpp"
-#include "utility/stream.hpp"
-
-
-namespace vmime
-{
- class text;
- class charset;
-
-
- // "Null" strings
- extern const string NULL_STRING;
-#if VMIME_WIDE_CHAR_SUPPORT
- extern const wstring NULL_WSTRING;
-#endif
-
- extern const text NULL_TEXT;
-
-
- //
- // Library name and version
- //
-
- const string libname();
- const string libversion();
-
-
- //
- // Helpful functions used for array -> iterator conversion
- //
-
- template <typename T, size_t N>
- inline T const* begin(T const (&array)[N])
- {
- return (array);
- }
-
- template <typename T, size_t N>
- inline T const* end(T const (&array)[N])
- {
- return (array + N);
- }
-
- template <typename T, size_t N>
- inline size_t count(T const (&array)[N])
- {
- return (N);
- }
-
-
- // Free the pointer elements in a STL container and empty the container
-
- template <class CONTAINER>
- void free_container(CONTAINER& c)
- {
- for (typename CONTAINER::iterator it = c.begin() ; it != c.end() ; ++it)
- delete (*it);
-
- c.clear();
- }
-
- // Copy one vector to another, with type conversion
-
- template <class T1, class T2>
- void copy_vector(T1& v1, T2& v2)
- {
- const typename T1::size_type count = v1.size();
-
- v2.resize(count);
-
- for (typename T1::size_type i = 0 ; i < count ; ++i)
- v2[i] = v1[i];
- }
-
-
- /*
-
- RFC#2822
- 2.1.1. Line Length Limits
-
- There are two limits that this standard places on the number of
- characters in a line. Each line of characters MUST be no more than
- 998 characters, and SHOULD be no more than 78 characters, excluding
- the CRLF.
-
- The 998 character limit is due to limitations in many implementations
- which send, receive, or store Internet Message Format messages that
- simply cannot handle more than 998 characters on a line. Receiving
- implementations would do well to handle an arbitrarily large number
- of characters in a line for robustness sake. However, there are so
- many implementations which (in compliance with the transport
- requirements of [RFC2821]) do not accept messages containing more
- than 1000 character including the CR and LF per line, it is important
- for implementations not to create such messages.
-
- The more conservative 78 character recommendation is to accommodate
- the many implementations of user interfaces that display these
- messages which may truncate, or disastrously wrap, the display of
- more than 78 characters per line, in spite of the fact that such
- implementations are non-conformant to the intent of this specification
- (and that of [RFC2821] if they actually cause information to be lost).
- Again, even though this limitation is put on messages, it is encumbant
- upon implementations which display messages to handle an arbitrarily
- large number of characters in a line (certainly at least up to the 998
- character limit) for the sake of robustness.
- */
-
- namespace lineLengthLimits
- {
- extern const string::size_type infinite;
-
- enum
- {
- max = 998,
- convenient = 78
- };
- }
-
-
- // New line sequence to be used when folding header fields.
- extern const string NEW_LINE_SEQUENCE;
- extern const string::size_type NEW_LINE_SEQUENCE_LENGTH;
-
-
- // CR-LF sequence
- extern const string CRLF;
-
-
- // Mime version
- extern const string MIME_VERSION;
-
- /** Utility classes. */
- namespace utility { }
-
-} // vmime
-
-
-#endif // VMIME_BASE_HPP_INCLUDED
diff --git a/src/body.cpp b/src/body.cpp
index dca3409a..414b36ce 100644
--- a/src/body.cpp
+++ b/src/body.cpp
@@ -17,16 +17,16 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "bodyPart.hpp"
-#include "body.hpp"
+#include "vmime/bodyPart.hpp"
+#include "vmime/body.hpp"
-#include "options.hpp"
+#include "vmime/options.hpp"
-#include "contentTypeField.hpp"
+#include "vmime/contentTypeField.hpp"
-#include "utility/random.hpp"
+#include "vmime/utility/random.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/body.hpp b/src/body.hpp
deleted file mode 100644
index 9008fea9..00000000
--- a/src/body.hpp
+++ /dev/null
@@ -1,266 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_BODY_HPP_INCLUDED
-#define VMIME_BODY_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-#include "header.hpp"
-
-#include "mediaType.hpp"
-#include "charset.hpp"
-#include "encoding.hpp"
-
-#include "contentHandler.hpp"
-
-
-namespace vmime
-{
-
-
-class bodyPart;
-
-
-/** Body section of a MIME part.
- */
-
-class body : public component
-{
- friend class bodyPart;
-
-private:
-
- body(bodyPart* parentPart);
-
-public:
-
- body();
- ~body();
-
- /** Add a part at the end of the list.
- *
- * @param part part to append
- */
- void appendPart(bodyPart* part);
-
- /** Insert a new part before the specified part.
- *
- * @param beforePart part before which the new part will be inserted
- * @param part part to insert
- * @throw exceptions::no_such_part if the part is not in the list
- */
- void insertPartBefore(bodyPart* beforePart, bodyPart* part);
-
- /** Insert a new part before the specified position.
- *
- * @param pos position at which to insert the new part (0 to insert at
- * the beginning of the list)
- * @param part part to insert
- */
- void insertPartBefore(const int pos, bodyPart* part);
-
- /** Insert a new part after the specified part.
- *
- * @param afterPart part after which the new part will be inserted
- * @param part part to insert
- * @throw exceptions::no_such_part if the part is not in the list
- */
- void insertPartAfter(bodyPart* afterPart, bodyPart* part);
-
- /** Insert a new part after the specified position.
- *
- * @param pos position of the part before the new part
- * @param part part to insert
- */
- void insertPartAfter(const int pos, bodyPart* part);
-
- /** Remove the specified part from the list.
- *
- * @param part part to remove
- * @throw exceptions::no_such_part if the part is not in the list
- */
- void removePart(bodyPart* part);
-
- /** Remove the part at the specified position.
- *
- * @param pos position of the part to remove
- */
- void removePart(const int pos);
-
- /** Remove all parts from the list.
- */
- void removeAllParts();
-
- /** Return the number of parts in the list.
- *
- * @return number of parts
- */
- const int getPartCount() const;
-
- /** Tests whether the list of parts is empty.
- *
- * @return true if there is no part, false otherwise
- */
- const bool isEmpty() const;
-
- /** Return the part at the specified position.
- *
- * @param pos position
- * @return part at position 'pos'
- */
- bodyPart* getPartAt(const int pos);
-
- /** Return the part at the specified position.
- *
- * @param pos position
- * @return part at position 'pos'
- */
- const bodyPart* const getPartAt(const int pos) const;
-
- /** Return the part list.
- *
- * @return list of parts
- */
- const std::vector <const bodyPart*> getPartList() const;
-
- /** Return the part list.
- *
- * @return list of parts
- */
- const std::vector <bodyPart*> getPartList();
-
- /** Return the prolog text.
- *
- * @return prolog text
- */
- const string& getPrologText() const;
-
- /** Set the prolog text.
- *
- * @param prologText new prolog text
- */
- void setPrologText(const string& prologText);
-
- /** Return the epilog text.
- *
- * @return epilog text
- */
- const string& getEpilogText() const;
-
- /** Set the epilog text.
- *
- * @param epilogText new epilog text
- */
- void setEpilogText(const string& epilogText);
-
- /** Return a read-only reference to body contents.
- *
- * @return read-only body contents
- */
- const contentHandler& getContents() const;
-
- /** Return a modifiable reference to body contents.
- *
- * @return body contents
- */
- contentHandler& getContents();
-
- /** Set the body contents.
- *
- * @param contents new body contents
- */
- void setContents(const contentHandler& contents);
-
- /** Return the media type of the data contained in the body contents.
- * This is a shortcut for getHeader()->ContentType()->getValue()
- * on the parent part.
- *
- * @return media type of body contents
- */
- const mediaType getContentType() const;
-
- /** Return the charset of the data contained in the body contents.
- * This is a shortcut for getHeader()->ContentType()->getCharset()
- * on the parent part.
- *
- * @return charset of body contents
- */
- const charset getCharset() const;
-
- /** Return the encoding used to encode the body contents.
- * This is a shortcut for getHeader()->ContentTransferEncoding()->getValue()
- * on the parent part.
- *
- * @return encoding of body contents
- */
- const encoding getEncoding() const;
-
- /** Generate a new random boundary string.
- *
- * @return randomly generated boundary string
- */
- static const string generateRandomBoundaryString();
-
- /** Test a boundary string for validity (as defined in RFC #1521, page 19).
- *
- * @param boundary boundary string to test
- * @return true if the boundary string is valid, false otherwise
- */
- static const bool isValidBoundary(const string& boundary);
-
- body* clone() const;
- void copyFrom(const component& other);
- body& operator=(const body& other);
-
- const std::vector <const component*> getChildComponents() const;
-
-private:
-
- string m_prologText;
- string m_epilogText;
-
- contentHandler m_contents;
-
- bodyPart* m_part;
- header* m_header;
-
- std::vector <bodyPart*> m_parts;
-
- const bool isRootPart() const;
-
- void initNewPart(bodyPart* part);
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_BODY_HPP_INCLUDED
diff --git a/src/bodyPart.cpp b/src/bodyPart.cpp
index 45998aea..51eaef90 100644
--- a/src/bodyPart.cpp
+++ b/src/bodyPart.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "bodyPart.hpp"
+#include "vmime/bodyPart.hpp"
namespace vmime
diff --git a/src/bodyPart.hpp b/src/bodyPart.hpp
deleted file mode 100644
index 222b8db9..00000000
--- a/src/bodyPart.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_BODYPART_HPP_INCLUDED
-#define VMIME_BODYPART_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-#include "header.hpp"
-#include "body.hpp"
-
-
-namespace vmime
-{
-
-
-/** A MIME part.
- */
-
-class bodyPart : public component
-{
- friend class body;
-
-public:
-
- bodyPart();
-
- /** Return the header section of this part.
- *
- * @return header section
- */
- const header* getHeader() const;
-
- /** Return the header section of this part.
- *
- * @return header section
- */
- header* getHeader();
-
- /** Return the body section of this part.
- *
- * @return body section
- */
- const body* getBody() const;
-
- /** Return the body section of this part.
- *
- * @return body section
- */
- body* getBody();
-
- /** Return the parent part of this part.
- *
- * @return parent part or NULL if not known
- */
- bodyPart* getParentPart() const;
-
- bodyPart* clone() const;
- void copyFrom(const component& other);
- bodyPart& operator=(const bodyPart& other);
-
- const std::vector <const component*> getChildComponents() const;
-
-private:
-
- header m_header;
- body m_body;
-
- bodyPart* m_parent;
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_BODYPART_HPP_INCLUDED
diff --git a/src/charset.cpp b/src/charset.cpp
index 0ec050a8..4d2e005a 100644
--- a/src/charset.cpp
+++ b/src/charset.cpp
@@ -17,11 +17,11 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "charset.hpp"
-#include "exception.hpp"
-#include "platformDependant.hpp"
+#include "vmime/charset.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
-#include "utility/stringUtils.hpp"
+#include "vmime/utility/stringUtils.hpp"
extern "C"
diff --git a/src/charset.hpp b/src/charset.hpp
deleted file mode 100644
index 8de75329..00000000
--- a/src/charset.hpp
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_CHARSET_HPP_INCLUDED
-#define VMIME_CHARSET_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** Charset description (basic type).
- */
-
-class charset : public component
-{
-public:
-
- charset();
- charset(const string& name);
-
-public:
-
- /** Return the ISO name of the charset.
- *
- * @return charset name
- */
- const string& getName() const;
-
- charset& operator=(const charset& other);
- charset& operator=(const string& name);
-
- const bool operator==(const charset& value) const;
- const bool operator!=(const charset& value) const;
-
- const std::vector <const component*> getChildComponents() const;
-
- /** Returns the default charset used on the system.
- *
- * This function simply calls <code>platformDependantHandler::getLocaleCharset()</code>
- * and is provided for convenience.
- *
- * @return system default charset
- */
- static const charset getLocaleCharset();
-
-#if VMIME_WIDE_CHAR_SUPPORT
- /** Convert a string buffer in the specified charset to a wide-char
- * string buffer.
- *
- * @param in input buffer
- * @param out output buffer
- * @param ch input charset
- */
- static void decode(const string& in, wstring& out, const charset& ch);
-
- /** Convert a wide-char string buffer to a string buffer in the
- * specified charset.
- *
- * @param in input buffer
- * @param out output buffer
- * @param ch output charset
- */
- static void encode(const wstring& in, string& out, const charset& ch);
-#endif
-
- /** Convert a string buffer from one charset to another
- * charset (in-memory conversion)
- *
- * \deprecated Use the new convert() method, which takes
- * an outputStream parameter.
- *
- * @param in input buffer
- * @param out output buffer
- * @param source input charset
- * @param dest output charset
- */
- static void convert(const string& in, string& out, const charset& source, const charset& dest);
-
- /** Convert the contents of an input stream in a specified charset
- * to another charset and write the result to an output stream.
- *
- * @param in input stream to read data from
- * @param out output stream to write the converted data
- * @param source input charset
- * @param dest output charset
- */
- static void convert(utility::inputStream& in, utility::outputStream& out, const charset& source, const charset& dest);
-
- charset* clone() const;
- void copyFrom(const component& other);
-
-private:
-
- string m_name;
-
- template <class STRINGF, class STRINGT>
- static void iconvert(const STRINGF& in, STRINGT& out, const charset& from, const charset& to);
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_CHARSET_HPP_INCLUDED
diff --git a/src/component.cpp b/src/component.cpp
index cbedac63..a13765a3 100644
--- a/src/component.cpp
+++ b/src/component.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "component.hpp"
-#include "base.hpp"
+#include "vmime/component.hpp"
+#include "vmime/base.hpp"
#include <sstream>
diff --git a/src/component.hpp b/src/component.hpp
deleted file mode 100644
index af5386b2..00000000
--- a/src/component.hpp
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_COMPONENT_HPP_INCLUDED
-#define VMIME_COMPONENT_HPP_INCLUDED
-
-
-#include "base.hpp"
-
-
-namespace vmime
-{
-
-
-/** This abstract class is the base for all the classes in the library.
- * It defines the methods for parsing and generating all the components.
- */
-
-class component
-{
-public:
-
- component();
- virtual ~component();
-
- /** Parse RFC-822/MIME data for this component.
- *
- * @param buffer input buffer
- */
- void parse(const string& buffer);
-
- /** Parse RFC-822/MIME data for this component.
- *
- * @param buffer input buffer
- * @param position current position in the input buffer
- * @param end end position in the input buffer
- * @param newPosition will receive the new position in the input buffer
- */
- virtual void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL) = 0;
-
- /** Generate RFC-2822/MIME data for this component.
- *
- * \deprecated Use the new generate() method, which takes an outputStream parameter.
- *
- * @param maxLineLength maximum line length for output
- * @param curLinePos length of the current line in the output buffer
- * @return generated data
- */
- const string generate(const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0) const;
-
- /** Generate RFC-2822/MIME data for this component.
- *
- * @param os output stream
- * @param maxLineLength maximum line length for output
- * @param curLinePos length of the current line in the output buffer
- * @param newLinePos will receive the new line position (length of the last line written)
- */
- virtual void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const = 0;
-
- /** Clone this component.
- *
- * @return a copy of this component
- */
- virtual component* clone() const = 0;
-
- /** Replace data in this component by data in other component.
- * Both components must be of the same type.
- *
- * @throw std::bad_cast_exception if the components are not
- * of the same (dynamic) type
- * @param other other component to copy data from
- */
- virtual void copyFrom(const component& other) = 0;
-
- /** Return the start position of this component in the
- * parsed message contents.
- *
- * @return start position in parsed buffer
- * or 0 if this component has not been parsed
- */
- const string::size_type getParsedOffset() const;
-
- /** Return the length of this component in the
- * parsed message contents.
- *
- * @return length of the component in parsed buffer
- * or 0 if this component has not been parsed
- */
- const string::size_type getParsedLength() const;
-
- /** Return the list of children of this component.
- *
- * @return list of child components
- */
- const std::vector <component*> getChildComponents();
-
- /** Return the list of children of this component (const version).
- *
- * @return list of child components
- */
- virtual const std::vector <const component*> getChildComponents() const = 0;
-
-protected:
-
- void setParsedBounds(const string::size_type start, const string::size_type end);
-
-private:
-
- string::size_type m_parsedOffset;
- string::size_type m_parsedLength;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_COMPONENT_HPP_INCLUDED
diff --git a/src/constants.cpp b/src/constants.cpp
index d59fea05..a77f8ea7 100644
--- a/src/constants.cpp
+++ b/src/constants.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "constants.hpp"
+#include "vmime/constants.hpp"
namespace vmime
diff --git a/src/constants.hpp b/src/constants.hpp
deleted file mode 100644
index 6dc21790..00000000
--- a/src/constants.hpp
+++ /dev/null
@@ -1,185 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_CONSTANTS_HPP_INCLUDED
-#define VMIME_CONSTANTS_HPP_INCLUDED
-
-
-#include <string>
-
-#include "types.hpp"
-
-
-namespace vmime
-{
- /** Constants for media types. */
- namespace mediaTypes
- {
- // Types
- extern const string::value_type* const TEXT;
- extern const string::value_type* const MULTIPART;
- extern const string::value_type* const MESSAGE;
- extern const string::value_type* const APPLICATION;
- extern const string::value_type* const IMAGE;
- extern const string::value_type* const AUDIO;
- extern const string::value_type* const VIDEO;
-
- // Sub-types
- extern const string::value_type* const TEXT_PLAIN;
- extern const string::value_type* const TEXT_HTML;
- extern const string::value_type* const TEXT_RICHTEXT;
- extern const string::value_type* const TEXT_ENRICHED;
-
- extern const string::value_type* const MULTIPART_MIXED;
- extern const string::value_type* const MULTIPART_RELATED;
- extern const string::value_type* const MULTIPART_ALTERNATIVE;
- extern const string::value_type* const MULTIPART_PARALLEL;
- extern const string::value_type* const MULTIPART_DIGEST;
-
- extern const string::value_type* const MESSAGE_RFC822;
- extern const string::value_type* const MESSAGE_PARTIAL;
- extern const string::value_type* const MESSAGE_EXTERNAL_BODY;
-
- extern const string::value_type* const APPLICATION_OCTET_STREAM;
-
- extern const string::value_type* const IMAGE_JPEG;
- extern const string::value_type* const IMAGE_GIF;
-
- extern const string::value_type* const AUDIO_BASIC;
-
- extern const string::value_type* const VIDEO_MPEG;
- }
-
-
- /** Constants for encoding types. */
- namespace encodingTypes
- {
- extern const string::value_type* const SEVEN_BIT;
- extern const string::value_type* const EIGHT_BIT;
- extern const string::value_type* const BASE64;
- extern const string::value_type* const QUOTED_PRINTABLE;
- extern const string::value_type* const BINARY;
- extern const string::value_type* const UUENCODE;
- }
-
-
- /** Constants for content disposition types (RFC-2183). */
- namespace contentDispositionTypes
- {
- extern const string::value_type* const INLINE;
- extern const string::value_type* const ATTACHMENT;
- }
-
-
- /** Constants for charsets. */
- namespace charsets
- {
- extern const string::value_type* const ISO8859_1;
- extern const string::value_type* const ISO8859_2;
- extern const string::value_type* const ISO8859_3;
- extern const string::value_type* const ISO8859_4;
- extern const string::value_type* const ISO8859_5;
- extern const string::value_type* const ISO8859_6;
- extern const string::value_type* const ISO8859_7;
- extern const string::value_type* const ISO8859_8;
- extern const string::value_type* const ISO8859_9;
- extern const string::value_type* const ISO8859_10;
- extern const string::value_type* const ISO8859_13;
- extern const string::value_type* const ISO8859_14;
- extern const string::value_type* const ISO8859_15;
- extern const string::value_type* const ISO8859_16;
-
- extern const string::value_type* const CP_437;
- extern const string::value_type* const CP_737;
- extern const string::value_type* const CP_775;
- extern const string::value_type* const CP_850;
- extern const string::value_type* const CP_852;
- extern const string::value_type* const CP_853;
- extern const string::value_type* const CP_855;
- extern const string::value_type* const CP_857;
- extern const string::value_type* const CP_858;
- extern const string::value_type* const CP_860;
- extern const string::value_type* const CP_861;
- extern const string::value_type* const CP_862;
- extern const string::value_type* const CP_863;
- extern const string::value_type* const CP_864;
- extern const string::value_type* const CP_865;
- extern const string::value_type* const CP_866;
- extern const string::value_type* const CP_869;
- extern const string::value_type* const CP_874;
- extern const string::value_type* const CP_1125;
- extern const string::value_type* const CP_1250;
- extern const string::value_type* const CP_1251;
- extern const string::value_type* const CP_1252;
- extern const string::value_type* const CP_1253;
- extern const string::value_type* const CP_1254;
- extern const string::value_type* const CP_1255;
- extern const string::value_type* const CP_1256;
- extern const string::value_type* const CP_1257;
-
- extern const string::value_type* const US_ASCII;
-
- extern const string::value_type* const UTF_7;
- extern const string::value_type* const UTF_8;
- extern const string::value_type* const UTF_16;
- extern const string::value_type* const UTF_32;
-
- extern const string::value_type* const WINDOWS_1250;
- extern const string::value_type* const WINDOWS_1251;
- extern const string::value_type* const WINDOWS_1252;
- extern const string::value_type* const WINDOWS_1253;
- extern const string::value_type* const WINDOWS_1254;
- extern const string::value_type* const WINDOWS_1255;
- extern const string::value_type* const WINDOWS_1256;
- extern const string::value_type* const WINDOWS_1257;
- extern const string::value_type* const WINDOWS_1258;
- }
-
- /** Constants for standard field names. */
- namespace fields
- {
- extern const string::value_type* const RECEIVED;
- extern const string::value_type* const FROM;
- extern const string::value_type* const SENDER;
- extern const string::value_type* const REPLY_TO;
- extern const string::value_type* const TO;
- extern const string::value_type* const CC;
- extern const string::value_type* const BCC;
- extern const string::value_type* const DATE;
- extern const string::value_type* const SUBJECT;
- extern const string::value_type* const ORGANIZATION;
- extern const string::value_type* const USER_AGENT;
- extern const string::value_type* const DELIVERED_TO;
- extern const string::value_type* const RETURN_PATH;
- extern const string::value_type* const MIME_VERSION;
- extern const string::value_type* const MESSAGE_ID;
- extern const string::value_type* const CONTENT_TYPE;
- extern const string::value_type* const CONTENT_TRANSFER_ENCODING;
- extern const string::value_type* const CONTENT_DESCRIPTION;
- extern const string::value_type* const CONTENT_DISPOSITION;
- extern const string::value_type* const CONTENT_ID;
- extern const string::value_type* const CONTENT_LOCATION;
-
- extern const string::value_type* const X_MAILER;
- extern const string::value_type* const X_PRIORITY;
- }
-}
-
-
-#endif // VMIME_CONSTANTS_HPP_INCLUDED
diff --git a/src/contentDisposition.cpp b/src/contentDisposition.cpp
index 74fd42ae..3eb8aad8 100644
--- a/src/contentDisposition.cpp
+++ b/src/contentDisposition.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "contentDisposition.hpp"
-#include "utility/stringUtils.hpp"
+#include "vmime/contentDisposition.hpp"
+#include "vmime/utility/stringUtils.hpp"
namespace vmime
diff --git a/src/contentDisposition.hpp b/src/contentDisposition.hpp
deleted file mode 100644
index cdc036aa..00000000
--- a/src/contentDisposition.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_CONTENTDISPOSITION_HPP_INCLUDED
-#define VMIME_CONTENTDISPOSITION_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** Content disposition (basic type).
- */
-
-class contentDisposition : public component
-{
-public:
-
- contentDisposition();
- contentDisposition(const string& name);
- contentDisposition(const contentDisposition& disp);
-
-
- /** Return the content disposition type.
- * See the constants in vmime::dispositionTypes.
- *
- * @return name of the disposition type (eg. "inline")
- */
- const string& getName() const;
-
- /** Set the content disposition type.
- * See the constants in vmime::dispositionTypes.
- *
- * @param name name of the disposition type
- */
- void setName(const string& name);
-
- contentDisposition* clone() const;
- void copyFrom(const component& other);
- contentDisposition& operator=(const contentDisposition& other);
-
- const std::vector <const component*> getChildComponents() const;
-
-
- contentDisposition& operator=(const string& name);
-
- const bool operator==(const contentDisposition& value) const;
- const bool operator!=(const contentDisposition& value) const;
-
-private:
-
- string m_name;
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_CONTENTDISPOSITION_HPP_INCLUDED
diff --git a/src/contentDispositionField.cpp b/src/contentDispositionField.cpp
index a4a4c623..03c0027d 100644
--- a/src/contentDispositionField.cpp
+++ b/src/contentDispositionField.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "contentDispositionField.hpp"
-#include "exception.hpp"
+#include "vmime/contentDispositionField.hpp"
+#include "vmime/exception.hpp"
-#include "standardParams.hpp"
+#include "vmime/standardParams.hpp"
namespace vmime
diff --git a/src/contentDispositionField.hpp b/src/contentDispositionField.hpp
deleted file mode 100644
index b896ce3e..00000000
--- a/src/contentDispositionField.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_CONTENTDISPOSITIONFIELD_HPP_INCLUDED
-#define VMIME_CONTENTDISPOSITIONFIELD_HPP_INCLUDED
-
-
-#include "parameterizedHeaderField.hpp"
-#include "genericField.hpp"
-
-#include "contentDisposition.hpp"
-#include "dateTime.hpp"
-
-
-namespace vmime
-{
-
-
-class contentDispositionField : public parameterizedHeaderField, public genericField <contentDisposition>
-{
- friend class headerFieldFactory::registerer <contentDispositionField>;
-
-protected:
-
- contentDispositionField();
- contentDispositionField(contentDispositionField&);
-
-public:
-
- const datetime& getCreationDate() const;
- void setCreationDate(const datetime& creationDate);
-
- const datetime& getModificationDate() const;
- void setModificationDate(const datetime& modificationDate);
-
- const datetime& getReadDate() const;
- void setReadDate(const datetime& readDate);
-
- const string getFilename() const;
- void setFilename(const string& filename);
-
- const string getSize() const;
- void setSize(const string& size);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_CONTENTDISPOSITIONFIELD_HPP_INCLUDED
diff --git a/src/contentHandler.cpp b/src/contentHandler.cpp
index 195055ed..8c35ebaa 100644
--- a/src/contentHandler.cpp
+++ b/src/contentHandler.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "contentHandler.hpp"
+#include "vmime/contentHandler.hpp"
namespace vmime
diff --git a/src/contentHandler.hpp b/src/contentHandler.hpp
deleted file mode 100644
index a6ea884a..00000000
--- a/src/contentHandler.hpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_CONTENTHANDLER_HPP_INCLUDED
-#define VMIME_CONTENTHANDLER_HPP_INCLUDED
-
-
-#include <limits>
-
-#include "base.hpp"
-#include "utility/stringProxy.hpp"
-#include "utility/smartPtr.hpp"
-#include "encoding.hpp"
-
-
-namespace vmime
-{
-
-
-class contentHandler
-{
-private:
-
- static const vmime::encoding NO_ENCODING;
-
-public:
-
- contentHandler();
- contentHandler(const string& buffer, const vmime::encoding& enc = NO_ENCODING); // for compatibility
- ~contentHandler();
-
- // Copy
- contentHandler(const contentHandler& cts);
- contentHandler& operator=(const contentHandler& cts);
-
- // Set the data contained in the body.
- //
- // The two first functions take advantage of the COW (copy-on-write) system that
- // might be implemented into std::string. This is done using "stringProxy" object.
- //
- // Set "enc" parameter to anything other than NO_ENCODING if the data managed by
- // this content handler is already encoded with the specified encoding (so, no
- // encoding/decoding will be performed on generate()/extract()). Note that the
- // data may be re-encoded (that is, decoded and encoded) if the encoding passed
- // to generate() is different from this one...
- //
- // The 'length' parameter is optional (user-defined). You can pass 0 if you want,
- // VMime does not make use of it.
- void setData(const utility::stringProxy& str, const vmime::encoding& enc = NO_ENCODING);
- void setData(const string& buffer, const vmime::encoding& enc = NO_ENCODING);
- void setData(const string& buffer, const string::size_type start, const string::size_type end, const vmime::encoding& enc = NO_ENCODING);
- void setData(utility::inputStream* const is, const utility::stream::size_type length, const bool own, const vmime::encoding& enc = NO_ENCODING);
-
- // For compatibility
- contentHandler& operator=(const string& buffer);
-
- // WRITE: Output the contents into the specified stream. Data will be
- // encoded before being written into the stream. This is used internally
- // by the body object to generate the message, you may not need to use
- // this (see function extract() if you want to get the contents).
- void generate(utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength = lineLengthLimits::infinite) const;
-
- // READ: Extract the contents into the specified stream. If needed, data
- // will be decoded before being written into the stream.
- void extract(utility::outputStream& os) const;
-
- // Returns the actual length of the data. WARNING: this can return 0 if no
- // length was specified when setting data of this object.
- const string::size_type getLength() const;
-
- // Returns 'true' if the data managed by this object is encoded.
- const bool isEncoded() const;
-
- // Returns the encoding used for the data (or "binary" if not encoded).
- const vmime::encoding& getEncoding() const;
-
- // Returns 'true' if there is no data set.
- const bool isEmpty() const;
-
-private:
-
- // Source of data managed by this content handler
- enum Types
- {
- TYPE_NONE,
- TYPE_STRING,
- TYPE_STREAM
- };
-
- Types m_type;
-
- // Equals to NO_ENCODING if data is not encoded, otherwise this
- // specifies the encoding that have been used to encode the data.
- vmime::encoding m_encoding;
-
- // Used if m_type == TYPE_STRING
- utility::stringProxy m_string;
-
- // Used if m_type == TYPE_STREAM
- utility::smart_ptr <utility::inputStream> m_ownedStream; // 'contentHandler' objects are copiable...
- utility::inputStream* m_stream;
- string::size_type m_length;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_CONTENTHANDLER_HPP_INCLUDED
diff --git a/src/contentTypeField.cpp b/src/contentTypeField.cpp
index 69da97ae..2ced531a 100644
--- a/src/contentTypeField.cpp
+++ b/src/contentTypeField.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "contentTypeField.hpp"
-#include "exception.hpp"
+#include "vmime/contentTypeField.hpp"
+#include "vmime/exception.hpp"
-#include "standardParams.hpp"
+#include "vmime/standardParams.hpp"
namespace vmime
diff --git a/src/contentTypeField.hpp b/src/contentTypeField.hpp
deleted file mode 100644
index 69ea5d5c..00000000
--- a/src/contentTypeField.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_CONTENTTYPEFIELD_HPP_INCLUDED
-#define VMIME_CONTENTTYPEFIELD_HPP_INCLUDED
-
-
-#include "parameterizedHeaderField.hpp"
-#include "genericField.hpp"
-
-#include "mediaType.hpp"
-#include "charset.hpp"
-
-
-namespace vmime
-{
-
-
-class contentTypeField : public parameterizedHeaderField, public genericField <mediaType>
-{
- friend class headerFieldFactory::registerer <contentTypeField>;
-
-protected:
-
- contentTypeField();
- contentTypeField(contentTypeField&);
-
-public:
-
- const string getBoundary() const;
- void setBoundary(const string& boundary);
-
- const charset& getCharset() const;
- void setCharset(const charset& ch);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_CONTENTTYPEFIELD_HPP_INCLUDED
diff --git a/src/dateTime.cpp b/src/dateTime.cpp
index 08ad89e9..11a9d43d 100644
--- a/src/dateTime.cpp
+++ b/src/dateTime.cpp
@@ -19,9 +19,9 @@
#include <iomanip>
-#include "dateTime.hpp"
-#include "platformDependant.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/dateTime.hpp"
+#include "vmime/platformDependant.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/dateTime.hpp b/src/dateTime.hpp
deleted file mode 100644
index 40ff90fc..00000000
--- a/src/dateTime.hpp
+++ /dev/null
@@ -1,243 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_DATETIME_HPP_INCLUDED
-#define VMIME_DATETIME_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** Date and time (basic type).
- */
-
-class datetime : public component
-{
-public:
-
- // Constructors
- datetime();
- datetime(const int year, const int month, const int day);
- datetime(const int year, const int month, const int day, const int hour, const int minute, const int second, const int zone = GMT);
- datetime(const datetime& d);
- datetime(const string& date);
-
- // Destructor
- ~datetime();
-
- // Some time zones (in minutes)
- enum TimeZones
- {
- GMT_12 = -720, // GMT-12h
- GMT_11 = -660, // GMT-11h
- GMT_10 = -600, // GMT-10h
- GMT_9 = -540, // GMT-9h
- GMT_8 = -480, // GMT-8h
- GMT_7 = -420, // GMT-7h
- GMT_6 = -360, // GMT-6h
- GMT_5 = -300, // GMT-5h
- GMT_4 = -240, // GMT-4h
- GMT_3 = -180, // GMT-3h
- GMT_2 = -120, // GMT-2h
- GMT_1 = -60, // GMT-1h
- GMT = 0, // GMT
- GMT1 = 60, // GMT+1h
- GMT2 = 120, // GMT+2h
- GMT3 = 180, // GMT+3h
- GMT4 = 240, // GMT+4h
- GMT5 = 300, // GMT+5h
- GMT6 = 360, // GMT+6h
- GMT7 = 420, // GMT+7h
- GMT8 = 480, // GMT+8h
- GMT9 = 540, // GMT+9h
- GMT10 = 600, // GMT+10h
- GMT11 = 660, // GMT+11h
- GMT12 = 720, // GMT+12h
-
- UT = GMT, // Universal Time
-
- EST = GMT_5, // Eastern
- EDT = GMT_4,
- CST = GMT_6, // Central
- CDT = GMT_5,
- MST = GMT_7, // Mountain
- MDT = GMT_6,
- PST = GMT_8, // Pacific
- PDT = GMT_7,
-
- // Military time zones
- A = GMT_1,
- B = GMT_2,
- C = GMT_3,
- D = GMT_4,
- E = GMT_5,
- F = GMT_6,
- G = GMT_7,
- H = GMT_8,
- I = GMT_9, // J not used
- K = GMT_10,
- L = GMT_11,
- M = GMT_12,
-
- N = GMT1,
- O = GMT2,
- P = GMT3,
- Q = GMT4,
- R = GMT5,
- S = GMT6,
- T = GMT7,
- U = GMT8,
- V = GMT9,
- W = GMT10,
- X = GMT11,
- Y = GMT12,
-
- Z = GMT
- };
-
- // Months list
- enum Months
- {
- // Long
- JANUARY = 1,
- FEBRUARY = 2,
- MARCH = 3,
- APRIL = 4,
- MAY = 5,
- JUNE = 6,
- JULY = 7,
- AUGUST = 8,
- SEPTEMBER = 9,
- OCTOBER = 10,
- NOVEMBER = 11,
- DECEMBER = 12,
-
- // Short
- JAN = 1,
- FEB = 2,
- MAR = 3,
- APR = 4,
- JUN = 6,
- JUL = 7,
- AUG = 8,
- SEP = 9,
- OCT = 10,
- NOV = 11,
- DEC = 12
- };
-
- // Days of week list
- enum DaysOfWeek
- {
- // Long
- SUNDAY = 0,
- MONDAY = 1,
- TUESDAY = 2,
- WEDNESDAY = 3,
- THURSDAY = 4,
- FRIDAY = 5,
- SATURDAY = 6,
-
- // Short
- SUN = 0,
- MON = 1,
- TUE = 2,
- WED = 3,
- THU = 4,
- FRI = 5,
- SAT = 6
- };
-
-private:
-
- // Date components
- int m_year;
- int m_month;
- int m_day;
-
- // Time components
- int m_hour;
- int m_minute;
- int m_second;
- int m_zone;
-
-public:
-
- // Get
- const int getYear() const;
- const int getMonth() const;
- const int getDay() const;
- const int getHour() const;
- const int getMinute() const;
- const int getSecond() const;
- const int getZone() const;
-
- void getTime(int& hour, int& minute, int& second, int& zone) const;
- void getTime(int& hour, int& minute, int& second) const;
- void getDate(int& year, int& month, int& day) const;
-
- // Set
- void setYear(const int year);
- void setMonth(const int month);
- void setDay(const int day);
- void setHour(const int hour);
- void setMinute(const int minute);
- void setSecond(const int second);
- void setZone(const int zone);
-
- void setTime(const int hour = 0, const int minute = 0, const int second = 0, const int zone = GMT);
- void setDate(const int year, const int month, const int day);
-
- // Assignment
- datetime& operator=(const datetime& other);
- datetime& operator=(const string& s);
-
- void copyFrom(const component& other);
-
- datetime* clone() const;
-
- // Current date and time
- static const datetime now();
-
- const std::vector <const component*> getChildComponents() const;
-
-private:
-
- static const int dayOfWeek(const int year, const int month, const int day);
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_DATETIME_HPP_INCLUDED
diff --git a/src/defaultAttachment.cpp b/src/defaultAttachment.cpp
index 48fbcdbb..80d251f0 100644
--- a/src/defaultAttachment.cpp
+++ b/src/defaultAttachment.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "defaultAttachment.hpp"
-#include "encoding.hpp"
+#include "vmime/defaultAttachment.hpp"
+#include "vmime/encoding.hpp"
namespace vmime
diff --git a/src/defaultAttachment.hpp b/src/defaultAttachment.hpp
deleted file mode 100644
index 0fe21092..00000000
--- a/src/defaultAttachment.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_DEFAULTATTACHMENT_HPP_INCLUDED
-#define VMIME_DEFAULTATTACHMENT_HPP_INCLUDED
-
-
-#include "attachment.hpp"
-#include "encoding.hpp"
-
-
-namespace vmime
-{
-
-
-/** Default implementation for attachments.
- */
-
-class defaultAttachment : public attachment
-{
-protected:
-
- // For use in derived classes.
- defaultAttachment();
-
-public:
-
- defaultAttachment(const contentHandler& data, const encoding& enc, const mediaType& type, const text& desc = NULL_TEXT);
- defaultAttachment(const contentHandler& data, const mediaType& type, const text& desc = NULL_TEXT);
- defaultAttachment(const defaultAttachment& attach);
-
- defaultAttachment& operator=(const defaultAttachment& attach);
-
- const mediaType& getType() const;
- const text& getDescription() const;
- const contentHandler& getData() const;
- const encoding& getEncoding() const;
-
-protected:
-
- mediaType m_type; // Media type (eg. "application/octet-stream")
- text m_desc; // Description (eg. "The image you requested")
- contentHandler m_data; // Attachment data (eg. the file contents)
- encoding m_encoding; // Encoding
-
-private:
-
- // No need to override "generateIn", use "generatePart" instead (see below).
- void generateIn(bodyPart& parent) const;
-
-protected:
-
- virtual void generatePart(bodyPart& part) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_DEFAULTATTACHMENT_HPP_INCLUDED
diff --git a/src/encoder.cpp b/src/encoder.cpp
index 9fabd5a8..3acbb8f6 100644
--- a/src/encoder.cpp
+++ b/src/encoder.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoder.hpp"
-#include "exception.hpp"
+#include "vmime/encoder.hpp"
+#include "vmime/exception.hpp"
namespace vmime
diff --git a/src/encoder.hpp b/src/encoder.hpp
deleted file mode 100644
index 3d2f7159..00000000
--- a/src/encoder.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODER_HPP_INCLUDED
-#define VMIME_ENCODER_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "propertySet.hpp"
-#include "exception.hpp"
-
-
-namespace vmime
-{
-
-
-/** Encode/decode data in different encodings.
- */
-
-class encoder
-{
-public:
-
- encoder();
- virtual ~encoder();
-
- /** Encode data.
- *
- * @param in input data (decoded)
- * @param out output stream for encoded data
- * @return number of bytes written into output stream
- */
- virtual const utility::stream::size_type encode(utility::inputStream& in, utility::outputStream& out) = 0;
-
- /** Decode data.
- *
- * @param in input data (encoded)
- * @param out output stream for decoded data
- * @return number of bytes written into output stream
- */
- virtual const utility::stream::size_type decode(utility::inputStream& in, utility::outputStream& out) = 0;
-
- /** Return the properties of the encoder.
- *
- * @return properties of the encoder
- */
- const propertySet& getProperties() const;
-
- /** Return the properties of the encoder.
- *
- * @return properties of the encoder
- */
- propertySet& getProperties();
-
- /** Return a list of property names that can be set for
- * this encoder.
- *
- * @return list of property names
- */
- virtual const std::vector <string> getAvailableProperties() const;
-
- /** Return the results returned by this encoder.
- *
- * @return results returned by the encoder
- */
- const propertySet& getResults() const;
-
-protected:
-
- propertySet& getResults();
-
-private:
-
- propertySet m_props;
- propertySet m_results;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODER_HPP_INCLUDED
diff --git a/src/encoder7bit.cpp b/src/encoder7bit.cpp
index b5ae3820..8609e61b 100644
--- a/src/encoder7bit.cpp
+++ b/src/encoder7bit.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoder7bit.hpp"
+#include "vmime/encoder7bit.hpp"
namespace vmime
diff --git a/src/encoder7bit.hpp b/src/encoder7bit.hpp
deleted file mode 100644
index a4b64cdf..00000000
--- a/src/encoder7bit.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODER7BIT_HPP_INCLUDED
-#define VMIME_ENCODER7BIT_HPP_INCLUDED
-
-
-#include "encoderDefault.hpp"
-
-
-namespace vmime
-{
-
-
-/** 7-bit encoder.
- */
-
-class encoder7bit : public encoderDefault
-{
-public:
-
- encoder7bit();
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODER7BIT_HPP_INCLUDED
diff --git a/src/encoder8bit.cpp b/src/encoder8bit.cpp
index b9b91457..6a7463e2 100644
--- a/src/encoder8bit.cpp
+++ b/src/encoder8bit.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoder8bit.hpp"
+#include "vmime/encoder8bit.hpp"
namespace vmime
diff --git a/src/encoder8bit.hpp b/src/encoder8bit.hpp
deleted file mode 100644
index 7cbbd417..00000000
--- a/src/encoder8bit.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODER8BIT_HPP_INCLUDED
-#define VMIME_ENCODER8BIT_HPP_INCLUDED
-
-
-#include "encoderDefault.hpp"
-
-
-namespace vmime
-{
-
-
-/** 8-bit encoder.
- */
-
-class encoder8bit : public encoderDefault
-{
-public:
-
- encoder8bit();
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODER8BIT_HPP_INCLUDED
diff --git a/src/encoderB64.cpp b/src/encoderB64.cpp
index c45d719f..79ed4418 100644
--- a/src/encoderB64.cpp
+++ b/src/encoderB64.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoderB64.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/encoderB64.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/encoderB64.hpp b/src/encoderB64.hpp
deleted file mode 100644
index 93c0b7f3..00000000
--- a/src/encoderB64.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODERB64_HPP_INCLUDED
-#define VMIME_ENCODERB64_HPP_INCLUDED
-
-
-#include "encoder.hpp"
-
-
-namespace vmime
-{
-
-
-/** Base64 encoder.
- */
-
-class encoderB64 : public encoder
-{
-public:
-
- encoderB64();
-
- const utility::stream::size_type encode(utility::inputStream& in, utility::outputStream& out);
- const utility::stream::size_type decode(utility::inputStream& in, utility::outputStream& out);
-
- const std::vector <string> getAvailableProperties() const;
-
-protected:
-
- static const unsigned char sm_alphabet[];
- static const unsigned char sm_decodeMap[256];
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODERB64_HPP_INCLUDED
diff --git a/src/encoderBinary.cpp b/src/encoderBinary.cpp
index 606da99c..0d5878a6 100644
--- a/src/encoderBinary.cpp
+++ b/src/encoderBinary.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoderBinary.hpp"
+#include "vmime/encoderBinary.hpp"
namespace vmime
diff --git a/src/encoderBinary.hpp b/src/encoderBinary.hpp
deleted file mode 100644
index dadca217..00000000
--- a/src/encoderBinary.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODERBINARY_HPP_INCLUDED
-#define VMIME_ENCODERBINARY_HPP_INCLUDED
-
-
-#include "encoderDefault.hpp"
-
-
-namespace vmime
-{
-
-
-/** Binary encoder.
- */
-
-class encoderBinary : public encoderDefault
-{
-public:
-
- encoderBinary();
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODERBINARY_HPP_INCLUDED
diff --git a/src/encoderDefault.cpp b/src/encoderDefault.cpp
index cdff3735..df689e82 100644
--- a/src/encoderDefault.cpp
+++ b/src/encoderDefault.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoderDefault.hpp"
+#include "vmime/encoderDefault.hpp"
namespace vmime
diff --git a/src/encoderDefault.hpp b/src/encoderDefault.hpp
deleted file mode 100644
index d54d1f0f..00000000
--- a/src/encoderDefault.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODERDEFAULT_HPP_INCLUDED
-#define VMIME_ENCODERDEFAULT_HPP_INCLUDED
-
-
-#include "encoder.hpp"
-
-
-namespace vmime
-{
-
-
-/** Default encoder (simple copy, no encoding/decoding is performed).
- */
-
-class encoderDefault : public encoder
-{
-public:
-
- encoderDefault();
-
- const utility::stream::size_type encode(utility::inputStream& in, utility::outputStream& out);
- const utility::stream::size_type decode(utility::inputStream& in, utility::outputStream& out);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODERDEFAUL_HPP_INCLUDED
diff --git a/src/encoderFactory.cpp b/src/encoderFactory.cpp
index 15c9e959..f73421eb 100644
--- a/src/encoderFactory.cpp
+++ b/src/encoderFactory.cpp
@@ -17,15 +17,15 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoderFactory.hpp"
-#include "exception.hpp"
+#include "vmime/encoderFactory.hpp"
+#include "vmime/exception.hpp"
-#include "encoderB64.hpp"
-#include "encoderQP.hpp"
-#include "encoderUUE.hpp"
-#include "encoderBinary.hpp"
-#include "encoder7bit.hpp"
-#include "encoder8bit.hpp"
+#include "vmime/encoderB64.hpp"
+#include "vmime/encoderQP.hpp"
+#include "vmime/encoderUUE.hpp"
+#include "vmime/encoderBinary.hpp"
+#include "vmime/encoder7bit.hpp"
+#include "vmime/encoder8bit.hpp"
namespace vmime
diff --git a/src/encoderFactory.hpp b/src/encoderFactory.hpp
deleted file mode 100644
index a5d39c6e..00000000
--- a/src/encoderFactory.hpp
+++ /dev/null
@@ -1,148 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODERFACTORY_HPP_INCLUDED
-#define VMIME_ENCODERFACTORY_HPP_INCLUDED
-
-
-#include "encoder.hpp"
-#include "utility/singleton.hpp"
-#include "utility/stringUtils.hpp"
-
-
-namespace vmime
-{
-
-
-/** A factory to create 'encoder' objects for the specified encoding.
- */
-
-class encoderFactory : public utility::singleton <encoderFactory>
-{
- friend class utility::singleton <encoderFactory>;
-
-private:
-
- encoderFactory();
- ~encoderFactory();
-
-public:
-
- /** Information about a registered encoder. */
- class registeredEncoder
- {
- friend class encoderFactory;
-
- protected:
-
- virtual ~registeredEncoder() { }
-
- public:
-
- virtual encoder* create() const = 0;
-
- virtual const string& getName() const = 0;
- };
-
-private:
-
- template <class E>
- class registeredEncoderImpl : public registeredEncoder
- {
- friend class encoderFactory;
-
- protected:
-
- registeredEncoderImpl(const string& name) : m_name(name) { }
-
- public:
-
- encoder* create() const
- {
- return new E;
- }
-
- const string& getName() const
- {
- return (m_name);
- }
-
- private:
-
- const string m_name;
- };
-
-
- std::vector <registeredEncoder*> m_encoders;
-
-public:
-
- /** Register a new encoder by its encoding name.
- *
- * @param name encoding name
- */
- template <class E>
- void registerName(const string& name)
- {
- m_encoders.push_back(new registeredEncoderImpl <E>(stringUtils::toLower(name)));
- }
-
- /** Create a new encoder instance from an encoding name.
- *
- * @param name encoding name (eg. "base64")
- * @return a new encoder instance for the specified encoding
- * @throw exceptions::no_encoder_available if no encoder is registered
- * for this encoding
- */
- encoder* create(const string& name);
-
- /** Return information about a registered encoder.
- *
- * @param name encoding name
- * @return information about this encoder
- * @throw exceptions::no_encoder_available if no encoder is registered
- * for this encoding
- */
- const registeredEncoder* getEncoderByName(const string& name) const;
-
- /** Return the number of registered encoders.
- *
- * @return number of registered encoders
- */
- const int getEncoderCount() const;
-
- /** Return the registered encoder at the specified position.
- *
- * @param pos position of the registered encoder to return
- * @return registered encoder at the specified position
- */
- const registeredEncoder* getEncoderAt(const int pos) const;
-
- /** Return a list of all registered encoders.
- *
- * @return list of registered encoders
- */
- const std::vector <const registeredEncoder*> getEncoderList() const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODERFACTORY_HPP_INCLUDED
diff --git a/src/encoderQP.cpp b/src/encoderQP.cpp
index d37ac351..6ae9de64 100644
--- a/src/encoderQP.cpp
+++ b/src/encoderQP.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoderQP.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/encoderQP.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/encoderQP.hpp b/src/encoderQP.hpp
deleted file mode 100644
index 2029c8b9..00000000
--- a/src/encoderQP.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODERQP_HPP_INCLUDED
-#define VMIME_ENCODERQP_HPP_INCLUDED
-
-
-#include "encoder.hpp"
-
-
-namespace vmime
-{
-
-
-/** Quoted-printable encoder.
- */
-
-class encoderQP : public encoder
-{
-public:
-
- encoderQP();
-
- const utility::stream::size_type encode(utility::inputStream& in, utility::outputStream& out);
- const utility::stream::size_type decode(utility::inputStream& in, utility::outputStream& out);
-
- const std::vector <string> getAvailableProperties() const;
-
-protected:
-
- static const unsigned char sm_hexDigits[17];
- static const unsigned char sm_hexDecodeTable[256];
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODERQP_HPP_INCLUDED
diff --git a/src/encoderUUE.cpp b/src/encoderUUE.cpp
index dbc31ce8..26c0410f 100644
--- a/src/encoderUUE.cpp
+++ b/src/encoderUUE.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoderUUE.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/encoderUUE.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/encoderUUE.hpp b/src/encoderUUE.hpp
deleted file mode 100644
index 44945de9..00000000
--- a/src/encoderUUE.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODERUUE_HPP_INCLUDED
-#define VMIME_ENCODERUUE_HPP_INCLUDED
-
-
-#include "encoder.hpp"
-
-
-namespace vmime
-{
-
-
-/** UUEncode encoder.
- */
-
-class encoderUUE : public encoder
-{
-public:
-
- encoderUUE();
-
- const utility::stream::size_type encode(utility::inputStream& in, utility::outputStream& out);
- const utility::stream::size_type decode(utility::inputStream& in, utility::outputStream& out);
-
- const std::vector <string> getAvailableProperties() const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODERUUE_HPP_INCLUDED
diff --git a/src/encoding.cpp b/src/encoding.cpp
index 4b270c8d..2ccded09 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -17,9 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "encoding.hpp"
-#include "encoderFactory.hpp"
-#include "contentHandler.hpp"
+#include "vmime/encoding.hpp"
+#include "vmime/encoderFactory.hpp"
+#include "vmime/contentHandler.hpp"
#include <algorithm>
diff --git a/src/encoding.hpp b/src/encoding.hpp
deleted file mode 100644
index e8d358ac..00000000
--- a/src/encoding.hpp
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_ENCODING_HPP_INCLUDED
-#define VMIME_ENCODING_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-#include "encoder.hpp"
-
-
-namespace vmime
-{
-
-
-class contentHandler;
-
-
-/** Content encoding (basic type).
- */
-
-class encoding : public component
-{
-public:
-
- encoding();
- encoding(const string& name);
- encoding(const encoding& enc);
-
-public:
-
- /** Return the name of the encoding.
- * See the constants in vmime::encodingTypes.
- *
- * @return name of the encoding (eg. "quoted-printable")
- */
- const string& getName() const;
-
- /** Set the name of the encoding.
- * See the constants in vmime::encodingTypes.
- *
- * @param name name of the encoding
- */
- void setName(const string& name);
-
- encoding& operator=(const encoding& other);
- encoding& operator=(const string& name);
-
- const bool operator==(const encoding& value) const;
- const bool operator!=(const encoding& value) const;
-
- const std::vector <const component*> getChildComponents() const;
-
- /** Decide which encoding to use based on the specified data.
- *
- * \deprecated Use the new decide() method which takes a contentHandler parameter.
- *
- * @param begin start iterator in buffer
- * @param end end iterator in buffer
- * @return suitable encoding for specified data
- */
- static const encoding decide(const string::const_iterator begin, const string::const_iterator end);
-
- /** Decide which encoding to use based on the specified data.
- *
- * @param data data used to determine encoding
- * @return suitable encoding for specified data
- */
- static const encoding decide(const contentHandler& data);
-
- encoding* clone() const;
- void copyFrom(const component& other);
-
- /** Use encoderFactory to obtain an encoder/decoder object
- * for the current encoding type.
- *
- * @throw exceptions::no_encoder_available if no encoder
- * is registered for the encoding
- * @return a new encoder object for the encoding type
- */
- encoder* getEncoder() const;
-
-private:
-
- string m_name;
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_ENCODING_HPP_INCLUDED
diff --git a/src/exception.cpp b/src/exception.cpp
index 9dc71c81..8a339a9a 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "exception.hpp"
+#include "vmime/exception.hpp"
namespace vmime {
diff --git a/src/exception.hpp b/src/exception.hpp
deleted file mode 100644
index d7f95b95..00000000
--- a/src/exception.hpp
+++ /dev/null
@@ -1,745 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_EXCEPTION_HPP_INCLUDED
-#define VMIME_EXCEPTION_HPP_INCLUDED
-
-
-#include "config.hpp"
-#include "base.hpp"
-#include "utility/path.hpp"
-
-
-namespace vmime
-{
-
-
-/** Base class for VMime exceptions.
- */
-
-class exception
-{
-private:
-
- string m_what;
- exception* m_other;
-
- exception();
-
-public:
-
- exception(const string& what, const exception& other = NO_EXCEPTION);
- virtual ~exception();
-
- /** Return a description of the error.
- *
- * @return error message
- */
- const string what() const throw();
-
- /** Return the next exception in the chain (encapsuled exception).
- *
- * @return next exception in the chain
- */
- const exception* other() const;
-
- /** Return a name identifying the exception.
- *
- * @return exception name
- */
- virtual const string name() const;
-
-protected:
-
- static const exception NO_EXCEPTION;
-
- virtual exception* clone() const;
-};
-
-
-
-/** List of all VMime exceptions. */
-
-namespace exceptions
-{
-
-
-class bad_field_type : public vmime::exception
-{
-public:
-
- bad_field_type(const exception& other = NO_EXCEPTION);
- ~bad_field_type() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class charset_conv_error : public vmime::exception
-{
-public:
-
- charset_conv_error(const exception& other = NO_EXCEPTION);
- ~charset_conv_error() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_encoder_available : public vmime::exception
-{
-public:
-
- no_encoder_available(const exception& other = NO_EXCEPTION);
- ~no_encoder_available() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_such_parameter : public vmime::exception
-{
-public:
-
- no_such_parameter(const string& name, const exception& other = NO_EXCEPTION);
- ~no_such_parameter() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_such_field : public vmime::exception
-{
-public:
-
- no_such_field(const exception& other = NO_EXCEPTION);
- ~no_such_field() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_such_part : public vmime::exception
-{
-public:
-
- no_such_part(const exception& other = NO_EXCEPTION);
- ~no_such_part() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_such_mailbox : public vmime::exception
-{
-public:
-
- no_such_mailbox(const exception& other = NO_EXCEPTION);
- ~no_such_mailbox() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_such_address : public vmime::exception
-{
-public:
-
- no_such_address(const exception& other = NO_EXCEPTION);
- ~no_such_address() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class open_file_error : public vmime::exception
-{
-public:
-
- open_file_error(const exception& other = NO_EXCEPTION);
- ~open_file_error() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_factory_available : public vmime::exception
-{
-public:
-
- no_factory_available(const exception& other = NO_EXCEPTION);
- ~no_factory_available() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_platform_dependant_handler : public vmime::exception
-{
-public:
-
- no_platform_dependant_handler(const exception& other = NO_EXCEPTION);
- ~no_platform_dependant_handler() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** No expeditor specified.
- */
-
-class no_expeditor : public vmime::exception
-{
-public:
-
- no_expeditor(const exception& other = NO_EXCEPTION);
- ~no_expeditor() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** No recipient specified.
- */
-
-class no_recipient : public vmime::exception
-{
-public:
-
- no_recipient(const exception& other = NO_EXCEPTION);
- ~no_recipient() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-class no_object_found : public vmime::exception
-{
-public:
-
- no_object_found(const exception& other = NO_EXCEPTION);
- ~no_object_found() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** There is no property with that name in the set.
- */
-
-class no_such_property : public vmime::exception
-{
-public:
-
- no_such_property(const string& name, const exception& other = NO_EXCEPTION);
- ~no_such_property() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Bad type specified when reading property.
- */
-
-class invalid_property_type : public vmime::exception
-{
-public:
-
- invalid_property_type(const exception& other = NO_EXCEPTION);
- ~invalid_property_type() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Bad argument was passed to the function.
- */
-
-class invalid_argument : public vmime::exception
-{
-public:
-
- invalid_argument(const exception& other = NO_EXCEPTION);
- ~invalid_argument() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-
-#if VMIME_HAVE_MESSAGING_FEATURES
-
-
-/** Base class for exceptions thrown by the messaging module.
- */
-
-class messaging_exception : public vmime::exception
-{
-public:
-
- messaging_exception(const string& what, const exception& other = NO_EXCEPTION);
- ~messaging_exception() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Error while connecting to the server: this may be a DNS resolution error
- * or a connection error (for example, time-out while connecting).
- */
-
-class connection_error : public messaging_exception
-{
-public:
-
- connection_error(const exception& other = NO_EXCEPTION);
- ~connection_error() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Server did not initiated the connection correctly.
- */
-
-class connection_greeting_error : public messaging_exception
-{
-public:
-
- connection_greeting_error(const string& response, const exception& other = NO_EXCEPTION);
- ~connection_greeting_error() throw();
-
- const string& response() const;
-
- exception* clone() const;
- const string name() const;
-
-private:
-
- string m_response;
-};
-
-
-/** Error while giving credentials to the server (wrong username
- * or password, or wrong authentication method).
- */
-
-class authentication_error : public messaging_exception
-{
-public:
-
- authentication_error(const string& response, const exception& other = NO_EXCEPTION);
- ~authentication_error() throw();
-
- const string& response() const;
-
- exception* clone() const;
- const string name() const;
-
-private:
-
- string m_response;
-};
-
-
-/** Option not supported.
- */
-
-class unsupported_option : public messaging_exception
-{
-public:
-
- unsupported_option(const exception& other = NO_EXCEPTION);
- ~unsupported_option() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** No service available for this protocol.
- */
-
-class no_service_available : public messaging_exception
-{
-public:
-
- no_service_available(const string& proto = "", const exception& other = NO_EXCEPTION);
- ~no_service_available() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** The current state of the object does not permit to execute the
- * operation (for example, you try to close a folder which is not open).
- */
-
-class illegal_state : public messaging_exception
-{
-public:
-
- illegal_state(const string& state, const exception& other = NO_EXCEPTION);
- ~illegal_state() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Folder not found (does not exist).
- */
-
-class folder_not_found : public messaging_exception
-{
-public:
-
- folder_not_found(const exception& other = NO_EXCEPTION);
- ~folder_not_found() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Message not found (does not exist).
- */
-
-class message_not_found : public messaging_exception
-{
-public:
-
- message_not_found(const exception& other = NO_EXCEPTION);
- ~message_not_found() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Operation not supported by the underlying protocol.
- */
-
-class operation_not_supported : public messaging_exception
-{
-public:
-
- operation_not_supported(const exception& other = NO_EXCEPTION);
- ~operation_not_supported() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** The operation timed out (time-out delay is elapsed).
- */
-
-class operation_timed_out : public messaging_exception
-{
-public:
-
- operation_timed_out(const exception& other = NO_EXCEPTION);
- ~operation_timed_out() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** The operation has been cancelled.
- */
-
-class operation_cancelled : public messaging_exception
-{
-public:
-
- operation_cancelled(const exception& other = NO_EXCEPTION);
- ~operation_cancelled() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Must call fetchMessage() or fetchHeader() before accessing
- * the requested object.
- */
-
-class unfetched_object : public messaging_exception
-{
-public:
-
- unfetched_object(const exception& other = NO_EXCEPTION);
- ~unfetched_object() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** The service is not currently connected.
- */
-
-class not_connected : public messaging_exception
-{
-public:
-
- not_connected(const exception& other = NO_EXCEPTION);
- ~not_connected() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** The service is already connected (must disconnect before).
- */
-
-class already_connected : public messaging_exception
-{
-public:
-
- already_connected(const exception& other = NO_EXCEPTION);
- ~already_connected() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Illegal operation: cannot run this operation on the object.
- */
-
-class illegal_operation : public messaging_exception
-{
-public:
-
- illegal_operation(const string& msg = "", const exception& other = NO_EXCEPTION);
- ~illegal_operation() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Command error: operation failed (this is specific to the underlying protocol).
- */
-
-class command_error : public messaging_exception
-{
-public:
-
- command_error(const string& command, const string& response, const string& desc = "", const exception& other = NO_EXCEPTION);
- ~command_error() throw();
-
- /** Return the name of the command which have thrown the exception.
- * This is protocol-dependant.
- *
- * @return command name (protocol-dependant)
- */
- const string& command() const;
-
- /** Return the invalid response line.
- * The meaning is protocol-dependant.
- *
- * @return response line (protocol-dependant)
- */
- const string& response() const;
-
- exception* clone() const;
- const string name() const;
-
-private:
-
- string m_command;
- string m_response;
-};
-
-
-/** The server returned an invalid response.
- */
-
-class invalid_response : public messaging_exception
-{
-public:
-
- invalid_response(const string& command, const string& response, const exception& other = NO_EXCEPTION);
- ~invalid_response() throw();
-
- /** Return the name of the command which have thrown the exception.
- * This is protocol-dependant.
- *
- * @return command name (protocol-dependant)
- */
- const string& command() const;
-
- /** Return the invalid response line.
- * The meaning is protocol-dependant.
- *
- * @return response line (protocol-dependant)
- */
- const string& response() const;
-
- exception* clone() const;
- const string name() const;
-
-private:
-
- string m_command;
- string m_response;
-};
-
-
-/** Partial fetch is not supported by the underlying protocol.
- */
-
-class partial_fetch_not_supported : public messaging_exception
-{
-public:
-
- partial_fetch_not_supported(const exception& other = NO_EXCEPTION);
- ~partial_fetch_not_supported() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** The URL is malformed.
- */
-
-class malformed_url : public messaging_exception
-{
-public:
-
- malformed_url(const string& error, const exception& other = NO_EXCEPTION);
- ~malformed_url() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** Folder name is invalid.
- */
-
-class invalid_folder_name : public messaging_exception
-{
-public:
-
- invalid_folder_name(const string& error = "", const exception& other = NO_EXCEPTION);
- ~invalid_folder_name() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-#endif // VMIME_HAVE_MESSAGING_FEATURES
-
-
-#if VMIME_HAVE_FILESYSTEM_FEATURES
-
-
-/** Base class for exceptions thrown by the filesystem features.
- */
-
-class filesystem_exception : public vmime::exception
-{
-public:
-
- filesystem_exception(const string& what, const utility::path& path, const exception& other = NO_EXCEPTION);
- ~filesystem_exception() throw();
-
- /** Return the full path of the file have thrown the exception.
- *
- * @return full path of the file/directory
- */
- const utility::path& path() const;
-
- exception* clone() const;
- const string name() const;
-
-private:
-
- const utility::path m_path;
-};
-
-
-/** File is not a directory.
- */
-
-class not_a_directory : public filesystem_exception
-{
-public:
-
- not_a_directory(const utility::path& path, const exception& other = NO_EXCEPTION);
- ~not_a_directory() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-/** File not found.
- */
-
-class file_not_found : public filesystem_exception
-{
-public:
-
- file_not_found(const utility::path& path, const exception& other = NO_EXCEPTION);
- ~file_not_found() throw();
-
- exception* clone() const;
- const string name() const;
-};
-
-
-#endif // VMIME_HAVE_FILESYSTEM_FEATURES
-
-
-} // exceptions
-
-
-} // vmime
-
-
-#endif // VMIME_EXCEPTION_HPP_INCLUDED
diff --git a/src/fileAttachment.cpp b/src/fileAttachment.cpp
index d13eb3de..04e85123 100644
--- a/src/fileAttachment.cpp
+++ b/src/fileAttachment.cpp
@@ -20,8 +20,8 @@
#include <fstream>
#include <sstream>
-#include "fileAttachment.hpp"
-#include "exception.hpp"
+#include "vmime/fileAttachment.hpp"
+#include "vmime/exception.hpp"
namespace vmime
diff --git a/src/fileAttachment.hpp b/src/fileAttachment.hpp
deleted file mode 100644
index f38b6d79..00000000
--- a/src/fileAttachment.hpp
+++ /dev/null
@@ -1,170 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_FILEATTACHMENT_HPP_INCLUDED
-#define VMIME_FILEATTACHMENT_HPP_INCLUDED
-
-
-#include "defaultAttachment.hpp"
-
-
-namespace vmime
-{
-
-
-/** Attachment of type 'file'.
- */
-
-class fileAttachment : public defaultAttachment
-{
-public:
-
- fileAttachment(const string& filename, const mediaType& type, const text& desc = NULL_TEXT);
- fileAttachment(const string& filename, const mediaType& type, const encoding& enc, const text& desc = NULL_TEXT);
-
- /** Stores information about a file attachment.
- */
- class fileInfo
- {
- public:
-
- fileInfo();
- ~fileInfo();
-
- /** Check whether the 'filename' property is present.
- *
- * @return true if the 'filename' property is set,
- * false otherwise
- */
- const bool hasFilename() const;
-
- /** Return the value of the 'filename' property.
- *
- * @return file name
- */
- const string& getFilename() const;
-
- /** Set the value of the 'filename' property.
- *
- * @param name file name
- */
- void setFilename(const string& name);
-
- /** Check whether the 'creation-date' property is present.
- *
- * @return true if the 'creation-date' property is set,
- * false otherwise
- */
- const bool hasCreationDate() const;
-
- /** Return the value of the 'creation-date' property.
- *
- * @return file creation time
- */
- const datetime& getCreationDate() const;
-
- /** Set the value of the 'creation-date' property.
- *
- * @param date file creation time
- */
- void setCreationDate(const datetime& date);
-
- /** Check whether the 'modification-date' property is present.
- *
- * @return true if the 'modification-date' property is set,
- * false otherwise
- */
- const bool hasModificationDate() const;
-
- /** Return the value of the 'modification-date' property.
- *
- * @return file modification time
- */
- const datetime& getModificationDate() const;
-
- /** Set the value of the 'modification-date' property.
- *
- * @param date file modification time
- */
- void setModificationDate(const datetime& date);
-
- /** Check whether the 'read-date' property is set.
- *
- * @return true if the 'read-date' property is set,
- * false otherwise
- */
- const bool hasReadDate() const;
-
- /** Return the value of the 'read-date' property.
- *
- * @return file access time
- */
- const datetime& getReadDate() const;
-
- /** Set the value of the 'read-date' property.
- *
- * @param date file access time
- */
- void setReadDate(const datetime& date);
-
- /** Check whether the value of the 'size' property is set.
- *
- * @return true if the 'size' property is set,
- * false otherwise
- */
- const bool hasSize() const;
-
- /** Return the value of the 'size' property.
- *
- * @return file size
- */
- const unsigned int getSize() const;
-
- /** Set the value of the 'size' property.
- *
- * @param size file size
- */
- void setSize(const unsigned int& size);
-
- private:
-
- string* m_filename;
- unsigned int* m_size;
- datetime* m_creationDate;
- datetime* m_modifDate;
- datetime* m_readDate;
- };
-
- const fileInfo& getFileInfo() const;
- fileInfo& getFileInfo();
-
-private:
-
- void setData(const string& filename);
-
- fileInfo m_fileInfo;
-
- void generatePart(bodyPart& part) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_FILEATTACHMENT_HPP_INCLUDED
diff --git a/src/genericField.hpp b/src/genericField.hpp
deleted file mode 100644
index b212fdbc..00000000
--- a/src/genericField.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_GENERICFIELD_HPP_INCLUDED
-#define VMIME_GENERICFIELD_HPP_INCLUDED
-
-
-#include "headerField.hpp"
-#include "headerFieldFactory.hpp"
-
-#include "typeAdapter.hpp"
-
-
-namespace vmime
-{
-
-
-/** Generic implementation for headerField.
- */
-
-template <class VALUE_TYPE>
-class genericField : virtual public headerField
-{
- friend class headerFieldFactory::registerer <genericField <VALUE_TYPE> >;
-
-protected:
-
- genericField() { }
-
-public:
-
- genericField <VALUE_TYPE>& operator=(const genericField <VALUE_TYPE>& other)
- {
- copyFrom(other);
- return (*this);
- }
-
- const VALUE_TYPE& getValue() const
- {
- return (m_value);
- }
-
- VALUE_TYPE& getValue()
- {
- return (m_value);
- }
-
- template <class TYPE>
- void setValue(const TYPE& value)
- {
- m_value = value;
- }
-
- void setValue(const component& value)
- {
- const VALUE_TYPE& v = dynamic_cast <const VALUE_TYPE&>(value);
- m_value = v;
- }
-
-private:
-
- VALUE_TYPE m_value;
-};
-
-
-/** Generic implementation for headerField with a value of type 'string'.
- */
-
-template <>
-class genericField <string> : public genericField <typeAdapter <string> >
-{
-};
-
-
-} // vmime
-
-
-#endif // VMIME_GENERICFIELD_HPP_INCLUDED
diff --git a/src/genericParameter.hpp b/src/genericParameter.hpp
deleted file mode 100644
index fa335240..00000000
--- a/src/genericParameter.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_GENERICPARAMETER_HPP_INCLUDED
-#define VMIME_GENERICPARAMETER_HPP_INCLUDED
-
-
-#include "parameter.hpp"
-#include "parameterFactory.hpp"
-
-#include "typeAdapter.hpp"
-
-
-namespace vmime
-{
-
-
-/** Generic implementation for parameter.
- */
-
-template <class VALUE_TYPE>
-class genericParameter : public parameter
-{
- friend class parameterFactory::registerer <genericParameter <VALUE_TYPE> >;
-
-protected:
-
- genericParameter() { }
-
-public:
-
- genericParameter <VALUE_TYPE>& operator=(const genericParameter <VALUE_TYPE>& other)
- {
- copyFrom(other);
- return (*this);
- }
-
- const VALUE_TYPE& getValue() const
- {
- return (m_value);
- }
-
- VALUE_TYPE& getValue()
- {
- return (m_value);
- }
-
- template <class TYPE>
- void setValue(const TYPE& value)
- {
- m_value = value;
- }
-
- void setValue(const component& value)
- {
- const VALUE_TYPE& v = dynamic_cast <const VALUE_TYPE&>(value);
- m_value = v;
- }
-
-private:
-
- VALUE_TYPE m_value;
-};
-
-
-/** Generic implementation for parameter of type 'string'.
- */
-
-template <>
-class genericParameter <string> : public genericParameter <typeAdapter <string> >
-{
-};
-
-
-} // vmime
-
-
-#endif // VMIME_GENERICPARAMETER_HPP_INCLUDED
diff --git a/src/header.cpp b/src/header.cpp
index 492b4576..67435241 100644
--- a/src/header.cpp
+++ b/src/header.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "header.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/header.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/header.hpp b/src/header.hpp
deleted file mode 100644
index d191e776..00000000
--- a/src/header.hpp
+++ /dev/null
@@ -1,237 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_HEADER_HPP_INCLUDED
-#define VMIME_HEADER_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-#include "exception.hpp"
-
-#include "headerField.hpp"
-#include "headerFieldFactory.hpp"
-
-#include "mailboxField.hpp"
-#include "contentTypeField.hpp"
-#include "contentDispositionField.hpp"
-
-#include "standardFields.hpp"
-#include "standardParams.hpp"
-
-
-namespace vmime
-{
-
-
-class bodyPart;
-
-
-/** Header section of a MIME part.
- */
-
-class header : public component
-{
- friend class bodyPart;
- friend class body;
- friend class message;
-
-public:
-
- header();
- ~header();
-
-#define FIELD_ACCESS(methodName, fieldName, type) \
- type& methodName() { return dynamic_cast <type&> \
- (*getField(fields::fieldName)); } \
- const type& methodName() const { return dynamic_cast <const type&> \
- (*findField(fields::fieldName)); }
-
- FIELD_ACCESS(From, FROM, mailboxField)
- FIELD_ACCESS(Sender, SENDER, mailboxField)
- FIELD_ACCESS(ReplyTo, REPLY_TO, mailboxField)
- FIELD_ACCESS(DeliveredTo, DELIVERED_TO, mailboxField)
-
- FIELD_ACCESS(To, TO, addressListField)
- FIELD_ACCESS(Cc, CC, addressListField)
- FIELD_ACCESS(Bcc, BCC, addressListField)
- FIELD_ACCESS(Date, DATE, dateField)
- FIELD_ACCESS(Subject, SUBJECT, textField)
- FIELD_ACCESS(Organization, ORGANIZATION, textField)
- FIELD_ACCESS(UserAgent, USER_AGENT, textField)
-
- FIELD_ACCESS(ContentType, CONTENT_TYPE, contentTypeField)
- FIELD_ACCESS(ContentDescription, CONTENT_DESCRIPTION, textField)
- FIELD_ACCESS(ContentTransferEncoding, CONTENT_TRANSFER_ENCODING, contentEncodingField)
- FIELD_ACCESS(MimeVersion, MIME_VERSION, defaultField)
- FIELD_ACCESS(ContentDisposition, CONTENT_DISPOSITION, contentDispositionField)
- FIELD_ACCESS(ContentId, CONTENT_ID, messageIdField)
- FIELD_ACCESS(MessageId, MESSAGE_ID, messageIdField)
- FIELD_ACCESS(ContentLocation, CONTENT_LOCATION, defaultField)
-
-#undef FIELD_ACCESS
-
- /** Checks whether (at least) one field with this name exists.
- *
- * @return true if at least one field with the specified name
- * exists, or false otherwise
- */
- const bool hasField(const string& fieldName) const;
-
- /** Find the first field that matches the specified name.
- * If no field is found, an exception is thrown.
- *
- * @throw exceptions::no_such_field if no field with this name exists
- * @return first field with the specified name
- */
- headerField* findField(const string& fieldName) const;
-
- /** Find all fields that match the specified name.
- * If no field is found, an empty vector is returned.
- *
- * @return list of fields with the specified name
- */
- std::vector <headerField*> findAllFields(const string& fieldName);
-
- /** Find the first field that matches the specified name.
- * If no field is found, one will be created and inserted into
- * the header.
- *
- * @return first field with the specified name or a new field
- * if no field is found
- */
- headerField* getField(const string& fieldName);
-
- /** Add a field at the end of the list.
- *
- * @param field field to append
- */
- void appendField(headerField* field);
-
- /** Insert a new field before the specified field.
- *
- * @param beforeField field before which the new field will be inserted
- * @param field field to insert
- * @throw exceptions::no_such_field if the field is not in the list
- */
- void insertFieldBefore(headerField* beforeField, headerField* field);
-
- /** Insert a new field before the specified position.
- *
- * @param pos position at which to insert the new field (0 to insert at
- * the beginning of the list)
- * @param field field to insert
- */
- void insertFieldBefore(const int pos, headerField* field);
-
- /** Insert a new field after the specified field.
- *
- * @param afterField field after which the new field will be inserted
- * @param field field to insert
- * @throw exceptions::no_such_field if the field is not in the list
- */
- void insertFieldAfter(headerField* afterField, headerField* field);
-
- /** Insert a new field after the specified position.
- *
- * @param pos position of the field before the new field
- * @param field field to insert
- */
- void insertFieldAfter(const int pos, headerField* field);
-
- /** Remove the specified field from the list.
- *
- * @param field field to remove
- * @throw exceptions::no_such_field if the field is not in the list
- */
- void removeField(headerField* field);
-
- /** Remove the field at the specified position.
- *
- * @param pos position of the field to remove
- */
- void removeField(const int pos);
-
- /** Remove all fields from the list.
- */
- void removeAllFields();
-
- /** Return the number of fields in the list.
- *
- * @return number of fields
- */
- const int getFieldCount() const;
-
- /** Tests whether the list of fields is empty.
- *
- * @return true if there is no field, false otherwise
- */
- const bool isEmpty() const;
-
- /** Return the field at the specified position.
- *
- * @param pos position
- * @return field at position 'pos'
- */
- headerField* getFieldAt(const int pos);
-
- /** Return the field at the specified position.
- *
- * @param pos position
- * @return field at position 'pos'
- */
- const headerField* const getFieldAt(const int pos) const;
-
- /** Return the field list.
- *
- * @return list of fields
- */
- const std::vector <const headerField*> getFieldList() const;
-
- /** Return the field list.
- *
- * @return list of fields
- */
- const std::vector <headerField*> getFieldList();
-
- header* clone() const;
- void copyFrom(const component& other);
- header& operator=(const header& other);
-
- const std::vector <const component*> getChildComponents() const;
-
-private:
-
- std::vector <headerField*> m_fields;
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_HEADER_HPP_INCLUDED
diff --git a/src/headerField.cpp b/src/headerField.cpp
index 0efcd0a3..39809d23 100644
--- a/src/headerField.cpp
+++ b/src/headerField.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "headerField.hpp"
-#include "headerFieldFactory.hpp"
+#include "vmime/headerField.hpp"
+#include "vmime/headerFieldFactory.hpp"
namespace vmime
diff --git a/src/headerField.hpp b/src/headerField.hpp
deleted file mode 100644
index 081c809a..00000000
--- a/src/headerField.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_HEADERFIELD_HPP_INCLUDED
-#define VMIME_HEADERFIELD_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** Base class for header fields.
- */
-
-class headerField : public component
-{
- friend class headerFieldFactory;
-
-protected:
-
- headerField();
- headerField(const string& fieldName);
-
-public:
-
- ~headerField();
-
- headerField* clone() const;
- void copyFrom(const component& other);
- headerField& operator=(const headerField& other);
-
- const std::vector <const component*> getChildComponents() const;
-
- /** Return the name of this field.
- *
- * @return field name
- */
- const string getName() const;
-
- /** Check whether this field is a custom (non-standard) field.
- * Custom fields have a name beginning with "X-".
- *
- * @return true if the field is a custom field, false otherwise
- */
- const bool isCustom() const;
-
- /** Return the read-only value object attached to this field.
- *
- * @return read-only value object
- */
- virtual const component& getValue() const = 0;
-
- /** Return the value object attached to this field.
- *
- * @return value object
- */
- virtual component& getValue() = 0;
-
- /** Set the value of this field.
- *
- * @throw std::bad_cast_exception if the value type is
- * incompatible with the header field type
- * @param value value object
- */
- virtual void setValue(const component& value) = 0;
-
-
- using component::parse;
- using component::generate;
-
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-
-private:
-
- string m_name;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_HEADERFIELD_HPP_INCLUDED
diff --git a/src/headerFieldFactory.cpp b/src/headerFieldFactory.cpp
index 19862b6a..9f6916e4 100644
--- a/src/headerFieldFactory.cpp
+++ b/src/headerFieldFactory.cpp
@@ -17,14 +17,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "headerFieldFactory.hpp"
-#include "exception.hpp"
+#include "vmime/headerFieldFactory.hpp"
+#include "vmime/exception.hpp"
-#include "standardFields.hpp"
+#include "vmime/standardFields.hpp"
-#include "mailboxField.hpp"
-#include "contentTypeField.hpp"
-#include "contentDispositionField.hpp"
+#include "vmime/mailboxField.hpp"
+#include "vmime/contentTypeField.hpp"
+#include "vmime/contentDispositionField.hpp"
namespace vmime
diff --git a/src/headerFieldFactory.hpp b/src/headerFieldFactory.hpp
deleted file mode 100644
index 7090546d..00000000
--- a/src/headerFieldFactory.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_HEADERFIELDFACTORY_HPP_INCLUDED
-#define VMIME_HEADERFIELDFACTORY_HPP_INCLUDED
-
-
-#include "headerField.hpp"
-#include "utility/singleton.hpp"
-#include "utility/stringUtils.hpp"
-
-
-namespace vmime
-{
-
-
-class headerFieldFactory : public utility::singleton <headerFieldFactory>
-{
- friend class utility::singleton <headerFieldFactory>;
-
-protected:
-
- headerFieldFactory();
- ~headerFieldFactory();
-
- typedef headerField* (*AllocFunc)(void);
- typedef std::map <string, AllocFunc> NameMap;
-
- NameMap m_nameMap;
-
-public:
-
-#ifndef VMIME_BUILDING_DOC
- template <class TYPE>
- class registerer
- {
- public:
-
- static headerField* creator()
- {
- // Allocate a new object
- return new TYPE();
- }
- };
-#endif // VMIME_BUILDING_DOC
-
-
- template <class T>
- void registerName(const string& name)
- {
- m_nameMap.insert(NameMap::value_type(stringUtils::toLower(name), &registerer<T>::creator));
- }
-
- headerField* create(const string& name, const string& body = NULL_STRING);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_HEADERFIELDFACTORY_HPP_INCLUDED
diff --git a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp
index fd39c78b..919125fe 100644
--- a/src/htmlTextPart.cpp
+++ b/src/htmlTextPart.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "htmlTextPart.hpp"
-#include "exception.hpp"
+#include "vmime/htmlTextPart.hpp"
+#include "vmime/exception.hpp"
namespace vmime
diff --git a/src/htmlTextPart.hpp b/src/htmlTextPart.hpp
deleted file mode 100644
index cd45562c..00000000
--- a/src/htmlTextPart.hpp
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_HTMLTEXTPART_HPP_INCLUDED
-#define VMIME_HTMLTEXTPART_HPP_INCLUDED
-
-
-#include "textPart.hpp"
-#include "messageId.hpp"
-#include "encoding.hpp"
-
-#include "contentHandler.hpp"
-
-
-namespace vmime
-{
-
-
-/** Text part of type 'text/html'.
- */
-
-class htmlTextPart : public textPart
-{
-protected:
-
- ~htmlTextPart();
-
-public:
-
- const mediaType getType() const;
-
- const charset& getCharset() const;
- void setCharset(const charset& ch);
-
- const contentHandler& getPlainText() const;
- void setPlainText(const contentHandler& plainText);
-
- const contentHandler& getText() const;
- void setText(const contentHandler& text);
-
- /** Embedded object (eg: image for &lt;IMG> tag).
- */
- class embeddedObject
- {
- public:
-
- embeddedObject(const contentHandler& data, const encoding& enc,
- const string& id, const mediaType& type);
-
- /** Return data stored in this embedded object.
- *
- * @return stored data
- */
- const contentHandler& getData() const;
-
- /** Return the encoding used for data in this
- * embedded object.
- *
- * @return data encoding
- */
- const vmime::encoding& getEncoding() const;
-
- /** Return the identifier of this embedded object.
- *
- * @return object identifier
- */
- const string& getId() const;
-
- /** Return the content type of data stored in
- * this embedded object.
- *
- * @return data type
- */
- const mediaType& getType() const;
-
- private:
-
- contentHandler m_data;
- encoding m_encoding;
- string m_id;
- mediaType m_type;
- };
-
-
- /** Test the existence of an embedded object given its identifier.
- *
- * @param id object identifier
- * @return true if an object with this identifier exists,
- * false otherwise
- */
- const bool hasObject(const string& id) const;
-
- /** Return the embedded object with the specified identifier.
- *
- * @throw exceptions::no_object_found() if no object has been found
- * @param id object identifier
- * @return embedded object with the specified identifier
- */
- const embeddedObject* findObject(const string& id) const;
-
- /** Return the number of embedded objects.
- *
- * @return number of embedded objects
- */
- const int getObjectCount() const;
-
- /** Return the embedded object at the specified position.
- *
- * @param pos position of the embedded object
- * @return embedded object at position 'pos'
- */
- const embeddedObject* getObjectAt(const int pos) const;
-
- /** Embed an object and returns a string which identifies it.
- *
- * \deprecated Use the addObject() methods which take a 'contentHandler'
- * parameter type instead.
- *
- * @param data object data
- * @param type data type
- * @return an unique object identifier used to identify the new
- * object among all other embedded objects
- */
- const string addObject(const string& data, const mediaType& type);
-
- /** Embed an object and returns a string which identifies it.
- *
- * @param data object data
- * @param type data type
- * @return an unique object identifier used to identify the new
- * object among all other embedded objects
- */
- const string addObject(const contentHandler& data, const mediaType& type);
-
- /** Embed an object and returns a string which identifies it.
- *
- * @param data object data
- * @param enc data encoding
- * @param type data type
- * @return an unique object identifier used to identify the new
- * object among all other embedded objects
- */
- const string addObject(const contentHandler& data, const encoding& enc, const mediaType& type);
-
-private:
-
- contentHandler m_plainText;
- contentHandler m_text;
- charset m_charset;
-
- std::vector <embeddedObject*> m_objects;
-
- void findEmbeddedParts(const bodyPart& part, std::vector <const bodyPart*>& cidParts, std::vector <const bodyPart*>& locParts);
- void addEmbeddedObject(const bodyPart& part, const string& id);
-
- bool findPlainTextPart(const bodyPart& part, const bodyPart& parent, const bodyPart& textPart);
-
- const int getPartCount() const;
-
- void generateIn(bodyPart& message, bodyPart& parent) const;
- void parse(const bodyPart& message, const bodyPart& parent, const bodyPart& textPart);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_HTMLTEXTPART_HPP_INCLUDED
diff --git a/src/mailbox.cpp b/src/mailbox.cpp
index 65031064..e9235eb5 100644
--- a/src/mailbox.cpp
+++ b/src/mailbox.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "mailbox.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/mailbox.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/mailbox.hpp b/src/mailbox.hpp
deleted file mode 100644
index 0acc2cc8..00000000
--- a/src/mailbox.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MAILBOX_HPP_INCLUDED
-#define VMIME_MAILBOX_HPP_INCLUDED
-
-
-#include "address.hpp"
-#include "text.hpp"
-
-
-namespace vmime
-{
-
-
-/** A mailbox: full name + email (basic type).
- */
-
-class mailbox : public address
-{
- friend class mailboxGroup;
- friend class mailboxField;
-
-public:
-
- mailbox();
- mailbox(const mailbox& mbox);
- mailbox(const string& email);
- mailbox(const text& name, const string& email);
-
- /** Return the full name of the mailbox (empty if not specified).
- *
- * @return full name of the mailbox
- */
- const text& getName() const;
-
- /** Set the full name of the mailbox.
- *
- * @return full name of the mailbox
- */
- void setName(const text& name);
-
- /** Return the email of the mailbox.
- *
- * @return email of the mailbox
- */
- const string& getEmail() const;
-
- /** Set the email of the mailbox.
- *
- * @return email of the mailbox
- */
- void setEmail(const string& email);
-
- // Comparison
- const bool operator==(const class mailbox& mailbox) const;
- const bool operator!=(const class mailbox& mailbox) const;
-
- // Assignment
- void copyFrom(const component& other);
- mailbox* clone() const;
- mailbox& operator=(const mailbox& other);
-
- const bool isEmpty() const;
-
- void clear();
-
- const std::vector <const component*> getChildComponents() const;
-
-
- const bool isGroup() const;
-
-protected:
-
- text m_name;
- string m_email;
-
-public:
-
- using address::parse;
- using address::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MAILBOX_HPP_INCLUDED
diff --git a/src/mailboxField.cpp b/src/mailboxField.cpp
index f9ad2f8f..d5381769 100644
--- a/src/mailboxField.cpp
+++ b/src/mailboxField.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "mailboxField.hpp"
-#include "mailboxGroup.hpp"
+#include "vmime/mailboxField.hpp"
+#include "vmime/mailboxGroup.hpp"
namespace vmime
diff --git a/src/mailboxField.hpp b/src/mailboxField.hpp
deleted file mode 100644
index a8213613..00000000
--- a/src/mailboxField.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MAILBOXFIELD_HPP_INCLUDED
-#define VMIME_MAILBOXFIELD_HPP_INCLUDED
-
-
-#include "genericField.hpp"
-#include "mailbox.hpp"
-
-
-namespace vmime
-{
-
-
-class mailboxField : public genericField <mailbox>
-{
- friend class headerFieldFactory::registerer <mailboxField>;
-
-protected:
-
- mailboxField();
- mailboxField(const mailboxField&);
-
-public:
-
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MAILBOXFIELD_HPP_INCLUDED
diff --git a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp
index 7b830030..6ca84d10 100644
--- a/src/mailboxGroup.cpp
+++ b/src/mailboxGroup.cpp
@@ -17,9 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "mailboxGroup.hpp"
-#include "parserHelpers.hpp"
-#include "exception.hpp"
+#include "vmime/mailboxGroup.hpp"
+#include "vmime/parserHelpers.hpp"
+#include "vmime/exception.hpp"
namespace vmime
diff --git a/src/mailboxGroup.hpp b/src/mailboxGroup.hpp
deleted file mode 100644
index d0d7fd93..00000000
--- a/src/mailboxGroup.hpp
+++ /dev/null
@@ -1,178 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MAILBOXGROUP_HPP_INCLUDED
-#define VMIME_MAILBOXGROUP_HPP_INCLUDED
-
-
-#include "address.hpp"
-#include "mailbox.hpp"
-#include "text.hpp"
-
-
-namespace vmime
-{
-
-
-/** A group of mailboxes (basic type).
- */
-
-class mailboxGroup : public address
-{
-public:
-
- mailboxGroup();
- mailboxGroup(const mailboxGroup& mboxGroup);
- mailboxGroup(const text& name);
-
- ~mailboxGroup();
-
-
- void copyFrom(const component& other);
- mailboxGroup* clone() const;
- mailboxGroup& operator=(const component& other);
-
- const std::vector <const component*> getChildComponents() const;
-
- /** Return the name of the group.
- *
- * @return group name
- */
- const text& getName() const;
-
- /** Set the name of the group.
- *
- * @param name group name
- */
- void setName(const text& name);
-
- /** Add a mailbox at the end of the list.
- *
- * @param mbox mailbox to append
- */
- void appendMailbox(mailbox* mbox);
-
- /** Insert a new mailbox before the specified mailbox.
- *
- * @param beforeMailbox mailbox before which the new mailbox will be inserted
- * @param mbox mailbox to insert
- * @throw exceptions::no_such_mailbox if the mailbox is not in the list
- */
- void insertMailboxBefore(mailbox* beforeMailbox, mailbox* mbox);
-
- /** Insert a new mailbox before the specified position.
- *
- * @param pos position at which to insert the new mailbox (0 to insert at
- * the beginning of the list)
- * @param mbox mailbox to insert
- */
- void insertMailboxBefore(const int pos, mailbox* mbox);
-
- /** Insert a new mailbox after the specified mailbox.
- *
- * @param afterMailbox mailbox after which the new mailbox will be inserted
- * @param mbox mailbox to insert
- * @throw exceptions::no_such_mailbox if the mailbox is not in the list
- */
- void insertMailboxAfter(mailbox* afterMailbox, mailbox* mbox);
-
- /** Insert a new mailbox after the specified position.
- *
- * @param pos position of the mailbox before the new mailbox
- * @param mbox mailbox to insert
- */
- void insertMailboxAfter(const int pos, mailbox* mbox);
-
- /** Remove the specified mailbox from the list.
- *
- * @param mbox mailbox to remove
- * @throw exceptions::no_such_mailbox if the mailbox is not in the list
- */
- void removeMailbox(mailbox* mbox);
-
- /** Remove the mailbox at the specified position.
- *
- * @param pos position of the mailbox to remove
- */
- void removeMailbox(const int pos);
-
- /** Remove all mailboxes from the list.
- */
- void removeAllMailboxes();
-
- /** Return the number of mailboxes in the list.
- *
- * @return number of mailboxes
- */
- const int getMailboxCount() const;
-
- /** Tests whether the list of mailboxes is empty.
- *
- * @return true if there is no mailbox, false otherwise
- */
- const bool isEmpty() const;
-
- /** Return the mailbox at the specified position.
- *
- * @param pos position
- * @return mailbox at position 'pos'
- */
- mailbox* getMailboxAt(const int pos);
-
- /** Return the mailbox at the specified position.
- *
- * @param pos position
- * @return mailbox at position 'pos'
- */
- const mailbox* const getMailboxAt(const int pos) const;
-
- /** Return the mailbox list.
- *
- * @return list of mailboxes
- */
- const std::vector <const mailbox*> getMailboxList() const;
-
- /** Return the mailbox list.
- *
- * @return list of mailboxes
- */
- const std::vector <mailbox*> getMailboxList();
-
- const bool isGroup() const;
-
-private:
-
- text m_name;
- std::vector <mailbox*> m_list;
-
-public:
-
- using address::parse;
- using address::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MAILBOXGROUP_HPP_INCLUDED
diff --git a/src/mailboxList.cpp b/src/mailboxList.cpp
index f8944e29..59e46c9b 100644
--- a/src/mailboxList.cpp
+++ b/src/mailboxList.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "mailboxList.hpp"
-#include "exception.hpp"
+#include "vmime/mailboxList.hpp"
+#include "vmime/exception.hpp"
namespace vmime
diff --git a/src/mailboxList.hpp b/src/mailboxList.hpp
deleted file mode 100644
index 3cd5f038..00000000
--- a/src/mailboxList.hpp
+++ /dev/null
@@ -1,152 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MAILBOXLIST_HPP_INCLUDED
-#define VMIME_MAILBOXLIST_HPP_INCLUDED
-
-
-#include "addressList.hpp"
-#include "mailbox.hpp"
-
-
-namespace vmime
-{
-
-
-/** A list of mailboxes (basic type).
- */
-
-#ifdef __GNUC__
-# if (__GNUC__ >= 3) && (__GNUC_MINOR__ <= 2)
-class mailboxList : public addressList // BUG with gcc <= 3.2
-# else
-class mailboxList : protected addressList
-# endif
-#else
-class mailboxList : protected addressList
-#endif
-{
- friend class mailboxGroup;
-
-public:
-
- // This class works exactly like 'addressList' except it prevents user
- // from inserting mailbox groups where it is not allowed by the RFC.
-
- mailboxList();
- mailboxList(const mailboxList& mboxList);
-
- /** Add a mailbox at the end of the list.
- *
- * @param mbox mailbox to append
- */
- void appendMailbox(mailbox* mbox);
-
- /** Insert a new mailbox before the specified mailbox.
- *
- * @param beforeMailbox mailbox before which the new mailbox will be inserted
- * @param mbox mailbox to insert
- * @throw exceptions::no_such_mailbox if the mailbox is not in the list
- */
- void insertMailboxBefore(mailbox* beforeMailbox, mailbox* mbox);
-
- /** Insert a new mailbox before the specified position.
- *
- * @param pos position at which to insert the new mailbox (0 to insert at
- * the beginning of the list)
- * @param mbox mailbox to insert
- */
- void insertMailboxBefore(const int pos, mailbox* mbox);
-
- /** Insert a new mailbox after the specified mailbox.
- *
- * @param afterMailbox mailbox after which the new mailbox will be inserted
- * @param mbox mailbox to insert
- * @throw exceptions::no_such_mailbox if the mailbox is not in the list
- */
- void insertMailboxAfter(mailbox* afterMailbox, mailbox* mbox);
-
- /** Insert a new mailbox after the specified position.
- *
- * @param pos position of the mailbox before the new mailbox
- * @param mbox mailbox to insert
- */
- void insertMailboxAfter(const int pos, mailbox* mbox);
-
- /** Remove the specified mailbox from the list.
- *
- * @param mbox mailbox to remove
- * @throw exceptions::no_such_mailbox if the mailbox is not in the list
- */
- void removeMailbox(mailbox* mbox);
-
- /** Remove the mailbox at the specified position.
- *
- * @param pos position of the mailbox to remove
- */
- void removeMailbox(const int pos);
-
- /** Remove all mailboxes from the list.
- */
- void removeAllMailboxes();
-
- /** Return the number of mailboxes in the list.
- *
- * @return number of mailboxes
- */
- const int getMailboxCount() const;
-
- /** Tests whether the list of mailboxes is empty.
- *
- * @return true if there is no mailbox, false otherwise
- */
- const bool isEmpty() const;
-
- /** Return the mailbox at the specified position.
- *
- * @param pos position
- * @return mailbox at position 'pos'
- */
- mailbox* getMailboxAt(const int pos);
-
- /** Return the mailbox at the specified position.
- *
- * @param pos position
- * @return mailbox at position 'pos'
- */
- const mailbox* const getMailboxAt(const int pos) const;
-
- /** Return the mailbox list.
- *
- * @return list of mailboxes
- */
- const std::vector <const mailbox*> getMailboxList() const;
-
- /** Return the mailbox list.
- *
- * @return list of mailboxes
- */
- const std::vector <mailbox*> getMailboxList();
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MAILBOXLIST_HPP_INCLUDED
diff --git a/src/mediaType.cpp b/src/mediaType.cpp
index 0bf74c95..1c350dac 100644
--- a/src/mediaType.cpp
+++ b/src/mediaType.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "mediaType.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/mediaType.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/mediaType.hpp b/src/mediaType.hpp
deleted file mode 100644
index 7f88c965..00000000
--- a/src/mediaType.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MEDIATYPE_HPP_INCLUDED
-#define VMIME_MEDIATYPE_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** Content media type (basic type).
- */
-
-class mediaType : public component
-{
-public:
-
- mediaType();
- mediaType(const string& type);
- mediaType(const string& type, const string& subType);
-
-public:
-
- const bool operator==(const mediaType& type) const;
- const bool operator!=(const mediaType& type) const;
-
- mediaType& operator=(const string& type);
-
- mediaType* clone() const;
- void copyFrom(const component& other);
- mediaType& operator=(const mediaType& other);
-
- const std::vector <const component*> getChildComponents() const;
-
- /** Return the media type.
- * See the constants in vmime::mediaTypes.
- *
- * @return media type
- */
- const string& getType() const;
-
- /** Set the media type.
- * See the constants in vmime::mediaTypes.
- *
- * @param type media type
- */
- void setType(const string& type);
-
- /** Return the media subtype.
- * See the constants in vmime::mediaTypes.
- *
- * @return media subtype
- */
- const string& getSubType() const;
-
- /** Set the media subtype.
- * See the constants in vmime::mediaTypes.
- *
- * @param subType media subtype
- */
- void setSubType(const string& subType);
-
- /** Set the media type and subtype from a string
- * in the form "type/subtype" (eg: "image/jpeg").
- *
- * @param type media type and subtype
- */
- void setFromString(const string& type);
-
-protected:
-
- string m_type;
- string m_subType;
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MEDIATYPE_HPP_INCLUDED
diff --git a/src/message.cpp b/src/message.cpp
index bd6f6085..8b28039a 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "message.hpp"
-#include "options.hpp"
+#include "vmime/message.hpp"
+#include "vmime/options.hpp"
#include <sstream>
diff --git a/src/message.hpp b/src/message.hpp
deleted file mode 100644
index 9b3c6cc9..00000000
--- a/src/message.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGE_HPP_INCLUDED
-#define VMIME_MESSAGE_HPP_INCLUDED
-
-
-#include "bodyPart.hpp"
-#include "options.hpp"
-
-
-namespace vmime
-{
-
-
-/** A MIME message.
- */
-
-class message : public bodyPart
-{
-public:
-
- message();
-
-
- // Component parsing & assembling
- void generate(utility::outputStream& os, const string::size_type maxLineLength = options::getInstance()->message.maxLineLength(), const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-
- const string generate(const string::size_type maxLineLength = options::getInstance()->message.maxLineLength(), const string::size_type curLinePos = 0) const;
-
- void parse(const string& buffer);
-};
-
-
-
-} // vmime
-
-
-#endif // VMIME_MESSAGE_HPP_INCLUDED
diff --git a/src/messageBuilder.cpp b/src/messageBuilder.cpp
index c15532e6..f29ffe6c 100644
--- a/src/messageBuilder.cpp
+++ b/src/messageBuilder.cpp
@@ -17,9 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messageBuilder.hpp"
+#include "vmime/messageBuilder.hpp"
-#include "textPartFactory.hpp"
+#include "vmime/textPartFactory.hpp"
namespace vmime
diff --git a/src/messageBuilder.hpp b/src/messageBuilder.hpp
deleted file mode 100644
index 15bd8bc0..00000000
--- a/src/messageBuilder.hpp
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGEBUILDER_HPP_INCLUDED
-#define VMIME_MESSAGEBUILDER_HPP_INCLUDED
-
-
-#include "base.hpp"
-
-#include "mailbox.hpp"
-#include "addressList.hpp"
-#include "text.hpp"
-#include "message.hpp"
-#include "mediaType.hpp"
-#include "attachment.hpp"
-#include "textPart.hpp"
-#include "bodyPart.hpp"
-
-
-namespace vmime
-{
-
-
-/** A helper for building MIME messages.
- */
-
-class messageBuilder
-{
-public:
-
- messageBuilder();
- ~messageBuilder();
-
-public:
-
- /** Return the expeditor of the message (From:).
- *
- * @return expeditor of the message
- */
- const mailbox& getExpeditor() const;
-
- /** Set the expeditor of the message (From:).
- *
- * @param expeditor expeditor of the message
- */
- void setExpeditor(const mailbox& expeditor);
-
- /** Return the recipients of the message (To:).
- *
- * return recipients of the message
- */
- const addressList& getRecipients() const;
-
- /** Return the recipients of the message (To:).
- *
- * return recipients of the message
- */
- addressList& getRecipients();
-
- /** Set the recipients of the message (To:).
- *
- * @param recipients list of recipients
- */
- void setRecipients(const addressList& recipients);
-
- /** Return the copy recipients of the message (Cc:).
- *
- * @return copy recipients of the message
- */
- const addressList& getCopyRecipients() const;
-
- /** Return the copy recipients of the message (Cc:).
- *
- * @return copy recipients of the message
- */
- addressList& getCopyRecipients();
-
- /** Set the copy recipients of the message (Cc:).
- *
- * @param cc list of copy recipients
- */
- void setCopyRecipients(const addressList& cc);
-
- /** Return the blind-copy recipients of the message (Bcc:).
- *
- * @return blind-copy recipients of the message
- */
- const addressList& getBlindCopyRecipients() const;
-
- /** Return the blind-copy recipients of the message (Bcc:).
- *
- * @return blind-copy recipients of the message
- */
- addressList& getBlindCopyRecipients();
-
- /** Set the blind-copy recipients of the message (Bcc:).
- *
- * @param bcc list of blind-copy recipients
- */
- void setBlindCopyRecipients(const addressList& bcc);
-
- /** Return the subject of the message.
- *
- * @return subject of the message
- */
- const text& getSubject() const;
-
- /** Set the subject of the message.
- *
- * @param subject message subject
- */
- void setSubject(const text& subject);
-
- /** Attach a new object to the message.
- * This is a synonym for messageBuilder::appendAttachment().
- *
- * @param attach new attachment
- */
- void attach(attachment* attach);
-
- /** Attach a new object to the message.
- *
- * @param attach new attachment
- */
- void appendAttachment(attachment* attach);
-
- /** Remove the attachment at the specified position.
- *
- * @param pos position of the attachment to remove
- */
- void removeAttachment(const int pos);
-
- /** Return the attachment at the specified position.
- *
- * @param pos position of the attachment
- * @return attachment at the specified position
- */
- const attachment* getAttachmentAt(const int pos) const;
-
- /** Return the attachment at the specified position.
- *
- * @param pos position of the attachment
- * @return attachment at the specified position
- */
- attachment* getAttachmentAt(const int pos);
-
- /** Return the number of attachments in the message.
- *
- * @return number of attachments
- */
- const int getAttachmentCount() const;
-
- /** Return the list of attachments.
- *
- * @return list of attachments
- */
- const std::vector <const attachment*> getAttachmentList() const;
-
- /** Return the list of attachments.
- *
- * @return list of attachments
- */
- const std::vector <attachment*> getAttachmentList();
-
- /** Change the type of the text part and construct a new part.
- *
- * @param type media type of the text part
- */
- void constructTextPart(const mediaType& type);
-
- /** Return the text part of the message.
- *
- * @return text part of the message
- */
- textPart* getTextPart();
-
- /** Construct a new message based on the information specified
- * in this object.
- *
- * @return a new message
- */
- message* construct() const;
-
-private:
-
- mailbox m_from;
-
- addressList m_to;
- addressList m_cc;
- addressList m_bcc;
-
- text m_subject;
-
- textPart* m_textPart;
-
- std::vector <attachment*> m_attach;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MESSAGEBUILDER_HPP_INCLUDED
diff --git a/src/messageId.cpp b/src/messageId.cpp
index 35ab76b6..dfa9b307 100644
--- a/src/messageId.cpp
+++ b/src/messageId.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messageId.hpp"
-#include "utility/random.hpp"
-#include "platformDependant.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/messageId.hpp"
+#include "vmime/utility/random.hpp"
+#include "vmime/platformDependant.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/messageId.hpp b/src/messageId.hpp
deleted file mode 100644
index 467b554b..00000000
--- a/src/messageId.hpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGEID_HPP_INCLUDED
-#define VMIME_MESSAGEID_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** Message identifier (basic type).
- */
-
-class messageId : public component
-{
-public:
-
- messageId();
- messageId(const string& id);
- messageId(const messageId& mid);
- messageId(const string& left, const string& right);
-
-public:
-
- /** Return the left part of the message identifier.
- *
- * @return left part of message identifier
- */
- const string& getLeft() const;
-
- /** Set the left part of the message identifier.
- *
- * @param left left part of message identifier
- */
- void setLeft(const string& left);
-
- /** Return the right part of the message identifier.
- *
- * @return right part of message identifier
- */
- const string& getRight() const;
-
- /** Set the right part of the message identifier.
- *
- * @param right right part of message identifier
- */
- void setRight(const string& right);
-
-
- messageId& operator=(const string& id);
-
- const bool operator==(const messageId& mid) const;
- const bool operator!=(const messageId& mid) const;
-
- /** Generate a random message identifier.
- *
- * @return randomly created message identifier
- */
- static messageId generateId();
-
- /** Return the message identifier constructed by using
- * the right part and the left part, separated by
- * a '@' character.
- *
- * @return full message identifier
- */
- const string getId() const;
-
- messageId* clone() const;
- void copyFrom(const component& other);
- messageId& operator=(const messageId& other);
-
- const std::vector <const component*> getChildComponents() const;
-
-private:
-
- string m_left;
- string m_right;
-
-public:
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MESSAGEID_HPP_INCLUDED
diff --git a/src/messageParser.cpp b/src/messageParser.cpp
index 2834fc18..6099ef33 100644
--- a/src/messageParser.cpp
+++ b/src/messageParser.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messageParser.hpp"
+#include "vmime/messageParser.hpp"
-#include "defaultAttachment.hpp"
-#include "textPartFactory.hpp"
+#include "vmime/defaultAttachment.hpp"
+#include "vmime/textPartFactory.hpp"
namespace vmime
diff --git a/src/messageParser.hpp b/src/messageParser.hpp
deleted file mode 100644
index f6853e9f..00000000
--- a/src/messageParser.hpp
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGEPARSER_HPP_INCLUDED
-#define VMIME_MESSAGEPARSER_HPP_INCLUDED
-
-
-#include "base.hpp"
-
-#include "message.hpp"
-#include "attachment.hpp"
-
-#include "textPart.hpp"
-
-
-namespace vmime
-{
-
-
-/** A helper for parsing MIME messages.
- */
-
-class messageParser
-{
-public:
-
- messageParser(const string& buffer);
- messageParser(const message& msg);
- ~messageParser();
-
-public:
-
- /** Return the expeditor of the message (From:).
- *
- * @return expeditor of the message
- */
- const mailbox& getExpeditor() const;
-
- /** Return the recipients of the message (To:).
- *
- * return recipients of the message
- */
- const addressList& getRecipients() const;
-
- /** Return the copy recipients of the message (Cc:).
- *
- * @return copy recipients of the message
- */
- const addressList& getCopyRecipients() const;
-
- /** Return the blind-copy recipients of the message (Bcc:).
- *
- * @return blind-copy recipients of the message
- */
- const addressList& getBlindCopyRecipients() const;
-
- /** Return the subject of the message.
- *
- * @return subject of the message
- */
- const text& getSubject() const;
-
- /** Return the date of the message.
- *
- * @return date of the message
- */
- const datetime& getDate() const;
-
- /** Return the number of attachments in the message.
- *
- * @return number of attachments
- */
- const int getAttachmentCount() const;
-
- /** Return the attachment at the specified position.
- *
- * @param pos position of the attachment
- * @return attachment at position 'pos'
- */
- const attachment* getAttachmentAt(const int pos) const;
-
- /** Return the attachments of the message.
- *
- * @return list of attachments in the message
- */
- const std::vector <const attachment*> getAttachmentList() const;
-
- /** Return information about the specified attachment.
- *
- * @param a attachment to retrieve information about
- * @return information about the specified attachment
- */
- const contentDispositionField* getAttachmentInfo(const attachment* a) const;
-
- /** Return the text parts of the message.
- *
- * @return list of text parts in the message
- */
- const std::vector <const textPart*> getTextPartList() const;
-
- /** Return the number of text parts in the message.
- *
- * @return number of text parts
- */
- const int getTextPartCount() const;
-
- /** Return the text part at the specified position.
- *
- * @param pos position of the text part
- * @return text part at position 'pos'
- */
- const textPart* getTextPartAt(const int pos) const;
-
-private:
-
- mailbox m_from;
-
- addressList m_to;
- addressList m_cc;
- addressList m_bcc;
-
- text m_subject;
-
- datetime m_date;
-
- std::vector <attachment*> m_attach;
- std::map <attachment*, contentDispositionField*> m_attachInfo;
-
- std::vector <textPart*> m_textParts;
-
- void parse(const message& msg);
-
- void findAttachments(const bodyPart& part);
-
- void findTextParts(const bodyPart& msg, const bodyPart& part);
- bool findSubTextParts(const bodyPart& msg, const bodyPart& part);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_MESSAGEPARSER_HPP_INCLUDED
diff --git a/src/messaging/IMAPConnection.cpp b/src/messaging/IMAPConnection.cpp
index 7992db3c..d6f79ed3 100644
--- a/src/messaging/IMAPConnection.cpp
+++ b/src/messaging/IMAPConnection.cpp
@@ -17,13 +17,13 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/IMAPTag.hpp"
-#include "messaging/IMAPConnection.hpp"
-#include "messaging/IMAPUtils.hpp"
-#include "messaging/IMAPStore.hpp"
+#include "vmime/messaging/IMAPTag.hpp"
+#include "vmime/messaging/IMAPConnection.hpp"
+#include "vmime/messaging/IMAPUtils.hpp"
+#include "vmime/messaging/IMAPStore.hpp"
-#include "exception.hpp"
-#include "platformDependant.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
#include <sstream>
diff --git a/src/messaging/IMAPConnection.hpp b/src/messaging/IMAPConnection.hpp
deleted file mode 100644
index e53978c0..00000000
--- a/src/messaging/IMAPConnection.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_IMAPCONNECTION_HPP_INCLUDED
-#define VMIME_MESSAGING_IMAPCONNECTION_HPP_INCLUDED
-
-
-#include "config.hpp"
-
-#include "messaging/authenticator.hpp"
-#include "messaging/socket.hpp"
-#include "messaging/timeoutHandler.hpp"
-
-#include "messaging/IMAPParser.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class IMAPTag;
-class IMAPStore;
-
-
-class IMAPConnection
-{
-public:
-
- IMAPConnection(IMAPStore* store, authenticator* auth);
- ~IMAPConnection();
-
-
- void connect();
- const bool isConnected() const;
- void disconnect();
-
-
- enum ProtocolStates
- {
- STATE_NONE,
- STATE_NON_AUTHENTICATED,
- STATE_AUTHENTICATED,
- STATE_SELECTED,
- STATE_LOGOUT
- };
-
- const ProtocolStates state() const { return (m_state); }
- void setState(const ProtocolStates state) { m_state = state; }
-
-
- const char hierarchySeparator() const { return (m_hierarchySeparator); }
-
-
- void send(bool tag, const string& what, bool end);
- void sendRaw(const char* buffer, const int count);
-
- IMAPParser::response* readResponse(IMAPParser::literalHandler* lh = NULL);
-
-
- const IMAPTag* getTag() const { return (m_tag); }
- const IMAPParser* getParser() const { return (m_parser); }
-
- const IMAPStore* getStore() const { return (m_store); }
- IMAPStore* getStore() { return (m_store); }
-
-private:
-
- IMAPStore* m_store;
-
- authenticator* m_auth;
-
- socket* m_socket;
-
- IMAPParser* m_parser;
-
- IMAPTag* m_tag;
-
- char m_hierarchySeparator;
-
- ProtocolStates m_state;
-
- timeoutHandler* m_timeoutHandler;
-
-
- void internalDisconnect();
-
- void initHierarchySeparator();
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_IMAPCONNECTION_HPP_INCLUDED
diff --git a/src/messaging/IMAPFolder.cpp b/src/messaging/IMAPFolder.cpp
index a60ea40b..ce5b5236 100644
--- a/src/messaging/IMAPFolder.cpp
+++ b/src/messaging/IMAPFolder.cpp
@@ -17,18 +17,18 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/IMAPFolder.hpp"
+#include "vmime/messaging/IMAPFolder.hpp"
-#include "messaging/IMAPStore.hpp"
-#include "messaging/IMAPParser.hpp"
-#include "messaging/IMAPMessage.hpp"
-#include "messaging/IMAPUtils.hpp"
-#include "messaging/IMAPConnection.hpp"
+#include "vmime/messaging/IMAPStore.hpp"
+#include "vmime/messaging/IMAPParser.hpp"
+#include "vmime/messaging/IMAPMessage.hpp"
+#include "vmime/messaging/IMAPUtils.hpp"
+#include "vmime/messaging/IMAPConnection.hpp"
-#include "messageParser.hpp" // to include "message.hpp" in root directory
+#include "vmime/message.hpp"
-#include "exception.hpp"
-#include "utility/smartPtr.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/utility/smartPtr.hpp"
#include <algorithm>
#include <sstream>
diff --git a/src/messaging/IMAPFolder.hpp b/src/messaging/IMAPFolder.hpp
deleted file mode 100644
index 7a8382d1..00000000
--- a/src/messaging/IMAPFolder.hpp
+++ /dev/null
@@ -1,155 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_IMAPFOLDER_HPP_INCLUDED
-#define VMIME_MESSAGING_IMAPFOLDER_HPP_INCLUDED
-
-
-#include <vector>
-#include <map>
-
-#include "types.hpp"
-
-#include "messaging/folder.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class IMAPStore;
-class IMAPMessage;
-class IMAPConnection;
-
-
-/** IMAP folder implementation.
- */
-
-class IMAPFolder : public folder
-{
-private:
-
- friend class IMAPStore;
- friend class IMAPMessage;
-
-
- IMAPFolder(const folder::path& path, IMAPStore* store, const int type = TYPE_UNDEFINED, const int flags = FLAG_UNDEFINED);
- IMAPFolder(const IMAPFolder&) : folder() { }
-
- ~IMAPFolder();
-
-public:
-
- const int getMode() const;
-
- const int getType();
-
- const int getFlags();
-
- const folder::path::component getName() const;
- const folder::path getFullPath() const;
-
- void open(const int mode, bool failIfModeIsNotAvailable = false);
- void close(const bool expunge);
- void create(const int type);
-
- const bool exists();
-
- const bool isOpen() const;
-
- message* getMessage(const int num);
- std::vector <message*> getMessages(const int from = 1, const int to = -1);
- std::vector <message*> getMessages(const std::vector <int>& nums);
- const int getMessageCount();
-
- folder* getFolder(const folder::path::component& name);
- std::vector <folder*> getFolders(const bool recursive = false);
-
- void rename(const folder::path& newPath);
-
- void deleteMessage(const int num);
- void deleteMessages(const int from = 1, const int to = -1);
- void deleteMessages(const std::vector <int>& nums);
-
- void setMessageFlags(const int from, const int to, const int flags, const int mode = message::FLAG_MODE_SET);
- void setMessageFlags(const std::vector <int>& nums, const int flags, const int mode = message::FLAG_MODE_SET);
-
- void addMessage(vmime::message* msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL);
- void addMessage(utility::inputStream& is, const int size, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL);
-
- void copyMessage(const folder::path& dest, const int num);
- void copyMessages(const folder::path& dest, const int from = 1, const int to = -1);
- void copyMessages(const folder::path& dest, const std::vector <int>& nums);
-
- void status(int& count, int& unseen);
-
- void expunge();
-
- folder* getParent();
-
- const store* getStore() const;
- store* getStore();
-
-
- void fetchMessages(std::vector <message*>& msg, const int options, progressionListener* progress = NULL);
- void fetchMessage(message* msg, const int options);
-
- const int getFetchCapabilities() const;
-
-private:
-
- void registerMessage(IMAPMessage* msg);
- void unregisterMessage(IMAPMessage* msg);
-
- void onStoreDisconnected();
-
- void onClose();
-
- const int testExistAndGetType();
-
- void setMessageFlags(const string& set, const int flags, const int mode);
-
- void copyMessages(const string& set, const folder::path& dest);
-
-
- IMAPStore* m_store;
- IMAPConnection* m_connection;
-
- folder::path m_path;
- folder::path::component m_name;
-
- int m_mode;
- bool m_open;
-
- int m_type;
- int m_flags;
-
- int m_messageCount;
-
- int m_uidValidity;
-
- std::vector <IMAPMessage*> m_messages;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_IMAPFOLDER_HPP_INCLUDED
diff --git a/src/messaging/IMAPMessage.cpp b/src/messaging/IMAPMessage.cpp
index deb0087d..85833352 100644
--- a/src/messaging/IMAPMessage.cpp
+++ b/src/messaging/IMAPMessage.cpp
@@ -17,12 +17,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/IMAPParser.hpp"
-#include "messaging/IMAPMessage.hpp"
-#include "messaging/IMAPFolder.hpp"
-#include "messaging/IMAPStore.hpp"
-#include "messaging/IMAPConnection.hpp"
-#include "messaging/IMAPUtils.hpp"
+#include "vmime/messaging/IMAPParser.hpp"
+#include "vmime/messaging/IMAPMessage.hpp"
+#include "vmime/messaging/IMAPFolder.hpp"
+#include "vmime/messaging/IMAPStore.hpp"
+#include "vmime/messaging/IMAPConnection.hpp"
+#include "vmime/messaging/IMAPUtils.hpp"
#include <sstream>
#include <iterator>
diff --git a/src/messaging/IMAPMessage.hpp b/src/messaging/IMAPMessage.hpp
deleted file mode 100644
index ad844784..00000000
--- a/src/messaging/IMAPMessage.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_IMAPMESSAGE_HPP_INCLUDED
-#define VMIME_MESSAGING_IMAPMESSAGE_HPP_INCLUDED
-
-
-#include "messaging/message.hpp"
-#include "messaging/folder.hpp"
-
-#include "mailboxList.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** IMAP message implementation.
- */
-
-class IMAPMessage : public message
-{
-private:
-
- friend class IMAPFolder;
-
- IMAPMessage(IMAPFolder* folder, const int num);
- IMAPMessage(const IMAPMessage&) : message() { }
-
- ~IMAPMessage();
-
-public:
-
- const int getNumber() const;
-
- const uid getUniqueId() const;
-
- const int getSize() const;
-
- const bool isExpunged() const;
-
- const structure& getStructure() const;
- structure& getStructure();
-
- const header& getHeader() const;
-
- const int getFlags() const;
- void setFlags(const int flags, const int mode = FLAG_MODE_SET);
-
- void extract(utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const;
- void extractPart(const part& p, utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const;
-
- void fetchPartHeader(part& p);
-
-private:
-
- void fetch(IMAPFolder* folder, const int options);
-
- void processFetchResponse(const int options, const IMAPParser::msg_att* msgAtt);
-
- void extract(const part* p, utility::outputStream& os, progressionListener* progress, const int start, const int length, const bool headerOnly) const;
-
-
- void convertAddressList(const IMAPParser::address_list& src, mailboxList& dest);
-
-
- header& getOrCreateHeader();
-
-
- void onFolderClosed();
-
- IMAPFolder* m_folder;
-
- int m_num;
- int m_size;
- int m_flags;
- bool m_expunged;
- uid m_uid;
-
- header* m_header;
- structure* m_structure;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_IMAPMESSAGE_HPP_INCLUDED
diff --git a/src/messaging/IMAPParser.hpp b/src/messaging/IMAPParser.hpp
deleted file mode 100644
index bd4eeb56..00000000
--- a/src/messaging/IMAPParser.hpp
+++ /dev/null
@@ -1,5077 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_IMAPPARSER_HPP_INCLUDED
-#define VMIME_MESSAGING_IMAPPARSER_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "dateTime.hpp"
-#include "charset.hpp"
-#include "exception.hpp"
-
-#include "utility/smartPtr.hpp"
-#include "utility/stringUtils.hpp"
-
-#include "encoderB64.hpp"
-#include "encoderQP.hpp"
-
-#include "platformDependant.hpp"
-
-#include "messaging/progressionListener.hpp"
-#include "messaging/timeoutHandler.hpp"
-#include "messaging/socket.hpp"
-
-#include "messaging/IMAPTag.hpp"
-
-#include <vector>
-#include <stdexcept>
-
-
-//#define DEBUG_RESPONSE 1
-
-
-#if DEBUG_RESPONSE
-# include <iostream>
-#endif
-
-
-namespace vmime {
-namespace messaging {
-
-
-#if DEBUG_RESPONSE
- static string DEBUG_RESPONSE_level;
- static std::vector <string> DEBUG_RESPONSE_components;
-
-# define DEBUG_ENTER_COMPONENT(x) \
- DEBUG_RESPONSE_components.push_back(x); \
- std::cout << DEBUG_RESPONSE_level \
- << "(" << DEBUG_RESPONSE_level.length() << ") " \
- << (x) << std::endl;
-# define DEBUG_FOUND(x, y) \
- std::cout << "FOUND: " << x << ": " << y << std::endl;
-#else
-# define DEBUG_ENTER_COMPONENT(x)
-# define DEBUG_FOUND(x, y)
-#endif
-
-
-class IMAPParser
-{
-public:
-
- IMAPParser(IMAPTag* tag, socket* sok, timeoutHandler* _timeoutHandler)
- : m_tag(tag), m_socket(sok), m_progress(NULL),
- m_literalHandler(NULL), m_timeoutHandler(_timeoutHandler)
- {
- }
-
-
- const IMAPTag* tag() const
- {
- return (m_tag);
- }
-
-
- const string lastLine() const
- {
- // Remove blanks and new lines at the end of the line.
- string line(m_lastLine);
-
- string::const_iterator it = line.end();
- int count = 0;
-
- while (it != line.begin())
- {
- const unsigned char c = *(it - 1);
-
- if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
- break;
-
- ++count;
- --it;
- }
-
- line.resize(line.length() - count);
-
- return (line);
- }
-
-
-
- //
- // literalHandler : literal content handler
- //
-
- class component;
-
- class literalHandler
- {
- public:
-
- virtual ~literalHandler() { }
-
-
- // Abstract target class
- class target
- {
- protected:
-
- target(class progressionListener* progress) : m_progress(progress) {}
- target(const target&) {}
-
- public:
-
- virtual ~target() { }
-
-
- class progressionListener* progressionListener() { return (m_progress); }
-
- virtual void putData(const string& chunk) = 0;
-
- private:
-
- class progressionListener* m_progress;
- };
-
-
- // Target: put in a string
- class targetString : public target
- {
- public:
-
- targetString(class progressionListener* progress, vmime::string& str)
- : target(progress), m_string(str) { }
-
- const vmime::string& string() const { return (m_string); }
- vmime::string& string() { return (m_string); }
-
-
- void putData(const vmime::string& chunk)
- {
- m_string += chunk;
- }
-
- private:
-
- vmime::string& m_string;
- };
-
-
- // Target: redirect to an output stream
- class targetStream : public target
- {
- public:
-
- targetStream(class progressionListener* progress, utility::outputStream& stream)
- : target(progress), m_stream(stream) { }
-
- const utility::outputStream& stream() const { return (m_stream); }
- utility::outputStream& stream() { return (m_stream); }
-
-
- void putData(const string& chunk)
- {
- m_stream.write(chunk.data(), chunk.length());
- }
-
- private:
-
- utility::outputStream& m_stream;
- };
-
-
- // Called when the parser needs to know what to do with a literal
- // . comp: the component in which we are at this moment
- // . data: data specific to the component (may not be used)
- //
- // Returns :
- // . == NULL to put the literal into the response
- // . != NULL to redirect the literal to the specified target
-
- virtual target* targetFor(const component& comp, const int data) = 0;
- };
-
-
- //
- // Base class for a terminal or a non-terminal
- //
-
- class component
- {
- public:
-
- component() { }
- virtual ~component() { }
-
- virtual void go(IMAPParser& parser, string& line, string::size_type* currentPos) = 0;
-
-
- const string makeResponseLine(const string& comp, const string& line,
- const string::size_type pos)
- {
-#if DEBUG_RESPONSE
- if (pos > line.length())
- std::cout << "WARNING: component::makeResponseLine(): pos > line.length()" << std::endl;
-#endif
-
- string result(line.substr(0, pos));
- result += "[^]"; // indicates current parser position
- result += line.substr(pos, line.length());
- if (!comp.empty()) result += " [" + comp + "]";
-
- return (result);
- }
- };
-
-
-
- //
- // Parse one character
- //
-
- template <char C>
- class one_char : public component
- {
- public:
-
- void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT(string("one_char <") + C + ">: current='" + ((*currentPos < line.length() ? line[*currentPos] : '?')) + "'");
-
- const string::size_type pos = *currentPos;
-
- if (pos < line.length() && line[pos] == C)
- *currentPos = pos + 1;
- else
- throw exceptions::invalid_response("", makeResponseLine("", line, pos));
- }
- };
-
-
- //
- // SPACE ::= <ASCII SP, space, 0x20>
- //
-
- class SPACE : public component
- {
- public:
-
- void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("SPACE");
-
- string::size_type pos = *currentPos;
-
- while (pos < line.length() && (line[pos] == ' ' || line[pos] == '\t'))
- ++pos;
-
- if (pos > *currentPos)
- *currentPos = pos;
- else
- throw exceptions::invalid_response("", makeResponseLine("SPACE", line, pos));
- }
- };
-
-
- //
- // CR ::= <ASCII CR, carriage return, 0x0D>
- // LF ::= <ASCII LF, line feed, 0x0A>
- // CRLF ::= CR LF
- //
-
- class CRLF : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("CRLF");
-
- string::size_type pos = *currentPos;
-
- parser.check <SPACE>(line, &pos, true);
-
- if (pos + 1 < line.length() &&
- line[pos] == 0x0d && line[pos + 1] == 0x0a)
- {
- *currentPos = pos + 2;
- }
- else
- {
- throw exceptions::invalid_response("", makeResponseLine("CRLF", line, pos));
- }
- }
- };
-
-
- //
- // SPACE ::= <ASCII SP, space, 0x20>
- // CTL ::= <any ASCII control character and DEL, 0x00 - 0x1f, 0x7f>
- // CHAR ::= <any 7-bit US-ASCII character except NUL, 0x01 - 0x7f>
- // ATOM_CHAR ::= <any CHAR except atom_specials>
- // atom_specials ::= "(" / ")" / "{" / SPACE / CTL / list_wildcards / quoted_specials
- // list_wildcards ::= "%" / "*"
- // quoted_specials ::= <"> / "\"
- //
- // tag ::= 1*<any ATOM_CHAR except "+"> (named "xtag")
- //
-
- class xtag : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("tag");
-
- string::size_type pos = *currentPos;
-
- bool end = false;
-
- string tagString;
- tagString.reserve(10);
-
- while (!end && pos < line.length())
- {
- const unsigned char c = line[pos];
-
- switch (c)
- {
- case '+':
- case '(':
- case ')':
- case '{':
- case 0x20: // SPACE
- case '%': // list_wildcards
- case '*': // list_wildcards
- case '"': // quoted_specials
- case '\\': // quoted_specials
-
- end = true;
- break;
-
- default:
-
- if (c <= 0x1f || c >= 0x7f)
- end = true;
- else
- {
- tagString += c;
- ++pos;
- }
-
- break;
- }
- }
-
- if (tagString == (string) *(parser.tag()))
- {
- *currentPos = pos;
- }
- else
- {
- // Invalid tag
- throw exceptions::invalid_response("", makeResponseLine("tag", line, pos));
- }
- }
- };
-
-
- //
- // digit ::= "0" / digit_nz
- // digit_nz ::= "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
- //
- // number ::= 1*digit
- // ;; Unsigned 32-bit integer
- // ;; (0 <= n < 4,294,967,296)
- //
-
- class number : public component
- {
- public:
-
- number(const bool nonZero = false)
- : m_nonZero(nonZero), m_value(0)
- {
- }
-
- void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("number");
-
- string::size_type pos = *currentPos;
-
- bool valid = true;
- unsigned int val = 0;
-
- while (valid && pos < line.length())
- {
- const char c = line[pos];
-
- if (c >= '0' && c <= '9')
- {
- val = (val * 10) + (c - '0');
- ++pos;
- }
- else
- {
- valid = false;
- }
- }
-
- // Check for non-null length (and for non-zero number)
- if (!(m_nonZero && val == 0) && pos != *currentPos)
- {
- m_value = val;
- *currentPos = pos;
- }
- else
- {
- throw exceptions::invalid_response("", makeResponseLine("number", line, pos));
- }
- }
-
- private:
-
- const bool m_nonZero;
- unsigned int m_value;
-
- public:
-
- const unsigned int value() const { return (m_value); }
- };
-
-
- // nz_number ::= digit_nz *digit
- // ;; Non-zero unsigned 32-bit integer
- // ;; (0 < n < 4,294,967,296)
- //
-
- class nz_number : public number
- {
- public:
-
- nz_number() : number(true)
- {
- }
- };
-
-
- //
- // text ::= 1*TEXT_CHAR
- //
- // CHAR ::= <any 7-bit US-ASCII character except NUL, 0x01 - 0x7f>
- // TEXT_CHAR ::= <any CHAR except CR and LF>
- //
-
- class text : public component
- {
- public:
-
- text(bool allow8bits = false, const char except = 0)
- : m_allow8bits(allow8bits), m_except(except)
- {
- }
-
- void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("text");
-
- string::size_type pos = *currentPos;
- string::size_type len = 0;
-
- if (m_allow8bits)
- {
- const unsigned char except = m_except;
-
- for (bool end = false ; !end && pos < line.length() ; )
- {
- const unsigned char c = line[pos];
-
- if (c == 0x00 || c == 0x0d || c == 0x0a || c == except)
- {
- end = true;
- }
- else
- {
- ++pos;
- ++len;
- }
- }
- }
- else
- {
- const unsigned char except = m_except;
-
- for (bool end = false ; !end && pos < line.length() ; )
- {
- const unsigned char c = line[pos];
-
- if (c < 0x01 || c > 0x7f || c == 0x0d || c == 0x0a || c == except)
- {
- end = true;
- }
- else
- {
- ++pos;
- ++len;
- }
- }
- }
-
- if (len != 0)
- {
- m_value.resize(len);
- std::copy(line.begin() + *currentPos, line.begin() + pos, m_value.begin());
-
- *currentPos = pos;
- }
- else
- {
- throw exceptions::invalid_response("", makeResponseLine("text", line, pos));
- }
- }
-
- private:
-
- string m_value;
- const bool m_allow8bits;
- const char m_except;
-
- public:
-
- const string& value() const { return (m_value); }
- };
-
-
- class text8 : public text
- {
- public:
-
- text8() : text(true)
- {
- }
- };
-
-
- template <char C>
- class text_except : public text
- {
- public:
-
- text_except() : text(false, C)
- {
- }
- };
-
-
- template <char C>
- class text8_except : public text
- {
- public:
-
- text8_except() : text(true, C)
- {
- }
- };
-
-
- //
- // QUOTED_CHAR ::= <any TEXT_CHAR except quoted_specials> / "\" quoted_specials
- // quoted_specials ::= <"> / "\"
- // TEXT_CHAR ::= <any CHAR except CR and LF>
- // CHAR ::= <any 7-bit US-ASCII character except NUL, 0x01 - 0x7f>
- //
-
- class QUOTED_CHAR : public component
- {
- public:
-
- void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("quoted_char");
-
- string::size_type pos = *currentPos;
-
- const unsigned char c = (pos < line.length() ? line[pos] : 0);
-
- if (c >= 0x01 && c <= 0x7f && // 0x01 - 0x7f
- c != '"' && c != '\\' && // quoted_specials
- c != '\r' && c != '\n') // CR and LF
- {
- m_value = c;
- *currentPos = pos + 1;
- }
- else if (c == '\\' && pos + 1 < line.length() &&
- (line[pos + 1] == '"' || line[pos + 1] == '\\'))
- {
- m_value = line[pos + 1];
- *currentPos = pos + 2;
- }
- else
- {
- throw exceptions::invalid_response("", makeResponseLine("QUOTED_CHAR", line, pos));
- }
- }
-
- private:
-
- char m_value;
-
- public:
-
- const char value() const { return (m_value); }
- };
-
-
- //
- // quoted ::= <"> *QUOTED_CHAR <">
- // QUOTED_CHAR ::= <any TEXT_CHAR except quoted_specials> / "\" quoted_specials
- // quoted_specials ::= <"> / "\"
- // TEXT_CHAR ::= <any CHAR except CR and LF>
- // CHAR ::= <any 7-bit US-ASCII character except NUL, 0x01 - 0x7f>
- //
-
- class quoted_text : public component
- {
- public:
-
- void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("quoted_text");
-
- string::size_type pos = *currentPos;
- string::size_type len = 0;
- bool valid = false;
-
- m_value.reserve(line.length() - pos);
-
- for (bool end = false, quoted = false ; !end && pos < line.length() ; )
- {
- const unsigned char c = line[pos];
-
- if (quoted)
- {
- if (c == '"' || c == '\\')
- m_value += c;
- else
- {
- m_value += '\\';
- m_value += c;
- }
-
- quoted = false;
-
- ++pos;
- ++len;
- }
- else
- {
- if (c == '\\')
- {
- quoted = true;
-
- ++pos;
- ++len;
- }
- else if (c == '"')
- {
- valid = true;
- end = true;
- }
- else if (c >= 0x01 && c <= 0x7f && // CHAR
- c != 0x0a && c != 0x0d) // CR and LF
- {
- m_value += c;
-
- ++pos;
- ++len;
- }
- else
- {
- valid = false;
- end = true;
- }
- }
- }
-
- if (valid)
- {
- *currentPos = pos;
- }
- else
- {
- throw exceptions::invalid_response("", makeResponseLine("quoted_text", line, pos));
- }
- }
-
- private:
-
- string m_value;
-
- public:
-
- const string& value() const { return (m_value); }
- };
-
-
- //
- // nil ::= "NIL"
- //
-
- class NIL : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("NIL");
-
- string::size_type pos = *currentPos;
-
- parser.checkWithArg <special_atom>(line, &pos, "nil");
-
- *currentPos = pos;
- }
- };
-
-
- //
- // string ::= quoted / literal ----> named 'xstring'
- //
- // nil ::= "NIL"
- // quoted ::= <"> *QUOTED_CHAR <">
- // QUOTED_CHAR ::= <any TEXT_CHAR except quoted_specials> / "\" quoted_specials
- // quoted_specials ::= <"> / "\"
- // TEXT_CHAR ::= <any CHAR except CR and LF>
- // CHAR ::= <any 7-bit US-ASCII character except NUL, 0x01 - 0x7f>
- // literal ::= "{" number "}" CRLF *CHAR8
- // ;; Number represents the number of CHAR8 octets
- // CHAR8 ::= <any 8-bit octet except NUL, 0x01 - 0xff>
- //
-
- class xstring : public component
- {
- public:
-
- xstring(const bool canBeNIL = false, component* comp = NULL, const int data = 0)
- : m_canBeNIL(canBeNIL), m_component(comp), m_data(data)
- {
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("string");
-
- string::size_type pos = *currentPos;
-
- if (m_canBeNIL &&
- parser.checkWithArg <special_atom>(line, &pos, "nil", true))
- {
- // NIL
- }
- else
- {
- pos = *currentPos;
-
- // quoted ::= <"> *QUOTED_CHAR <">
- if (parser.check <one_char <'"'> >(line, &pos, true))
- {
- utility::auto_ptr <quoted_text> text(parser.get <quoted_text>(line, &pos));
- parser.check <one_char <'"'> >(line, &pos);
-
- if (parser.m_literalHandler != NULL)
- {
- literalHandler::target* target =
- parser.m_literalHandler->targetFor(*m_component, m_data);
-
- if (target != NULL)
- {
- m_value = "[literal-handler]";
-
- const string::size_type length = text->value().length();
- progressionListener* progress = target->progressionListener();
-
- if (progress)
- {
- progress->start(length);
- }
-
- target->putData(text->value());
-
- if (progress)
- {
- progress->progress(length, length);
- progress->stop(length);
- }
-
- delete (target);
- }
- else
- {
- m_value = text->value();
- }
- }
- else
- {
- m_value = text->value();
- }
-
- DEBUG_FOUND("string[quoted]", "<length=" << m_value.length() << ", value='" << m_value << "'>");
- }
- // literal ::= "{" number "}" CRLF *CHAR8
- else
- {
- parser.check <one_char <'{'> >(line, &pos);
-
- number* num = parser.get <number>(line, &pos);
-
- const string::size_type length = num->value();
- delete (num);
-
- parser.check <one_char <'}'> >(line, &pos);
-
- parser.check <CRLF>(line, &pos);
-
-
- if (parser.m_literalHandler != NULL)
- {
- literalHandler::target* target =
- parser.m_literalHandler->targetFor(*m_component, m_data);
-
- if (target != NULL)
- {
- m_value = "[literal-handler]";
-
- parser.m_progress = target->progressionListener();
- parser.readLiteral(*target, length);
- parser.m_progress = NULL;
-
- delete (target);
- }
- else
- {
- literalHandler::targetString target(NULL, m_value);
- parser.readLiteral(target, length);
- }
- }
- else
- {
- literalHandler::targetString target(NULL, m_value);
- parser.readLiteral(target, length);
- }
-
- line += parser.readLine();
-
- DEBUG_FOUND("string[literal]", "<length=" << length << ", value='" << m_value << "'>");
- }
- }
-
- *currentPos = pos;
- }
-
- private:
-
- bool m_canBeNIL;
- string m_value;
-
- component* m_component;
- const int m_data;
-
- public:
-
- const string& value() const { return (m_value); }
- };
-
-
- //
- // nstring ::= string / nil
- //
-
- class nstring : public xstring
- {
- public:
-
- nstring(component* comp = NULL, const int data = 0)
- : xstring(true, comp, data)
- {
- }
- };
-
-
- //
- // astring ::= atom / string
- //
-
- class astring : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("astring");
-
- string::size_type pos = *currentPos;
-
- xstring* str = NULL;
-
- if ((str = parser.get <xstring>(line, &pos, true)))
- {
- m_value = str->value();
- delete (str);
- }
- else
- {
- atom* at = parser.get <atom>(line, &pos);
- m_value = at->value();
- delete (at);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- string m_value;
-
- public:
-
- const string& value() const { return (m_value); }
- };
-
-
- //
- // atom ::= 1*ATOM_CHAR
- //
- // ATOM_CHAR ::= <any CHAR except atom_specials>
- // atom_specials ::= "(" / ")" / "{" / SPACE / CTL / list_wildcards / quoted_specials
- // CHAR ::= <any 7-bit US-ASCII character except NUL, 0x01 - 0x7f>
- // CTL ::= <any ASCII control character and DEL, 0x00 - 0x1f, 0x7f>
- // list_wildcards ::= "%" / "*"
- // quoted_specials ::= <"> / "\"
- // SPACE ::= <ASCII SP, space, 0x20>
- //
-
- class atom : public component
- {
- public:
-
- void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("atom");
-
- string::size_type pos = *currentPos;
- string::size_type len = 0;
-
- for (bool end = false ; !end && pos < line.length() ; )
- {
- const unsigned char c = line[pos];
-
- switch (c)
- {
- case '(':
- case ')':
- case '{':
- case 0x20: // SPACE
- case '%': // list_wildcards
- case '*': // list_wildcards
- case '"': // quoted_specials
- case '\\': // quoted_specials
-
- case '[':
- case ']': // for "special_atom"
-
- end = true;
- break;
-
- default:
-
- if (c <= 0x1f || c >= 0x7f)
- end = true;
- else
- {
- ++pos;
- ++len;
- }
- }
- }
-
- if (len != 0)
- {
- m_value.resize(len);
- std::copy(line.begin() + *currentPos, line.begin() + pos, m_value.begin());
-
- *currentPos = pos;
- }
- else
- {
- throw exceptions::invalid_response("", makeResponseLine("atom", line, pos));
- }
- }
-
- private:
-
- string m_value;
-
- public:
-
- const string& value() const { return (m_value); }
- };
-
-
- //
- // special atom (eg. "CAPABILITY", "FLAGS", "STATUS"...)
- //
- // " Except as noted otherwise, all alphabetic characters are case-
- // insensitive. The use of upper or lower case characters to define
- // token strings is for editorial clarity only. Implementations MUST
- // accept these strings in a case-insensitive fashion. "
- //
-
- class special_atom : public atom
- {
- public:
-
- special_atom(const char* str)
- : m_string(str) // 'string' must be in lower-case
- {
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT(string("special_atom(") + m_string + ")");
-
- string::size_type pos = *currentPos;
-
- atom::go(parser, line, &pos);
-
- const char* cmp = value().c_str();
- const char* with = m_string;
-
- bool ok = true;
-
- while (ok && *cmp && *with)
- {
- ok = (std::tolower(*cmp, std::locale()) == *with);
-
- ++cmp;
- ++with;
- }
-
- if (!ok || *cmp || *with)
- {
- throw exceptions::invalid_response("", makeResponseLine(string("special_atom <") + m_string + ">", line, pos));
- }
- else
- {
- *currentPos = pos;
- }
- }
-
- private:
-
- const char* m_string;
- };
-
-
- //
- // text_mime2 ::= "=?" <charset> "?" <encoding> "?" <encoded-text> "?="
- // ;; Syntax defined in [MIME-HDRS]
- //
-
- class text_mime2 : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("text_mime2");
-
- string::size_type pos = *currentPos;
-
- atom* theCharset = NULL, *theEncoding = NULL;
- text* theText = NULL;
-
- try
- {
- parser.check <one_char <'='> >(line, &pos);
- parser.check <one_char <'?'> >(line, &pos);
-
- theCharset = parser.get <atom>(line, &pos);
-
- parser.check <one_char <'?'> >(line, &pos);
-
- theEncoding = parser.get <atom>(line, &pos);
-
- parser.check <one_char <'?'> >(line, &pos);
-
- theText = parser.get <text8_except <'?'> >(line, &pos);
-
- parser.check <one_char <'?'> >(line, &pos);
- parser.check <one_char <'='> >(line, &pos);
- }
- catch (std::exception& e)
- {
- delete (theCharset);
- delete (theEncoding);
- delete (theText);
-
- throw;
- }
-
- m_charset = theCharset->value();
- delete (theCharset);
-
- // Decode text
- encoder* theEncoder = NULL;
-
- if (theEncoding->value()[0] == 'q' || theEncoding->value()[0] == 'Q')
- {
- // Quoted-printable
- theEncoder = new encoderQP;
- theEncoder->getProperties()["rfc2047"] = true;
- }
- else if (theEncoding->value()[0] == 'b' || theEncoding->value()[0] == 'B')
- {
- // Base64
- theEncoder = new encoderB64;
- }
-
- if (theEncoder)
- {
- utility::inputStreamStringAdapter in(theText->value());
- utility::outputStreamStringAdapter out(m_value);
-
- theEncoder->decode(in, out);
- delete (theEncoder);
- }
- // No decoder available
- else
- {
- m_value = theText->value();
- }
-
- delete (theEncoding);
- delete (theText);
-
- *currentPos = pos;
- }
-
- private:
-
- vmime::charset m_charset;
- string m_value;
-
- public:
-
- const vmime::charset& charset() const { return (m_charset); }
- const string& value() const { return (m_value); }
- };
-
-
- //
- // flag ::= "\Answered" / "\Flagged" / "\Deleted" /
- // "\Seen" / "\Draft" / flag_keyword / flag_extension
- //
- // flag_extension ::= "\" atom
- // ;; Future expansion. Client implementations
- // ;; MUST accept flag_extension flags. Server
- // ;; implementations MUST NOT generate
- // ;; flag_extension flags except as defined by
- // ;; future standard or standards-track
- // ;; revisions of this specification.
- //
- // flag_keyword ::= atom
- //
-
- class flag : public component
- {
- public:
-
- flag()
- : m_flag_keyword(NULL)
- {
- }
-
- ~flag()
- {
- delete (m_flag_keyword);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("flag_keyword");
-
- string::size_type pos = *currentPos;
-
- if (parser.check <one_char <'\\'> >(line, &pos, true))
- {
- if (parser.check <one_char <'*'> >(line, &pos, true))
- {
- m_type = STAR;
- }
- else
- {
- atom* at = parser.get <atom>(line, &pos);
- const string name = stringUtils::toLower(at->value());
- delete (at);
-
- if (name == "answered")
- m_type = ANSWERED;
- else if (name == "flagged")
- m_type = FLAGGED;
- else if (name == "deleted")
- m_type = DELETED;
- else if (name == "seen")
- m_type = SEEN;
- else if (name == "draft")
- m_type = DRAFT;
- else
- {
- m_type = UNKNOWN;
- m_name = name;
- }
- }
- }
- else
- {
- m_flag_keyword = parser.get <atom>(line, &pos);
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- UNKNOWN,
- ANSWERED,
- FLAGGED,
- DELETED,
- SEEN,
- DRAFT,
- STAR // * = custom flags allowed
- };
-
- private:
-
- Type m_type;
- string m_name;
-
- IMAPParser::atom* m_flag_keyword;
-
- public:
-
- const Type type() const { return (m_type); }
- const string& name() const { return (m_name); }
-
- const IMAPParser::atom* flag_keyword() const { return (m_flag_keyword); }
- };
-
-
- //
- // flag_list ::= "(" #flag ")"
- //
-
- class flag_list : public component
- {
- public:
-
- ~flag_list()
- {
- for (std::vector <flag*>::iterator it = m_flags.begin() ;
- it != m_flags.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("flag_list");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'('> >(line, &pos);
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- {
- m_flags.push_back(parser.get <flag>(line, &pos));
- parser.check <SPACE>(line, &pos, true);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <flag*> m_flags;
-
- public:
-
- const std::vector <flag*>& flags() const { return (m_flags); }
- };
-
-
- //
- // mailbox ::= "INBOX" / astring
- // ;; INBOX is case-insensitive. All case variants of
- // ;; INBOX (e.g. "iNbOx") MUST be interpreted as INBOX
- // ;; not as an astring. Refer to section 5.1 for
- // ;; further semantic details of mailbox names.
- //
-
- class mailbox : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("mailbox");
-
- string::size_type pos = *currentPos;
-
- if (parser.checkWithArg <special_atom>(line, &pos, "inbox", true))
- {
- m_type = INBOX;
- m_name = "INBOX";
- }
- else
- {
- m_type = OTHER;
-
- astring* astr = parser.get <astring>(line, &pos);
- m_name = astr->value();
- delete (astr);
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- INBOX,
- OTHER
- };
-
- private:
-
- Type m_type;
- string m_name;
-
- public:
-
- const Type type() const { return (m_type); }
- const string& name() const { return (m_name); }
- };
-
-
- //
- // mailbox_flag := "\Marked" / "\Noinferiors" /
- // "\Noselect" / "\Unmarked" / flag_extension
- //
-
- class mailbox_flag : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("mailbox_flag");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'\\'> >(line, &pos);
-
- atom* at = parser.get <atom>(line, &pos);
- const string name = stringUtils::toLower(at->value());
- delete (at);
-
- if (name == "marked")
- m_type = MARKED;
- else if (name == "noinferiors")
- m_type = NOINFERIORS;
- else if (name == "noselect")
- m_type = NOSELECT;
- else if (name == "unmarked")
- m_type = UNMARKED;
- else
- {
- m_type = UNKNOWN;
- m_name = name;
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- UNKNOWN,
- MARKED,
- NOINFERIORS,
- NOSELECT,
- UNMARKED
- };
-
- private:
-
- Type m_type;
- string m_name;
-
- public:
-
- const Type type() const { return (m_type); }
- const string& name() const { return (m_name); }
- };
-
-
- //
- // mailbox_flag_list ::= "(" #(mailbox_flag) ")"
- //
-
- class mailbox_flag_list : public component
- {
- public:
-
- ~mailbox_flag_list()
- {
- for (std::vector <mailbox_flag*>::iterator it = m_flags.begin() ;
- it != m_flags.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("mailbox_flag_list");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'('> >(line, &pos);
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- {
- m_flags.push_back(parser.get <mailbox_flag>(line, &pos));
- parser.check <SPACE>(line, &pos, true);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <mailbox_flag*> m_flags;
-
- public:
-
- const std::vector <mailbox_flag*>& flags() const { return (m_flags); }
- };
-
-
- //
- // mailbox_list ::= mailbox_flag_list SPACE
- // (<"> QUOTED_CHAR <"> / nil) SPACE mailbox
- //
-
- class mailbox_list : public component
- {
- public:
-
- mailbox_list()
- : m_mailbox_flag_list(NULL),
- m_mailbox(NULL), m_quoted_char('\0')
- {
- }
-
- ~mailbox_list()
- {
- delete (m_mailbox_flag_list);
- delete (m_mailbox);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("mailbox_list");
-
- string::size_type pos = *currentPos;
-
- m_mailbox_flag_list = parser.get <IMAPParser::mailbox_flag_list>(line, &pos);
-
- parser.check <SPACE>(line, &pos);
-
- if (!parser.check <NIL>(line, &pos, true))
- {
- parser.check <one_char <'"'> >(line, &pos);
-
- QUOTED_CHAR* qc = parser.get <QUOTED_CHAR>(line, &pos);
- m_quoted_char = qc->value();
- delete (qc);
-
- parser.check <one_char <'"'> >(line, &pos);
- }
-
- parser.check <SPACE>(line, &pos);
-
- m_mailbox = parser.get <IMAPParser::mailbox>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::mailbox_flag_list* m_mailbox_flag_list;
- IMAPParser::mailbox* m_mailbox;
- char m_quoted_char;
-
- public:
-
- const IMAPParser::mailbox_flag_list* mailbox_flag_list() const { return (m_mailbox_flag_list); }
- const IMAPParser::mailbox* mailbox() const { return (m_mailbox); }
- const char quoted_char() const { return (m_quoted_char); }
- };
-
-
- //
- // resp_text_code ::= "ALERT" / "PARSE" /
- // "PERMANENTFLAGS" SPACE "(" #(flag / "\*") ")" /
- // "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
- // "UIDVALIDITY" SPACE nz_number /
- // "UNSEEN" SPACE nz_number /
- // atom [SPACE 1*<any TEXT_CHAR except "]">]
-
- class resp_text_code : public component
- {
- public:
-
- resp_text_code()
- : m_nz_number(NULL), m_atom(NULL), m_flag_list(NULL), m_text(NULL)
- {
- }
-
- ~resp_text_code()
- {
- delete (m_nz_number);
- delete (m_atom);
- delete (m_flag_list);
- delete (m_text);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("resp_text_code");
-
- string::size_type pos = *currentPos;
-
- // "ALERT"
- if (parser.checkWithArg <special_atom>(line, &pos, "alert", true))
- {
- m_type = ALERT;
- }
- // "PARSE"
- else if (parser.checkWithArg <special_atom>(line, &pos, "parse", true))
- {
- m_type = PARSE;
- }
- // "PERMANENTFLAGS" SPACE flag_list
- else if (parser.checkWithArg <special_atom>(line, &pos, "permanentflags", true))
- {
- m_type = PERMANENTFLAGS;
-
- parser.check <SPACE>(line, &pos);
-
- m_flag_list = parser.get <IMAPParser::flag_list>(line, &pos);
- }
- // "READ-ONLY"
- else if (parser.checkWithArg <special_atom>(line, &pos, "read-only", true))
- {
- m_type = READ_ONLY;
- }
- // "READ-WRITE"
- else if (parser.checkWithArg <special_atom>(line, &pos, "read-write", true))
- {
- m_type = READ_WRITE;
- }
- // "TRYCREATE"
- else if (parser.checkWithArg <special_atom>(line, &pos, "trycreate", true))
- {
- m_type = TRYCREATE;
- }
- // "UIDVALIDITY" SPACE nz_number
- else if (parser.checkWithArg <special_atom>(line, &pos, "uidvalidity", true))
- {
- m_type = UIDVALIDITY;
-
- parser.check <SPACE>(line, &pos);
- m_nz_number = parser.get <IMAPParser::nz_number>(line, &pos);
- }
- // "UNSEEN" SPACE nz_number
- else if (parser.checkWithArg <special_atom>(line, &pos, "unseen", true))
- {
- m_type = UNSEEN;
-
- parser.check <SPACE>(line, &pos);
- m_nz_number = parser.get <IMAPParser::nz_number>(line, &pos);
- }
- // atom [SPACE 1*<any TEXT_CHAR except "]">]
- else
- {
- m_type = OTHER;
-
- m_atom = parser.get <IMAPParser::atom>(line, &pos);
-
- if (parser.check <SPACE>(line, &pos, true))
- m_text = parser.get <text_except <']'> >(line, &pos);
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- ALERT,
- PARSE,
- PERMANENTFLAGS,
- READ_ONLY,
- READ_WRITE,
- TRYCREATE,
- UIDVALIDITY,
- UNSEEN,
- OTHER
- };
-
- private:
-
- Type m_type;
-
- IMAPParser::nz_number* m_nz_number;
- IMAPParser::atom* m_atom;
- IMAPParser::flag_list* m_flag_list;
- IMAPParser::text* m_text;
-
- public:
-
- const Type type() const { return (m_type); }
-
- const IMAPParser::nz_number* nz_number() const { return (m_nz_number); }
- const IMAPParser::atom* atom() const { return (m_atom); }
- const IMAPParser::flag_list* flag_list() const { return (m_flag_list); }
- const IMAPParser::text* text() const { return (m_text); }
- };
-
-
- //
- // resp_text ::= ["[" resp_text_code "]" SPACE] (text_mime2 / text)
- // ;; text SHOULD NOT begin with "[" or "="
-
- class resp_text : public component
- {
- public:
-
- resp_text()
- : m_resp_text_code(NULL)
- {
- }
-
- ~resp_text()
- {
- delete (m_resp_text_code);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("resp_text");
-
- string::size_type pos = *currentPos;
-
- if (parser.check <one_char <'['> >(line, &pos, true))
- {
- m_resp_text_code = parser.get <IMAPParser::resp_text_code>(line, &pos);
-
- parser.check <one_char <']'> >(line, &pos);
- parser.check <SPACE>(line, &pos);
- }
-
- text_mime2* text1 = parser.get <text_mime2>(line, &pos, true);
-
- if (text1 != NULL)
- {
- m_text = text1->value();
- delete (text1);
- }
- else
- {
- IMAPParser::text* text2 =
- parser.get <IMAPParser::text>(line, &pos);
-
- m_text = text2->value();
- delete (text2);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::resp_text_code* m_resp_text_code;
- string m_text;
-
- public:
-
- const IMAPParser::resp_text_code* resp_text_code() const { return (m_resp_text_code); }
- const string& text() const { return (m_text); }
- };
-
-
- //
- // continue_req ::= "+" SPACE (resp_text / base64)
- //
-
- class continue_req : public component
- {
- public:
-
- continue_req()
- : m_resp_text(NULL)
- {
- }
-
- ~continue_req()
- {
- delete (m_resp_text);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("continue_req");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'+'> >(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_resp_text = parser.get <IMAPParser::resp_text>(line, &pos);
-
- parser.check <CRLF>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::resp_text* m_resp_text;
-
- public:
-
- const IMAPParser::resp_text* resp_text() const { return (m_resp_text); }
- };
-
-
- //
- // auth_type ::= atom
- // ;; Defined by [IMAP-AUTH]
- //
-
- class auth_type : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("auth_type");
-
- atom* at = parser.get <atom>(line, currentPos);
- m_name = stringUtils::toLower(at->value());
- delete (at);
-
- if (m_name == "kerberos_v4")
- m_type = KERBEROS_V4;
- else if (m_name == "gssapi")
- m_type = GSSAPI;
- else if (m_name == "skey")
- m_type = SKEY;
- else
- m_type = UNKNOWN;
- }
-
-
- enum Type
- {
- UNKNOWN,
-
- // RFC 1731 - IMAP4 Authentication Mechanisms
- KERBEROS_V4,
- GSSAPI,
- SKEY
- };
-
- private:
-
- Type m_type;
- string m_name;
-
- public:
-
- const Type type() const { return (m_type); }
- const string name() const { return (m_name); }
- };
-
-
- //
- // status_att ::= "MESSAGES" / "RECENT" / "UIDNEXT" /
- // "UIDVALIDITY" / "UNSEEN"
- //
-
- class status_att : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("status_att");
-
- string::size_type pos = *currentPos;
-
- if (parser.checkWithArg <special_atom>(line, &pos, "messages", true))
- {
- m_type = MESSAGES;
- }
- else if (parser.checkWithArg <special_atom>(line, &pos, "recent", true))
- {
- m_type = RECENT;
- }
- else if (parser.checkWithArg <special_atom>(line, &pos, "uidnext", true))
- {
- m_type = UIDNEXT;
- }
- else if (parser.checkWithArg <special_atom>(line, &pos, "uidvalidity", true))
- {
- m_type = UIDVALIDITY;
- }
- else
- {
- parser.checkWithArg <special_atom>(line, &pos, "unseen");
- m_type = UNSEEN;
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- MESSAGES,
- RECENT,
- UIDNEXT,
- UIDVALIDITY,
- UNSEEN
- };
-
- private:
-
- Type m_type;
-
- public:
-
- const Type type() const { return (m_type); }
- };
-
-
- //
- // capability ::= "AUTH=" auth_type / atom
- // ;; New capabilities MUST begin with "X" or be
- // ;; registered with IANA as standard or standards-track
- //
-
- class capability : public component
- {
- public:
-
- capability()
- : m_auth_type(NULL), m_atom(NULL)
- {
- }
-
- ~capability()
- {
- delete (m_auth_type);
- delete (m_atom);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("capability");
-
- string::size_type pos = *currentPos;
-
- class atom* at = parser.get <IMAPParser::atom>(line, &pos);
-
- string value = at->value();
- const char* str = value.c_str();
-
- if ((str[0] == 'a' || str[0] == 'A') &&
- (str[1] == 'u' || str[1] == 'U') &&
- (str[2] == 't' || str[2] == 'T') &&
- (str[3] == 'h' || str[3] == 'H') &&
- (str[4] == '='))
- {
- string::size_type pos = 5;
- m_auth_type = parser.get <IMAPParser::auth_type>(value, &pos);
- delete (at);
- }
- else
- {
- m_atom = at;
- }
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::auth_type* m_auth_type;
- IMAPParser::atom* m_atom;
-
- public:
-
- const IMAPParser::auth_type* auth_type() const { return (m_auth_type); }
- const IMAPParser::atom* atom() const { return (m_atom); }
- };
-
-
- //
- // capability_data ::= "CAPABILITY" SPACE [1#capability SPACE] "IMAP4rev1"
- // [SPACE 1#capability]
- // ;; IMAP4rev1 servers which offer RFC 1730
- // ;; compatibility MUST list "IMAP4" as the first
- // ;; capability.
- //
-
- class capability_data : public component
- {
- public:
-
- ~capability_data()
- {
- for (std::vector <capability*>::iterator it = m_capabilities.begin() ;
- it != m_capabilities.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("capability_data");
-
- string::size_type pos = *currentPos;
-
- parser.checkWithArg <special_atom>(line, &pos, "capability");
- parser.check <SPACE>(line, &pos);
-
- bool IMAP4rev1 = false;
-
- for (bool end = false ; !end && !IMAP4rev1 ; )
- {
- if (parser.checkWithArg <special_atom>(line, &pos, "imap4rev1", true))
- {
- IMAP4rev1 = true;
- }
- else
- {
- capability* cap = parser.get <capability>(line, &pos);
- end = (cap == NULL);
-
- if (cap)
- {
- m_capabilities.push_back(cap);
- }
- }
-
- parser.check <SPACE>(line, &pos);
- }
-
-
- if (parser.check <SPACE>(line, &pos, true))
- {
- for (capability* cap = NULL ;
- (cap = parser.get <capability>(line, &pos)) != NULL ; )
- {
- m_capabilities.push_back(cap);
-
- parser.check <SPACE>(line, &pos);
- }
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <capability*> m_capabilities;
-
- public:
-
- const std::vector <capability*>& capabilities() const { return (m_capabilities); }
- };
-
-
- //
- // date_day_fixed ::= (SPACE digit) / 2digit
- // ;; Fixed-format version of date_day
- //
- // date_month ::= "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
- // "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
- //
- // date_year ::= 4digit
- //
- // time ::= 2digit ":" 2digit ":" 2digit
- // ;; Hours minutes seconds
- //
- // zone ::= ("+" / "-") 4digit
- // ;; Signed four-digit value of hhmm representing
- // ;; hours and minutes west of Greenwich (that is,
- // ;; (the amount that the given time differs from
- // ;; Universal Time). Subtracting the timezone
- // ;; from the given time will give the UT form.
- // ;; The Universal Time zone is "+0000".
- //
- // date_time ::= <"> date_day_fixed "-" date_month "-" date_year
- // SPACE time SPACE zone <">
- //
-
- class date_time : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("date_time");
-
- string::size_type pos = *currentPos;
-
- // <"> date_day_fixed "-" date_month "-" date_year
- parser.check <one_char <'"'> >(line, &pos);
- parser.check <SPACE>(line, &pos, true);
-
- utility::auto_ptr <number> nd(parser.get <number>(line, &pos));
-
- parser.check <one_char <'-'> >(line, &pos);
-
- utility::auto_ptr <atom> amo(parser.get <atom>(line, &pos));
-
- parser.check <one_char <'-'> >(line, &pos);
-
- utility::auto_ptr <number> ny(parser.get <number>(line, &pos));
-
- parser.check <SPACE>(line, &pos, true);
-
- // 2digit ":" 2digit ":" 2digit
- utility::auto_ptr <number> nh(parser.get <number>(line, &pos));
-
- parser.check <one_char <':'> >(line, &pos);
-
- utility::auto_ptr <number> nmi(parser.get <number>(line, &pos));
-
- parser.check <one_char <':'> >(line, &pos);
-
- utility::auto_ptr <number> ns(parser.get <number>(line, &pos));
-
- parser.check <SPACE>(line, &pos, true);
-
- // ("+" / "-") 4digit
- int sign = 1;
-
- if (!(parser.check <one_char <'+'> >(line, &pos, true)))
- parser.check <one_char <'-'> >(line, &pos);
-
- utility::auto_ptr <number> nz(parser.get <number>(line, &pos));
-
- parser.check <one_char <'"'> >(line, &pos);
-
-
- m_datetime.setHour(std::min(std::max(nh->value(), 0u), 23u));
- m_datetime.setMinute(std::min(std::max(nmi->value(), 0u), 59u));
- m_datetime.setSecond(std::min(std::max(ns->value(), 0u), 59u));
-
- const int zone = static_cast <int>(nz->value());
- const int zh = zone / 100; // hour offset
- const int zm = zone % 100; // minute offset
-
- m_datetime.setZone(((zh * 60) + zm) * sign);
-
- m_datetime.setDay(std::min(std::max(nd->value(), 1u), 31u));
- m_datetime.setYear(ny->value());
-
- const string month(stringUtils::toLower(amo->value()));
- int mon = vmime::datetime::JANUARY;
-
- if (month.length() >= 3)
- {
- switch (month[0])
- {
- case 'j':
- {
- switch (month[1])
- {
- case 'a': mon = vmime::datetime::JANUARY; break;
- case 'u':
- {
- switch (month[2])
- {
- case 'n': mon = vmime::datetime::JUNE; break;
- default: mon = vmime::datetime::JULY; break;
- }
-
- break;
- }
-
- }
-
- break;
- }
- case 'f': mon = vmime::datetime::FEBRUARY; break;
- case 'm':
- {
- switch (month[2])
- {
- case 'r': mon = vmime::datetime::MARCH; break;
- default: mon = vmime::datetime::MAY; break;
- }
-
- break;
- }
- case 'a':
- {
- switch (month[1])
- {
- case 'p': mon = vmime::datetime::APRIL; break;
- default: mon = vmime::datetime::AUGUST; break;
- }
-
- break;
- }
- case 's': mon = vmime::datetime::SEPTEMBER; break;
- case 'o': mon = vmime::datetime::OCTOBER; break;
- case 'n': mon = vmime::datetime::NOVEMBER; break;
- case 'd': mon = vmime::datetime::DECEMBER; break;
- }
- }
-
- m_datetime.setMonth(mon);
-
- *currentPos = pos;
- }
-
- private:
-
- vmime::datetime m_datetime;
- };
-
-
- //
- // header_fld_name ::= astring
- //
-
- typedef astring header_fld_name;
-
-
- //
- // header_list ::= "(" 1#header_fld_name ")"
- //
-
- class header_list : public component
- {
- public:
-
- ~header_list()
- {
- for (std::vector <header_fld_name*>::iterator it = m_fld_names.begin() ;
- it != m_fld_names.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("header_list");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'('> >(line, &pos);
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- {
- m_fld_names.push_back(parser.get <header_fld_name>(line, &pos));
- parser.check <SPACE>(line, &pos, true);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <header_fld_name*> m_fld_names;
-
- public:
-
- const std::vector <header_fld_name*>& fld_names() const { return (m_fld_names); }
- };
-
-
- //
- // body_extension ::= nstring / number / "(" 1#body_extension ")"
- // ;; Future expansion. Client implementations
- // ;; MUST accept body_extension fields. Server
- // ;; implementations MUST NOT generate
- // ;; body_extension fields except as defined by
- // ;; future standard or standards-track
- // ;; revisions of this specification.
- //
-
- class body_extension : public component
- {
- public:
-
- body_extension()
- : m_nstring(NULL), m_number(NULL)
- {
- }
-
- ~body_extension()
- {
- delete (m_nstring);
- delete (m_number);
-
- for (std::vector <body_extension*>::iterator it = m_body_extensions.begin() ;
- it != m_body_extensions.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- string::size_type pos = *currentPos;
-
- if (parser.check <one_char <'('> >(line, &pos, true))
- {
- m_body_extensions.push_back
- (parser.get <body_extension>(line, &pos));
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- m_body_extensions.push_back(parser.get <body_extension>(line, &pos, true));
- }
- else
- {
- if (!(m_nstring = parser.get <IMAPParser::nstring>(line, &pos, true)))
- m_number = parser.get <IMAPParser::number>(line, &pos);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::nstring* m_nstring;
- IMAPParser::number* m_number;
-
- std::vector <body_extension*> m_body_extensions;
-
- public:
-
- IMAPParser::nstring* nstring() const { return (m_nstring); }
- IMAPParser::number* number() const { return (m_number); }
-
- const std::vector <body_extension*>& body_extensions() const { return (m_body_extensions); }
- };
-
-
- //
- // section_text ::= "HEADER" / "HEADER.FIELDS" [".NOT"]
- // SPACE header_list / "TEXT" / "MIME"
- //
-
- class section_text : public component
- {
- public:
-
- section_text()
- : m_header_list(NULL)
- {
- }
-
- ~section_text()
- {
- delete (m_header_list);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("section_text");
-
- string::size_type pos = *currentPos;
-
- // "HEADER.FIELDS" [".NOT"] SPACE header_list
- const bool b1 = parser.checkWithArg <special_atom>(line, &pos, "header.fields.not", true);
- const bool b2 = (b1 ? false : parser.checkWithArg <special_atom>(line, &pos, "header.fields", true));
-
- if (b1 || b2)
- {
- m_type = b1 ? HEADER_FIELDS_NOT : HEADER_FIELDS;
-
- parser.check <SPACE>(line, &pos);
- m_header_list = parser.get <IMAPParser::header_list>(line, &pos);
- }
- // "HEADER"
- else if (parser.checkWithArg <special_atom>(line, &pos, "header", true))
- {
- m_type = HEADER;
- }
- // "MIME"
- else if (parser.checkWithArg <special_atom>(line, &pos, "mime", true))
- {
- m_type = MIME;
- }
- // "TEXT"
- else
- {
- m_type = TEXT;
-
- parser.checkWithArg <special_atom>(line, &pos, "text");
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- HEADER,
- HEADER_FIELDS,
- HEADER_FIELDS_NOT,
- MIME,
- TEXT
- };
-
- private:
-
- Type m_type;
- IMAPParser::header_list* m_header_list;
-
- public:
-
- const Type type() const { return (m_type); }
- const IMAPParser::header_list* header_list() const { return (m_header_list); }
- };
-
-
- //
- // section ::= "[" [section_text / (nz_number *["." nz_number]
- // ["." (section_text / "MIME")])] "]"
- //
-
- class section : public component
- {
- public:
-
- section()
- : m_section_text1(NULL), m_section_text2(NULL)
- {
- }
-
- ~section()
- {
- delete (m_section_text1);
- delete (m_section_text2);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("section");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'['> >(line, &pos);
-
- if (!parser.check <one_char <']'> >(line, &pos, true))
- {
- if (!(m_section_text1 = parser.get <section_text>(line, &pos, true)))
- {
- nz_number* num = parser.get <nz_number>(line, &pos);
- m_nz_numbers.push_back(num->value());
- delete (num);
-
- while (parser.check <one_char <'.'> >(line, &pos, true))
- {
- if ((num = parser.get <nz_number>(line, &pos, true)))
- {
- m_nz_numbers.push_back(num->value());
- delete (num);
- }
- else
- {
- m_section_text2 = parser.get <section_text>(line, &pos);
- break;
- }
- }
- }
-
- parser.check <one_char <']'> >(line, &pos);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- section_text* m_section_text1;
- section_text* m_section_text2;
- std::vector <unsigned int> m_nz_numbers;
-
- public:
-
- const section_text* section_text1() const { return (m_section_text1); }
- const section_text* section_text2() const { return (m_section_text2); }
- const std::vector <unsigned int>& nz_numbers() const { return (m_nz_numbers); }
- };
-
-
- //
- // addr_adl ::= nstring
- // ;; Holds route from [RFC-822] route-addr if
- // ;; non-NIL
- //
- // addr_host ::= nstring
- // ;; NIL indicates [RFC-822] group syntax.
- // ;; Otherwise, holds [RFC-822] domain name
- //
- // addr_mailbox ::= nstring
- // ;; NIL indicates end of [RFC-822] group; if
- // ;; non-NIL and addr_host is NIL, holds
- // ;; [RFC-822] group name.
- // ;; Otherwise, holds [RFC-822] local-part
- //
- // addr_name ::= nstring
- // ;; Holds phrase from [RFC-822] mailbox if
- // ;; non-NIL
- //
- // address ::= "(" addr_name SPACE addr_adl SPACE addr_mailbox
- // SPACE addr_host ")"
- //
-
- class address : public component
- {
- public:
-
- address()
- : m_addr_name(NULL), m_addr_adl(NULL),
- m_addr_mailbox(NULL), m_addr_host(NULL)
- {
- }
-
- ~address()
- {
- delete (m_addr_name);
- delete (m_addr_adl);
- delete (m_addr_mailbox);
- delete (m_addr_host);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("address");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'('> >(line, &pos);
- m_addr_name = parser.get <nstring>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_addr_adl = parser.get <nstring>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_addr_mailbox = parser.get <nstring>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_addr_host = parser.get <nstring>(line, &pos);
- parser.check <one_char <')'> >(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- nstring* m_addr_name;
- nstring* m_addr_adl;
- nstring* m_addr_mailbox;
- nstring* m_addr_host;
-
- public:
-
- nstring* addr_name() const { return (m_addr_name); }
- nstring* addr_adl() const { return (m_addr_adl); }
- nstring* addr_mailbox() const { return (m_addr_mailbox); }
- nstring* addr_host() const { return (m_addr_host); }
- };
-
-
- //
- // address_list ::= "(" 1*address ")" / nil
- //
-
- class address_list : public component
- {
- public:
-
- ~address_list()
- {
- for (std::vector <address*>::iterator it = m_addresses.begin() ;
- it != m_addresses.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("address_list");
-
- string::size_type pos = *currentPos;
-
- if (!parser.check <NIL>(line, &pos, true))
- {
- parser.check <one_char <'('> >(line, &pos);
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- {
- m_addresses.push_back(parser.get <address>(line, &pos));
- parser.check <SPACE>(line, &pos, true);
- }
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <address*> m_addresses;
-
- public:
-
- const std::vector <address*>& addresses() const { return (m_addresses); }
- };
-
-
- //
- // env_bcc ::= "(" 1*address ")" / nil
- //
-
- typedef address_list env_bcc;
-
-
- //
- // env_cc ::= "(" 1*address ")" / nil
- //
-
- typedef address_list env_cc;
-
-
- //
- // env_date ::= nstring
- //
-
- typedef nstring env_date;
-
-
- //
- // env_from ::= "(" 1*address ")" / nil
- //
-
- typedef address_list env_from;
-
-
- //
- // env_in_reply_to ::= nstring
- //
-
- typedef nstring env_in_reply_to;
-
-
- //
- // env_message_id ::= nstring
- //
-
- typedef nstring env_message_id;
-
-
- //
- // env_reply_to ::= "(" 1*address ")" / nil
- //
-
- typedef address_list env_reply_to;
-
-
- //
- // env_sender ::= "(" 1*address ")" / nil
- //
-
- typedef address_list env_sender;
-
-
- //
- // env_subject ::= nstring
- //
-
- typedef nstring env_subject;
-
-
- //
- // env_to ::= "(" 1*address ")" / nil
- //
-
- typedef address_list env_to;
-
-
- //
- // envelope ::= "(" env_date SPACE env_subject SPACE env_from
- // SPACE env_sender SPACE env_reply_to SPACE env_to
- // SPACE env_cc SPACE env_bcc SPACE env_in_reply_to
- // SPACE env_message_id ")"
- //
-
- class envelope : public component
- {
- public:
-
- envelope()
- : m_env_date(NULL), m_env_subject(NULL),
- m_env_from(NULL), m_env_sender(NULL), m_env_reply_to(NULL),
- m_env_to(NULL), m_env_cc(NULL), m_env_bcc(NULL),
- m_env_in_reply_to(NULL), m_env_message_id(NULL)
- {
- }
-
- ~envelope()
- {
- delete (m_env_date);
- delete (m_env_subject);
- delete (m_env_from);
- delete (m_env_sender);
- delete (m_env_reply_to);
- delete (m_env_to);
- delete (m_env_cc);
- delete (m_env_bcc);
- delete (m_env_in_reply_to);
- delete (m_env_message_id);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("envelope");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'('> >(line, &pos);
-
- m_env_date = parser.get <IMAPParser::env_date>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_subject = parser.get <IMAPParser::env_subject>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_from = parser.get <IMAPParser::env_from>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_sender = parser.get <IMAPParser::env_sender>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_reply_to = parser.get <IMAPParser::env_reply_to>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_to = parser.get <IMAPParser::env_to>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_cc = parser.get <IMAPParser::env_cc>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_bcc = parser.get <IMAPParser::env_bcc>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_in_reply_to = parser.get <IMAPParser::env_in_reply_to>(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_env_message_id = parser.get <IMAPParser::env_message_id>(line, &pos);
-
- parser.check <one_char <')'> >(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::env_date* m_env_date;
- IMAPParser::env_subject* m_env_subject;
- IMAPParser::env_from* m_env_from;
- IMAPParser::env_sender* m_env_sender;
- IMAPParser::env_reply_to* m_env_reply_to;
- IMAPParser::env_to* m_env_to;
- IMAPParser::env_cc* m_env_cc;
- IMAPParser::env_bcc* m_env_bcc;
- IMAPParser::env_in_reply_to* m_env_in_reply_to;
- IMAPParser::env_message_id* m_env_message_id;
-
- public:
-
- const IMAPParser::env_date* env_date() const { return (m_env_date); }
- const IMAPParser::env_subject* env_subject() const { return (m_env_subject); }
- const IMAPParser::env_from* env_from() const { return (m_env_from); }
- const IMAPParser::env_sender* env_sender() const { return (m_env_sender); }
- const IMAPParser::env_reply_to* env_reply_to() const { return (m_env_reply_to); }
- const IMAPParser::env_to* env_to() const { return (m_env_to); }
- const IMAPParser::env_cc* env_cc() const { return (m_env_cc); }
- const IMAPParser::env_bcc* env_bcc() const { return (m_env_bcc); }
- const IMAPParser::env_in_reply_to* env_in_reply_to() const { return (m_env_in_reply_to); }
- const IMAPParser::env_message_id* env_message_id() const { return (m_env_message_id); }
- };
-
-
- //
- // body_fld_desc ::= nstring
- //
-
- typedef nstring body_fld_desc;
-
-
- //
- // body_fld_id ::= nstring
- //
-
- typedef nstring body_fld_id;
-
-
- //
- // body_fld_md5 ::= nstring
- //
-
- typedef nstring body_fld_md5;
-
-
- //
- // body_fld_octets ::= number
- //
-
- typedef number body_fld_octets;
-
-
- //
- // body_fld_lines ::= number
- //
-
- typedef number body_fld_lines;
-
-
- //
- // body_fld_enc ::= (<"> ("7BIT" / "8BIT" / "BINARY" / "BASE64"/
- // "QUOTED-PRINTABLE") <">) / string
- //
-
- typedef xstring body_fld_enc;
-
-
- //
- // body_fld_param_item ::= string SPACE string
- //
-
- class body_fld_param_item : public component
- {
- public:
-
- body_fld_param_item()
- : m_string1(NULL), m_string2(NULL)
- {
- }
-
- ~body_fld_param_item()
- {
- delete (m_string1);
- delete (m_string2);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_fld_param_item");
-
- string::size_type pos = *currentPos;
-
- m_string1 = parser.get <xstring>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_string2 = parser.get <xstring>(line, &pos);
-
- DEBUG_FOUND("body_fld_param_item", "<" << m_string1->value() << ", " << m_string2->value() << ">");
-
- *currentPos = pos;
- }
-
- private:
-
- xstring* m_string1;
- xstring* m_string2;
-
- public:
-
- const xstring* string1() const { return (m_string1); }
- const xstring* string2() const { return (m_string2); }
- };
-
-
- //
- // body_fld_param ::= "(" 1#(body_fld_param_item) ")" / nil
- //
-
- class body_fld_param : public component
- {
- public:
-
- ~body_fld_param()
- {
- for (std::vector <body_fld_param_item*>::iterator it = m_items.begin() ;
- it != m_items.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_fld_param");
-
- string::size_type pos = *currentPos;
-
- if (!parser.check <NIL>(line, &pos, true))
- {
- parser.check <one_char <'('> >(line, &pos);
-
- m_items.push_back(parser.get <body_fld_param_item>(line, &pos));
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- {
- parser.check <SPACE>(line, &pos);
- m_items.push_back(parser.get <body_fld_param_item>(line, &pos));
- }
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <body_fld_param_item*> m_items;
-
- public:
-
- const std::vector <body_fld_param_item*>& items() const { return (m_items); }
- };
-
-
- //
- // body_fld_dsp ::= "(" string SPACE body_fld_param ")" / nil
- //
-
- class body_fld_dsp : public component
- {
- public:
-
- body_fld_dsp()
- : m_string(NULL), m_body_fld_param(NULL)
- {
- }
-
- ~body_fld_dsp()
- {
- delete (m_string);
- delete (m_body_fld_param);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_fld_dsp");
-
- string::size_type pos = *currentPos;
-
- if (!parser.check <NIL>(line, &pos, true))
- {
- parser.check <one_char <'('> >(line, &pos);
- m_string = parser.get <xstring>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_param = parser.get <class body_fld_param>(line, &pos);
- parser.check <one_char <')'> >(line, &pos);
- }
-
- *currentPos = pos;
- }
-
- private:
-
- class xstring* m_string;
- class body_fld_param* m_body_fld_param;
-
- public:
-
- const class xstring* str() const { return (m_string); }
- const class body_fld_param* body_fld_param() const { return (m_body_fld_param); }
- };
-
-
- //
- // body_fld_lang ::= nstring / "(" 1#string ")"
- //
-
- class body_fld_lang : public component
- {
- public:
-
- ~body_fld_lang()
- {
- for (std::vector <xstring*>::iterator it = m_strings.begin() ;
- it != m_strings.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_fld_lang");
-
- string::size_type pos = *currentPos;
-
- if (parser.check <one_char <'('> >(line, &pos, true))
- {
- m_strings.push_back(parser.get <class xstring>(line, &pos));
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- m_strings.push_back(parser.get <class xstring>(line, &pos));
- }
- else
- {
- m_strings.push_back(parser.get <class nstring>(line, &pos));
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <xstring*> m_strings;
-
- public:
-
- const std::vector <xstring*>& strings() const { return (m_strings); }
- };
-
-
- //
- // body_fields ::= body_fld_param SPACE body_fld_id SPACE
- // body_fld_desc SPACE body_fld_enc SPACE
- // body_fld_octets
- //
-
- class body_fields : public component
- {
- public:
-
- body_fields()
- : m_body_fld_param(NULL), m_body_fld_id(NULL),
- m_body_fld_desc(NULL), m_body_fld_enc(NULL), m_body_fld_octets(NULL)
- {
- }
-
- ~body_fields()
- {
- delete (m_body_fld_param);
- delete (m_body_fld_id);
- delete (m_body_fld_desc);
- delete (m_body_fld_enc);
- delete (m_body_fld_octets);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_fields");
-
- string::size_type pos = *currentPos;
-
- m_body_fld_param = parser.get <IMAPParser::body_fld_param>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_id = parser.get <IMAPParser::body_fld_id>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_desc = parser.get <IMAPParser::body_fld_desc>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_enc = parser.get <IMAPParser::body_fld_enc>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_octets = parser.get <IMAPParser::body_fld_octets>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::body_fld_param* m_body_fld_param;
- IMAPParser::body_fld_id* m_body_fld_id;
- IMAPParser::body_fld_desc* m_body_fld_desc;
- IMAPParser::body_fld_enc* m_body_fld_enc;
- IMAPParser::body_fld_octets* m_body_fld_octets;
-
- public:
-
- const IMAPParser::body_fld_param* body_fld_param() const { return (m_body_fld_param); }
- const IMAPParser::body_fld_id* body_fld_id() const { return (m_body_fld_id); }
- const IMAPParser::body_fld_desc* body_fld_desc() const { return (m_body_fld_desc); }
- const IMAPParser::body_fld_enc* body_fld_enc() const { return (m_body_fld_enc); }
- const IMAPParser::body_fld_octets* body_fld_octets() const { return (m_body_fld_octets); }
- };
-
-
- //
- // media_subtype ::= string
- // ;; Defined in [MIME-IMT]
- //
-
- typedef xstring media_subtype;
-
-
- //
- // media_text ::= <"> "TEXT" <"> SPACE media_subtype
- // ;; Defined in [MIME-IMT]
- //
-
- class media_text : public component
- {
- public:
-
- media_text()
- : m_media_subtype(NULL)
- {
- }
-
- ~media_text()
- {
- delete (m_media_subtype);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("media_text");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'"'> >(line, &pos);
- parser.checkWithArg <special_atom>(line, &pos, "text");
- parser.check <one_char <'"'> >(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_media_subtype = parser.get <IMAPParser::media_subtype>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::media_subtype* m_media_subtype;
-
- public:
-
- const IMAPParser::media_subtype* media_subtype() const { return (m_media_subtype); }
- };
-
-
- //
- // media_message ::= <"> "MESSAGE" <"> SPACE <"> "RFC822" <">
- // ;; Defined in [MIME-IMT]
- //
-
- class media_message : public component
- {
- public:
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("media_message");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'"'> >(line, &pos);
- parser.checkWithArg <special_atom>(line, &pos, "message");
- parser.check <one_char <'"'> >(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- //parser.check <one_char <'"'> >(line, &pos);
- //parser.checkWithArg <special_atom>(line, &pos, "rfc822");
- //parser.check <one_char <'"'> >(line, &pos);
-
- m_media_subtype = parser.get <IMAPParser::media_subtype>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::media_subtype* m_media_subtype;
-
- public:
-
- const IMAPParser::media_subtype* media_subtype() const { return (m_media_subtype); }
- };
-
-
- //
- // media_basic ::= (<"> ("APPLICATION" / "AUDIO" / "IMAGE" /
- // "MESSAGE" / "VIDEO") <">) / string)
- // SPACE media_subtype
- // ;; Defined in [MIME-IMT]
-
- class media_basic : public component
- {
- public:
-
- media_basic()
- : m_media_type(NULL), m_media_subtype(NULL)
- {
- }
-
- ~media_basic()
- {
- delete (m_media_type);
- delete (m_media_subtype);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("media_basic");
-
- string::size_type pos = *currentPos;
-
- m_media_type = parser.get <xstring>(line, &pos);
-
- parser.check <SPACE>(line, &pos);
-
- m_media_subtype = parser.get <IMAPParser::media_subtype>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::xstring* m_media_type;
- IMAPParser::media_subtype* m_media_subtype;
-
- public:
-
- const IMAPParser::xstring* media_type() const { return (m_media_type); }
- const IMAPParser::media_subtype* media_subtype() const { return (m_media_subtype); }
- };
-
-
- //
- // body_ext_1part ::= body_fld_md5 [SPACE body_fld_dsp
- // [SPACE body_fld_lang
- // [SPACE 1#body_extension]]]
- // ;; MUST NOT be returned on non-extensible
- // ;; "BODY" fetch
- //
-
- class body_ext_1part : public component
- {
- public:
-
- body_ext_1part()
- : m_body_fld_md5(NULL), m_body_fld_dsp(NULL), m_body_fld_lang(NULL)
- {
- }
-
- ~body_ext_1part()
- {
- delete (m_body_fld_md5);
- delete (m_body_fld_dsp);
- delete (m_body_fld_lang);
-
- for (std::vector <body_extension*>::iterator it = m_body_extensions.begin() ;
- it != m_body_extensions.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_ext_1part");
-
- string::size_type pos = *currentPos;
-
- m_body_fld_md5 = parser.get <IMAPParser::body_fld_md5>(line, &pos);
-
- // [SPACE body_fld_dsp
- if (parser.check <SPACE>(line, &pos, true))
- {
- m_body_fld_dsp = parser.get <IMAPParser::body_fld_dsp>(line, &pos);
-
- // [SPACE body_fld_lang
- if (parser.check <SPACE>(line, &pos, true))
- {
- m_body_fld_lang = parser.get <IMAPParser::body_fld_lang>(line, &pos);
-
- // [SPACE 1#body_extension]
- if (parser.check <SPACE>(line, &pos, true))
- {
- m_body_extensions.push_back
- (parser.get <body_extension>(line, &pos));
-
- body_extension* ext = NULL;
-
- while ((ext = parser.get <body_extension>(line, &pos, true)) != NULL)
- m_body_extensions.push_back(ext);
- }
- }
- }
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::body_fld_md5* m_body_fld_md5;
- IMAPParser::body_fld_dsp* m_body_fld_dsp;
- IMAPParser::body_fld_lang* m_body_fld_lang;
-
- std::vector <body_extension*> m_body_extensions;
-
- public:
-
- const IMAPParser::body_fld_md5* body_fld_md5() const { return (m_body_fld_md5); }
- const IMAPParser::body_fld_dsp* body_fld_dsp() const { return (m_body_fld_dsp); }
- const IMAPParser::body_fld_lang* body_fld_lang() const { return (m_body_fld_lang); }
-
- const std::vector <body_extension*> body_extensions() const { return (m_body_extensions); }
- };
-
-
- //
- // body_ext_mpart ::= body_fld_param
- // [SPACE body_fld_dsp SPACE body_fld_lang
- // [SPACE 1#body_extension]]
- // ;; MUST NOT be returned on non-extensible
- // ;; "BODY" fetch
-
- class body_ext_mpart : public component
- {
- public:
-
- body_ext_mpart()
- : m_body_fld_param(NULL), m_body_fld_dsp(NULL), m_body_fld_lang(NULL)
- {
- }
-
- ~body_ext_mpart()
- {
- delete (m_body_fld_param);
- delete (m_body_fld_dsp);
- delete (m_body_fld_lang);
-
- for (std::vector <body_extension*>::iterator it = m_body_extensions.begin() ;
- it != m_body_extensions.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_ext_mpart");
-
- string::size_type pos = *currentPos;
-
- m_body_fld_param = parser.get <IMAPParser::body_fld_param>(line, &pos);
-
- // [SPACE body_fld_dsp SPACE body_fld_lang [SPACE 1#body_extension]]
- if (parser.check <SPACE>(line, &pos, true))
- {
- m_body_fld_dsp = parser.get <IMAPParser::body_fld_dsp>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_lang = parser.get <IMAPParser::body_fld_lang>(line, &pos);
-
- // [SPACE 1#body_extension]
- if (parser.check <SPACE>(line, &pos, true))
- {
- m_body_extensions.push_back
- (parser.get <body_extension>(line, &pos));
-
- body_extension* ext = NULL;
-
- while ((ext = parser.get <body_extension>(line, &pos, true)) != NULL)
- m_body_extensions.push_back(ext);
- }
- }
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::body_fld_param* m_body_fld_param;
- IMAPParser::body_fld_dsp* m_body_fld_dsp;
- IMAPParser::body_fld_lang* m_body_fld_lang;
-
- std::vector <body_extension*> m_body_extensions;
-
- public:
-
- const IMAPParser::body_fld_param* body_fld_param() const { return (m_body_fld_param); }
- const IMAPParser::body_fld_dsp* body_fld_dsp() const { return (m_body_fld_dsp); }
- const IMAPParser::body_fld_lang* body_fld_lang() const { return (m_body_fld_lang); }
-
- const std::vector <body_extension*> body_extensions() const { return (m_body_extensions); }
- };
-
-
- //
- // body_type_basic ::= media_basic SPACE body_fields
- // ;; MESSAGE subtype MUST NOT be "RFC822"
- //
-
- class body_type_basic : public component
- {
- public:
-
- body_type_basic()
- : m_media_basic(NULL), m_body_fields(NULL)
- {
- }
-
- ~body_type_basic()
- {
- delete (m_media_basic);
- delete (m_body_fields);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_type_basic");
-
- string::size_type pos = *currentPos;
-
- m_media_basic = parser.get <IMAPParser::media_basic>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fields = parser.get <IMAPParser::body_fields>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::media_basic* m_media_basic;
- IMAPParser::body_fields* m_body_fields;
-
- public:
-
- const IMAPParser::media_basic* media_basic() const { return (m_media_basic); }
- const IMAPParser::body_fields* body_fields() const { return (m_body_fields); }
- };
-
-
- //
- // body_type_msg ::= media_message SPACE body_fields SPACE envelope
- // SPACE body SPACE body_fld_lines
- //
-
- class xbody;
- typedef xbody body;
-
- class body_type_msg : public component
- {
- public:
-
- body_type_msg()
- : m_media_message(NULL), m_body_fields(NULL),
- m_envelope(NULL), m_body(NULL), m_body_fld_lines(NULL)
- {
- }
-
- ~body_type_msg()
- {
- delete (m_media_message);
- delete (m_body_fields);
- delete (m_envelope);
- delete (m_body);
- delete (m_body_fld_lines);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_type_msg");
-
- string::size_type pos = *currentPos;
-
- m_media_message = parser.get <IMAPParser::media_message>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fields = parser.get <IMAPParser::body_fields>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_envelope = parser.get <IMAPParser::envelope>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body = parser.get <IMAPParser::xbody>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_lines = parser.get <IMAPParser::body_fld_lines>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::media_message* m_media_message;
- IMAPParser::body_fields* m_body_fields;
- IMAPParser::envelope* m_envelope;
- IMAPParser::xbody* m_body;
- IMAPParser::body_fld_lines* m_body_fld_lines;
-
- public:
-
- const IMAPParser::media_message* media_message() const { return (m_media_message); }
- const IMAPParser::body_fields* body_fields() const { return (m_body_fields); }
- const IMAPParser::envelope* envelope() const { return (m_envelope); }
- const IMAPParser::xbody* body() const { return (m_body); }
- const IMAPParser::body_fld_lines* body_fld_lines() const { return (m_body_fld_lines); }
- };
-
-
- //
- // body_type_text ::= media_text SPACE body_fields SPACE body_fld_lines
- //
-
- class body_type_text : public component
- {
- public:
-
- body_type_text()
- : m_media_text(NULL),
- m_body_fields(NULL), m_body_fld_lines(NULL)
- {
- }
-
- ~body_type_text()
- {
- delete (m_media_text);
- delete (m_body_fields);
- delete (m_body_fld_lines);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_type_text");
-
- string::size_type pos = *currentPos;
-
- m_media_text = parser.get <IMAPParser::media_text>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fields = parser.get <IMAPParser::body_fields>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_body_fld_lines = parser.get <IMAPParser::body_fld_lines>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::media_text* m_media_text;
- IMAPParser::body_fields* m_body_fields;
- IMAPParser::body_fld_lines* m_body_fld_lines;
-
- public:
-
- const IMAPParser::media_text* media_text() const { return (m_media_text); }
- const IMAPParser::body_fields* body_fields() const { return (m_body_fields); }
- const IMAPParser::body_fld_lines* body_fld_lines() const { return (m_body_fld_lines); }
- };
-
-
- //
- // body_type_1part ::= (body_type_basic / body_type_msg / body_type_text)
- // [SPACE body_ext_1part]
- //
-
- class body_type_1part : public component
- {
- public:
-
- body_type_1part()
- : m_body_type_basic(NULL), m_body_type_msg(NULL),
- m_body_type_text(NULL), m_body_ext_1part(NULL)
- {
- }
-
- ~body_type_1part()
- {
- delete (m_body_type_basic);
- delete (m_body_type_msg);
- delete (m_body_type_text);
-
- delete (m_body_ext_1part);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_type_1part");
-
- string::size_type pos = *currentPos;
-
- if (!(m_body_type_text = parser.get <IMAPParser::body_type_text>(line, &pos, true)))
- if (!(m_body_type_msg = parser.get <IMAPParser::body_type_msg>(line, &pos, true)))
- m_body_type_basic = parser.get <IMAPParser::body_type_basic>(line, &pos);
-
- if (parser.check <SPACE>(line, &pos, true))
- m_body_ext_1part = parser.get <IMAPParser::body_ext_1part>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::body_type_basic* m_body_type_basic;
- IMAPParser::body_type_msg* m_body_type_msg;
- IMAPParser::body_type_text* m_body_type_text;
-
- IMAPParser::body_ext_1part* m_body_ext_1part;
-
- public:
-
- const IMAPParser::body_type_basic* body_type_basic() const { return (m_body_type_basic); }
- const IMAPParser::body_type_msg* body_type_msg() const { return (m_body_type_msg); }
- const IMAPParser::body_type_text* body_type_text() const { return (m_body_type_text); }
-
- const IMAPParser::body_ext_1part* body_ext_1part() const { return (m_body_ext_1part); }
- };
-
-
- //
- // body_type_mpart ::= 1*body SPACE media_subtype
- // [SPACE body_ext_mpart]
- //
-
- class body_type_mpart : public component
- {
- public:
-
- body_type_mpart()
- : m_media_subtype(NULL), m_body_ext_mpart(NULL)
- {
- }
-
- ~body_type_mpart()
- {
- delete (m_media_subtype);
- delete (m_body_ext_mpart);
-
- for (std::vector <xbody*>::iterator it = m_list.begin() ;
- it != m_list.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body_type_mpart");
-
- string::size_type pos = *currentPos;
-
- m_list.push_back(parser.get <xbody>(line, &pos));
-
- for (xbody* b ; (b = parser.get <xbody>(line, &pos, true)) ; )
- m_list.push_back(b);
-
- parser.check <SPACE>(line, &pos);
-
- m_media_subtype = parser.get <IMAPParser::media_subtype>(line, &pos);
-
- if (parser.check <SPACE>(line, &pos, true))
- m_body_ext_mpart = parser.get <IMAPParser::body_ext_mpart>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::media_subtype* m_media_subtype;
- IMAPParser::body_ext_mpart* m_body_ext_mpart;
-
- std::vector <xbody*> m_list;
-
- public:
-
- const std::vector <IMAPParser::xbody*>& list() const { return (m_list); }
-
- const IMAPParser::media_subtype* media_subtype() const { return (m_media_subtype); }
- const IMAPParser::body_ext_mpart* body_ext_mpart() const { return (m_body_ext_mpart); }
- };
-
-
- //
- // xbody ::= "(" body_type_1part / body_type_mpart ")"
- //
-
- class xbody : public component
- {
- public:
-
- xbody()
- : m_body_type_1part(NULL), m_body_type_mpart(NULL)
- {
- }
-
- ~xbody()
- {
- delete (m_body_type_1part);
- delete (m_body_type_mpart);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("body");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'('> >(line, &pos);
-
- if (!(m_body_type_1part = parser.get <IMAPParser::body_type_1part>(line, &pos, true)))
- m_body_type_mpart = parser.get <IMAPParser::body_type_mpart>(line, &pos);
-
- parser.check <one_char <')'> >(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::body_type_1part* m_body_type_1part;
- IMAPParser::body_type_mpart* m_body_type_mpart;
-
- public:
-
- const IMAPParser::body_type_1part* body_type_1part() const { return (m_body_type_1part); }
- const IMAPParser::body_type_mpart* body_type_mpart() const { return (m_body_type_mpart); }
- };
-
-
- //
- // uniqueid ::= nz_number
- // ;; Strictly ascending
- //
- // msg_att_item ::= "ENVELOPE" SPACE envelope /
- // "FLAGS" SPACE "(" #(flag / "\Recent") ")" /
- // "INTERNALDATE" SPACE date_time /
- // "RFC822" [".HEADER" / ".TEXT"] SPACE nstring /
- // "RFC822.SIZE" SPACE number /
- // "BODY" ["STRUCTURE"] SPACE body /
- // "BODY" section ["<" number ">"] SPACE nstring /
- // "UID" SPACE uniqueid
- //
-
- class msg_att_item : public component
- {
- public:
-
- msg_att_item()
- : m_date_time(NULL), m_number(NULL), m_envelope(NULL),
- m_uniqueid(NULL), m_nstring(NULL), m_body(NULL), m_flag_list(NULL)
- {
- }
-
- ~msg_att_item()
- {
- delete (m_date_time);
- delete (m_number);
- delete (m_envelope);
- delete (m_uniqueid);
- delete (m_nstring);
- delete (m_body);
- delete (m_flag_list);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("msg_att_item");
-
- string::size_type pos = *currentPos;
-
- // "ENVELOPE" SPACE envelope
- if (parser.checkWithArg <special_atom>(line, &pos, "envelope", true))
- {
- m_type = ENVELOPE;
-
- parser.check <SPACE>(line, &pos);
- m_envelope = parser.get <IMAPParser::envelope>(line, &pos);
- }
- // "FLAGS" SPACE "(" #(flag / "\Recent") ")"
- else if (parser.checkWithArg <special_atom>(line, &pos, "flags", true))
- {
- m_type = FLAGS;
-
- parser.check <SPACE>(line, &pos);
-
- m_flag_list = parser.get <IMAPParser::flag_list>(line, &pos);
- }
- // "INTERNALDATE" SPACE date_time
- else if (parser.checkWithArg <special_atom>(line, &pos, "internaldate", true))
- {
- m_type = INTERNALDATE;
-
- parser.check <SPACE>(line, &pos);
- m_date_time = parser.get <IMAPParser::date_time>(line, &pos);
- }
- // "RFC822" ".HEADER" SPACE nstring
- else if (parser.checkWithArg <special_atom>(line, &pos, "rfc822.header", true))
- {
- m_type = RFC822_HEADER;
-
- parser.check <SPACE>(line, &pos);
-
- m_nstring = parser.get <IMAPParser::nstring>(line, &pos);
- }
- // "RFC822" ".TEXT" SPACE nstring
- else if (parser.checkWithArg <special_atom>(line, &pos, "rfc822.text", true))
- {
- m_type = RFC822_TEXT;
-
- parser.check <SPACE>(line, &pos);
-
- m_nstring = parser.getWithArgs <IMAPParser::nstring>
- (line, &pos, this, RFC822_TEXT);
- }
- // "RFC822.SIZE" SPACE number
- else if (parser.checkWithArg <special_atom>(line, &pos, "rfc822.size", true))
- {
- m_type = RFC822_SIZE;
-
- parser.check <SPACE>(line, &pos);
- m_number = parser.get <IMAPParser::number>(line, &pos);
- }
- // "RFC822" SPACE nstring
- else if (parser.checkWithArg <special_atom>(line, &pos, "rfc822", true))
- {
- m_type = RFC822;
-
- parser.check <SPACE>(line, &pos);
-
- m_nstring = parser.get <IMAPParser::nstring>(line, &pos);
- }
- // "BODY" "STRUCTURE" SPACE body
- else if (parser.checkWithArg <special_atom>(line, &pos, "bodystructure", true))
- {
- m_type = BODY_STRUCTURE;
-
- parser.check <SPACE>(line, &pos);
-
- m_body = parser.get <IMAPParser::body>(line, &pos);
- }
- // "BODY" section ["<" number ">"] SPACE nstring
- // "BODY" SPACE body
- else if (parser.checkWithArg <special_atom>(line, &pos, "body", true))
- {
- m_section = parser.get <IMAPParser::section>(line, &pos, true);
-
- // "BODY" section ["<" number ">"] SPACE nstring
- if (m_section != NULL)
- {
- m_type = BODY_SECTION;
-
- if (parser.check <one_char <'<'> >(line, &pos, true))
- {
- m_number = parser.get <IMAPParser::number>(line, &pos);
- parser.check <one_char <'>'> >(line, &pos);
- }
-
- parser.check <SPACE>(line, &pos);
-
- m_nstring = parser.getWithArgs <IMAPParser::nstring>
- (line, &pos, this, BODY_SECTION);
- }
- // "BODY" SPACE body
- else
- {
- m_type = BODY;
-
- parser.check <SPACE>(line, &pos);
-
- m_body = parser.get <IMAPParser::body>(line, &pos);
- }
- }
- // "UID" SPACE uniqueid
- else
- {
- m_type = UID;
-
- parser.checkWithArg <special_atom>(line, &pos, "uid");
- parser.check <SPACE>(line, &pos);
-
- m_uniqueid = parser.get <nz_number>(line, &pos);
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- ENVELOPE,
- FLAGS,
- INTERNALDATE,
- RFC822,
- RFC822_SIZE,
- RFC822_HEADER,
- RFC822_TEXT,
- BODY,
- BODY_SECTION,
- BODY_STRUCTURE,
- UID
- };
-
- private:
-
- Type m_type;
-
- IMAPParser::date_time* m_date_time;
- IMAPParser::number* m_number;
- IMAPParser::envelope* m_envelope;
- IMAPParser::nz_number* m_uniqueid;
- IMAPParser::nstring* m_nstring;
- IMAPParser::xbody* m_body;
- IMAPParser::flag_list* m_flag_list;
- IMAPParser::section* m_section;
-
- public:
-
- const Type type() const { return (m_type); }
-
- const IMAPParser::date_time* date_time() const { return (m_date_time); }
- const IMAPParser::number* number() const { return (m_number); }
- const IMAPParser::envelope* envelope() const { return (m_envelope); }
- const IMAPParser::nz_number* unique_id() const { return (m_uniqueid); }
- const IMAPParser::nstring* nstring() const { return (m_nstring); }
- const IMAPParser::xbody* body() const { return (m_body); }
- const IMAPParser::flag_list* flag_list() const { return (m_flag_list); }
- const IMAPParser::section* section() const { return (m_section); }
- };
-
-
- //
- // msg_att ::= "(" 1#(msg_att_item) ")"
- //
-
- class msg_att : public component
- {
- public:
-
- ~msg_att()
- {
- for (std::vector <msg_att_item*>::iterator it = m_items.begin() ;
- it != m_items.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("msg_att");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'('> >(line, &pos);
-
- m_items.push_back(parser.get <msg_att_item>(line, &pos));
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- {
- parser.check <SPACE>(line, &pos);
- m_items.push_back(parser.get <msg_att_item>(line, &pos));
- }
-
- *currentPos = pos;
- }
-
- private:
-
- std::vector <msg_att_item*> m_items;
-
- public:
-
- const std::vector <msg_att_item*>& items() const { return (m_items); }
- };
-
-
- //
- // message_data ::= nz_number SPACE ("EXPUNGE" /
- // ("FETCH" SPACE msg_att))
- //
-
- class message_data : public component
- {
- public:
-
- message_data()
- : m_number(0), m_msg_att(NULL)
- {
- }
-
- ~message_data()
- {
- delete (m_msg_att);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("message_data");
-
- string::size_type pos = *currentPos;
-
- nz_number* num = parser.get <nz_number>(line, &pos);
- m_number = num->value();
- delete (num);
-
- parser.check <SPACE>(line, &pos);
-
- if (parser.checkWithArg <special_atom>(line, &pos, "expunge", true))
- {
- m_type = EXPUNGE;
- }
- else
- {
- parser.checkWithArg <special_atom>(line, &pos, "fetch");
-
- parser.check <SPACE>(line, &pos);
-
- m_type = FETCH;
- m_msg_att = parser.get <IMAPParser::msg_att>(line, &pos);
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- EXPUNGE,
- FETCH
- };
-
- private:
-
- Type m_type;
- unsigned int m_number;
- IMAPParser::msg_att* m_msg_att;
-
- public:
-
- const Type type() const { return (m_type); }
- const unsigned int number() const { return (m_number); }
- const IMAPParser::msg_att* msg_att() const { return (m_msg_att); }
- };
-
-
- //
- // resp_cond_state ::= ("OK" / "NO" / "BAD") SPACE resp_text
- // ;; Status condition
- //
-
- class resp_cond_state : public component
- {
- public:
-
- resp_cond_state()
- : m_resp_text(NULL), m_status(BAD)
- {
- }
-
- ~resp_cond_state()
- {
- delete (m_resp_text);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("resp_cond_state");
-
- string::size_type pos = *currentPos;
-
- if (parser.checkWithArg <special_atom>(line, &pos, "ok", true))
- {
- m_status = OK;
- }
- else if (parser.checkWithArg <special_atom>(line, &pos, "no", true))
- {
- m_status = NO;
- }
- else
- {
- parser.checkWithArg <special_atom>(line, &pos, "bad");
- m_status = BAD;
- }
-
- parser.check <SPACE>(line, &pos);
-
- m_resp_text = parser.get <IMAPParser::resp_text>(line, &pos);
-
- *currentPos = pos;
- }
-
-
- enum Status
- {
- OK,
- NO,
- BAD
- };
-
- private:
-
- IMAPParser::resp_text* m_resp_text;
- Status m_status;
-
- public:
-
- const IMAPParser::resp_text* resp_text() const { return (m_resp_text); }
- const Status status() const { return (m_status); }
- };
-
-
- //
- // resp_cond_bye ::= "BYE" SPACE resp_text
- //
-
- class resp_cond_bye : public component
- {
- public:
-
- resp_cond_bye()
- : m_resp_text(NULL)
- {
- }
-
- ~resp_cond_bye()
- {
- delete (m_resp_text);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("resp_cond_bye");
-
- string::size_type pos = *currentPos;
-
- parser.checkWithArg <special_atom>(line, &pos, "bye");
-
- parser.check <SPACE>(line, &pos);
-
- m_resp_text = parser.get <IMAPParser::resp_text>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::resp_text* m_resp_text;
-
- public:
-
- const IMAPParser::resp_text* resp_text() const { return (m_resp_text); }
- };
-
-
- //
- // resp_cond_auth ::= ("OK" / "PREAUTH") SPACE resp_text
- // ;; Authentication condition
- //
-
- class resp_cond_auth : public component
- {
- public:
-
- resp_cond_auth()
- : m_resp_text(NULL)
- {
- }
-
- ~resp_cond_auth()
- {
- delete (m_resp_text);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("resp_cond_auth");
-
- string::size_type pos = *currentPos;
-
- if (parser.checkWithArg <special_atom>(line, &pos, "ok", true))
- {
- m_cond = OK;
- }
- else
- {
- parser.checkWithArg <special_atom>(line, &pos, "preauth");
-
- m_cond = PREAUTH;
- }
-
- parser.check <SPACE>(line, &pos);
-
- m_resp_text = parser.get <IMAPParser::resp_text>(line, &pos);
-
- *currentPos = pos;
- }
-
-
- enum Condition
- {
- OK,
- PREAUTH
- };
-
- private:
-
- Condition m_cond;
- IMAPParser::resp_text* m_resp_text;
-
- public:
-
- const Condition condition() const { return (m_cond); }
- const IMAPParser::resp_text* resp_text() const { return (m_resp_text); }
- };
-
-
- //
- // status_info ::= status_att SPACE number
- //
-
- class status_info : public component
- {
- public:
-
- status_info()
- : m_status_att(NULL), m_number(NULL)
- {
- }
-
- ~status_info()
- {
- delete (m_status_att);
- delete (m_number);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("status_info");
-
- string::size_type pos = *currentPos;
-
- m_status_att = parser.get <IMAPParser::status_att>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_number = parser.get <IMAPParser::number>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::status_att* m_status_att;
- IMAPParser::number* m_number;
-
- public:
-
- const IMAPParser::status_att* status_att() const { return (m_status_att); }
- const IMAPParser::number* number() const { return (m_number); }
- };
-
-
- //
- // mailbox_data ::= "FLAGS" SPACE mailbox_flag_list /
- // "LIST" SPACE mailbox_list /
- // "LSUB" SPACE mailbox_list /
- // "MAILBOX" SPACE text /
- // "SEARCH" [SPACE 1#nz_number] /
- // "STATUS" SPACE mailbox SPACE
- // "(" #<status_att number ")" /
- // number SPACE "EXISTS" /
- // number SPACE "RECENT"
- //
-
- class mailbox_data : public component
- {
- public:
-
- mailbox_data()
- : m_number(NULL), m_mailbox_flag_list(NULL), m_mailbox_list(NULL),
- m_mailbox(NULL), m_text(NULL)
- {
- }
-
- ~mailbox_data()
- {
- delete (m_number);
- delete (m_mailbox_flag_list);
- delete (m_mailbox_list);
- delete (m_mailbox);
- delete (m_text);
-
- for (std::vector <nz_number*>::iterator it = m_search_nz_number_list.begin() ;
- it != m_search_nz_number_list.end() ; ++it)
- {
- delete (*it);
- }
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("mailbox_data");
-
- string::size_type pos = *currentPos;
-
- m_number = parser.get <IMAPParser::number>(line, &pos, true);
-
- if (m_number)
- {
- parser.check <SPACE>(line, &pos);
-
- if (parser.checkWithArg <special_atom>(line, &pos, "exists", true))
- {
- m_type = EXISTS;
- }
- else
- {
- parser.checkWithArg <special_atom>(line, &pos, "recent");
-
- m_type = RECENT;
- }
- }
- else
- {
- // "FLAGS" SPACE mailbox_flag_list
- if (parser.checkWithArg <special_atom>(line, &pos, "flags", true))
- {
- parser.check <SPACE>(line, &pos);
-
- m_mailbox_flag_list = parser.get <IMAPParser::mailbox_flag_list>(line, &pos);
-
- m_type = FLAGS;
- }
- // "LIST" SPACE mailbox_list
- else if (parser.checkWithArg <special_atom>(line, &pos, "list", true))
- {
- parser.check <SPACE>(line, &pos);
-
- m_mailbox_list = parser.get <IMAPParser::mailbox_list>(line, &pos);
-
- m_type = LIST;
- }
- // "LSUB" SPACE mailbox_list
- else if (parser.checkWithArg <special_atom>(line, &pos, "lsub", true))
- {
- parser.check <SPACE>(line, &pos);
-
- m_mailbox_list = parser.get <IMAPParser::mailbox_list>(line, &pos);
-
- m_type = LSUB;
- }
- // "MAILBOX" SPACE text
- else if (parser.checkWithArg <special_atom>(line, &pos, "mailbox", true))
- {
- parser.check <SPACE>(line, &pos);
-
- m_text = parser.get <IMAPParser::text>(line, &pos);
-
- m_type = MAILBOX;
- }
- // "SEARCH" [SPACE 1#nz_number]
- else if (parser.checkWithArg <special_atom>(line, &pos, "search", true))
- {
- if (parser.check <SPACE>(line, &pos, true))
- {
- m_search_nz_number_list.push_back
- (parser.get <nz_number>(line, &pos));
-
- while (parser.check <SPACE>(line, &pos, true))
- {
- m_search_nz_number_list.push_back
- (parser.get <nz_number>(line, &pos));
- }
- }
-
- m_type = SEARCH;
- }
- // "STATUS" SPACE mailbox SPACE
- // "(" #<status_att number)] ")"
- //
- // "(" [status_att SPACE number *(SPACE status_att SPACE number)] ")"
- else
- {
- parser.checkWithArg <special_atom>(line, &pos, "status");
- parser.check <SPACE>(line, &pos);
-
- m_mailbox = parser.get <IMAPParser::mailbox>(line, &pos);
-
- parser.check <SPACE>(line, &pos);
- parser.check <one_char <'('> >(line, &pos);
-
- m_status_info_list.push_back(parser.get <status_info>(line, &pos));
-
- while (!parser.check <one_char <')'> >(line, &pos, true))
- m_status_info_list.push_back(parser.get <status_info>(line, &pos));
-
- m_type = STATUS;
- }
- }
-
- *currentPos = pos;
- }
-
-
- enum Type
- {
- FLAGS,
- LIST,
- LSUB,
- MAILBOX,
- SEARCH,
- STATUS,
- EXISTS,
- RECENT
- };
-
- private:
-
- Type m_type;
-
- IMAPParser::number* m_number;
- IMAPParser::mailbox_flag_list* m_mailbox_flag_list;
- IMAPParser::mailbox_list* m_mailbox_list;
- IMAPParser::mailbox* m_mailbox;
- IMAPParser::text* m_text;
- std::vector <nz_number*> m_search_nz_number_list;
- std::vector <status_info*> m_status_info_list;
-
- public:
-
- const Type type() const { return (m_type); }
-
- const IMAPParser::number* number() const { return (m_number); }
- const IMAPParser::mailbox_flag_list* mailbox_flag_list() const { return (m_mailbox_flag_list); }
- const IMAPParser::mailbox_list* mailbox_list() const { return (m_mailbox_list); }
- const IMAPParser::mailbox* mailbox() const { return (m_mailbox); }
- const IMAPParser::text* text() const { return (m_text); }
- const std::vector <nz_number*>& search_nz_number_list() const { return (m_search_nz_number_list); }
- const std::vector <status_info*>& status_info_list() const { return (m_status_info_list); }
- };
-
-
- //
- // response_data ::= "*" SPACE (resp_cond_state / resp_cond_bye /
- // mailbox_data / message_data / capability_data) CRLF
- //
-
- class response_data : public component
- {
- public:
-
- response_data()
- : m_resp_cond_state(NULL), m_resp_cond_bye(NULL),
- m_mailbox_data(NULL), m_message_data(NULL), m_capability_data(NULL)
- {
- }
-
- ~response_data()
- {
- delete (m_resp_cond_state);
- delete (m_resp_cond_bye);
- delete (m_mailbox_data);
- delete (m_message_data);
- delete (m_capability_data);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("response_data");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'*'> >(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- if (!(m_resp_cond_state = parser.get <IMAPParser::resp_cond_state>(line, &pos, true)))
- if (!(m_resp_cond_bye = parser.get <IMAPParser::resp_cond_bye>(line, &pos, true)))
- if (!(m_mailbox_data = parser.get <IMAPParser::mailbox_data>(line, &pos, true)))
- if (!(m_message_data = parser.get <IMAPParser::message_data>(line, &pos, true)))
- m_capability_data = parser.get <IMAPParser::capability_data>(line, &pos);
-
- parser.check <CRLF>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::resp_cond_state* m_resp_cond_state;
- IMAPParser::resp_cond_bye* m_resp_cond_bye;
- IMAPParser::mailbox_data* m_mailbox_data;
- IMAPParser::message_data* m_message_data;
- IMAPParser::capability_data* m_capability_data;
-
- public:
-
- const IMAPParser::resp_cond_state* resp_cond_state() const { return (m_resp_cond_state); }
- const IMAPParser::resp_cond_bye* resp_cond_bye() const { return (m_resp_cond_bye); }
- const IMAPParser::mailbox_data* mailbox_data() const { return (m_mailbox_data); }
- const IMAPParser::message_data* message_data() const { return (m_message_data); }
- const IMAPParser::capability_data* capability_data() const { return (m_capability_data); }
- };
-
-
- class continue_req_or_response_data : public component
- {
- public:
-
- continue_req_or_response_data()
- : m_continue_req(NULL), m_response_data(NULL)
- {
- }
-
- ~continue_req_or_response_data()
- {
- delete (m_continue_req);
- delete (m_response_data);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("continue_req_or_response_data");
-
- string::size_type pos = *currentPos;
-
- if (!(m_continue_req = parser.get <IMAPParser::continue_req>(line, &pos, true)))
- m_response_data = parser.get <IMAPParser::response_data>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::continue_req* m_continue_req;
- IMAPParser::response_data* m_response_data;
-
- public:
-
- const IMAPParser::continue_req* continue_req() const { return (m_continue_req); }
- const IMAPParser::response_data* response_data() const { return (m_response_data); }
- };
-
-
- //
- // response_fatal ::= "*" SPACE resp_cond_bye CRLF
- // ;; Server closes connection immediately
- //
-
- class response_fatal : public component
- {
- public:
-
- response_fatal()
- : m_resp_cond_bye(NULL)
- {
- }
-
- ~response_fatal()
- {
- delete (m_resp_cond_bye);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("response_fatal");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'*'> >(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- m_resp_cond_bye = parser.get <IMAPParser::resp_cond_bye>(line, &pos);
-
- parser.check <CRLF>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::resp_cond_bye* m_resp_cond_bye;
-
- public:
-
- const IMAPParser::resp_cond_bye* resp_cond_bye() const { return (m_resp_cond_bye); }
- };
-
-
- //
- // response_tagged ::= tag SPACE resp_cond_state CRLF
- //
-
- class response_tagged : public component
- {
- public:
-
- response_tagged()
- : m_resp_cond_state(NULL)
- {
- }
-
- ~response_tagged()
- {
- delete (m_resp_cond_state);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("response_tagged");
-
- string::size_type pos = *currentPos;
-
- parser.check <IMAPParser::xtag>(line, &pos);
- parser.check <SPACE>(line, &pos);
- m_resp_cond_state = parser.get <IMAPParser::resp_cond_state>(line, &pos);
- parser.check <CRLF>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::resp_cond_state* m_resp_cond_state;
-
- public:
-
- const IMAPParser::resp_cond_state* resp_cond_state() const { return (m_resp_cond_state); }
- };
-
-
- //
- // response_done ::= response_tagged / response_fatal
- //
-
- class response_done : public component
- {
- public:
-
- response_done()
- : m_response_tagged(NULL), m_response_fatal(NULL)
- {
- }
-
- ~response_done()
- {
- delete (m_response_tagged);
- delete (m_response_fatal);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("response_done");
-
- string::size_type pos = *currentPos;
-
- if (!(m_response_tagged = parser.get <IMAPParser::response_tagged>(line, &pos, true)))
- m_response_fatal = parser.get <IMAPParser::response_fatal>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::response_tagged* m_response_tagged;
- IMAPParser::response_fatal* m_response_fatal;
-
- public:
-
- const IMAPParser::response_tagged* response_tagged() const { return (m_response_tagged); }
- const IMAPParser::response_fatal* response_fatal() const { return (m_response_fatal); }
- };
-
-
- //
- // response ::= *(continue_req / response_data) response_done
- //
-
- class response : public component
- {
- public:
-
- response()
- : m_response_done(NULL)
- {
- }
-
- ~response()
- {
- for (std::vector <IMAPParser::continue_req_or_response_data*>::iterator
- it = m_continue_req_or_response_data.begin() ;
- it != m_continue_req_or_response_data.end() ; ++it)
- {
- delete (*it);
- }
-
- delete (m_response_done);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("response");
-
- string::size_type pos = *currentPos;
- string curLine = line;
- bool partial = false; // partial response
-
- IMAPParser::continue_req_or_response_data* resp = NULL;
-
- while ((resp = parser.get <IMAPParser::continue_req_or_response_data>(curLine, &pos, true)) != NULL)
- {
- m_continue_req_or_response_data.push_back(resp);
-
- // Partial response (continue_req)
- if (resp->continue_req())
- {
- partial = true;
- break;
- }
-
- // We have read a CRLF, read another line
- curLine = parser.readLine();
- pos = 0;
- }
-
- if (!partial)
- m_response_done = parser.get <IMAPParser::response_done>(curLine, &pos);
-
- *currentPos = pos;
- }
-
-
- const bool isBad() const
- {
- if (!response_done()) // incomplete (partial) response
- return (true);
-
- if (response_done()->response_fatal())
- return (true);
-
- if (response_done()->response_tagged()->resp_cond_state()->
- status() == IMAPParser::resp_cond_state::BAD)
- {
- return (true);
- }
-
- return (false);
- }
-
- private:
-
- std::vector <IMAPParser::continue_req_or_response_data*> m_continue_req_or_response_data;
- IMAPParser::response_done* m_response_done;
-
- public:
-
- const std::vector <IMAPParser::continue_req_or_response_data*>& continue_req_or_response_data() const { return (m_continue_req_or_response_data); }
- const IMAPParser::response_done* response_done() const { return (m_response_done); }
- };
-
-
- //
- // greeting ::= "*" SPACE (resp_cond_auth / resp_cond_bye) CRLF
- //
-
- class greeting : public component
- {
- public:
-
- greeting()
- : m_resp_cond_auth(NULL), m_resp_cond_bye(NULL)
- {
- }
-
- ~greeting()
- {
- delete (m_resp_cond_auth);
- delete (m_resp_cond_bye);
- }
-
- void go(IMAPParser& parser, string& line, string::size_type* currentPos)
- {
- DEBUG_ENTER_COMPONENT("greeting");
-
- string::size_type pos = *currentPos;
-
- parser.check <one_char <'*'> >(line, &pos);
- parser.check <SPACE>(line, &pos);
-
- if (!(m_resp_cond_auth = parser.get <IMAPParser::resp_cond_auth>(line, &pos, true)))
- m_resp_cond_bye = parser.get <IMAPParser::resp_cond_bye>(line, &pos);
-
- parser.check <CRLF>(line, &pos);
-
- *currentPos = pos;
- }
-
- private:
-
- IMAPParser::resp_cond_auth* m_resp_cond_auth;
- IMAPParser::resp_cond_bye* m_resp_cond_bye;
-
- public:
-
- const IMAPParser::resp_cond_auth* resp_cond_auth() const { return (m_resp_cond_auth); }
- const IMAPParser::resp_cond_bye* resp_cond_bye() const { return (m_resp_cond_bye); }
- };
-
-
-
- //
- // The main functions used to parse a response
- //
-
- response* readResponse(literalHandler* lh = NULL)
- {
- string::size_type pos = 0;
- string line = readLine();
-
- m_literalHandler = lh;
- response* resp = get <response>(line, &pos);
- m_literalHandler = NULL;
-
- return (resp);
- }
-
-
- greeting* readGreeting()
- {
- string::size_type pos = 0;
- string line = readLine();
-
- return get <greeting>(line, &pos);
- }
-
-
- //
- // Get a token and advance
- //
-
- template <class TYPE>
- TYPE* get(string& line, string::size_type* currentPos,
- const bool noThrow = false)
- {
- component* resp = new TYPE;
- return internalGet <TYPE>(resp, line, currentPos, noThrow);
- }
-
-
- template <class TYPE, class ARG1_TYPE, class ARG2_TYPE>
- TYPE* getWithArgs(string& line, string::size_type* currentPos,
- ARG1_TYPE arg1, ARG2_TYPE arg2, const bool noThrow = false)
- {
- component* resp = new TYPE(arg1, arg2);
- return internalGet <TYPE>(resp, line, currentPos, noThrow);
- }
-
-
-private:
-
- template <class TYPE>
- TYPE* internalGet(component* resp, string& line, string::size_type* currentPos,
- const bool noThrow = false)
- {
-#if DEBUG_RESPONSE
- DEBUG_RESPONSE_level += " ";
-#endif
-
- try
- {
- resp->go(*this, line, currentPos);
-
-#if DEBUG_RESPONSE
- std::cout << DEBUG_RESPONSE_level << "SUCCESS! (" << DEBUG_RESPONSE_components.back() << ")" << std::endl;
-
- DEBUG_RESPONSE_level.erase(DEBUG_RESPONSE_level.begin() + DEBUG_RESPONSE_level.length() - 1);
- DEBUG_RESPONSE_components.pop_back();
-#endif
- }
- catch (...)
- {
-#if DEBUG_RESPONSE
- std::cout << DEBUG_RESPONSE_level << "FAILED! (" << DEBUG_RESPONSE_components.back() << ")" << std::endl;
-
- DEBUG_RESPONSE_level.erase(DEBUG_RESPONSE_level.begin() + DEBUG_RESPONSE_level.length() - 1);
- DEBUG_RESPONSE_components.pop_back();
-#endif
-
- delete (resp);
- if (!noThrow) throw;
- return (NULL);
- }
-
- return static_cast <TYPE*>(resp);
- }
-
-
-public:
-
- //
- // Check a token and advance
- //
-
- template <class TYPE>
- const bool check(string& line, string::size_type* currentPos,
- const bool noThrow = false)
- {
- try
- {
- TYPE term;
- term.go(*this, line, currentPos);
-
-#if DEBUG_RESPONSE
- std::cout << DEBUG_RESPONSE_level << "SUCCESS! (" << DEBUG_RESPONSE_components.back() << ")" << std::endl;
- DEBUG_RESPONSE_components.pop_back();
-#endif
- }
- catch (...)
- {
-#if DEBUG_RESPONSE
- std::cout << DEBUG_RESPONSE_level << "FAILED! (" << DEBUG_RESPONSE_components.back() << ")" << std::endl;
- DEBUG_RESPONSE_components.pop_back();
-#endif
-
- if (!noThrow) throw;
- return false;
- }
-
- return true;
- }
-
- template <class TYPE, class ARG_TYPE>
- const bool checkWithArg(string& line, string::size_type* currentPos,
- const ARG_TYPE arg, const bool noThrow = false)
- {
- try
- {
- TYPE term(arg);
- term.go(*this, line, currentPos);
-
-#if DEBUG_RESPONSE
- std::cout << DEBUG_RESPONSE_level << "SUCCESS! (" << DEBUG_RESPONSE_components.back() << ")" << std::endl;
- DEBUG_RESPONSE_components.pop_back();
-#endif
- }
- catch (...)
- {
-#if DEBUG_RESPONSE
- std::cout << DEBUG_RESPONSE_level << "FAILED! (" << DEBUG_RESPONSE_components.back() << ")" << std::endl;
- DEBUG_RESPONSE_components.pop_back();
-#endif
-
- if (!noThrow) throw;
- return false;
- }
-
- return true;
- }
-
-
-private:
-
- IMAPTag* m_tag;
- socket* m_socket;
-
- progressionListener* m_progress;
-
- literalHandler* m_literalHandler;
-
- timeoutHandler* m_timeoutHandler;
-
-
- string m_buffer;
- int m_pos;
-
- string m_lastLine;
-
-public:
-
- //
- // Read one line
- //
-
- const string readLine()
- {
- string::size_type pos;
-
- while ((pos = m_buffer.find('\n')) == string::npos)
- {
- read();
- }
-
- string line;
- line.resize(pos + 1);
- std::copy(m_buffer.begin(), m_buffer.begin() + pos + 1, line.begin());
-
- m_buffer.erase(m_buffer.begin(), m_buffer.begin() + pos + 1);
-
- m_lastLine = line;
-
-#if DEBUG_RESPONSE
- std::cout << std::endl << "Read line:" << std::endl << line << std::endl;
-#endif
-
- return (line);
- }
-
-
- //
- // Read available data from socket stream
- //
-
- void read()
- {
- string receiveBuffer;
-
- while (receiveBuffer.empty())
- {
- // Check whether the time-out delay is elapsed
- if (m_timeoutHandler && m_timeoutHandler->isTimeOut())
- {
- if (!m_timeoutHandler->handleTimeOut())
- throw exceptions::operation_timed_out();
- }
-
- // We have received data: reset the time-out counter
- m_socket->receive(receiveBuffer);
-
- if (receiveBuffer.empty()) // buffer is empty
- {
- platformDependant::getHandler()->wait();
- continue;
- }
-
- // We have received data ...
- if (m_timeoutHandler)
- m_timeoutHandler->resetTimeOut();
- }
-
- m_buffer += receiveBuffer;
- }
-
-
- void readLiteral(literalHandler::target& buffer, string::size_type count)
- {
- string::size_type len = 0;
- string receiveBuffer;
-
- if (m_progress)
- m_progress->start(count);
-
- if (m_timeoutHandler)
- m_timeoutHandler->resetTimeOut();
-
- if (!m_buffer.empty())
- {
- if (m_buffer.length() > count)
- {
- buffer.putData(string(m_buffer.begin(), m_buffer.begin() + count));
- m_buffer.erase(m_buffer.begin(), m_buffer.begin() + count);
- len = count;
- }
- else
- {
- len += m_buffer.length();
- buffer.putData(m_buffer);
- m_buffer.clear();
- }
- }
-
- while (len < count)
- {
- // Check whether the time-out delay is elapsed
- if (m_timeoutHandler && m_timeoutHandler->isTimeOut())
- {
- if (!m_timeoutHandler->handleTimeOut())
- throw exceptions::operation_timed_out();
- }
-
- // Receive data from the socket
- m_socket->receive(receiveBuffer);
-
- if (receiveBuffer.empty()) // buffer is empty
- {
- platformDependant::getHandler()->wait();
- continue;
- }
-
- // We have received data: reset the time-out counter
- if (m_timeoutHandler)
- m_timeoutHandler->resetTimeOut();
-
- if (len + receiveBuffer.length() > count)
- {
- const string::size_type remaining = count - len;
-
- // Get the needed amount of data
- buffer.putData(string(receiveBuffer.begin(), receiveBuffer.begin() + remaining));
-
- // Put the remaining data into the internal response buffer
- receiveBuffer.erase(receiveBuffer.begin(), receiveBuffer.begin() + remaining);
- m_buffer += receiveBuffer;
-
- len = count;
- }
- else
- {
- buffer.putData(receiveBuffer);
- len += receiveBuffer.length();
- }
-
- // Notify progression
- if (m_progress)
- m_progress->progress(len, count);
- }
-
- if (m_progress)
- m_progress->stop(count);
- }
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_IMAPPARSER_HPP_INCLUDED
diff --git a/src/messaging/IMAPStore.cpp b/src/messaging/IMAPStore.cpp
index 482c559f..4ac50764 100644
--- a/src/messaging/IMAPStore.cpp
+++ b/src/messaging/IMAPStore.cpp
@@ -17,12 +17,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/IMAPStore.hpp"
-#include "messaging/IMAPFolder.hpp"
-#include "messaging/IMAPConnection.hpp"
+#include "vmime/messaging/IMAPStore.hpp"
+#include "vmime/messaging/IMAPFolder.hpp"
+#include "vmime/messaging/IMAPConnection.hpp"
-#include "exception.hpp"
-#include "platformDependant.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
#include <map>
diff --git a/src/messaging/IMAPStore.hpp b/src/messaging/IMAPStore.hpp
deleted file mode 100644
index 70f049b5..00000000
--- a/src/messaging/IMAPStore.hpp
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_IMAPSTORE_HPP_INCLUDED
-#define VMIME_MESSAGING_IMAPSTORE_HPP_INCLUDED
-
-
-#include "config.hpp"
-
-#include "messaging/store.hpp"
-#include "messaging/socket.hpp"
-#include "messaging/folder.hpp"
-
-#include <ostream>
-
-
-namespace vmime {
-namespace messaging {
-
-
-class IMAPParser;
-class IMAPTag;
-class IMAPConnection;
-
-
-/** IMAP store service.
- */
-
-class IMAPStore : public store
-{
- friend class IMAPFolder;
- friend class IMAPMessage;
-
-public:
-
- IMAPStore(session* sess, authenticator* auth);
- ~IMAPStore();
-
- const string getProtocolName() const;
-
- folder* getDefaultFolder();
- folder* getRootFolder();
- folder* getFolder(const folder::path& path);
-
- const bool isValidFolderName(const folder::path::component& name) const;
-
- static const serviceInfos& getInfosInstance();
- const serviceInfos& getInfos() const;
-
- void connect();
- const bool isConnected() const;
- void disconnect();
-
- void noop();
-
- const int getCapabilities() const;
-
-private:
-
- // Connection
- IMAPConnection* m_connection;
-
- // Used to request the authentication informations only the
- // first time, and reuse these informations the next time.
- class authenticator* m_oneTimeAuth;
-
-
-
- class authenticator* oneTimeAuthenticator();
-
-
- IMAPConnection* connection();
-
-
- void registerFolder(IMAPFolder* folder);
- void unregisterFolder(IMAPFolder* folder);
-
- std::list <IMAPFolder*> m_folders;
-
-
-
- // Service infos
- class _infos : public serviceInfos
- {
- public:
-
- const port_t getDefaultPort() const;
-
- const string getPropertyPrefix() const;
- const std::vector <string> getAvailableProperties() const;
- };
-
- static _infos sm_infos;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_IMAPSTORE_HPP_INCLUDED
diff --git a/src/messaging/IMAPTag.cpp b/src/messaging/IMAPTag.cpp
index 12194bce..549abfcc 100644
--- a/src/messaging/IMAPTag.cpp
+++ b/src/messaging/IMAPTag.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/IMAPTag.hpp"
+#include "vmime/messaging/IMAPTag.hpp"
namespace vmime {
diff --git a/src/messaging/IMAPTag.hpp b/src/messaging/IMAPTag.hpp
deleted file mode 100644
index c7c48f31..00000000
--- a/src/messaging/IMAPTag.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_IMAPTAG_HPP_INCLUDED
-#define VMIME_MESSAGING_IMAPTAG_HPP_INCLUDED
-
-
-#include "types.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class IMAPTag
-{
-private:
-
- IMAPTag(const int number);
- IMAPTag(const IMAPTag& tag);
-
-public:
-
- IMAPTag();
-
- IMAPTag& operator++(); // ++IMAPTag
- const IMAPTag operator++(int); // IMAPTag++
-
- const int number() const;
-
- operator string() const;
-
-private:
-
- void generate();
-
- static const int sm_maxNumber;
-
- int m_number;
- string m_tag;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_IMAPTAG_HPP_INCLUDED
diff --git a/src/messaging/IMAPUtils.cpp b/src/messaging/IMAPUtils.cpp
index e04ee2ce..ef25c103 100644
--- a/src/messaging/IMAPUtils.cpp
+++ b/src/messaging/IMAPUtils.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/IMAPUtils.hpp"
-#include "messaging/message.hpp"
+#include "vmime/messaging/IMAPUtils.hpp"
+#include "vmime/messaging/message.hpp"
#include <sstream>
#include <iterator>
diff --git a/src/messaging/IMAPUtils.hpp b/src/messaging/IMAPUtils.hpp
deleted file mode 100644
index 767cbc34..00000000
--- a/src/messaging/IMAPUtils.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_IMAPUTILS_HPP_INCLUDED
-#define VMIME_MESSAGING_IMAPUTILS_HPP_INCLUDED
-
-
-#include "types.hpp"
-#include "dateTime.hpp"
-
-#include "messaging/folder.hpp"
-#include "messaging/IMAPParser.hpp"
-
-#include <vector>
-
-
-namespace vmime {
-namespace messaging {
-
-
-class IMAPUtils
-{
-public:
-
- static const string pathToString(const char hierarchySeparator, const folder::path& path);
- static const folder::path stringToPath(const char hierarchySeparator, const string& str);
-
- static const string toModifiedUTF7(const char hierarchySeparator, const folder::path::component& text);
- static const folder::path::component fromModifiedUTF7(const string& text);
-
- static const string quoteString(const string& text);
-
- static const int folderTypeFromFlags(const IMAPParser::mailbox_flag_list* list);
- static const int folderFlagsFromFlags(const IMAPParser::mailbox_flag_list* list);
-
- static const int messageFlagsFromFlags(const IMAPParser::flag_list* list);
-
- static const string messageFlagList(const int flags);
-
- static const string listToSet(const std::vector <int>& list, const int max = -1, const bool alreadySorted = false);
-
- static const string dateTime(const vmime::datetime& date);
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_IMAPUTILS_HPP_INCLUDED
diff --git a/src/messaging/POP3Folder.cpp b/src/messaging/POP3Folder.cpp
index d1c501ca..61e3475b 100644
--- a/src/messaging/POP3Folder.cpp
+++ b/src/messaging/POP3Folder.cpp
@@ -17,12 +17,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/POP3Folder.hpp"
+#include "vmime/messaging/POP3Folder.hpp"
-#include "messaging/POP3Store.hpp"
-#include "messaging/POP3Message.hpp"
+#include "vmime/messaging/POP3Store.hpp"
+#include "vmime/messaging/POP3Message.hpp"
-#include "exception.hpp"
+#include "vmime/exception.hpp"
namespace vmime {
diff --git a/src/messaging/POP3Folder.hpp b/src/messaging/POP3Folder.hpp
deleted file mode 100644
index 93174a8a..00000000
--- a/src/messaging/POP3Folder.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_POP3FOLDER_HPP_INCLUDED
-#define VMIME_MESSAGING_POP3FOLDER_HPP_INCLUDED
-
-
-#include <vector>
-#include <map>
-
-#include "config.hpp"
-#include "types.hpp"
-
-#include "messaging/folder.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class POP3Store;
-class POP3Message;
-
-
-/** POP3 folder implementation.
- */
-
-class POP3Folder : public folder
-{
-private:
-
- friend class POP3Store;
- friend class POP3Message;
-
- POP3Folder(const folder::path& path, POP3Store* store);
- POP3Folder(const POP3Folder&) : folder() { }
-
- ~POP3Folder();
-
-public:
-
- const int getMode() const;
-
- const int getType();
-
- const int getFlags();
-
- const folder::path::component getName() const;
- const folder::path getFullPath() const;
-
- void open(const int mode, bool failIfModeIsNotAvailable = false);
- void close(const bool expunge);
- void create(const int type);
-
- const bool exists();
-
- const bool isOpen() const;
-
- message* getMessage(const int num);
- std::vector <message*> getMessages(const int from = 1, const int to = -1);
- std::vector <message*> getMessages(const std::vector <int>& nums);
- const int getMessageCount();
-
- folder* getFolder(const folder::path::component& name);
- std::vector <folder*> getFolders(const bool recursive = false);
-
- void rename(const folder::path& newPath);
-
- void deleteMessage(const int num);
- void deleteMessages(const int from = 1, const int to = -1);
- void deleteMessages(const std::vector <int>& nums);
-
- void setMessageFlags(const int from, const int to, const int flags, const int mode = message::FLAG_MODE_SET);
- void setMessageFlags(const std::vector <int>& nums, const int flags, const int mode = message::FLAG_MODE_SET);
-
- void addMessage(vmime::message* msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL);
- void addMessage(utility::inputStream& is, const int size, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL);
-
- void copyMessage(const folder::path& dest, const int num);
- void copyMessages(const folder::path& dest, const int from = 1, const int to = -1);
- void copyMessages(const folder::path& dest, const std::vector <int>& nums);
-
- void status(int& count, int& unseen);
-
- void expunge();
-
- folder* getParent();
-
- const store* getStore() const;
- store* getStore();
-
-
- void fetchMessages(std::vector <message*>& msg, const int options, progressionListener* progress = NULL);
- void fetchMessage(message* msg, const int options);
-
- const int getFetchCapabilities() const;
-
-private:
-
- void registerMessage(POP3Message* msg);
- void unregisterMessage(POP3Message* msg);
-
- void onStoreDisconnected();
-
- void onClose();
-
-
- POP3Store* m_store;
-
- folder::path m_path;
- folder::path::component m_name;
-
- int m_mode;
- bool m_open;
-
- int m_messageCount;
-
- typedef std::map <POP3Message*, int> MessageMap;
- MessageMap m_messages;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_POP3FOLDER_HPP_INCLUDED
diff --git a/src/messaging/POP3Message.cpp b/src/messaging/POP3Message.cpp
index f23994cd..ac3aa120 100644
--- a/src/messaging/POP3Message.cpp
+++ b/src/messaging/POP3Message.cpp
@@ -17,9 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/POP3Message.hpp"
-#include "messaging/POP3Folder.hpp"
-#include "messaging/POP3Store.hpp"
+#include "vmime/messaging/POP3Message.hpp"
+#include "vmime/messaging/POP3Folder.hpp"
+#include "vmime/messaging/POP3Store.hpp"
#include <sstream>
diff --git a/src/messaging/POP3Message.hpp b/src/messaging/POP3Message.hpp
deleted file mode 100644
index 15f3562c..00000000
--- a/src/messaging/POP3Message.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_POP3MESSAGE_HPP_INCLUDED
-#define VMIME_MESSAGING_POP3MESSAGE_HPP_INCLUDED
-
-
-#include "config.hpp"
-
-#include "messaging/message.hpp"
-#include "messaging/folder.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** POP3 message implementation.
- */
-
-class POP3Message : public message
-{
-private:
-
- friend class POP3Folder;
-
- POP3Message(POP3Folder* folder, const int num);
- POP3Message(const POP3Message&) : message() { }
-
- ~POP3Message();
-
-public:
-
- const int getNumber() const;
-
- const uid getUniqueId() const;
-
- const int getSize() const;
-
- const bool isExpunged() const;
-
- const structure& getStructure() const;
- structure& getStructure();
-
- const header& getHeader() const;
-
- const int getFlags() const;
- void setFlags(const int flags, const int mode = FLAG_MODE_SET);
-
- void extract(utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const;
- void extractPart(const part& p, utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const;
-
- void fetchPartHeader(part& p);
-
-private:
-
- void fetch(POP3Folder* folder, const int options);
-
- void onFolderClosed();
-
- POP3Folder* m_folder;
- int m_num;
- uid m_uid;
-
- header* m_header;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_POP3MESSAGE_HPP_INCLUDED
diff --git a/src/messaging/POP3Store.cpp b/src/messaging/POP3Store.cpp
index d5b4ec12..21e09f77 100644
--- a/src/messaging/POP3Store.cpp
+++ b/src/messaging/POP3Store.cpp
@@ -17,13 +17,13 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/POP3Store.hpp"
-#include "messaging/POP3Folder.hpp"
+#include "vmime/messaging/POP3Store.hpp"
+#include "vmime/messaging/POP3Folder.hpp"
-#include "exception.hpp"
-#include "platformDependant.hpp"
-#include "messageId.hpp"
-#include "utility/md5.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
+#include "vmime/messageId.hpp"
+#include "vmime/utility/md5.hpp"
#include <algorithm>
diff --git a/src/messaging/POP3Store.hpp b/src/messaging/POP3Store.hpp
deleted file mode 100644
index 3030807d..00000000
--- a/src/messaging/POP3Store.hpp
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_POP3STORE_HPP_INCLUDED
-#define VMIME_MESSAGING_POP3STORE_HPP_INCLUDED
-
-
-#include "config.hpp"
-
-#include "messaging/store.hpp"
-#include "messaging/socket.hpp"
-#include "messaging/timeoutHandler.hpp"
-
-#include "utility/stream.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** POP3 store service.
- */
-
-class POP3Store : public store
-{
- friend class POP3Folder;
- friend class POP3Message;
-
-public:
-
- POP3Store(session* sess, authenticator* auth);
- ~POP3Store();
-
- const string getProtocolName() const;
-
- folder* getDefaultFolder();
- folder* getRootFolder();
- folder* getFolder(const folder::path& path);
-
- const bool isValidFolderName(const folder::path::component& name) const;
-
- static const serviceInfos& getInfosInstance();
- const serviceInfos& getInfos() const;
-
- void connect();
- const bool isConnected() const;
- void disconnect();
-
- void noop();
-
- const int getCapabilities() const;
-
-private:
-
- static const bool isSuccessResponse(const string& buffer);
- static const bool stripFirstLine(const string& buffer, string& result, string* firstLine = NULL);
- static void stripResponseCode(const string& buffer, string& result);
-
- void sendRequest(const string& buffer, const bool end = true);
- void readResponse(string& buffer, const bool multiLine, progressionListener* progress = NULL);
- void readResponse(utility::outputStream& os, progressionListener* progress = NULL, const int predictedSize = 0);
-
- static const bool checkTerminator(string& buffer, const bool multiLine);
- static const bool checkOneTerminator(string& buffer, const string& term);
-
- void internalDisconnect();
-
-
- void registerFolder(POP3Folder* folder);
- void unregisterFolder(POP3Folder* folder);
-
- std::list <POP3Folder*> m_folders;
-
-
- socket* m_socket;
- bool m_authentified;
-
- timeoutHandler* m_timeoutHandler;
-
-
- // Service infos
- class _infos : public serviceInfos
- {
- public:
-
- const port_t getDefaultPort() const;
-
- const string getPropertyPrefix() const;
- const std::vector <string> getAvailableProperties() const;
- };
-
- static _infos sm_infos;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_POP3STORE_HPP_INCLUDED
diff --git a/src/messaging/SMTPTransport.cpp b/src/messaging/SMTPTransport.cpp
index 54ffe546..0ba8ebd0 100644
--- a/src/messaging/SMTPTransport.cpp
+++ b/src/messaging/SMTPTransport.cpp
@@ -17,15 +17,15 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/SMTPTransport.hpp"
+#include "vmime/messaging/SMTPTransport.hpp"
-#include "exception.hpp"
-#include "platformDependant.hpp"
-#include "encoderB64.hpp"
-#include "messageParser.hpp" // to include "message.hpp" in root directory
-#include "mailboxList.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
+#include "vmime/encoderB64.hpp"
+#include "vmime/message.hpp"
+#include "vmime/mailboxList.hpp"
-#include "messaging/authHelper.hpp"
+#include "vmime/messaging/authHelper.hpp"
namespace vmime {
diff --git a/src/messaging/SMTPTransport.hpp b/src/messaging/SMTPTransport.hpp
deleted file mode 100644
index 84f680b9..00000000
--- a/src/messaging/SMTPTransport.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_SMTPTRANSPORT_HPP_INCLUDED
-#define VMIME_MESSAGING_SMTPTRANSPORT_HPP_INCLUDED
-
-
-#include "config.hpp"
-
-#include "messaging/transport.hpp"
-#include "messaging/socket.hpp"
-#include "messaging/timeoutHandler.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** SMTP transport service.
- */
-
-class SMTPTransport : public transport
-{
-public:
-
- SMTPTransport(session* sess, authenticator* auth);
- ~SMTPTransport();
-
- const string getProtocolName() const;
-
- static const serviceInfos& getInfosInstance();
- const serviceInfos& getInfos() const;
-
- void connect();
- const bool isConnected() const;
- void disconnect();
-
- void noop();
-
- void send(vmime::message* msg, progressionListener* progress = NULL);
- void send(const mailbox& expeditor, const mailboxList& recipients, utility::inputStream& is, const utility::stream::size_type size, progressionListener* progress = NULL);
-
-private:
-
- static const int responseCode(const string& response);
- static const string responseText(const string& response);
-
- void sendRequest(const string& buffer, const bool end = true);
-
- void readResponse(string& buffer);
-
- void internalDisconnect();
-
- socket* m_socket;
- bool m_authentified;
- bool m_extendedSMTP;
-
- timeoutHandler* m_timeoutHandler;
-
-
- // Service infos
- class _infos : public serviceInfos
- {
- public:
-
- const port_t getDefaultPort() const;
-
- const string getPropertyPrefix() const;
- const std::vector <string> getAvailableProperties() const;
- };
-
- static _infos sm_infos;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_SMTPTRANSPORT_HPP_INCLUDED
diff --git a/src/messaging/authHelper.cpp b/src/messaging/authHelper.cpp
index 0bd1c99e..5ddb8111 100644
--- a/src/messaging/authHelper.cpp
+++ b/src/messaging/authHelper.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/authHelper.hpp"
+#include "vmime/messaging/authHelper.hpp"
-#include "config.hpp"
-#include "utility/md5.hpp"
+#include "vmime/config.hpp"
+#include "vmime/utility/md5.hpp"
namespace vmime {
diff --git a/src/messaging/authHelper.hpp b/src/messaging/authHelper.hpp
deleted file mode 100644
index 147bc2bd..00000000
--- a/src/messaging/authHelper.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_AUTHHELPER_HPP_INCLUDED
-#define VMIME_MESSAGING_AUTHHELPER_HPP_INCLUDED
-
-
-#include "types.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-void hmac_md5(const string& text, const string& key, string& hexDigest);
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_AUTHHELPER_HPP_INCLUDED
diff --git a/src/messaging/authenticationInfos.cpp b/src/messaging/authenticationInfos.cpp
index 3bc572d6..06e4745e 100644
--- a/src/messaging/authenticationInfos.cpp
+++ b/src/messaging/authenticationInfos.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/authenticationInfos.hpp"
+#include "vmime/messaging/authenticationInfos.hpp"
namespace vmime {
diff --git a/src/messaging/authenticationInfos.hpp b/src/messaging/authenticationInfos.hpp
deleted file mode 100644
index 5cbf2fe9..00000000
--- a/src/messaging/authenticationInfos.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_AUTHENTICATIONINFOS_HPP_INCLUDED
-#define VMIME_MESSAGING_AUTHENTICATIONINFOS_HPP_INCLUDED
-
-
-#include "types.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** This class encapsulates user credentials.
- */
-
-class authenticationInfos
-{
-public:
-
- authenticationInfos(const string& username, const string& password);
- authenticationInfos(const authenticationInfos& infos);
-
- /** Return the user account name.
- *
- * @return account name
- */
- const string& getUsername() const;
-
- /** Return the user account password.
- *
- * @return account password
- */
- const string& getPassword() const;
-
-private:
-
- string m_username;
- string m_password;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_AUTHENTICATIONINFOS_HPP_INCLUDED
diff --git a/src/messaging/authenticator.cpp b/src/messaging/authenticator.cpp
index 87823d4f..c8c4bbc1 100644
--- a/src/messaging/authenticator.cpp
+++ b/src/messaging/authenticator.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/authenticator.hpp"
+#include "vmime/messaging/authenticator.hpp"
namespace vmime {
diff --git a/src/messaging/authenticator.hpp b/src/messaging/authenticator.hpp
deleted file mode 100644
index 1164dbbc..00000000
--- a/src/messaging/authenticator.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_AUTHENTICATOR_HPP_INCLUDED
-#define VMIME_MESSAGING_AUTHENTICATOR_HPP_INCLUDED
-
-
-#include "messaging/authenticationInfos.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** This class is used to obtain user credentials.
- */
-
-class authenticator
-{
-public:
-
- virtual ~authenticator();
-
- /** Called when the service needs to retrieve user credentials.
- * It should return the user account name and password.
- *
- * @return user credentials (user name and password)
- */
- virtual const authenticationInfos requestAuthInfos() const = 0;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_AUTHENTICATOR_HPP_INCLUDED
diff --git a/src/messaging/builtinServices.inl b/src/messaging/builtinServices.inl
index 77809234..e330cad9 100644
--- a/src/messaging/builtinServices.inl
+++ b/src/messaging/builtinServices.inl
@@ -25,25 +25,25 @@
#if VMIME_BUILTIN_MESSAGING_PROTO_POP3
- #include "POP3Store.hpp"
+ #include "vmime/messaging/POP3Store.hpp"
REGISTER_SERVICE(POP3Store, pop3);
#endif
#if VMIME_BUILTIN_MESSAGING_PROTO_SMTP
- #include "SMTPTransport.hpp"
+ #include "vmime/messaging/SMTPTransport.hpp"
REGISTER_SERVICE(SMTPTransport, smtp);
#endif
#if VMIME_BUILTIN_MESSAGING_PROTO_IMAP
- #include "IMAPStore.hpp"
+ #include "vmime/messaging/IMAPStore.hpp"
REGISTER_SERVICE(IMAPStore, imap);
#endif
#if VMIME_BUILTIN_MESSAGING_PROTO_MAILDIR
- #include "maildirStore.hpp"
+ #include "vmime/messaging/maildirStore.hpp"
REGISTER_SERVICE(maildirStore, maildir);
#endif
diff --git a/src/messaging/defaultAuthenticator.cpp b/src/messaging/defaultAuthenticator.cpp
index 4ecf8ed4..72273ac4 100644
--- a/src/messaging/defaultAuthenticator.cpp
+++ b/src/messaging/defaultAuthenticator.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/defaultAuthenticator.hpp"
+#include "vmime/messaging/defaultAuthenticator.hpp"
namespace vmime {
diff --git a/src/messaging/defaultAuthenticator.hpp b/src/messaging/defaultAuthenticator.hpp
deleted file mode 100644
index b38e7bd6..00000000
--- a/src/messaging/defaultAuthenticator.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_DEFAULTAUTHENTICATOR_HPP_INCLUDED
-#define VMIME_MESSAGING_DEFAULTAUTHENTICATOR_HPP_INCLUDED
-
-
-#include "messaging/authenticator.hpp"
-#include "propertySet.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** Default implementation for authenticator. It simply returns
- * the credentials set in the session properties (named 'username'
- * and 'password'). This is the default implementation used if
- * you do not write your own authenticator object.
- */
-
-class defaultAuthenticator : public authenticator
-{
-public:
-
- defaultAuthenticator(const propertySet& props, const string& prefix);
-
-private:
-
- const propertySet& m_props;
- const string m_prefix;
-
- const authenticationInfos requestAuthInfos() const;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_DEFAULTAUTHENTICATOR_HPP_INCLUDED
diff --git a/src/messaging/events.cpp b/src/messaging/events.cpp
index 7bbd6f77..90dbf797 100644
--- a/src/messaging/events.cpp
+++ b/src/messaging/events.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/events.hpp"
+#include "vmime/messaging/events.hpp"
#include <algorithm>
diff --git a/src/messaging/events.hpp b/src/messaging/events.hpp
deleted file mode 100644
index f1a166de..00000000
--- a/src/messaging/events.hpp
+++ /dev/null
@@ -1,180 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_EVENTS_HPP_INCLUDED
-#define VMIME_MESSAGING_EVENTS_HPP_INCLUDED
-
-
-#include <vector>
-
-#include "utility/path.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-class folder;
-
-namespace events {
-
-
-/** Event about the message count in a folder.
- */
-
-class messageCountEvent
-{
-public:
-
- enum Types
- {
- TYPE_ADDED, /**< New messages have been added. */
- TYPE_REMOVED /**< Messages have been expunged (renumbering). */
- };
-
-
- messageCountEvent(class folder* folder, const Types type, const std::vector <int>& nums);
-
- const class folder* folder() const;
- const Types type() const;
- const std::vector <int>& numbers() const;
-
- void dispatch(class messageCountListener* listener) const;
-
-private:
-
- class folder* m_folder;
- const Types m_type;
- std::vector <int> m_nums;
-};
-
-
-/** Listener for events about the message count in a folder.
- */
-
-class messageCountListener
-{
-protected:
-
- virtual ~messageCountListener() { }
-
-public:
-
- virtual void messagesAdded(const messageCountEvent& event) = 0;
- virtual void messagesRemoved(const messageCountEvent& event) = 0;
-};
-
-
-/** Event occuring on a message.
- */
-
-class messageChangedEvent
-{
-public:
-
- enum Types
- {
- TYPE_FLAGS // flags changed
- };
-
-
- messageChangedEvent(class folder* folder, const Types type, const std::vector <int>& nums);
-
- const class folder* folder() const;
- const Types type() const;
- const std::vector <int>& numbers() const;
-
- void dispatch(class messageChangedListener* listener) const;
-
-private:
-
- class folder* m_folder;
- const Types m_type;
- std::vector <int> m_nums;
-};
-
-
-/** Listener for events occuring on a message.
- */
-
-class messageChangedListener
-{
-protected:
-
- virtual ~messageChangedListener() { }
-
-public:
-
- virtual void messageChanged(const messageChangedEvent& event) = 0;
-};
-
-
-/** Event occuring on a folder.
- */
-
-class folderEvent
-{
-public:
-
- enum Types
- {
- TYPE_CREATED, /**< A folder was created. */
- TYPE_DELETED, /**< A folder was deleted. */
- TYPE_RENAMED /**< A folder was renamed. */
- };
-
-
- folderEvent(class folder* folder, const Types type, const utility::path& oldPath, const utility::path& newPath);
-
- const class folder* folder() const;
- const Types type() const;
-
- void dispatch(class folderListener* listener) const;
-
-private:
-
- class folder* m_folder;
- const Types m_type;
- const utility::path m_oldPath;
- const utility::path m_newPath;
-};
-
-
-/** Listener for events occuring on a folder.
- */
-
-class folderListener
-{
-protected:
-
- virtual ~folderListener() { }
-
-public:
-
- virtual void folderCreated(const folderEvent& event) = 0;
- virtual void folderRenamed(const folderEvent& event) = 0;
- virtual void folderDeleted(const folderEvent& event) = 0;
-};
-
-
-} // events
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_EVENTS_HPP_INCLUDED
diff --git a/src/messaging/folder.cpp b/src/messaging/folder.cpp
index 21514672..f14eb525 100644
--- a/src/messaging/folder.cpp
+++ b/src/messaging/folder.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/folder.hpp"
+#include "vmime/messaging/folder.hpp"
#include <algorithm>
diff --git a/src/messaging/folder.hpp b/src/messaging/folder.hpp
deleted file mode 100644
index 60bb0d23..00000000
--- a/src/messaging/folder.hpp
+++ /dev/null
@@ -1,375 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_FOLDER_HPP_INCLUDED
-#define VMIME_MESSAGING_FOLDER_HPP_INCLUDED
-
-
-#include <vector>
-
-#include "types.hpp"
-#include "dateTime.hpp"
-#include "messaging/progressionListener.hpp"
-#include "messaging/message.hpp"
-#include "messaging/events.hpp"
-#include "utility/path.hpp"
-#include "utility/stream.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class store;
-
-
-/** Abstract representation of a folder in a message store.
- */
-
-class folder
-{
-protected:
-
- folder(const folder&) { }
- folder() { }
-
-public:
-
- virtual ~folder() { }
-
- /** Type used for fully qualified path name of a folder.
- */
- typedef vmime::utility::path path;
-
-
- /** Open mode.
- */
- enum Modes
- {
- MODE_READ_ONLY, /**< Read-only mode (no modification to folder or messages is possible). */
- MODE_READ_WRITE /**< Full access mode (read and write). */
- };
-
- /** Folder types.
- */
- enum Types
- {
- TYPE_CONTAINS_FOLDERS = (1 << 0), /**< Folder can contain folders. */
- TYPE_CONTAINS_MESSAGES = (1 << 1), /**< Folder can contain messages. */
-
- TYPE_UNDEFINED = 9999 /**< Used internally (this should not be returned
- by the type() function). */
- };
-
- /** Folder flags.
- */
- enum Flags
- {
- FLAG_CHILDREN = (1 << 0), /**< Folder contains subfolders. */
- FLAG_NO_OPEN = (1 << 1), /**< Folder cannot be open. */
-
- FLAG_UNDEFINED = 9999 /**< Used internally (this should not be returned
- by the type() function). */
- };
-
- /** Return the type of this folder.
- *
- * @return folder type (see folder::Types)
- */
- virtual const int getType() = 0;
-
- /** Return the flags of this folder.
- *
- * @return folder flags (see folder::Flags)
- */
- virtual const int getFlags() = 0;
-
- /** Return the mode in which the folder has been open.
- *
- * @return folder opening mode (see folder::Modes)
- */
- virtual const int getMode() const = 0;
-
- /** Return the name of this folder.
- *
- * @return folder name
- */
- virtual const folder::path::component getName() const = 0;
-
- /** Return the fully qualified path name of this folder.
- *
- * @return absolute path of the folder
- */
- virtual const folder::path getFullPath() const = 0;
-
- /** Open this folder.
- *
- * @param mode open mode (see folder::Modes)
- * @param failIfModeIsNotAvailable if set to false and if the requested mode
- * is not available, a more restricted mode will be selected automatically.
- * If set to true and if the requested mode is not available, the opening
- * will fail.
- */
- virtual void open(const int mode, bool failIfModeIsNotAvailable = false) = 0;
-
- /** Close this folder.
- *
- * @param expunge if set to true, deleted messages are expunged
- */
- virtual void close(const bool expunge) = 0;
-
- /** Create this folder.
- *
- * @param type folder type (see folder::Types)
- */
- virtual void create(const int type) = 0;
-
- /** Test whether this folder exists.
- *
- * @return true if the folder exists, false otherwise
- */
- virtual const bool exists() = 0;
-
- /** Test whether this folder is open.
- *
- * @return true if the folder is open, false otherwise
- */
- virtual const bool isOpen() const = 0;
-
- /** Get a new reference to a message in this folder.
- *
- * @param num message sequence number
- * @return a new object referencing the specified message
- */
- virtual message* getMessage(const int num) = 0;
-
- /** Get new references to messages in this folder.
- *
- * @param from sequence number of the first message to get
- * @param to sequence number of the last message to get
- * @return new objects referencing the specified messages
- */
- virtual std::vector <message*> getMessages(const int from = 1, const int to = -1) = 0;
-
- /** Get new references to messages in this folder.
- *
- * @param nums sequence numbers of the messages to delete
- * @return new objects referencing the specified messages
- */
- virtual std::vector <message*> getMessages(const std::vector <int>& nums) = 0;
-
- /** Return the number of messages in this folder.
- *
- * @return number of messages in the folder
- */
- virtual const int getMessageCount() = 0;
-
- /** Get a new reference to a sub-folder in this folder.
- *
- * @param name sub-folder name
- * @return a new object referencing the specified folder
- */
- virtual folder* getFolder(const folder::path::component& name) = 0;
-
- /** Get the list of all sub-folders in this folder.
- *
- * @param recursive if set to true, all the descendant are returned.
- * If set to false, only the direct children are returned.
- * @return list of sub-folders
- */
- virtual std::vector <folder*> getFolders(const bool recursive = false) = 0;
-
- /** Rename (move) this folder to another location.
- *
- * @param newPath new path of the folder
- */
- virtual void rename(const folder::path& newPath) = 0;
-
- /** Remove a message in this folder.
- *
- * @param num sequence number of the message to delete
- */
- virtual void deleteMessage(const int num) = 0;
-
- /** Remove one or more messages from this folder.
- *
- * @param from sequence number of the first message to delete
- * @param to sequence number of the last message to delete
- */
- virtual void deleteMessages(const int from = 1, const int to = -1) = 0;
-
- /** Remove one or more messages from this folder.
- *
- * @param nums sequence numbers of the messages to delete
- */
- virtual void deleteMessages(const std::vector <int>& nums) = 0;
-
- /** Change the flags for one or more messages in this folder.
- *
- * @param from sequence number of the first message to modify
- * @param to sequence number of the last message to modify
- * @param flags set of flags (see message::Flags)
- * @param mode indicate how to treat old and new flags (see message::FlagsModes)
- */
- virtual void setMessageFlags(const int from, const int to, const int flags, const int mode = message::FLAG_MODE_SET) = 0;
-
- /** Change the flags for one or more messages in this folder.
- *
- * @param nums sequence numbers of the messages to modify
- * @param flags set of flags (see message::Flags)
- * @param mode indicate how to treat old and new flags (see message::FlagsModes)
- */
- virtual void setMessageFlags(const std::vector <int>& nums, const int flags, const int mode = message::FLAG_MODE_SET) = 0;
-
- /** Add a message to this folder.
- *
- * @param msg message to add (data: header + body)
- * @param flags flags for the new message
- * @param date date/time for the new message (if NULL, the current time is used)
- * @param progress progression listener, or NULL if not used
- */
- virtual void addMessage(vmime::message* msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL) = 0;
-
- /** Add a message to this folder.
- *
- * @param is message to add (data: header + body)
- * @param size size of the message to add (in bytes)
- * @param flags flags for the new message
- * @param date date/time for the new message (if NULL, the current time is used)
- * @param progress progression listener, or NULL if not used
- */
- virtual void addMessage(utility::inputStream& is, const int size, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL) = 0;
-
- /** Copy a message from this folder to another folder.
- *
- * @param dest destination folder path
- * @param num sequence number of the message to copy
- */
- virtual void copyMessage(const folder::path& dest, const int num) = 0;
-
- /** Copy messages from this folder to another folder.
- *
- * @param dest destination folder path
- * @param from sequence number of the first message to copy
- * @param to sequence number of the last message to copy
- */
- virtual void copyMessages(const folder::path& dest, const int from = 1, const int to = -1) = 0;
-
- /** Copy messages from this folder to another folder.
- *
- * @param dest destination folder path
- * @param nums sequence numbers of the messages to copy
- */
- virtual void copyMessages(const folder::path& dest, const std::vector <int>& nums) = 0;
-
- /** Request folder status without opening it.
- *
- * @param count will receive the number of messages in the folder
- * @param unseen will receive the number of unseen messages in the folder
- */
- virtual void status(int& count, int& unseen) = 0;
-
- /** Expunge deleted messages.
- */
- virtual void expunge() = 0;
-
- /** Return a new folder object referencing the parent folder of this folder.
- *
- * @return parent folder object
- */
- virtual folder* getParent() = 0;
-
- /** Return a reference to the store to which this folder belongs.
- *
- * @return the store object to which this folder is attached
- */
- virtual const store* getStore() const = 0;
-
- /** Return a reference to the store to which this folder belongs.
- *
- * @return the store object to which this folder is attached
- */
- virtual store* getStore() = 0;
-
- /** Fetchable objects.
- */
- enum FetchOptions
- {
- FETCH_ENVELOPE = (1 << 0), /**< Fetch sender, recipients, date, subject. */
- FETCH_STRUCTURE = (1 << 1), /**< Fetch structure (body parts). */
- FETCH_CONTENT_INFO = (1 << 2), /**< Fetch top-level content type. */
- FETCH_FLAGS = (1 << 3), /**< Fetch message flags. */
- FETCH_SIZE = (1 << 4), /**< Fetch message size (exact or estimated). */
- FETCH_FULL_HEADER = (1 << 5), /**< Fetch full RFC-[2]822 header. */
- FETCH_UID = (1 << 6), /**< Fetch unique identifier (protocol specific). */
-
- FETCH_CUSTOM = (1 << 16) /**< Reserved for future use. */
- };
-
- /** Fetch objects for the specified messages.
- *
- * @param msg list of message sequence numbers
- * @param options objects to fetch (combination of folder::FetchOptions flags)
- * @param progress progression listener, or NULL if not used
- */
- virtual void fetchMessages(std::vector <message*>& msg, const int options, progressionListener* progress = NULL) = 0;
-
- /** Fetch objects for the specified message.
- *
- * @param msg the message
- * @param options objects to fetch (combination of folder::FetchOptions flags)
- */
- virtual void fetchMessage(message* msg, const int options) = 0;
-
- /** Return the list of fetchable objects supported by
- * the underlying protocol (see folder::FetchOptions).
- *
- * @return list of supported fetchable objects
- */
- virtual const int getFetchCapabilities() const = 0;
-
- // Event listeners
- void addMessageChangedListener(events::messageChangedListener* l);
- void removeMessageChangedListener(events::messageChangedListener* l);
-
- void addMessageCountListener(events::messageCountListener* l);
- void removeMessageCountListener(events::messageCountListener* l);
-
- void addFolderListener(events::folderListener* l);
- void removeFolderListener(events::folderListener* l);
-
-protected:
-
- void notifyMessageChanged(const events::messageChangedEvent& event);
- void notifyMessageCount(const events::messageCountEvent& event);
- void notifyFolder(const events::folderEvent& event);
-
-private:
-
- std::list <events::messageChangedListener*> m_messageChangedListeners;
- std::list <events::messageCountListener*> m_messageCountListeners;
- std::list <events::folderListener*> m_folderListeners;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_FOLDER_HPP_INCLUDED
diff --git a/src/messaging/maildirFolder.cpp b/src/messaging/maildirFolder.cpp
index e12b7c43..19153907 100644
--- a/src/messaging/maildirFolder.cpp
+++ b/src/messaging/maildirFolder.cpp
@@ -17,18 +17,18 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/maildirFolder.hpp"
+#include "vmime/messaging/maildirFolder.hpp"
-#include "messaging/maildirStore.hpp"
-#include "messaging/maildirMessage.hpp"
-#include "messaging/maildirUtils.hpp"
+#include "vmime/messaging/maildirStore.hpp"
+#include "vmime/messaging/maildirMessage.hpp"
+#include "vmime/messaging/maildirUtils.hpp"
-#include "utility/smartPtr.hpp"
+#include "vmime/utility/smartPtr.hpp"
-#include "messageParser.hpp" // to include "message.hpp" in root directory
+#include "vmime/message.hpp"
-#include "exception.hpp"
-#include "platformDependant.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
namespace vmime {
diff --git a/src/messaging/maildirFolder.hpp b/src/messaging/maildirFolder.hpp
deleted file mode 100644
index 2a607773..00000000
--- a/src/messaging/maildirFolder.hpp
+++ /dev/null
@@ -1,174 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_MAILDIRFOLDER_HPP_INCLUDED
-#define VMIME_MESSAGING_MAILDIRFOLDER_HPP_INCLUDED
-
-
-#include <vector>
-#include <map>
-
-#include "types.hpp"
-
-#include "messaging/folder.hpp"
-
-#include "utility/file.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class maildirStore;
-
-
-/** maildir folder implementation.
- */
-
-class maildirFolder : public folder
-{
-private:
-
- friend class maildirStore;
- friend class maildirMessage;
-
-
- maildirFolder(const folder::path& path, maildirStore* store);
- maildirFolder(const maildirFolder&) : folder() { }
-
- ~maildirFolder();
-
-public:
-
- const int getMode() const;
-
- const int getType();
-
- const int getFlags();
-
- const folder::path::component getName() const;
- const folder::path getFullPath() const;
-
- void open(const int mode, bool failIfModeIsNotAvailable = false);
- void close(const bool expunge);
- void create(const int type);
-
- const bool exists();
-
- const bool isOpen() const;
-
- message* getMessage(const int num);
- std::vector <message*> getMessages(const int from = 1, const int to = -1);
- std::vector <message*> getMessages(const std::vector <int>& nums);
- const int getMessageCount();
-
- folder* getFolder(const folder::path::component& name);
- std::vector <folder*> getFolders(const bool recursive = false);
-
- void rename(const folder::path& newPath);
-
- void deleteMessage(const int num);
- void deleteMessages(const int from = 1, const int to = -1);
- void deleteMessages(const std::vector <int>& nums);
-
- void setMessageFlags(const int from, const int to, const int flags, const int mode = message::FLAG_MODE_SET);
- void setMessageFlags(const std::vector <int>& nums, const int flags, const int mode = message::FLAG_MODE_SET);
-
- void addMessage(vmime::message* msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL);
- void addMessage(utility::inputStream& is, const int size, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, progressionListener* progress = NULL);
-
- void copyMessage(const folder::path& dest, const int num);
- void copyMessages(const folder::path& dest, const int from = 1, const int to = -1);
- void copyMessages(const folder::path& dest, const std::vector <int>& nums);
-
- void status(int& count, int& unseen);
-
- void expunge();
-
- folder* getParent();
-
- const store* getStore() const;
- store* getStore();
-
-
- void fetchMessages(std::vector <message*>& msg, const int options, progressionListener* progress = NULL);
- void fetchMessage(message* msg, const int options);
-
- const int getFetchCapabilities() const;
-
-private:
-
- void scanFolder();
-
- void listFolders(std::vector <folder*>& list, const bool recursive);
-
- void registerMessage(maildirMessage* msg);
- void unregisterMessage(maildirMessage* msg);
-
- const utility::file::path getMessageFSPath(const int number);
-
- void onStoreDisconnected();
-
- void onClose();
-
- void deleteMessagesImpl(const std::vector <int>& nums);
- void setMessageFlagsImpl(const std::vector <int>& nums, const int flags, const int mode);
-
- void copyMessagesImpl(const folder::path& dest, const std::vector <int>& nums);
- void copyMessageImpl(const utility::file::path& tmpDirPath, const utility::file::path& curDirPath, const utility::file::path::component& filename, utility::inputStream& is, const utility::stream::size_type size, progressionListener* progress);
-
- void notifyMessagesCopied(const folder::path& dest);
-
-
- maildirStore* m_store;
-
- folder::path m_path;
- folder::path::component m_name;
-
- int m_mode;
- bool m_open;
-
- int m_unreadMessageCount;
- int m_messageCount;
-
- // Store information about scanned messages
- struct messageInfos
- {
- enum Type
- {
- TYPE_CUR,
- TYPE_DELETED
- };
-
- utility::file::path::component path; // filename
- Type type; // current location
- };
-
- std::vector <messageInfos> m_messageInfos;
-
- // Instanciated message objects
- std::vector <maildirMessage*> m_messages;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_MAILDIRFOLDER_HPP_INCLUDED
diff --git a/src/messaging/maildirMessage.cpp b/src/messaging/maildirMessage.cpp
index 17f595fb..7145123b 100644
--- a/src/messaging/maildirMessage.cpp
+++ b/src/messaging/maildirMessage.cpp
@@ -17,14 +17,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/maildirMessage.hpp"
-#include "messaging/maildirFolder.hpp"
-#include "messaging/maildirUtils.hpp"
+#include "vmime/messaging/maildirMessage.hpp"
+#include "vmime/messaging/maildirFolder.hpp"
+#include "vmime/messaging/maildirUtils.hpp"
-#include "messageParser.hpp" // to include "message.hpp" in root directory
+#include "vmime/messageParser.hpp" // to include "message.hpp" in root directory
-#include "exception.hpp"
-#include "platformDependant.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
namespace vmime {
diff --git a/src/messaging/maildirMessage.hpp b/src/messaging/maildirMessage.hpp
deleted file mode 100644
index 02ada2f6..00000000
--- a/src/messaging/maildirMessage.hpp
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_MAILDIRMESSAGE_HPP_INCLUDED
-#define VMIME_MESSAGING_MAILDIRMESSAGE_HPP_INCLUDED
-
-
-#include "messaging/message.hpp"
-#include "messaging/folder.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class maildirFolder;
-
-
-/** maildir message implementation.
- */
-
-class maildirMessage : public message
-{
- friend class maildirFolder;
-
-private:
-
- maildirMessage(maildirFolder* folder, const int num);
- maildirMessage(const maildirMessage&) : message() { }
-
- ~maildirMessage();
-
-public:
-
- const int getNumber() const;
-
- const uid getUniqueId() const;
-
- const int getSize() const;
-
- const bool isExpunged() const;
-
- const structure& getStructure() const;
- structure& getStructure();
-
- const header& getHeader() const;
-
- const int getFlags() const;
- void setFlags(const int flags, const int mode = FLAG_MODE_SET);
-
- void extract(utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const;
- void extractPart(const part& p, utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const;
-
- void fetchPartHeader(part& p);
-
-private:
-
- void fetch(maildirFolder* folder, const int options);
-
- void onFolderClosed();
-
- header& getOrCreateHeader();
-
- void extractImpl(utility::outputStream& os, progressionListener* progress, const int start, const int length, const int partialStart, const int partialLength) const;
-
-
- maildirFolder* m_folder;
-
- int m_num;
- int m_size;
- int m_flags;
- bool m_expunged;
- uid m_uid;
-
- header* m_header;
- structure* m_structure;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_MAILDIRMESSAGE_HPP_INCLUDED
diff --git a/src/messaging/maildirStore.cpp b/src/messaging/maildirStore.cpp
index 8390117b..5f1ebb6c 100644
--- a/src/messaging/maildirStore.cpp
+++ b/src/messaging/maildirStore.cpp
@@ -17,14 +17,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/maildirStore.hpp"
+#include "vmime/messaging/maildirStore.hpp"
-#include "messaging/maildirFolder.hpp"
+#include "vmime/messaging/maildirFolder.hpp"
-#include "utility/smartPtr.hpp"
+#include "vmime/utility/smartPtr.hpp"
-#include "exception.hpp"
-#include "platformDependant.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/platformDependant.hpp"
namespace vmime {
diff --git a/src/messaging/maildirStore.hpp b/src/messaging/maildirStore.hpp
deleted file mode 100644
index b24eae60..00000000
--- a/src/messaging/maildirStore.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_MAILDIRSTORE_HPP_INCLUDED
-#define VMIME_MESSAGING_MAILDIRSTORE_HPP_INCLUDED
-
-
-#include "config.hpp"
-
-#include "messaging/store.hpp"
-#include "messaging/socket.hpp"
-#include "messaging/folder.hpp"
-
-#include "utility/file.hpp"
-
-#include <ostream>
-
-
-namespace vmime {
-namespace messaging {
-
-
-class maildirFolder;
-
-
-/** maildir store service.
- */
-
-class maildirStore : public store
-{
- friend class maildirFolder;
-
-public:
-
- maildirStore(session* sess, authenticator* auth);
- ~maildirStore();
-
- const string getProtocolName() const;
-
- folder* getDefaultFolder();
- folder* getRootFolder();
- folder* getFolder(const folder::path& path);
-
- const bool isValidFolderName(const folder::path::component& name) const;
-
- static const serviceInfos& getInfosInstance();
- const serviceInfos& getInfos() const;
-
- void connect();
- const bool isConnected() const;
- void disconnect();
-
- void noop();
-
- const utility::path& getFileSystemPath() const;
-
- const int getCapabilities() const;
-
-private:
-
- void registerFolder(maildirFolder* folder);
- void unregisterFolder(maildirFolder* folder);
-
-
- std::list <maildirFolder*> m_folders;
-
- bool m_connected;
-
- utility::path m_fsPath;
-
-
- // Service infos
- class _infos : public serviceInfos
- {
- public:
-
- const port_t getDefaultPort() const;
-
- const string getPropertyPrefix() const;
- const std::vector <string> getAvailableProperties() const;
- };
-
- static _infos sm_infos;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_MAILDIRSTORE_HPP_INCLUDED
diff --git a/src/messaging/maildirUtils.cpp b/src/messaging/maildirUtils.cpp
index 587f8f4c..71ed5593 100644
--- a/src/messaging/maildirUtils.cpp
+++ b/src/messaging/maildirUtils.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/maildirUtils.hpp"
-#include "messaging/maildirStore.hpp"
+#include "vmime/messaging/maildirUtils.hpp"
+#include "vmime/messaging/maildirStore.hpp"
-#include "utility/random.hpp"
+#include "vmime/utility/random.hpp"
namespace vmime {
diff --git a/src/messaging/maildirUtils.hpp b/src/messaging/maildirUtils.hpp
deleted file mode 100644
index ca0b9bfd..00000000
--- a/src/messaging/maildirUtils.hpp
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_MAILDIRUTILS_HPP_INCLUDED
-#define VMIME_MESSAGING_MAILDIRUTILS_HPP_INCLUDED
-
-
-#include "utility/file.hpp"
-#include "utility/path.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class maildirStore;
-
-
-/** Miscellaneous helpers functions for maildir messaging system.
- */
-
-class maildirUtils
-{
-public:
-
- /** Comparator for message filenames, based only on the
- * unique identifier part of the filename.
- */
- class messageIdComparator
- {
- public:
-
- messageIdComparator(const utility::file::path::component& comp);
-
- const bool operator()(const utility::file::path::component& other) const;
-
- private:
-
- const utility::file::path::component m_comp;
- };
-
- /** Mode for return value of getFolderFSPath(). */
- enum FolderFSPathMode
- {
- FOLDER_PATH_ROOT, /**< Root folder. Eg: ~/Mail/MyFolder */
- FOLDER_PATH_NEW, /**< Folder containing unread messages. Eg: ~/Mail/MyFolder/new */
- FOLDER_PATH_CUR, /**< Folder containing messages that have been seen. Eg: ~/Mail/MyFolder/cur */
- FOLDER_PATH_TMP, /**< Temporary folder used for reliable delivery. Eg: ~/Mail/MyFolder/tmp */
- FOLDER_PATH_CONTAINER /**< Container for sub-folders. Eg: ~/Mail/.MyFolder.directory */
- };
-
- /** Return the path on the filesystem for the folder in specified store.
- *
- * @param store parent store
- * @param folderPath path of the folder
- * @param mode type of path to return (see FolderFSPathMode)
- * @return filesystem path for the specified folder
- */
- static const utility::file::path getFolderFSPath(maildirStore* store, const utility::path& folderPath, const FolderFSPathMode mode);
-
- /** Test whether the specified file-system directory corresponds to
- * a maildir sub-folder. The name of the directory should not start
- * with '.' to be listed as a sub-folder.
- *
- * @param file reference to a file-system directory
- * @return true if the specified directory is a maildir sub-folder,
- * false otherwise
- */
- static const bool isSubfolderDirectory(const utility::file& file);
-
- /** Extract the unique identifier part of the message filename.
- * Eg: for the filename "1071577232.28549.m03s:2,RS", it will
- * return "1071577232.28549.m03s".
- *
- * @param filename filename part
- * @return part of the filename that corresponds to the unique
- * identifier of the message
- */
- static const utility::file::path::component extractId(const utility::file::path::component& filename);
-
- /** Extract message flags from the specified message filename.
- * Eg: for the filename "1071577232.28549.m03s:2,RS", it will
- * return (message::FLAG_SEEN | message::FLAG_REPLIED).
- *
- * @param comp filename part
- * @return message flags extracted from the specified filename
- */
- static const int extractFlags(const utility::file::path::component& comp);
-
- /** Return a string representing the specified message flags.
- * Eg: for (message::FLAG_SEEN | message::FLAG_REPLIED), it will
- * return "RS".
- *
- * @param flags set of flags
- * @return message flags in a string representation
- */
- static const utility::file::path::component buildFlags(const int flags);
-
- /** Build a filename with the specified id and flags.
- *
- * @param id id part of the filename
- * @param flags flags part of the filename
- * @return message filename
- */
- static const utility::file::path::component buildFilename(const utility::file::path::component& id, const utility::file::path::component& flags);
-
- /** Build a filename with the specified id and flags.
- *
- * @param id id part of the filename
- * @param flags set of flags
- * @return message filename
- */
- static const utility::file::path::component buildFilename(const utility::file::path::component& id, const int flags);
-
- /** Generate a new unique message identifier.
- *
- * @return unique message id
- */
- static const utility::file::path::component generateId();
-
-private:
-
- static const vmime::word TMP_DIR;
- static const vmime::word CUR_DIR;
- static const vmime::word NEW_DIR;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_MAILDIRUTILS_HPP_INCLUDED
diff --git a/src/messaging/message.cpp b/src/messaging/message.cpp
index cf36158b..4fcedf31 100644
--- a/src/messaging/message.cpp
+++ b/src/messaging/message.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/message.hpp"
+#include "vmime/messaging/message.hpp"
namespace vmime {
diff --git a/src/messaging/message.hpp b/src/messaging/message.hpp
deleted file mode 100644
index e94663b4..00000000
--- a/src/messaging/message.hpp
+++ /dev/null
@@ -1,286 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_MESSAGE_HPP_INCLUDED
-#define VMIME_MESSAGING_MESSAGE_HPP_INCLUDED
-
-
-#include "header.hpp"
-#include "messaging/progressionListener.hpp"
-#include "utility/stream.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class structure;
-
-
-/** A MIME part in a message.
- */
-
-class part
-{
-protected:
-
- part() { }
- part(const part&) { }
-
- virtual ~part() { }
-
-public:
-
- /** Return the structure of this part.
- *
- * @return structure of the part
- */
- virtual const structure& getStructure() const = 0;
-
- /** Return the structure of this part.
- *
- * @return structure of the part
- */
- virtual structure& getStructure() = 0;
-
- /** Return the header section for this part (you must fetch header
- * before using this function: see message::fetchPartHeader).
- *
- * @return header section
- */
- virtual const header& getHeader() const = 0;
-
- /** Return the media-type of the content in this part.
- *
- * @return content media type
- */
- virtual const mediaType& getType() const = 0;
-
- /** Return the size of this part.
- *
- * @return size of the part (in bytes)
- */
- virtual const int getSize() const = 0;
-
- /** Return the part sequence number (index)
- *
- * @return part number
- */
- virtual const int getNumber() const = 0; // begin at 1
-
- /** Return the sub-part at the specified position.
- * This provide easy access to parts:
- * Eg: "message->extract(message->structure()[3][1][2])".
- *
- * @param x index of the sub-part
- * @return sub-part at position 'x'
- */
- const part& operator[](const int x) const;
-
- /** Return the sub-part at the specified position.
- * This provide easy access to parts:
- * Eg: "message->extract(message->structure()[3][1][2])".
- *
- * @param x index of the sub-part
- * @return sub-part at position 'x'
- */
- part& operator[](const int x);
-
- /** Return the number of sub-parts in this part.
- *
- * @return number of sub-parts
- */
- const int getCount() const;
-};
-
-
-/** Structure of a MIME part/message.
- */
-
-class structure
-{
-protected:
-
- structure() { }
- structure(const structure&) { }
-
-public:
-
- virtual ~structure() { }
-
- /** Return the part at the specified position (first
- * part is at position 1).
- *
- * @param x position
- * @return part at position 'x'
- */
- virtual const part& operator[](const int x) const = 0;
-
- /** Return the part at the specified position (first
- * part is at position 1).
- *
- * @param x position
- * @return part at position 'x'
- */
- virtual part& operator[](const int x) = 0;
-
- /** Return the number of parts in this part.
- *
- * @return number of parts
- */
- virtual const int getCount() const = 0;
-};
-
-
-/** Abstract representation of a message in a store/transport service.
- */
-
-class message
-{
-protected:
-
- message() { }
- message(const message&) { }
-
-public:
-
- virtual ~message() { }
-
- /** The type for an unique message identifier.
- */
- typedef string uid;
-
- /** Return the MIME structure of the message (must fetch before).
- *
- * @return MIME structure of the message
- */
- virtual const structure& getStructure() const = 0;
-
- /** Return the MIME structure of the message (must fetch before).
- *
- * @return MIME structure of the message
- */
- virtual structure& getStructure() = 0;
-
- /** Return a reference to the header fields of the message (must fetch before).
- *
- * @return header section of the message
- */
- virtual const header& getHeader() const = 0;
-
- /** Return the sequence number of this message. This number is
- * used to reference the message in the folder.
- *
- * @return sequence number of the message
- */
- virtual const int getNumber() const = 0;
-
- /** Return the unique identified of this message (must fetch before).
- *
- * @return UID of the message
- */
- virtual const uid getUniqueId() const = 0;
-
- /** Return the size of the message (must fetch before).
- *
- * @return size of the message (in bytes)
- */
- virtual const int getSize() const = 0;
-
- /** Check whether this message has been expunged
- * (ie: definitively deleted).
- *
- * @return true if the message is expunged, false otherwise
- */
- virtual const bool isExpunged() const = 0;
-
- /** Possible flags for a message.
- */
- enum Flags
- {
- FLAG_SEEN = (1 << 0), /**< Message has been seen. */
- FLAG_RECENT = (1 << 1), /**< Message has been recently received. */
- FLAG_DELETED = (1 << 2), /**< Message is marked for deletion. */
- FLAG_REPLIED = (1 << 3), /**< User replied to this message. */
- FLAG_MARKED = (1 << 4), /**< Used-defined flag. */
- FLAG_PASSED = (1 << 5), /**< Message has been resent/forwarded/bounced. */
-
- FLAG_UNDEFINED = 9999 /**< Used internally (this should not be returned
- by the flags() function). */
- };
-
- /** Methods for setting the flags.
- */
- enum FlagsModes
- {
- FLAG_MODE_SET, /**< Set (replace) the flags. */
- FLAG_MODE_ADD, /**< Add the flags. */
- FLAG_MODE_REMOVE /**< Remove the flags. */
- };
-
- /** Return the flags of this message.
- *
- * @return flags of the message
- */
- virtual const int getFlags() const = 0;
-
- /** Set the flags of this message.
- *
- * @param flags set of flags (see Flags)
- * @param mode indicate how to treat old and new flags (see FlagsModes)
- */
- virtual void setFlags(const int flags, const int mode = FLAG_MODE_SET) = 0;
-
- /** Extract the whole message data (header + contents).
- *
- * \warning Partial fetch might not be supported by the underlying protocol.
- *
- * @param os output stream in which to write message data
- * @param progress progression listener, or NULL if not used
- * @param start index of the first byte to retrieve (used for partial fetch)
- * @param length number of bytes to retrieve (used for partial fetch)
- */
-
- virtual void extract(utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const = 0;
-
- /** Extract the specified (MIME) part of the message (header + contents).
- *
- * \warning Partial fetch might not be supported by the underlying protocol.
- *
- * @param p part to extract
- * @param os output stream in which to write part data
- * @param progress progression listener, or NULL if not used
- * @param start index of the first byte to retrieve (used for partial fetch)
- * @param length number of bytes to retrieve (used for partial fetch)
- */
- virtual void extractPart(const part& p, utility::outputStream& os, progressionListener* progress = NULL, const int start = 0, const int length = -1) const = 0;
-
- /** Fetch the MIME header for the specified part.
- *
- * @param p the part for which to fetch the header
- */
- virtual void fetchPartHeader(part& p) = 0;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_MESSAGE_HPP_INCLUDED
diff --git a/src/messaging/progressionListener.hpp b/src/messaging/progressionListener.hpp
deleted file mode 100644
index 1e75d862..00000000
--- a/src/messaging/progressionListener.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_PROGRESSIONLISTENER_HPP_INCLUDED
-#define VMIME_MESSAGING_PROGRESSIONLISTENER_HPP_INCLUDED
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** An interface to implement if you want to be notified
- * of a progression status by some objects.
- */
-
-class progressionListener
-{
-protected:
-
- virtual ~progressionListener() { }
-
-public:
-
- /** Allow the caller object to cancel the current operation.
- *
- * @warning WARNING: this is implementation-dependant: the underlying
- * messaging protocol may not support this).
- *
- * @return true to cancel the operation, false otherwise
- */
- virtual const bool cancel() const = 0;
-
- /** Called at the beginning of the operation.
- *
- * @param predictedTotal predicted amount of units (this has
- * no concrete meaning: they are not bytes, nor percentage...)
- */
- virtual void start(const int predictedTotal) = 0;
-
- /** Called during the operation (can be called several times).
- *
- * @param current current position
- * @param currentTotal adjusted total amount of units
- */
- virtual void progress(const int current, const int currentTotal) = 0;
-
- /** Called at the end of the operation.
- *
- * @param total final total amount of units
- */
- virtual void stop(const int total) = 0;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_PROGRESSIONLISTENER_HPP_INCLUDED
diff --git a/src/messaging/service.cpp b/src/messaging/service.cpp
index 3b0c7ed3..6654160b 100644
--- a/src/messaging/service.cpp
+++ b/src/messaging/service.cpp
@@ -17,9 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/service.hpp"
+#include "vmime/messaging/service.hpp"
-#include "messaging/defaultAuthenticator.hpp"
+#include "vmime/messaging/defaultAuthenticator.hpp"
namespace vmime {
diff --git a/src/messaging/service.hpp b/src/messaging/service.hpp
deleted file mode 100644
index 062d9b69..00000000
--- a/src/messaging/service.hpp
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_SERVICE_HPP_INCLUDED
-#define VMIME_MESSAGING_SERVICE_HPP_INCLUDED
-
-
-#include "types.hpp"
-
-#include "messaging/session.hpp"
-
-#include "messaging/authenticator.hpp"
-#include "messaging/progressionListener.hpp"
-
-#include "messaging/serviceFactory.hpp"
-#include "messaging/serviceInfos.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** Base class for messaging services.
- */
-
-class service
-{
-protected:
-
- service(session* sess, const serviceInfos& infos, authenticator* auth);
-
-public:
-
- virtual ~service();
-
- // Possible service types
- enum Type
- {
- TYPE_STORE = 0, /**< The service is a message store. */
- TYPE_TRANSPORT /**< The service sends messages. */
- };
-
- /** Return the type of service.
- *
- * @return type of service
- */
- virtual const Type getType() const = 0;
-
- /** Return the protocol name of this service.
- *
- * @return protocol name
- */
- virtual const string getProtocolName() const = 0;
-
- /** Return the session object associated with this service instance.
- *
- * @return session object
- */
- const session* getSession() const;
-
- /** Return the session object associated with this service instance.
- *
- * @return session object
- */
- session* getSession();
-
- /** Return information about this service.
- *
- * @return information about the service
- */
- virtual const serviceInfos& getInfos() const = 0;
-
- /** Connect to service.
- */
- virtual void connect() = 0;
-
- /** Disconnect from service.
- */
- virtual void disconnect() = 0;
-
- /** Test whether this service is connected.
- *
- * @return true if the service is connected, false otherwise
- */
- virtual const bool isConnected() const = 0;
-
- /** Do nothing but ensure the server do not disconnect (for
- * example, this can reset the auto-logout timer on the
- * server, if one exists).
- */
- virtual void noop() = 0;
-
- /** Return the authenticator object used with this service instance.
- *
- * @return authenticator object
- */
- const authenticator* getAuthenticator() const;
-
- /** Return the authenticator object used with this service instance.
- *
- * @return authenticator object
- */
- authenticator* getAuthenticator();
-
-#ifndef VMIME_BUILDING_DOC
- // Basic service registerer
- template <class S>
- class initializer
- {
- public:
-
- initializer(const string& protocol)
- {
- serviceFactory::getInstance()->
- template registerServiceByProtocol <S>(protocol);
- }
- };
-#endif // VMIME_BUILDING_DOC
-
-private:
-
- bool m_deleteAuth;
-
- session* m_session;
- authenticator* m_auth;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_SERVICE_HPP_INCLUDED
diff --git a/src/messaging/serviceFactory.cpp b/src/messaging/serviceFactory.cpp
index 9d51e79b..31f28b66 100644
--- a/src/messaging/serviceFactory.cpp
+++ b/src/messaging/serviceFactory.cpp
@@ -17,13 +17,13 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/serviceFactory.hpp"
-#include "messaging/service.hpp"
+#include "vmime/messaging/serviceFactory.hpp"
+#include "vmime/messaging/service.hpp"
-#include "exception.hpp"
-#include "config.hpp"
+#include "vmime/exception.hpp"
+#include "vmime/config.hpp"
-#include "messaging/builtinServices.inl"
+#include "builtinServices.inl"
namespace vmime {
diff --git a/src/messaging/serviceFactory.hpp b/src/messaging/serviceFactory.hpp
deleted file mode 100644
index 89ce9773..00000000
--- a/src/messaging/serviceFactory.hpp
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_SERVICEFACTORY_HPP_INCLUDED
-#define VMIME_MESSAGING_SERVICEFACTORY_HPP_INCLUDED
-
-
-#include <map>
-
-#include "types.hpp"
-#include "base.hpp"
-#include "utility/singleton.hpp"
-#include "utility/stringUtils.hpp"
-
-#include "messaging/serviceInfos.hpp"
-#include "messaging/authenticator.hpp"
-#include "messaging/progressionListener.hpp"
-#include "messaging/timeoutHandler.hpp"
-#include "messaging/url.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class service;
-class session;
-
-
-/** A factory to create 'service' objects for a specified protocol.
- */
-
-class serviceFactory : public utility::singleton <serviceFactory>
-{
- friend class utility::singleton <serviceFactory>;
-
-private:
-
- serviceFactory();
- ~serviceFactory();
-
-public:
-
- /** Information about a registered service. */
- class registeredService
- {
- friend class serviceFactory;
-
- protected:
-
- virtual ~registeredService() { }
-
- public:
-
- virtual service* create(session* sess, authenticator* auth) const = 0;
-
- virtual const string& getName() const = 0;
- virtual const serviceInfos& getInfos() const = 0;
- };
-
-private:
-
- template <class S>
- class registeredServiceImpl : public registeredService
- {
- friend class serviceFactory;
-
- protected:
-
- registeredServiceImpl(const string& name)
- : m_name(name), m_servInfos(S::getInfosInstance())
- {
- }
-
- public:
-
- service* create(session* sess, authenticator* auth) const
- {
- return new S(sess, auth);
- }
-
- const serviceInfos& getInfos() const
- {
- return (m_servInfos);
- }
-
- const string& getName() const
- {
- return (m_name);
- }
-
- private:
-
- const string m_name;
- const serviceInfos& m_servInfos;
- };
-
- std::vector <registeredService*> m_services;
-
-public:
-
- /** Register a new service by its protocol name.
- *
- * @param protocol protocol name
- */
- template <class S>
- void registerServiceByProtocol(const string& protocol)
- {
- const string name = stringUtils::toLower(protocol);
- m_services.push_back(new registeredServiceImpl <S>(name));
- }
-
- /** Create a new service instance from a protocol name.
- *
- * @param sess session
- * @param protocol protocol name (eg. "pop3")
- * @param auth authenticator used to provide credentials (can be NULL if not used)
- * @return a new service instance for the specified protocol
- * @throw exceptions::no_service_available if no service is registered
- * for this protocol
- */
- service* create(session* sess, const string& protocol, authenticator* auth = NULL);
-
- /** Create a new service instance from a URL.
- *
- * @param sess session
- * @param u full URL with at least protocol and server (you can also specify
- * port, username and password)
- * @param auth authenticator used to provide credentials (can be NULL if not used)
- * @return a new service instance for the specified protocol
- * @throw exceptions::no_service_available if no service is registered
- * for this protocol
- */
- service* create(session* sess, const url& u, authenticator* auth = NULL);
-
- /** Return information about a registered protocol.
- *
- * @param protocol protocol name
- * @return information about this protocol
- * @throw exceptions::no_service_available if no service is registered
- * for this protocol
- */
- const registeredService* getServiceByProtocol(const string& protocol) const;
-
- /** Return the number of registered services.
- *
- * @return number of registered services
- */
- const int getServiceCount() const;
-
- /** Return the registered service at the specified position.
- *
- * @param pos position of the registered service to return
- * @return registered service at the specified position
- */
- const registeredService* getServiceAt(const int pos) const;
-
- /** Return a list of all registered services.
- *
- * @return list of registered services
- */
- const std::vector <const registeredService*> getServiceList() const;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_SERVICEFACTORY_HPP_INCLUDED
diff --git a/src/messaging/serviceInfos.hpp b/src/messaging/serviceInfos.hpp
deleted file mode 100644
index a2f4a7cc..00000000
--- a/src/messaging/serviceInfos.hpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_SERVICEINFOS_HPP_INCLUDED
-#define VMIME_MESSAGING_SERVICEINFOS_HPP_INCLUDED
-
-
-#include <vector>
-
-#include "types.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** Stores information about a messaging service.
- */
-
-class serviceInfos
-{
- friend class serviceFactory;
-
-protected:
-
- serviceInfos() { }
- serviceInfos(const serviceInfos&) { }
-
-private:
-
- serviceInfos& operator=(const serviceInfos&) { return (*this); }
-
-public:
-
- virtual ~serviceInfos() { }
-
- /** Return the default port used for the underlying protocol.
- *
- * @return default port number
- */
- virtual const port_t getDefaultPort() const = 0;
-
- /** Return the property prefix used by this service.
- * Use this to set/get properties in the session object.
- *
- * @return property prefix
- */
- virtual const string getPropertyPrefix() const = 0;
-
- /** Return a list of available properties for this service.
- *
- * @return list of property names
- */
- virtual const std::vector <string> getAvailableProperties() const = 0;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_SERVICEINFOS_HPP_INCLUDED
diff --git a/src/messaging/session.cpp b/src/messaging/session.cpp
index 8edfcab4..1807f408 100644
--- a/src/messaging/session.cpp
+++ b/src/messaging/session.cpp
@@ -17,11 +17,11 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/session.hpp"
-#include "messaging/serviceFactory.hpp"
+#include "vmime/messaging/session.hpp"
+#include "vmime/messaging/serviceFactory.hpp"
-#include "messaging/store.hpp"
-#include "messaging/transport.hpp"
+#include "vmime/messaging/store.hpp"
+#include "vmime/messaging/transport.hpp"
namespace vmime {
diff --git a/src/messaging/session.hpp b/src/messaging/session.hpp
deleted file mode 100644
index 4ee25157..00000000
--- a/src/messaging/session.hpp
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_SESSION_HPP_INCLUDED
-#define VMIME_MESSAGING_SESSION_HPP_INCLUDED
-
-
-#include "messaging/authenticator.hpp"
-#include "messaging/progressionListener.hpp"
-#include "messaging/url.hpp"
-
-#include "propertySet.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-class store;
-class transport;
-
-
-/** An object that contains all the information needed
- * for connection to a service.
- */
-
-class session
-{
-public:
-
- session();
- session(const propertySet& props);
-
- virtual ~session();
-
- /** Return a transport service instance for the protocol specified
- * in the session properties.
- *
- * The property "transport.protocol" specify the protocol to use.
- *
- * @param auth authenticator object to use for the new transport service. If
- * NULL, a default one is used. The default authenticator simply return user
- * credentials by reading the session properties "auth.username" and "auth.password".
- * @return a new transport service
- */
- transport* getTransport(authenticator* auth = NULL);
-
- /** Return a transport service instance for the specified protocol.
- *
- * @param protocol transport protocol to use (eg. "smtp")
- * @param auth authenticator object to use for the new transport service. If
- * NULL, a default one is used. The default authenticator simply return user
- * credentials by reading the session properties "auth.username" and "auth.password".
- * @return a new transport service
- */
- transport* getTransport(const string& protocol, authenticator* auth = NULL);
-
- /** Return a transport service instance for the specified URL.
- *
- * @param url full URL with at least the protocol to use (eg: "smtp://myserver.com/")
- * @param auth authenticator object to use for the new transport service. If
- * NULL, a default one is used. The default authenticator simply return user
- * credentials by reading the session properties "auth.username" and "auth.password".
- * @return a new transport service
- */
- transport* getTransport(const messaging::url& url, authenticator* auth = NULL);
-
- /** Return a transport service instance for the protocol specified
- * in the session properties.
- *
- * The property "store.protocol" specify the protocol to use.
- *
- * @param auth authenticator object to use for the new store service. If
- * NULL, a default one is used. The default authenticator simply return user
- * credentials by reading the session properties "auth.username" and "auth.password".
- * @return a new store service
- */
- store* getStore(authenticator* auth = NULL);
-
- /** Return a store service instance for the specified protocol.
- *
- * @param protocol store protocol to use (eg. "imap")
- * @param auth authenticator object to use for the new store service. If
- * NULL, a default one is used. The default authenticator simply return user
- * credentials by reading the session properties "auth.username" and "auth.password".
- * @return a new store service
- */
- store* getStore(const string& protocol, authenticator* auth = NULL);
-
- /** Return a store service instance for the specified URL.
- *
- * @param url full URL with at least the protocol to use (eg: "imap://username:[email protected]/")
- * @param auth authenticator object to use for the new store service. If
- * NULL, a default one is used. The default authenticator simply return user
- * credentials by reading the session properties "auth.username" and "auth.password".
- * @return a new store service
- */
- store* getStore(const messaging::url& url, authenticator* auth = NULL);
-
- /** Properties for the session and for the services.
- */
- const propertySet& getProperties() const;
-
- /** Properties for the session and for the services.
- */
- propertySet& getProperties();
-
-private:
-
- propertySet m_props;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_SESSION_HPP_INCLUDED
diff --git a/src/messaging/simpleAuthenticator.cpp b/src/messaging/simpleAuthenticator.cpp
index abfa3086..8ed534ac 100644
--- a/src/messaging/simpleAuthenticator.cpp
+++ b/src/messaging/simpleAuthenticator.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/simpleAuthenticator.hpp"
+#include "vmime/messaging/simpleAuthenticator.hpp"
namespace vmime {
diff --git a/src/messaging/simpleAuthenticator.hpp b/src/messaging/simpleAuthenticator.hpp
deleted file mode 100644
index ddee3360..00000000
--- a/src/messaging/simpleAuthenticator.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_SIMPLEAUTHENTICATOR_HPP_INCLUDED
-#define VMIME_MESSAGING_SIMPLEAUTHENTICATOR_HPP_INCLUDED
-
-
-#include "messaging/authenticator.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** Basic implementation for an authenticator.
- */
-
-class simpleAuthenticator : public authenticator
-{
-public:
-
- simpleAuthenticator();
- simpleAuthenticator(const string& username, const string& password);
-
-public:
-
- const string& getUsername() const;
- void setUsername(const string& username);
-
- const string& getPassword() const;
- void setPassword(const string& password);
-
-private:
-
- string m_username;
- string m_password;
-
- const authenticationInfos getAuthInfos() const;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_SIMPLEAUTHENTICATOR_HPP_INCLUDED
diff --git a/src/messaging/socket.hpp b/src/messaging/socket.hpp
deleted file mode 100644
index 020af57e..00000000
--- a/src/messaging/socket.hpp
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_SOCKET_HPP_INCLUDED
-#define VMIME_MESSAGING_SOCKET_HPP_INCLUDED
-
-
-#include "base.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** Interface for connecting to servers.
- */
-
-class socket
-{
-public:
-
- virtual ~socket() { }
-
- /** Connect to the specified address and port.
- *
- * @param address server address (this can be a full qualified domain name
- * or an IP address, doesn't matter)
- * @param port server port
- */
- virtual void connect(const string& address, const port_t port) = 0;
-
- /** Disconnect from the server.
- */
- virtual void disconnect() = 0;
-
- /** Test whether this socket is connected.
- *
- * @return true if the socket is connected, false otherwise
- */
- virtual const bool isConnected() const = 0;
-
- /** Receive (text) data from the socket.
- *
- * @param buffer buffer in which to write received data
- */
- virtual void receive(string& buffer) = 0;
-
- /** Receive (raw) data from the socket.
- *
- * @param buffer buffer in which to write received data
- * @param count maximum number of bytes to receive (size of buffer)
- * @return number of bytes received/written into output buffer
- */
- virtual const int receiveRaw(char* buffer, const int count) = 0;
-
- /** Send (text) data to the socket.
- *
- * @param buffer data to send
- */
- virtual void send(const string& buffer) = 0;
-
- /** Send (raw) data to the socket.
- *
- * @param buffer data to send
- * @param count number of bytes to send (size of buffer)
- */
- virtual void sendRaw(const char* buffer, const int count) = 0;
-};
-
-
-/** A class to create 'socket' objects.
- */
-
-class socketFactory
-{
-public:
-
- virtual ~socketFactory() { }
-
- virtual socket* create() = 0;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_SOCKET_HPP_INCLUDED
diff --git a/src/messaging/store.hpp b/src/messaging/store.hpp
deleted file mode 100644
index d6830166..00000000
--- a/src/messaging/store.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_STORE_HPP_INCLUDED
-#define VMIME_MESSAGING_STORE_HPP_INCLUDED
-
-
-#include "messaging/service.hpp"
-#include "messaging/folder.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** A store service.
- * Encapsulate protocols that provide access to user's mail drop.
- */
-
-class store : public service
-{
-protected:
-
- store(session* sess, const serviceInfos& infos, authenticator* auth)
- : service(sess, infos, auth) { }
-
-public:
-
- /** Return the default folder. This is protocol dependant
- * and usually is the INBOX folder.
- *
- * @return default folder
- */
- virtual folder* getDefaultFolder() = 0;
-
- /** Return the root folder. This is protocol dependant
- * and usually is the user's mail drop root folder.
- *
- * @return root folder
- */
- virtual folder* getRootFolder() = 0;
-
- /** Return the folder specified by the path.
- *
- * @param path absolute folder path
- * @return folder at the specified path
- */
- virtual folder* getFolder(const folder::path& path) = 0;
-
- /** Test whether the specified folder name is a syntactically
- * a valid name.
- *
- * @return true if the specified folder name is valid, false otherwise
- */
- virtual const bool isValidFolderName(const folder::path::component& name) const = 0;
-
- /** Store capabilities. */
- enum Capabilities
- {
- CAPABILITY_CREATE_FOLDER = (1 << 0), /**< Can create folders. */
- CAPABILITY_RENAME_FOLDER = (1 << 1), /**< Can rename folders. */
- CAPABILITY_ADD_MESSAGE = (1 << 2), /**< Can append message to folders. */
- CAPABILITY_COPY_MESSAGE = (1 << 3), /**< Can copy messages from a folder to another one. */
- CAPABILITY_DELETE_MESSAGE = (1 << 4), /**< Can delete messages. */
- CAPABILITY_PARTIAL_FETCH = (1 << 5), /**< Is partial fetch supported? */
- CAPABILITY_MESSAGE_FLAGS = (1 << 6), /**< Can set flags on messages. */
- CAPABILITY_EXTRACT_PART = (1 << 7) /**< Can extract a specific part of the message. */
- };
-
- /** Return the features supported by this service. This is
- * a combination of store::CAPABILITY_xxx flags.
- *
- * @return features supported by this service
- */
- virtual const int getCapabilities() const = 0;
-
-
- const Type getType() const { return (TYPE_STORE); }
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_STORE_HPP_INCLUDED
diff --git a/src/messaging/timeoutHandler.hpp b/src/messaging/timeoutHandler.hpp
deleted file mode 100644
index 1d366084..00000000
--- a/src/messaging/timeoutHandler.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_TIMEOUTHANDLER_HPP_INCLUDED
-#define VMIME_MESSAGING_TIMEOUTHANDLER_HPP_INCLUDED
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** A class to manage time-out in messaging services.
- */
-
-class timeoutHandler
-{
-public:
-
- virtual ~timeoutHandler() { }
-
- /** Called to test if the time limit has been reached.
- *
- * @return true if the time-out delay is elapsed
- */
- virtual const bool isTimeOut() = 0;
-
- /** Called to reset the time-out counter.
- */
- virtual void resetTimeOut() = 0;
-
- /** Called when the time limit has been reached (when
- * isTimeOut() returned true).
- *
- * @return true to continue (and reset the time-out)
- * or false to cancel the current operation
- */
- virtual const bool handleTimeOut() = 0;
-};
-
-
-/** A class to create 'timeoutHandler' objects.
- */
-
-class timeoutHandlerFactory
-{
-public:
-
- virtual ~timeoutHandlerFactory() { }
-
- virtual timeoutHandler* create() = 0;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_TIMEOUTHANDLER_HPP_INCLUDED
diff --git a/src/messaging/transport.hpp b/src/messaging/transport.hpp
deleted file mode 100644
index be7caab9..00000000
--- a/src/messaging/transport.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_TRANSPORT_HPP_INCLUDED
-#define VMIME_MESSAGING_TRANSPORT_HPP_INCLUDED
-
-
-#include "messaging/service.hpp"
-#include "utility/stream.hpp"
-
-
-namespace vmime {
-
-class message;
-class mailbox;
-class mailboxList;
-
-namespace messaging {
-
-
-/** A transport service.
- * Encapsulate protocols that can send messages.
- */
-
-class transport : public service
-{
-protected:
-
- transport(session* sess, const serviceInfos& infos, authenticator* auth)
- : service(sess, infos, auth) { }
-
-public:
-
- /** Send a message over this transport service.
- *
- * @param msg message to send
- * @param progress progression listener, or NULL if not used
- */
- virtual void send(vmime::message* msg, progressionListener* progress = NULL) = 0;
-
- /** Send a message over this transport service.
- *
- * @param expeditor expeditor mailbox
- * @param recipients list of recipient mailboxes
- * @param is input stream provding message data (header + body)
- * @param size size of the message data
- * @param progress progression listener, or NULL if not used
- */
- virtual void send(const mailbox& expeditor, const mailboxList& recipients, utility::inputStream& is, const utility::stream::size_type size, progressionListener* progress = NULL) = 0;
-
-
- const Type getType() const { return (TYPE_TRANSPORT); }
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_TRANSPORT_HPP_INCLUDED
diff --git a/src/messaging/url.cpp b/src/messaging/url.cpp
index b770482b..9d6ba0dd 100644
--- a/src/messaging/url.cpp
+++ b/src/messaging/url.cpp
@@ -17,11 +17,11 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "url.hpp"
+#include "vmime/messaging/url.hpp"
-#include "parserHelpers.hpp"
-#include "messaging/urlUtils.hpp"
-#include "exception.hpp"
+#include "vmime/parserHelpers.hpp"
+#include "vmime/messaging/urlUtils.hpp"
+#include "vmime/exception.hpp"
#include <sstream>
diff --git a/src/messaging/url.hpp b/src/messaging/url.hpp
deleted file mode 100644
index 9440e61d..00000000
--- a/src/messaging/url.hpp
+++ /dev/null
@@ -1,188 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_URL_HPP_INCLUDED
-#define VMIME_MESSAGING_URL_HPP_INCLUDED
-
-
-#include "types.hpp"
-#include "base.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** This class represents a Uniform Resource Locator (a pointer
- * to a "resource" on the World Wide Web).
- */
-
-class url
-{
-public:
-
- /** Means "port not specified" (use default port). */
- static const port_t UNSPECIFIED_PORT = static_cast <port_t>(-1);
-
- /** Standard name for FILE protocol (local file-system). */
- static const string PROTOCOL_FILE;
-
- /** Standard name for HTTP protocol. */
- static const string PROTOCOL_HTTP;
-
- /** Standard name for FTP protocol. */
- static const string PROTOCOL_FTP;
-
-
- /** Construct an URL from a string (parse the URL components).
- *
- * @param s full URL string (eg. http://vmime.sourceforge.net:80/download.html
- */
- url(const string& s);
-
- /** Construct an URL from another URL object.
- *
- * @param u other URL object
- */
- url(const url& u);
-
- /** Construct an URL from the components.
- *
- * @param protocol protocol (eg. "http", "ftp"...)
- * @param host host name (eg. "vmime.sourceforge.net", "123.45.67.89")
- * @param port optional port number (eg. 80, 110 or UNSPECIFIED_PORT to mean "default")
- * @param path optional full path (eg. "download.html")
- * @param username optional user name
- * @param password optional user password
- */
- url(const string& protocol, const string& host, const port_t port = UNSPECIFIED_PORT,
- const string& path = "", const string& username = "", const string& password = "");
-
-
- /** Return the protocol of the URL (eg: "http").
- *
- * @return protocol of the URL
- */
- const string& getProtocol() const;
-
- /** Set the protocol of the URL.
- *
- * @param protocol new protocol (eg: "http")
- */
- void setProtocol(const string& protocol);
-
- /** Return the username specified in the URL
- * or empty if not specified.
- *
- * @return user name
- */
- const string& getUsername() const;
-
- /** Set the username of the URL.
- *
- * @param username user name
- */
- void setUsername(const string& username);
-
- /** Return the password specified in the URL
- * or empty if not specified.
- *
- * @return user password
- */
- const string& getPassword() const;
-
- /** Set the password of the URL.
- *
- * @param password user password
- */
- void setPassword(const string& password);
-
- /** Return the host name of the URL (server name or IP address).
- *
- * @return host name
- */
- const string& getHost() const;
-
- /** Set the host name of the URL.
- *
- * @param host server name or IP address
- */
- void setHost(const string& host);
-
- /** Return the port of the URL, or url::UNSPECIFIED_PORT if
- * the default port if used.
- *
- * @return server port
- */
- const port_t getPort() const;
-
- /** Set the port of the URL.
- *
- * @param port server port or url::UNSPECIFIED_PORT to
- * use the default port of the protocol
- */
- void setPort(const port_t port);
-
- /** Return the path portion of the URL,
- * or empty if not specified.
- *
- * @return path
- */
- const string& getPath() const;
-
- /** Set the part portion of the URL.
- *
- * @param path path
- */
- void setPath(const string& path);
-
-
- /** Build a string URL from this object.
- */
- operator string() const;
-
- url& operator=(const url& u);
- url& operator=(const string& s);
-
-private:
-
- const string build() const;
- void parse(const string& str);
-
- // Format:
- // "protocol://[username[:password]@]host[:port][/path]"
-
- string m_protocol;
-
- string m_username;
- string m_password;
-
- string m_host;
-
- port_t m_port;
-
- string m_path;
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_URL_HPP_INCLUDED
diff --git a/src/messaging/urlUtils.cpp b/src/messaging/urlUtils.cpp
index 03b20a8f..c09ce993 100644
--- a/src/messaging/urlUtils.cpp
+++ b/src/messaging/urlUtils.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "messaging/urlUtils.hpp"
+#include "vmime/messaging/urlUtils.hpp"
namespace vmime {
diff --git a/src/messaging/urlUtils.hpp b/src/messaging/urlUtils.hpp
deleted file mode 100644
index 1e73a38a..00000000
--- a/src/messaging/urlUtils.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_MESSAGING_URLUTILS_HPP_INCLUDED
-#define VMIME_MESSAGING_URLUTILS_HPP_INCLUDED
-
-
-#include "types.hpp"
-#include "base.hpp"
-
-
-namespace vmime {
-namespace messaging {
-
-
-/** Miscellaneous functions related to URLs.
- */
-
-class urlUtils
-{
-public:
-
- /** Encode extended characters in a URL string (ASCII characters
- * are unmodified, other are encoded as '%' followed by hex code).
- */
- static const string encode(const string& s);
-
- /** Decode an hex-encoded URL (see encode()).
- */
- static const string decode(const string& s);
-};
-
-
-} // messaging
-} // vmime
-
-
-#endif // VMIME_MESSAGING_URLUTILS_HPP_INCLUDED
diff --git a/src/options.cpp b/src/options.cpp
index 8435f8f3..443bf38d 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "options.hpp"
+#include "vmime/options.hpp"
namespace vmime
diff --git a/src/options.hpp b/src/options.hpp
deleted file mode 100644
index a3b9c051..00000000
--- a/src/options.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_OPTIONS_HPP_INCLUDED
-#define VMIME_OPTIONS_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "utility/singleton.hpp"
-
-
-namespace vmime
-{
-
-
-/** A class to set global options for VMime.
- */
-
-class options : public utility::singleton <options>
-{
- friend class utility::singleton <options>;
-
-protected:
-
- /** Message-related options.
- */
- class messageOptions
- {
- protected:
-
- friend class options;
-
- messageOptions()
- : m_maxLineLength(lineLengthLimits::convenient)
- {
- }
-
- string::size_type m_maxLineLength;
-
- public:
-
- const string::size_type& maxLineLength() const { return (m_maxLineLength); }
- string::size_type& maxLineLength() { return (m_maxLineLength); }
- };
-
- /** Multipart-related options.
- */
- class multipartOptions
- {
- private:
-
- friend class options;
-
- multipartOptions();
-
- string m_prologText;
- string m_epilogText;
-
- public:
-
- const string& getPrologText() const;
- void setPrologText(const string& prologText);
-
- const string& getEpilogText() const;
- void setEpilogText(const string& epilogText);
- };
-
-public:
-
- multipartOptions multipart;
- messageOptions message;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_OPTIONS_HPP_INCLUDED
diff --git a/src/parameter.cpp b/src/parameter.cpp
index a47a5a1a..f541f75e 100644
--- a/src/parameter.cpp
+++ b/src/parameter.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "parameter.hpp"
-#include "parameterFactory.hpp"
+#include "vmime/parameter.hpp"
+#include "vmime/parameterFactory.hpp"
namespace vmime
diff --git a/src/parameter.hpp b/src/parameter.hpp
deleted file mode 100644
index 8e718a26..00000000
--- a/src/parameter.hpp
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PARAMETER_HPP_INCLUDED
-#define VMIME_PARAMETER_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-class parameter : public component
-{
- friend class parameterFactory;
-
-public:
-
- parameter* clone() const;
- void copyFrom(const component& other);
- parameter& operator=(const parameter& other);
-
- const std::vector <const component*> getChildComponents() const;
-
- /** Return the name of the parameter.
- *
- * @return name of the parameter
- */
- const string& getName() const;
-
- /** Return the read-only value object attached to this field.
- *
- * @return read-only value object
- */
- virtual const component& getValue() const = 0;
-
- /** Return the value object attached to this field.
- *
- * @return value object
- */
- virtual component& getValue() = 0;
-
- /** Set the value of the parameter.
- *
- * @throw std::bad_cast_exception if the value type is
- * incompatible with the parameter type
- * @param value value object
- */
- virtual void setValue(const component& value) = 0;
-
- using component::parse;
- using component::generate;
-
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-
-private:
-
- string m_name;
-
- void generateValue(utility::outputStream& os, const string::size_type maxLineLength, const string::size_type curLinePos, string::size_type* newLinePos) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_PARAMETER_HPP_INCLUDED
diff --git a/src/parameterFactory.cpp b/src/parameterFactory.cpp
index ae1d470d..f1fbd0a3 100644
--- a/src/parameterFactory.cpp
+++ b/src/parameterFactory.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "parameterFactory.hpp"
-#include "exception.hpp"
+#include "vmime/parameterFactory.hpp"
+#include "vmime/exception.hpp"
-#include "standardParams.hpp"
+#include "vmime/standardParams.hpp"
namespace vmime
diff --git a/src/parameterFactory.hpp b/src/parameterFactory.hpp
deleted file mode 100644
index 9cda9128..00000000
--- a/src/parameterFactory.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PARAMETERFACTORY_HPP_INCLUDED
-#define VMIME_PARAMETERFACTORY_HPP_INCLUDED
-
-
-#include "parameter.hpp"
-#include "utility/singleton.hpp"
-#include "utility/stringUtils.hpp"
-
-
-namespace vmime
-{
-
-
-class parameterFactory : public utility::singleton <parameterFactory>
-{
- friend class utility::singleton <parameterFactory>;
-
-protected:
-
- parameterFactory();
- ~parameterFactory();
-
- typedef parameter* (*AllocFunc)(void);
- typedef std::map <string, AllocFunc> NameMap;
-
- NameMap m_nameMap;
-
-public:
-
-#ifndef VMIME_BUILDING_DOC
- template <class TYPE>
- class registerer
- {
- public:
-
- static parameter* creator()
- {
- // Allocate a new object
- return new TYPE();
- }
- };
-#endif // VMIME_BUILDING_DOC
-
-
- template <class T>
- void registerName(const string& name)
- {
- m_nameMap.insert(NameMap::value_type(stringUtils::toLower(name), &registerer<T>::creator));
- }
-
- parameter* create(const string& name, const string& value = NULL_STRING);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_PARAMETERFACTORY_HPP_INCLUDED
diff --git a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
index 1487abd7..f824fe11 100644
--- a/src/parameterizedHeaderField.cpp
+++ b/src/parameterizedHeaderField.cpp
@@ -17,10 +17,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "parameterizedHeaderField.hpp"
-#include "parameterFactory.hpp"
-#include "text.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/parameterizedHeaderField.hpp"
+#include "vmime/parameterFactory.hpp"
+#include "vmime/text.hpp"
+#include "vmime/parserHelpers.hpp"
namespace vmime
diff --git a/src/parameterizedHeaderField.hpp b/src/parameterizedHeaderField.hpp
deleted file mode 100644
index 980c78eb..00000000
--- a/src/parameterizedHeaderField.hpp
+++ /dev/null
@@ -1,181 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PARAMETERIZEDHEADERFIELD_HPP_INCLUDED
-#define VMIME_PARAMETERIZEDHEADERFIELD_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "headerFieldFactory.hpp"
-#include "parameter.hpp"
-#include "exception.hpp"
-#include "parameterFactory.hpp"
-
-
-namespace vmime
-{
-
-
-class parameterizedHeaderField : virtual public headerField
-{
- friend class headerFieldFactory::registerer <parameterizedHeaderField>;
-
-protected:
-
- parameterizedHeaderField();
-
-public:
-
- void copyFrom(const component& other);
- parameterizedHeaderField& operator=(const parameterizedHeaderField& other);
-
- /** Checks whether (at least) one parameter with this name exists.
- *
- * @return true if at least one parameter with the specified name
- * exists, or false otherwise
- */
- const bool hasParameter(const string& paramName) const;
-
- /** Find the first parameter that matches the specified name.
- * If no parameter is found, an exception is thrown.
- *
- * @throw exceptions::no_such_parameter if no parameter with this name exists
- * @return first parameter with the specified name
- */
- parameter* findParameter(const string& paramName) const;
-
- /** Find the first parameter that matches the specified name.
- * If no parameter is found, one will be created and inserted into
- * the parameter list.
- *
- * @return first parameter with the specified name or a new field
- * if no parameter is found
- */
- parameter* getParameter(const string& paramName);
-
- /** Add a parameter at the end of the list.
- *
- * @param param parameter to append
- */
- void appendParameter(parameter* param);
-
- /** Insert a new parameter before the specified parameter.
- *
- * @param beforeParam parameter before which the new parameter will be inserted
- * @param param parameter to insert
- * @throw exceptions::no_such_parameter if the parameter is not in the list
- */
- void insertParameterBefore(parameter* beforeParam, parameter* param);
-
- /** Insert a new parameter before the specified position.
- *
- * @param pos position at which to insert the new parameter (0 to insert at
- * the beginning of the list)
- * @param param parameter to insert
- */
- void insertParameterBefore(const int pos, parameter* param);
-
- /** Insert a new parameter after the specified parameter.
- *
- * @param afterParam parameter after which the new parameter will be inserted
- * @param param parameter to insert
- * @throw exceptions::no_such_parameter if the parameter is not in the list
- */
- void insertParameterAfter(parameter* afterParam, parameter* param);
-
- /** Insert a new parameter after the specified position.
- *
- * @param pos position of the parameter before the new parameter
- * @param param parameter to insert
- */
- void insertParameterAfter(const int pos, parameter* param);
-
- /** Remove the specified parameter from the list.
- *
- * @param param parameter to remove
- * @throw exceptions::no_such_parameter if the parameter is not in the list
- */
- void removeParameter(parameter* param);
-
- /** Remove the parameter at the specified position.
- *
- * @param pos position of the parameter to remove
- */
- void removeParameter(const int pos);
-
- /** Remove all parameters from the list.
- */
- void removeAllParameters();
-
- /** Return the number of parameters in the list.
- *
- * @return number of parameters
- */
- const int getParameterCount() const;
-
- /** Tests whether the list of parameters is empty.
- *
- * @return true if there is no parameter, false otherwise
- */
- const bool isEmpty() const;
-
- /** Return the parameter at the specified position.
- *
- * @param pos position
- * @return parameter at position 'pos'
- */
- parameter* getParameterAt(const int pos);
-
- /** Return the parameter at the specified position.
- *
- * @param pos position
- * @return parameter at position 'pos'
- */
- const parameter* const getParameterAt(const int pos) const;
-
- /** Return the parameter list.
- *
- * @return list of parameters
- */
- const std::vector <const parameter*> getParameterList() const;
-
- /** Return the parameter list.
- *
- * @return list of parameters
- */
- const std::vector <parameter*> getParameterList();
-
-private:
-
- std::vector <parameter*> m_params;
-
-public:
-
- using headerField::parse;
- using headerField::generate;
-
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_PARAMETERIZEDHEADERFIELD_HPP_INCLUDED
diff --git a/src/parserHelpers.hpp b/src/parserHelpers.hpp
deleted file mode 100644
index cfe853dd..00000000
--- a/src/parserHelpers.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PARSERHELPERS_HPP_INCLUDED
-#define VMIME_PARSERHELPERS_HPP_INCLUDED
-
-
-#include "types.hpp"
-#include "utility/stringUtils.hpp"
-
-#include <algorithm>
-
-
-
-namespace vmime
-{
-
-
-inline const bool isspace(const char_t c)
-{
- return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
-}
-
-
-inline const bool isdigit(const char_t c)
-{
- return (c >= '0' && c <= '9');
-}
-
-
-inline const bool isalpha(const char_t c)
-{
- return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
-}
-
-
-inline const char_t tolower(const char_t c)
-{
- if (c >= 'A' && c <= 'Z')
- return ('a' + (c - 'A'));
- else
- return c;
-}
-
-
-// Checks whether a character is in the 7-bit US-ASCII charset
-
-inline const bool isascii(const char_t c)
-{
- return (c <= 127);
-}
-
-
-// Checks whether a character has a visual representation
-
-inline const bool isprint(const char_t c)
-{
- return (c >= 0x20 && c <= 0x7E);
-}
-
-
-} // vmime
-
-
-#endif // VMIME_PARSERHELPERS_HPP_INCLUDED
diff --git a/src/plainTextPart.cpp b/src/plainTextPart.cpp
index 8a1bf994..b8cb8224 100644
--- a/src/plainTextPart.cpp
+++ b/src/plainTextPart.cpp
@@ -17,9 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "plainTextPart.hpp"
-#include "header.hpp"
-#include "exception.hpp"
+#include "vmime/plainTextPart.hpp"
+#include "vmime/header.hpp"
+#include "vmime/exception.hpp"
namespace vmime
diff --git a/src/plainTextPart.hpp b/src/plainTextPart.hpp
deleted file mode 100644
index ae5425c6..00000000
--- a/src/plainTextPart.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PLAINTEXTPART_HPP_INCLUDED
-#define VMIME_PLAINTEXTPART_HPP_INCLUDED
-
-
-#include "textPart.hpp"
-
-
-namespace vmime
-{
-
-
-/** Text part of type 'text/plain'.
- */
-
-class plainTextPart : public textPart
-{
-public:
-
- const mediaType getType() const;
-
- const charset& getCharset() const;
- void setCharset(const charset& ch);
-
- const contentHandler& getText() const;
- void setText(const contentHandler& text);
-
-private:
-
- contentHandler m_text;
- charset m_charset;
-
- const int getPartCount() const;
-
- void generateIn(bodyPart& message, bodyPart& parent) const;
- void parse(const bodyPart& message, const bodyPart& parent, const bodyPart& textPart);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_PLAINTEXTPART_HPP_INCLUDED
diff --git a/src/platformDependant.cpp b/src/platformDependant.cpp
index cf1ed8c1..91a9f93a 100644
--- a/src/platformDependant.cpp
+++ b/src/platformDependant.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "platformDependant.hpp"
+#include "vmime/platformDependant.hpp"
namespace vmime
diff --git a/src/platformDependant.hpp b/src/platformDependant.hpp
deleted file mode 100644
index 660d54b3..00000000
--- a/src/platformDependant.hpp
+++ /dev/null
@@ -1,158 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PLATFORMDEPENDANT_HPP_INCLUDED
-#define VMIME_PLATFORMDEPENDANT_HPP_INCLUDED
-
-
-#include "config.hpp"
-#include "dateTime.hpp"
-#include "exception.hpp"
-#include "charset.hpp"
-
-#if VMIME_HAVE_MESSAGING_FEATURES
- #include "messaging/socket.hpp"
- #include "messaging/timeoutHandler.hpp"
-#endif
-
-#if VMIME_HAVE_FILESYSTEM_FEATURES
- #include "utility/file.hpp"
-#endif
-
-
-namespace vmime
-{
-
-
-/** Allow setting or getting the current platform handler.
- */
-
-class platformDependant
-{
-public:
-
- /** Handles all platform-dependant operations. It offers an interface to
- * access platform-dependant objects: sockets, date/time, file system, etc.
- */
-
- class handler
- {
- public:
-
- virtual ~handler();
-
- /** Return the current UNIX time (Epoch time): the number of
- * seconds elapsed since Jan, 1st 1970 00:00.
- *
- * @return UNIX Epoch time
- */
- virtual const unsigned int getUnixTime() const = 0;
-
- /** Return the current date and time, in the local time zone.
- *
- * @return current date and time
- */
- virtual const datetime getCurrentLocalTime() const = 0;
-
- /** Return the host name of the system.
- * Used when generating message ids.
- *
- * @return host name
- */
- virtual const string getHostName() const = 0;
-
- /** Return the current process identifier.
- * Used when generating random strings (part boundaries or message ids).
- *
- * @return current process id
- */
- virtual const unsigned int getProcessId() const = 0;
-
- /** Return the charset used on the system.
- *
- * @return locale charset
- */
- virtual const charset getLocaleCharset() const = 0;
-
- /** This function is called when VMime library is waiting for
- * something (for example, it is called when there is no data
- * available in a socket). On POSIX-compliant systems, a
- * simple call to sched_yield() should suffice.
- */
- virtual void wait() const = 0;
-
-#if VMIME_HAVE_MESSAGING_FEATURES
- /** Return a pointer to a socket factory for the specified socket
- * type name (this is user-defined, and used for example when you
- * want to set up a SSL connection to a server).
- * The returned object will not be deleted by VMime, so it can be
- * a pointer to a static object.
- *
- * @param name socket type name (user-dependant): this is usually
- * the value of the property "server.socket-factory" set in the
- * session object
- * @return socket factory
- */
- virtual messaging::socketFactory* getSocketFactory(const string& name = "default") const = 0;
-
- /** Return a pointer to a timeout-handler factory for the specified name.
- * The returned object will not be deleted by VMime, so it can be a
- * pointer to a static object.
- *
- * This is used when you want to handle a timeout-mechanism when
- * connecting to messaging servers (please read the documentation to
- * learn how to use it). If you are not using time-out handlers, you
- * can safely return NULL here.
- *
- * @param name time-out type name
- * @return time-out factory
- */
- virtual messaging::timeoutHandlerFactory* getTimeoutHandlerFactory(const string& name = "default") const = 0;
-#endif
-#if VMIME_HAVE_FILESYSTEM_FEATURES
- virtual utility::fileSystemFactory* getFileSystemFactory() const = 0;
-#endif
- };
-
-
- template <class TYPE>
- static void setHandler()
- {
- delete (sm_handler);
- sm_handler = new TYPE;
- }
-
- static const handler* const getHandler()
- {
- if (!sm_handler)
- throw exceptions::no_platform_dependant_handler();
-
- return (sm_handler);
- }
-
-private:
-
- static handler* sm_handler;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_PLATFORMDEPENDANT_HPP_INCLUDED
diff --git a/src/platforms/posix/file.cpp b/src/platforms/posix/file.cpp
index 463d4ca0..2854f54d 100644
--- a/src/platforms/posix/file.cpp
+++ b/src/platforms/posix/file.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "platforms/posix/file.hpp"
+#include "vmime/platforms/posix/file.hpp"
#include <unistd.h>
#include <fcntl.h>
@@ -30,7 +30,7 @@
#include <string.h>
-#include "exception.hpp"
+#include "vmime/exception.hpp"
#if VMIME_HAVE_FILESYSTEM_FEATURES
diff --git a/src/platforms/posix/file.hpp b/src/platforms/posix/file.hpp
deleted file mode 100644
index 7405d238..00000000
--- a/src/platforms/posix/file.hpp
+++ /dev/null
@@ -1,205 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PLATFORMS_POSIX_FILE_HPP_INCLUDED
-#define VMIME_PLATFORMS_POSIX_FILE_HPP_INCLUDED
-
-
-#include "utility/file.hpp"
-
-
-#if VMIME_HAVE_FILESYSTEM_FEATURES
-
-
-#include <dirent.h>
-
-
-namespace vmime {
-namespace platforms {
-namespace posix {
-
-
-class posixFileWriterOutputStream : public vmime::utility::outputStream
-{
-public:
-
- posixFileWriterOutputStream(const vmime::utility::file::path& path, const int fd);
- ~posixFileWriterOutputStream();
-
- void write(const value_type* const data, const size_type count);
-
-private:
-
- const vmime::utility::file::path m_path;
- const int m_fd;
-};
-
-
-
-class posixFileReaderInputStream : public vmime::utility::inputStream
-{
-public:
-
- posixFileReaderInputStream(const vmime::utility::file::path& path, const int fd);
- ~posixFileReaderInputStream();
-
- const bool eof() const;
-
- void reset();
-
- const size_type read(value_type* const data, const size_type count);
-
- const size_type skip(const size_type count);
-
-private:
-
- const vmime::utility::file::path m_path;
- const int m_fd;
-
- bool m_eof;
-};
-
-
-
-class posixFileWriter : public vmime::utility::fileWriter
-{
-public:
-
- posixFileWriter(const vmime::utility::file::path& path, const vmime::string& nativePath);
-
- vmime::utility::outputStream* getOutputStream();
-
-private:
-
- vmime::utility::file::path m_path;
- vmime::string m_nativePath;
-};
-
-
-
-class posixFileReader : public vmime::utility::fileReader
-{
-public:
-
- posixFileReader(const vmime::utility::file::path& path, const vmime::string& nativePath);
-
- vmime::utility::inputStream* getInputStream();
-
-private:
-
- vmime::utility::file::path m_path;
- vmime::string m_nativePath;
-};
-
-
-
-class posixFileIterator : public vmime::utility::fileIterator
-{
-public:
-
- posixFileIterator(const vmime::utility::file::path& path, const vmime::string& nativePath);
- ~posixFileIterator();
-
- const bool hasMoreElements() const;
- vmime::utility::file* nextElement();
-
-private:
-
- void getNextElement();
-
- vmime::utility::file::path m_path;
- vmime::string m_nativePath;
-
- DIR* m_dir;
- struct dirent* m_dirEntry;
-};
-
-
-
-class posixFile : public vmime::utility::file
-{
-public:
-
- posixFile(const vmime::utility::file::path& path);
-
- void createFile();
- void createDirectory(const bool createAll = false);
-
- const bool isFile() const;
- const bool isDirectory() const;
-
- const bool canRead() const;
- const bool canWrite() const;
-
- const length_type getLength();
-
- const path& getFullPath() const;
-
- const bool exists() const;
-
- const vmime::utility::file* getParent() const;
-
- void rename(const path& newName);
-
- void remove();
-
- vmime::utility::fileWriter* getFileWriter();
- vmime::utility::fileReader* getFileReader();
-
- vmime::utility::fileIterator* getFiles() const;
-
-private:
-
- static void createDirectoryImpl(const vmime::utility::file::path& fullPath, const vmime::utility::file::path& path, const bool recursive = false);
-
-private:
-
- vmime::utility::file::path m_path;
- vmime::string m_nativePath;
-};
-
-
-
-class posixFileSystemFactory : public vmime::utility::fileSystemFactory
-{
-public:
-
- vmime::utility::file* create(const vmime::utility::file::path& path) const;
-
- const vmime::utility::file::path stringToPath(const vmime::string& str) const;
- const vmime::string pathToString(const vmime::utility::file::path& path) const;
-
- static const vmime::utility::file::path stringToPathImpl(const vmime::string& str);
- static const vmime::string pathToStringImpl(const vmime::utility::file::path& path);
-
- const bool isValidPathComponent(const vmime::utility::file::path::component& comp) const;
- const bool isValidPath(const vmime::utility::file::path& path) const;
-
- static void reportError(const vmime::utility::path& path, const int err);
-};
-
-
-} // posix
-} // platforms
-} // vmime
-
-
-#endif // VMIME_HAVE_FILESYSTEM_FEATURES
-
-#endif // VMIME_PLATFORMS_POSIX_FILE_HPP_INCLUDED
diff --git a/src/platforms/posix/handler.cpp b/src/platforms/posix/handler.cpp
index ddb1c421..1084d59e 100644
--- a/src/platforms/posix/handler.cpp
+++ b/src/platforms/posix/handler.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "platforms/posix/handler.hpp"
+#include "vmime/platforms/posix/handler.hpp"
#include <time.h>
diff --git a/src/platforms/posix/handler.hpp b/src/platforms/posix/handler.hpp
deleted file mode 100644
index a284e5ab..00000000
--- a/src/platforms/posix/handler.hpp
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED
-#define VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED
-
-
-#include "config.hpp"
-#include "platformDependant.hpp"
-
-#if VMIME_HAVE_MESSAGING_FEATURES
- #include "platforms/posix/socket.hpp"
-#endif
-
-#if VMIME_HAVE_FILESYSTEM_FEATURES
- #include "platforms/posix/file.hpp"
-#endif
-
-
-namespace vmime {
-namespace platforms {
-namespace posix {
-
-
-class posixHandler : public vmime::platformDependant::handler
-{
-public:
-
- posixHandler();
- ~posixHandler();
-
- const unsigned int getUnixTime() const;
-
- const vmime::datetime getCurrentLocalTime() const;
-
- const vmime::charset getLocaleCharset() const;
-
- const vmime::string getHostName() const;
-
- const unsigned int getProcessId() const;
-
-#if VMIME_HAVE_MESSAGING_FEATURES
- vmime::messaging::socketFactory* getSocketFactory(const vmime::string& name) const;
-
- vmime::messaging::timeoutHandlerFactory* getTimeoutHandlerFactory(const vmime::string& name) const;
-#endif
-
-#if VMIME_HAVE_FILESYSTEM_FEATURES
- vmime::utility::fileSystemFactory* getFileSystemFactory() const;
-#endif
-
- void wait() const;
-
-private:
-
-#if VMIME_HAVE_MESSAGING_FEATURES
- posixSocketFactory* m_socketFactory;
-#endif
-
-#if VMIME_HAVE_FILESYSTEM_FEATURES
- posixFileSystemFactory* m_fileSysFactory;
-#endif
-};
-
-
-} // posix
-} // platforms
-} // vmime
-
-
-#endif // VMIME_PLATFORMS_POSIX_HANDLER_HPP_INCLUDED
diff --git a/src/platforms/posix/socket.cpp b/src/platforms/posix/socket.cpp
index e5a07f36..fe3150bf 100644
--- a/src/platforms/posix/socket.cpp
+++ b/src/platforms/posix/socket.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "platforms/posix/socket.hpp"
+#include "vmime/platforms/posix/socket.hpp"
#include <unistd.h>
#include <sys/socket.h>
@@ -27,7 +27,7 @@
#include <netdb.h>
#include <fcntl.h>
-#include "exception.hpp"
+#include "vmime/exception.hpp"
#if VMIME_HAVE_MESSAGING_FEATURES
diff --git a/src/platforms/posix/socket.hpp b/src/platforms/posix/socket.hpp
deleted file mode 100644
index 83291bbf..00000000
--- a/src/platforms/posix/socket.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PLATFORMS_POSIX_SOCKET_HPP_INCLUDED
-#define VMIME_PLATFORMS_POSIX_SOCKET_HPP_INCLUDED
-
-
-#include "messaging/socket.hpp"
-
-
-#if VMIME_HAVE_MESSAGING_FEATURES
-
-
-namespace vmime {
-namespace platforms {
-namespace posix {
-
-
-class posixSocket : public vmime::messaging::socket
-{
-public:
-
- posixSocket();
- ~posixSocket();
-
- void connect(const vmime::string& address, const vmime::port_t port);
- const bool isConnected() const;
- void disconnect();
-
- void receive(vmime::string& buffer);
- const int receiveRaw(char* buffer, const int count);
-
- void send(const vmime::string& buffer);
- void sendRaw(const char* buffer, const int count);
-
-private:
-
- char m_buffer[65536];
- int m_desc;
-};
-
-
-
-class posixSocketFactory : public vmime::messaging::socketFactory
-{
-public:
-
- vmime::messaging::socket* create();
-};
-
-
-} // posix
-} // platforms
-} // vmime
-
-
-#endif // VMIME_HAVE_MESSAGING_FEATURES
-
-#endif // VMIME_PLATFORMS_POSIX_SOCKET_HPP_INCLUDED
diff --git a/src/propertySet.cpp b/src/propertySet.cpp
index 24ffee2c..317a5add 100644
--- a/src/propertySet.cpp
+++ b/src/propertySet.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "propertySet.hpp"
+#include "vmime/propertySet.hpp"
namespace vmime
diff --git a/src/propertySet.hpp b/src/propertySet.hpp
deleted file mode 100644
index 569c994d..00000000
--- a/src/propertySet.hpp
+++ /dev/null
@@ -1,335 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_PROPERTY_HPP_INCLUDED
-#define VMIME_PROPERTY_HPP_INCLUDED
-
-
-#include <list>
-#include <functional>
-#include <algorithm>
-#include <sstream>
-
-#include "base.hpp"
-#include "exception.hpp"
-
-#include "utility/stringUtils.hpp"
-
-
-namespace vmime
-{
-
-
-/** Manage a list of (name,value) pairs.
- */
-
-class propertySet
-{
-protected:
-
- class property
- {
- public:
-
- property(const string& name, const string& value);
- property(const string& name);
- property(const property& prop);
-
- /** Return the name of the property.
- *
- * @return property name
- */
- const string& getName() const;
-
- /** Return the value of the property as a string.
- *
- * @return current value of the property
- */
- const string& getValue() const;
-
- /** Set the value of the property as a string.
- *
- * @param value new value for property
- */
- void setValue(const string& value);
-
- /** Set the value of the property as a generic type.
- *
- * @param value new value for property
- */
- template <class TYPE> void setValue(const TYPE& value);
-
- /** Get the value of the property as a generic type.
- *
- * @throw exceptions::invalid_property_type if the specified
- * type is incompatible with the string value (cannot be
- * converted using std::istringstream)
- * @return current value of the property
- */
- template <class TYPE> const TYPE getValue() const;
-
- private:
-
- const string m_name;
- string m_value;
- };
-
- class propertyProxy
- {
- public:
-
- propertyProxy(const string& name, propertySet* set)
- : m_name(name), m_set(set)
- {
- }
-
- template <class TYPE>
- propertyProxy& operator=(const TYPE& value)
- {
- m_set->setProperty(m_name, value);
- return (*this);
- }
-
- template <class TYPE>
- void setValue(const TYPE& value)
- {
- m_set->setProperty(m_name, value);
- }
-
- template <class TYPE>
- const TYPE getValue() const
- {
- return (m_set->getProperty <TYPE>(m_name));
- }
-
- operator string() const
- {
- return (m_set->getProperty <string>(m_name));
- }
-
- private:
-
- const string m_name;
- propertySet* m_set;
- };
-
- class constPropertyProxy
- {
- public:
-
- constPropertyProxy(const string& name, const propertySet* set)
- : m_name(name), m_set(set)
- {
- }
-
- template <class TYPE>
- const TYPE getValue() const
- {
- return (m_set->getProperty <TYPE>(m_name));
- }
-
- operator string() const
- {
- return (m_set->getProperty <string>(m_name));
- }
-
- private:
-
- const string m_name;
- const propertySet* m_set;
- };
-
-public:
-
- propertySet();
- propertySet(const string& props);
- propertySet(const propertySet& set);
-
- ~propertySet();
-
- propertySet& operator=(const propertySet& set);
-
- /** Parse a string and extract one or more properties.
- * The string format is: name[=value](;name[=value])*.
- *
- * @param props string representing a list of properties
- */
- void setFromString(const string& props);
-
- /** Remove all properties from the list.
- */
- void removeAllProperties();
-
- /** Remove the specified property.
- *
- * @param name name of the property to remove
- */
- void removeProperty(const string& name);
-
- /** Test whether the specified property is set.
- *
- * @param name name of the property to test
- * @return true if the property is set (has a value),
- * false otherwise
- */
- const bool hasProperty(const string& name) const;
-
- /** Get the value of the specified property.
- *
- * @throw exceptions::no_such_property if the property does not exist
- * @param name property name
- * @return value of the specified property
- */
- template <class TYPE>
- const TYPE getProperty(const string& name) const
- {
- const property* const prop = find(name);
- if (!prop) throw exceptions::no_such_property(name);
-
- //return (prop->getValue <TYPE>()); // BUG: with g++ < 3.4
- return (prop->template getValue <TYPE>());
- }
-
- /** Get the value of the specified property.
- * A default value can be returned if the property is not set.
- *
- * @param name property name
- * @param defaultValue value to return if the specified property
- * does not exist
- * @return value of the specified property or default value
- * if if does not exist
- */
- template <class TYPE>
- const TYPE getProperty(const string& name, const TYPE defaultValue) const
- {
- const property* const prop = find(name);
- //return (prop ? prop->getValue <TYPE>() : defaultValue); // BUG: with g++ < 3.4
- return (prop ? prop->template getValue <TYPE>() : defaultValue);
- }
-
- /** Change the value of the specified property or create
- * a new property set to the specified a value.
- *
- * @param name property name
- * @param value property value
- */
- template <class TYPE>
- void setProperty(const string& name, const TYPE& value)
- {
- findOrCreate(name)->setValue(value);
- }
-
- /** Return a proxy object to access the specified property
- * suitable for reading or writing. If the property does not
- * exist and the value is changed, a new property will
- * be created.
- *
- * @param name property name
- * @return proxy object for the specified property
- */
- propertyProxy operator[](const string& name);
-
- /** Return a proxy object to access the specified property
- * suitable for reading only.
- *
- * @throw exceptions::no_such_property if the property does not exist
- * @return read-only proxy object for the specified property
- */
- const constPropertyProxy operator[](const string& name) const;
-
-private:
-
- void parse(const string& props);
-
-
- class propFinder : public std::unary_function <property*, bool>
- {
- public:
-
- propFinder(const string& name) : m_name(stringUtils::toLower(name)) { }
-
- const bool operator()(property* const p) const
- {
- return (stringUtils::toLower(p->getName()) == m_name);
- }
-
- private:
-
- const std::string m_name;
- };
-
- property* find(const string& name) const;
- property* findOrCreate(const string& name);
-
- typedef std::list <property*> list_type;
- list_type m_props;
-
-public:
-
- /** Return the property list.
- *
- * @return list of properties
- */
- const std::vector <const property*> getPropertyList() const;
-
- /** Return the property list.
- *
- * @return list of properties
- */
- const std::vector <property*> getPropertyList();
-};
-
-
-
-template <class TYPE>
-void propertySet::property::setValue(const TYPE& value)
-{
- std::ostringstream oss;
- oss << value;
-
- m_value = oss.str();
-}
-
-
-template <class TYPE>
-const TYPE propertySet::property::getValue() const
-{
- TYPE val = TYPE();
-
- std::istringstream iss(m_value);
- iss >> val;
-
- if (iss.fail())
- throw exceptions::invalid_property_type();
-
- return (val);
-}
-
-
-template <> void propertySet::property::setValue(const string& value);
-template <> void propertySet::property::setValue(const bool& value);
-
-template <> const string propertySet::property::getValue() const;
-template <> const bool propertySet::property::getValue() const;
-
-
-} // vmime
-
-
-#endif // VMIME_PROPERTY_HPP_INCLUDED
diff --git a/src/relay.cpp b/src/relay.cpp
index b2a4d102..14521b38 100644
--- a/src/relay.cpp
+++ b/src/relay.cpp
@@ -17,9 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "relay.hpp"
-#include "text.hpp"
-#include "parserHelpers.hpp"
+#include "vmime/relay.hpp"
+#include "vmime/text.hpp"
+#include "vmime/parserHelpers.hpp"
#include <sstream>
diff --git a/src/relay.hpp b/src/relay.hpp
deleted file mode 100644
index aac9d2bc..00000000
--- a/src/relay.hpp
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_RELAY_HPP_INCLUDED
-#define VMIME_RELAY_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "component.hpp"
-
-#include "dateTime.hpp"
-
-
-namespace vmime
-{
-
-
-/** Trace information about a relay (basic type).
- */
-
-class relay : public component
-{
-public:
-
- relay();
- relay(const relay& r);
-
-public:
-
- relay* clone() const;
- void copyFrom(const component& other);
- relay& operator=(const relay& other);
-
- const std::vector <const component*> getChildComponents() const;
-
- const string& getFrom() const;
- void setFrom(const string& from);
-
- const string& getVia() const;
- void setVia(const string& via);
-
- const string& getBy() const;
- void setBy(const string& by);
-
- const string& getId() const;
- void setId(const string& id);
-
- const string& getFor() const;
- void setFor(const string& for_);
-
- const datetime& getDate() const;
- void setDate(const datetime& date);
-
- const std::vector <string>& getWithList() const;
- std::vector <string>& getWithList();
-
-private:
-
- string m_from;
- string m_via;
- string m_by;
- string m_id;
- string m_for;
- std::vector <string> m_with;
-
- datetime m_date;
-
-public:
-
- using component::parse;
- using component::generate;
-
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_RELAY_HPP_INCLUDED
diff --git a/src/standardFields.hpp b/src/standardFields.hpp
deleted file mode 100644
index f329069d..00000000
--- a/src/standardFields.hpp
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_STANDARDFIELDS_HPP_INCLUDED
-#define VMIME_STANDARDFIELDS_HPP_INCLUDED
-
-
-#include "genericField.hpp"
-#include "parameterizedHeaderField.hpp"
-#include "headerFieldFactory.hpp"
-
-// Inclusion for field value types
-#include "addressList.hpp"
-#include "encoding.hpp"
-#include "dateTime.hpp"
-#include "text.hpp"
-#include "messageId.hpp"
-#include "relay.hpp"
-#include "mailboxList.hpp"
-
-
-namespace vmime
-{
-
-
-#define DECLARE_STANDARD_FIELD(fieldClassName, valueTypeClassName) \
- class fieldClassName : public genericField <valueTypeClassName> { \
- friend class headerFieldFactory::registerer <fieldClassName>; \
- protected: \
- fieldClassName() { } \
- fieldClassName(const fieldClassName&) \
- : headerField(), \
- genericField <valueTypeClassName>() { /* Not used */ } \
- }
-
-#define DECLARE_STANDARD_FIELD_PARAM(fieldClassName, valueTypeClassName) \
- class fieldClassName : public genericField <valueTypeClassName>, \
- public parameterizedHeaderField { \
- friend class headerFieldFactory::registerer <fieldClassName>; \
- protected: \
- fieldClassName() { } \
- fieldClassName(const fieldClassName&) \
- : headerField(), \
- genericField <valueTypeClassName>(), \
- parameterizedHeaderField() { /* Not used */ } \
- }
-
-
-DECLARE_STANDARD_FIELD(addressListField, addressList);
-DECLARE_STANDARD_FIELD_PARAM(contentEncodingField, encoding);
-DECLARE_STANDARD_FIELD(dateField, datetime);
-DECLARE_STANDARD_FIELD(textField, text);
-DECLARE_STANDARD_FIELD(messageIdField, messageId);
-DECLARE_STANDARD_FIELD(defaultField, string);
-DECLARE_STANDARD_FIELD(relayField, relay);
-DECLARE_STANDARD_FIELD(mailboxListField, mailboxList);
-
-
-#undef DECLARE_STANDARD_FIELD
-#undef DECLARE_STANDARD_FIELD_PARAM
-
-
-} // vmime
-
-
-#endif // VMIME_STANDARDFIELDS_HPP_INCLUDED
diff --git a/src/standardParams.hpp b/src/standardParams.hpp
deleted file mode 100644
index 340f290b..00000000
--- a/src/standardParams.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_STANDARDPARAMS_HPP_INCLUDED
-#define VMIME_STANDARDPARAMS_HPP_INCLUDED
-
-
-#include "genericParameter.hpp"
-
-// Inclusion for field value types
-#include "dateTime.hpp"
-#include "charset.hpp"
-
-
-namespace vmime
-{
-
-
-#define DECLARE_STANDARD_PARAM(paramClassName, valueTypeClassName) \
- class paramClassName : public genericParameter <valueTypeClassName> { \
- friend class parameterFactory::registerer <paramClassName>; \
- protected: \
- paramClassName() { } \
- paramClassName(const paramClassName&) \
- : genericParameter <valueTypeClassName>() { /* Not used */ } \
- }
-
-
-DECLARE_STANDARD_PARAM(defaultParameter, string);
-DECLARE_STANDARD_PARAM(dateParameter, datetime);
-DECLARE_STANDARD_PARAM(charsetParameter, charset);
-
-
-#undef DECLARE_STANDARD_PARAM
-
-
-} // vmime
-
-
-#endif // VMIME_STANDARDPARAMS_HPP_INCLUDED
diff --git a/src/text.cpp b/src/text.cpp
index cfbbea7a..4fb5337b 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -17,13 +17,13 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "text.hpp"
+#include "vmime/text.hpp"
-#include "utility/stringUtils.hpp"
+#include "vmime/utility/stringUtils.hpp"
-#include "encoder.hpp"
-#include "encoderB64.hpp"
-#include "encoderQP.hpp"
+#include "vmime/encoder.hpp"
+#include "vmime/encoderB64.hpp"
+#include "vmime/encoderQP.hpp"
namespace vmime
diff --git a/src/text.hpp b/src/text.hpp
deleted file mode 100644
index 8af0c78d..00000000
--- a/src/text.hpp
+++ /dev/null
@@ -1,217 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_TEXT_HPP_INCLUDED
-#define VMIME_TEXT_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "word.hpp"
-
-
-namespace vmime
-{
-
-
-/** List of encoded-words, as defined in RFC-2047 (basic type).
- */
-
-class text : public component
-{
-public:
-
- text();
- text(const text& t);
- text(const string& t, const charset& ch);
- explicit text(const string& t);
- explicit text(const word& w);
- ~text();
-
-public:
-
- const bool operator==(const text& t) const;
- const bool operator!=(const text& t) const;
-
- text* clone() const;
- void copyFrom(const component& other);
- text& operator=(const component& other);
- text& operator=(const text& other);
-
- const std::vector <const component*> getChildComponents() const;
-
- /** Add a word at the end of the list.
- *
- * @param w word to append
- */
- void appendWord(word* w);
-
- /** Insert a new word before the specified position.
- *
- * @param pos position at which to insert the new word (0 to insert at
- * the beginning of the list)
- * @param w word to insert
- */
- void insertWordBefore(const int pos, word* w);
-
- /** Insert a new word after the specified position.
- *
- * @param pos position of the word before the new word
- * @param w word to insert
- */
- void insertWordAfter(const int pos, word* w);
-
- /** Remove the word at the specified position.
- *
- * @param pos position of the word to remove
- */
- void removeWord(const int pos);
-
- /** Remove all words from the list.
- */
- void removeAllWords();
-
- /** Return the number of words in the list.
- *
- * @return number of words
- */
- const int getWordCount() const;
-
- /** Tests whether the list of words is empty.
- *
- * @return true if there is no word, false otherwise
- */
- const bool isEmpty() const;
-
- /** Return the word at the specified position.
- *
- * @param pos position
- * @return word at position 'pos'
- */
- word* getWordAt(const int pos);
-
- /** Return the word at the specified position.
- *
- * @param pos position
- * @return word at position 'pos'
- */
- const word* const getWordAt(const int pos) const;
-
- /** Return the word list.
- *
- * @return list of words
- */
- const std::vector <const word*> getWordList() const;
-
- /** Return the word list.
- *
- * @return list of words
- */
- const std::vector <word*> getWordList();
-
- // Decoding
-#if VMIME_WIDE_CHAR_SUPPORT
- const wstring getDecodedText() const;
-#endif
-
- /** Return the text converted into the specified charset.
- * The encoded-words are decoded and then converted in the
- * specified destination charset.
- *
- * @param dest output charset
- * @return text decoded in the specified charset
- */
- const string getConvertedText(const charset& dest) const;
-
- /** This function can be used to make several encoded words from a text.
- * All the characters in the text must be in the same specified charset.
- *
- * <p>Eg: giving:</p>
- * <pre> &lt;iso-8859-1> "Linux dans un t'el'ephone mobile"
- * ("=?iso-8859-1?Q?Linux_dans_un_t=E9l=E9phone_mobile?=")
- * </pre><p>it will return:</p>
- * <pre> &lt;us-ascii> "Linux dans un "
- * &lt;iso-8859-1> "t'el'ephone "
- * &lt;us-ascii> "mobile"
- * ("Linux dans un =?iso-8859-1?Q?t=E9l=E9phone_?= mobile")
- * </pre>
- *
- * @param in input string
- * @param ch input charset
- * @param generateInExisting if not NULL, the resulting text will be generated
- * in the specified object instead of a new created object (in this case, the
- * function returns the same pointer). Can be used to avoid copying the
- * resulting object into an existing object.
- * @return new text object or existing object if generateInExisting != NULL
- */
- static text* newFromString(const string& in, const charset& ch, text* generateInExisting = NULL);
-
- /** Flags used by "encodeAndFold" function.
- */
- enum EncodeAndFoldFlags
- {
- // NOTE: If both "FORCE_NO_ENCODING" and "FORCE_ENCODING" are
- // specified, "FORCE_NO_ENCODING" is used by default.
-
- FORCE_NO_ENCODING = (1 << 0), /**< Just fold lines, don't encode them. */
- FORCE_ENCODING = (1 << 1), /**< Encode lines even if they are plain ASCII text. */
- NO_NEW_LINE_SEQUENCE = (1 << 2) /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
- };
-
- /** Encode and fold text in respect to RFC-2047.
- *
- * @param os output stream
- * @param maxLineLength maximum line length for output
- * @param firstLineOffset the first line length (may be useful if the current output line is not empty)
- * @param lastLineLength will receive the length of the last line written
- * @param flags encoding flags (see EncodeAndFoldFlags)
- */
- void encodeAndFold(utility::outputStream& os, const string::size_type maxLineLength,
- const string::size_type firstLineOffset, string::size_type* lastLineLength, const int flags) const;
-
- /** Decode and unfold text (RFC-2047).
- *
- * @param in input string
- * @param generateInExisting if not NULL, the resulting text will be generated
- * in the specified object instead of a new created object (in this case, the
- * function returns the same pointer). Can be used to avoid copying the
- * resulting object into an existing object.
- * @return new text object or existing object if generateInExisting != NULL
- */
- static text* decodeAndUnfold(const string& in, text* generateInExisting = NULL);
-
-
- using component::parse;
- using component::generate;
-
- // Component parsing & assembling
- void parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition = NULL);
- void generate(utility::outputStream& os, const string::size_type maxLineLength = lineLengthLimits::infinite, const string::size_type curLinePos = 0, string::size_type* newLinePos = NULL) const;
-
-private:
-
- static void decodeAndUnfold(const string::const_iterator& inStart, const string::const_iterator& inEnd, text& out);
-
- std::vector <word*> m_words;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_TEXT_HPP_INCLUDED
diff --git a/src/textPart.hpp b/src/textPart.hpp
deleted file mode 100644
index 412493d3..00000000
--- a/src/textPart.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_TEXTPART_HPP_INCLUDED
-#define VMIME_TEXTPART_HPP_INCLUDED
-
-
-#include "bodyPart.hpp"
-
-#include "mediaType.hpp"
-#include "charset.hpp"
-#include "contentHandler.hpp"
-
-
-namespace vmime
-{
-
-
-/** Generic text part.
- */
-
-class textPart
-{
- friend class textPartFactory;
- friend class messageBuilder; // for generateIn, getPartCount
- friend class messageParser; // for parse
-
-public:
-
- virtual ~textPart() { }
-
- /** Return the type of text part (eg: "text/html").
- *
- * @return type of text part
- */
- virtual const mediaType getType() const = 0;
-
- /** Return the charset used to encode text in the
- * text part.
- *
- * @return text charset
- */
- virtual const charset& getCharset() const = 0;
-
- /** Set the charset used to encode text in the
- * text part.
- *
- * @param ch text charset
- */
- virtual void setCharset(const charset& ch) = 0;
-
- /** Return the text contained in the part.
- *
- * @return text of the part
- */
- virtual const contentHandler& getText() const = 0;
-
- /** Set the text contained in the part.
- *
- * @param text text of the part
- */
- virtual void setText(const contentHandler& text) = 0;
-
-protected:
-
- virtual const int getPartCount() const = 0;
-
- virtual void generateIn(bodyPart& message, bodyPart& parent) const = 0;
- virtual void parse(const bodyPart& message, const bodyPart& parent, const bodyPart& textPart) = 0;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_TEXTPART_HPP_INCLUDED
diff --git a/src/textPartFactory.cpp b/src/textPartFactory.cpp
index c8fc37eb..0401cc8c 100644
--- a/src/textPartFactory.cpp
+++ b/src/textPartFactory.cpp
@@ -17,12 +17,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "textPartFactory.hpp"
-#include "exception.hpp"
+#include "vmime/textPartFactory.hpp"
+#include "vmime/exception.hpp"
-#include "plainTextPart.hpp"
-#include "htmlTextPart.hpp"
+#include "vmime/plainTextPart.hpp"
+#include "vmime/htmlTextPart.hpp"
namespace vmime
diff --git a/src/textPartFactory.hpp b/src/textPartFactory.hpp
deleted file mode 100644
index 2193f843..00000000
--- a/src/textPartFactory.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_TEXTPARTFACTORY_HPP_INCLUDED
-#define VMIME_TEXTPARTFACTORY_HPP_INCLUDED
-
-
-#include "textPart.hpp"
-#include "mediaType.hpp"
-#include "utility/singleton.hpp"
-
-
-namespace vmime
-{
-
-
-class textPartFactory : public utility::singleton <textPartFactory>
-{
- friend class utility::singleton <textPartFactory>;
-
-protected:
-
- textPartFactory();
- ~textPartFactory();
-
- typedef textPart* (*AllocFunc)(void);
- typedef std::map <string, AllocFunc> NameMap;
-
- NameMap m_nameMap;
-
-#ifndef VMIME_BUILDING_DOC
- template <class TYPE>
- class registerer
- {
- public:
-
- static textPart* creator()
- {
- // Allocate a new object
- return new TYPE();
- }
- };
-#endif // VMIME_BUILDING_DOC
-
-public:
-
- template <class T>
- void registerType(const mediaType& type)
- {
- m_nameMap.insert(NameMap::value_type(type.generate(), &registerer<T>::creator));
- }
-
- textPart* create(const mediaType& type);
-};
-
-
-} // vmime
-
-
-#endif // VMIME_TEXTPARTFACTORY_HPP_INCLUDED
diff --git a/src/typeAdapter.cpp b/src/typeAdapter.cpp
index 58b42a01..6585a15a 100644
--- a/src/typeAdapter.cpp
+++ b/src/typeAdapter.cpp
@@ -18,7 +18,7 @@
//
-#include "typeAdapter.hpp"
+#include "vmime/typeAdapter.hpp"
namespace vmime
diff --git a/src/typeAdapter.hpp b/src/typeAdapter.hpp
deleted file mode 100644
index cd82816c..00000000
--- a/src/typeAdapter.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_TYPEADAPTER_HPP_INCLUDED
-#define VMIME_TYPEADAPTER_HPP_INCLUDED
-
-
-#include <sstream>
-
-#include "component.hpp"
-
-
-namespace vmime
-{
-
-
-/** An adapter to allow any type being treated as a 'component'.
- */
-
-template <class TYPE>
-class typeAdapter : public component
-{
-public:
-
- typeAdapter()
- {
- }
-
- typeAdapter(typeAdapter& a)
- : m_value(a.m_value)
- {
- }
-
- typeAdapter(const TYPE& v)
- : m_value(v)
- {
- }
-
-
- typeAdapter* clone() const
- {
- return new typeAdapter(*this);
- }
-
-
- void copyFrom(const component& other)
- {
- m_value = dynamic_cast <const typeAdapter <TYPE>&>(other).m_value;
- }
-
-
- typeAdapter& operator=(const TYPE& v)
- {
- m_value = v;
- return (*this);
- }
-
-
- typeAdapter& operator=(const component& other)
- {
- copyFrom(other);
- return (*this);
- }
-
-
- operator TYPE() const
- {
- return (m_value);
- }
-
-
- void parse(const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition = NULL)
- {
- std::istringstream iss(string(buffer.begin() + position, buffer.begin() + end));
- iss >> m_value;
-
- if (newPosition)
- *newPosition = end;
- }
-
-
- void generate(utility::outputStream& os,
- const string::size_type /* maxLineLength */ = lineLengthLimits::infinite,
- const string::size_type curLinePos = 0,
- string::size_type* newLinePos = NULL) const
- {
- std::ostringstream oss;
- oss << m_value;
-
- os << oss.str();
-
- if (newLinePos)
- *newLinePos = curLinePos + oss.str().length();
- }
-
- const std::vector <const component*> getChildComponents() const
- {
- return std::vector <const component*>();
- }
-
-private:
-
- TYPE m_value;
-};
-
-
-template <>
-void typeAdapter <string>::parse(const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition);
-
-
-} // vmime
-
-
-#endif // VMIME_TYPEADAPTE_HPP_INCLUDED
diff --git a/src/types.hpp b/src/types.hpp
deleted file mode 100644
index 7f20ce8a..00000000
--- a/src/types.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_TYPES_HPP_INCLUDED
-#define VMIME_TYPES_HPP_INCLUDED
-
-
-#include <limits>
-#include <string>
-
-#include "config.hpp"
-
-
-namespace vmime
-{
- typedef std::string string;
-#if VMIME_WIDE_CHAR_SUPPORT
- typedef std::wstring wstring;
-#endif
-
- typedef unsigned short port_t;
-
- typedef int char_t;
-}
-
-
-#endif // VMIME_TYPES_HPP_INCLUDED
diff --git a/src/utility/file.hpp b/src/utility/file.hpp
deleted file mode 100644
index 6697d3d7..00000000
--- a/src/utility/file.hpp
+++ /dev/null
@@ -1,257 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_FILE_HPP_INCLUDED
-#define VMIME_UTILITY_FILE_HPP_INCLUDED
-
-
-#include "config.hpp"
-
-#include "utility/path.hpp"
-#include "utility/stream.hpp"
-
-
-#if VMIME_HAVE_FILESYSTEM_FEATURES
-
-
-namespace vmime {
-namespace utility {
-
-
-class file;
-
-
-/** File list iterator (see file::getFiles).
- */
-
-class fileIterator
-{
-public:
-
- virtual ~fileIterator() { }
-
- /** Check whether the cursor has reach the end of the list.
- *
- * @return true if you can call nextElement(), or false
- * if no more file is available
- */
- virtual const bool hasMoreElements() const = 0;
-
- /** Return the next file in the list.
- *
- * @return next file or NULL
- */
- virtual file* nextElement() = 0;
-};
-
-
-/** Write to a file.
- */
-
-class fileWriter
-{
-public:
-
- virtual ~fileWriter() { }
-
- virtual utility::outputStream* getOutputStream() = 0;
-};
-
-
-/** Read from a file.
- */
-
-class fileReader
-{
-public:
-
- virtual ~fileReader() { }
-
- virtual utility::inputStream* getInputStream() = 0;
-};
-
-
-/** Abstract representation of a file or directory.
- */
-
-class file
-{
-public:
-
- typedef utility::path path;
- typedef unsigned long length_type;
-
-
- virtual ~file() { }
-
-
- /** Create the file pointed by this file object.
- *
- * @throw exceptions::filesystem_exception if an error occurs
- */
- virtual void createFile() = 0;
-
- /** Create the directory pointed by this file object.
- *
- * @param createAll if set to true, recursively create all
- * parent directories if they do not exist
- * @throw exceptions::filesystem_exception if an error occurs
- */
- virtual void createDirectory(const bool createAll = false) = 0;
-
- /** Test whether this is a file.
- *
- * @return true if this is a file, false otherwise
- */
- virtual const bool isFile() const = 0;
-
- /** Test whether this is a directory.
- *
- * @return true if this is a directory, false otherwise
- */
- virtual const bool isDirectory() const = 0;
-
- /** Test whether this file is readible.
- *
- * @return true if we can read this file, false otherwise
- */
- virtual const bool canRead() const = 0;
-
- /** Test whether this file is writeable.
- *
- * @return true if we can write to this file, false otherwise
- */
- virtual const bool canWrite() const = 0;
-
- /** Return the length of this file.
- *
- * @return file size (in bytes)
- */
- virtual const length_type getLength() = 0;
-
- /** Return the full path of this file/directory.
- *
- * @return full path of the file
- */
- virtual const path& getFullPath() const = 0;
-
- /** Test whether this file/directory exists.
- *
- * @return true if the file exists, false otherwise
- */
- virtual const bool exists() const = 0;
-
- /** Return the parent directory of this file/directory.
- *
- * @return parent directory (or NULL if root)
- */
- virtual const file* getParent() const = 0;
-
- /** Rename the file/directory.
- *
- * @param newName full path of the new file
- * @throw exceptions::filesystem_exception if an error occurs
- */
- virtual void rename(const path& newName) = 0;
-
- /** Deletes this file/directory.
- * If this is a directory, it must be empty.
- *
- * @throw exceptions::filesystem_exception if an error occurs
- */
- virtual void remove() = 0;
-
- /** Return an object capable of writing to this file.
- *
- * @return file writer object
- */
- virtual fileWriter* getFileWriter() = 0;
-
- /** Return an object capable of reading from this file.
- *
- * @return file reader object
- */
- virtual fileReader* getFileReader() = 0;
-
- /** Enumerate files contained in this directory.
- *
- * @return file iterator to enumerate files
- * @throw exceptions::not_a_directory if this is not a directory,
- * exceptions::filesystem_exception if another error occurs
- */
- virtual fileIterator* getFiles() const = 0;
-};
-
-
-/** Constructs 'file' objects.
- */
-
-class fileSystemFactory
-{
-public:
-
- virtual ~fileSystemFactory() { }
-
- /** Create a new file object from the specified path.
- *
- * @param path full path (absolute) of the file
- * @return new file object for the path
- */
- virtual file* create(const file::path& path) const = 0;
-
- /** Parse a path contained in a string.
- *
- * @param str string containing a path in a system-dependant representation
- * @return path object (abstract representation)
- */
- virtual const file::path stringToPath(const string& str) const = 0;
-
- /** Return the system-dependant string representation for the specified path.
- *
- * @param path abstract representation of the path
- * @return string representation of the path
- */
- virtual const string pathToString(const file::path& path) const = 0;
-
- /** Test whether the specified path component is syntactically
- * valid (ie: does not contain any 'special' character).
- *
- * @param comp path component to test
- * @return true if the component is valid, false otherwise
- */
- virtual const bool isValidPathComponent(const file::path::component& comp) const = 0;
-
- /** Test whether the specified path is syntactically valid
- * (ie: components do not contain any 'special' character).
- *
- * @param path path to test
- * @return true if the path is valid, false otherwise
- */
- virtual const bool isValidPath(const file::path& path) const = 0;
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_HAVE_FILESYSTEM_FEATURES
-
-
-#endif // VMIME_UTILITY_FILE_HPP_INCLUDED
diff --git a/src/utility/md5.cpp b/src/utility/md5.cpp
index 9a1d4129..53bf17ae 100644
--- a/src/utility/md5.cpp
+++ b/src/utility/md5.cpp
@@ -44,7 +44,7 @@
// These notices must be retained in any copies of any part of this
// documentation and/or software.
-#include "utility/md5.hpp"
+#include "vmime/utility/md5.hpp"
namespace vmime {
diff --git a/src/utility/md5.hpp b/src/utility/md5.hpp
deleted file mode 100644
index dc9bb384..00000000
--- a/src/utility/md5.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_MD5_HPP_INCLUDED
-#define VMIME_UTILITY_MD5_HPP_INCLUDED
-
-
-#include "base.hpp"
-#include "config.hpp"
-
-
-namespace vmime {
-namespace utility {
-
-
-class md5
-{
-public:
-
- md5();
- md5(const vmime_uint8* const in, const unsigned long length);
- md5(const string& in);
-
-public:
-
- const string hex();
- const vmime_uint8* hash();
-
- void update(const vmime_uint8* data, unsigned long len);
- void update(const string& in);
-
-protected:
-
- void init();
- void transformHelper();
- void transform();
- void finalize();
-
- vmime_uint32 m_hash[4];
-
- unsigned long m_byteCount;
- vmime_uint8 m_block[64];
-
- bool m_finalized;
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_MD5_HPP_INCLUDED
diff --git a/src/utility/path.cpp b/src/utility/path.cpp
index 6455145d..b7651615 100644
--- a/src/utility/path.cpp
+++ b/src/utility/path.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "utility/path.hpp"
+#include "vmime/utility/path.hpp"
#include <algorithm>
diff --git a/src/utility/path.hpp b/src/utility/path.hpp
deleted file mode 100644
index 01e78935..00000000
--- a/src/utility/path.hpp
+++ /dev/null
@@ -1,161 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_PATH_HPP_INCLUDED
-#define VMIME_UTILITY_PATH_HPP_INCLUDED
-
-
-#include <vector>
-
-#include "types.hpp"
-#include "word.hpp"
-
-
-namespace vmime {
-namespace utility {
-
-
-/** Abstract representation of a path (filesystem, mailbox, etc).
- */
-
-class path
-{
-public:
-
- typedef vmime::word component;
- typedef std::vector <component> list;
-
- // Construct a path
- path();
- path(const component& c);
- path(const path& p);
- path(const string& s);
-
- // Append a component to a path
- path operator/(const path& p) const;
- path operator/(const component& c) const;
-
- path& operator/=(const path& p);
- path& operator/=(const component& c);
-
- // Return the parent path
- path getParent() const;
-
- // Assignment
- path& operator=(const path& p);
- path& operator=(const component& c);
-
- // Path comparison
- const bool operator==(const path& p) const;
- const bool operator!=(const path& p) const;
-
- /** Append a component to the path.
- *
- * @param c component to add
- */
- void appendComponent(const component& c);
-
- /** Return the component at the specified position.
- *
- * @param pos position
- * @return component at position 'pos'
- */
- const component& getComponentAt(const int pos) const;
-
- /** Return the component at the specified position.
- *
- * @param pos position
- * @return component at position 'pos'
- */
- component& getComponentAt(const int pos);
-
- /** Test whether this path is empty (root).
- *
- * @return true if the path is empty (no components = root)
- */
- const bool isEmpty() const;
-
- /** Return the last component of this path (const version).
- *
- * @return last component
- */
- const component getLastComponent() const;
-
- /** Return the last component of this path (non-const version).
- *
- * @return last component
- */
- component& getLastComponent();
-
- /** Return the number of components in this path.
- *
- * @return number of components
- */
- const int getSize() const;
-
- /** Return the specified component of the path (const version).
- *
- * @param x index of the component
- * @return component at the specified index
- */
- const component& operator[](const int x) const;
-
- /** Return the specified component of the path (non-const version).
- *
- * @param x index of the component
- * @return component at the specified index
- */
- component& operator[](const int x);
-
- /** Test whether this path is a direct parent of another one.
- *
- * @param p other path
- * @return true if the specified path is a child
- * of this path, false otherwise
- */
- const bool isDirectParentOf(const path& p) const;
-
- /** Test whether this path is a parent of another one.
- *
- * @param p other path
- * @return true if the specified path is a child (direct or
- * indirect) of this path, false otherwise
- */
- const bool isParentOf(const path& p) const;
-
- /** Rename a parent component in the path.
- * Example: path("a/b/c/d").renameParent("a/b", "x/y/z")
- * will return path("x/y/z/c/d").
- *
- * @param oldPath old parent path
- * @param newPath new parent path
- */
- void renameParent(const path& oldPath, const path& newPath);
-
-private:
-
- list m_list;
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_PATH_HPP_INCLUDED
diff --git a/src/utility/random.cpp b/src/utility/random.cpp
index 43e5703c..7c82d78c 100644
--- a/src/utility/random.cpp
+++ b/src/utility/random.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "utility/random.hpp"
-#include "platformDependant.hpp"
+#include "vmime/utility/random.hpp"
+#include "vmime/platformDependant.hpp"
#include <ctime>
diff --git a/src/utility/random.hpp b/src/utility/random.hpp
deleted file mode 100644
index 442905a5..00000000
--- a/src/utility/random.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_RANDOM_HPP_INCLUDED
-#define VMIME_UTILITY_RANDOM_HPP_INCLUDED
-
-
-#include "types.hpp"
-
-
-namespace vmime {
-namespace utility {
-
-
-/** Pseudo-random number generator.
- */
-
-class random
-{
-public:
-
- /** Return a new random number.
- *
- * @return random number
- */
- static const unsigned int getNext();
-
- /** Return the current time as a number (may be used to
- * build "random" strings).
- *
- * @return time as a number
- */
- static const unsigned int getTime();
-
- /** Return the current process number (may be user to
- * build "random" strings).
- *
- * @return process number
- */
- static const unsigned int getProcess();
-
- /** Return a random character string with the specified length.
- *
- * @param length length of the string to generate
- * @param randomChars list of characters to use
- * @return random string
- */
- static const string getString(const int length, const string& randomChars
- = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
-
-protected:
-
- static unsigned int m_next;
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_RANDOM_HPP_INCLUDED
diff --git a/src/utility/singleton.cpp b/src/utility/singleton.cpp
index c960a64a..a429c41f 100644
--- a/src/utility/singleton.cpp
+++ b/src/utility/singleton.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "singleton.hpp"
+#include "vmime/utility/singleton.hpp"
namespace vmime {
diff --git a/src/utility/singleton.hpp b/src/utility/singleton.hpp
deleted file mode 100644
index 33def75b..00000000
--- a/src/utility/singleton.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_SINGLETON_HPP_INCLUDED
-#define VMIME_UTILITY_SINGLETON_HPP_INCLUDED
-
-
-#include <list>
-
-
-namespace vmime {
-namespace utility {
-
-
-// Singleton abstract base class.
-
-class abstractSingleton
-{
- friend class singletonManager;
-
-protected:
-
- abstractSingleton() { }
- virtual ~abstractSingleton() { }
-};
-
-
-// Singleton manager
-// (for automatic clean-up of all instanciated singletons).
-
-class singletonManager
-{
-public:
-
- static singletonManager* getInstance();
-
- void manage(abstractSingleton* s);
-
-private:
-
- singletonManager();
- ~singletonManager();
-
- std::list <abstractSingleton*> m_list;
-};
-
-
-// A singleton template.
-
-template <class TYPE>
-class singleton : public abstractSingleton
-{
-protected:
-
- singleton() { }
- ~singleton() { }
-
-public:
-
- static TYPE* getInstance()
- {
- static TYPE* inst = NULL;
-
- if (!inst)
- singletonManager::getInstance()->manage(inst = new TYPE());
-
- return (inst);
- }
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_SINGLETON_HPP_INCLUDED
diff --git a/src/utility/smartPtr.hpp b/src/utility/smartPtr.hpp
deleted file mode 100644
index 9905ae2f..00000000
--- a/src/utility/smartPtr.hpp
+++ /dev/null
@@ -1,166 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
-#define VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
-
-
-namespace vmime {
-namespace utility {
-
-
-/** Simple auto-delete pointer.
- */
-
-template <class T>
-class auto_ptr
-{
-private:
-
- T* const m_ptr;
-
-public:
-
- auto_ptr(T* const ptr) : m_ptr(ptr) { }
- ~auto_ptr() { delete (m_ptr); }
-
- operator T*() { return (m_ptr); }
-
- T* const operator ->() { return (m_ptr); }
- T& operator *() { return (*m_ptr); }
-};
-
-
-/** Smart auto-delete, referencable and copiable pointer.
- */
-
-template <class T>
-class smart_ptr
-{
-private:
-
- struct data
- {
- int refCount;
- T* ptr;
- };
-
- data* m_data;
-
-
- typedef std::map <T*, data*> MapType;
- static MapType sm_map;
-
-public:
-
- smart_ptr() : m_data(NULL) { }
- smart_ptr(T* const ptr) : m_data(NULL) { if (ptr) { attach(ptr); } }
- smart_ptr(smart_ptr& ptr) : m_data(NULL) { if (ptr.m_data) { attach(ptr); } }
-
- ~smart_ptr() { detach(); }
-
- smart_ptr& operator=(smart_ptr& ptr)
- {
- attach(ptr);
- return (*this);
- }
-
- smart_ptr& operator=(T* const ptr)
- {
- if (!ptr)
- detach();
- else
- attach(ptr);
-
- return (*this);
- }
-
- operator T*() { return (m_data ? m_data->ptr : NULL); }
- operator const T*() { return (m_data ? m_data->ptr : NULL); }
-
- T& operator *() { return (*(m_data->ptr)); }
- T* operator ->() { return (m_data->ptr); }
-
- const T* const ptr() const { return (m_data ? m_data->ptr : NULL); }
- T* const ptr() { return (m_data ? m_data->ptr : NULL); }
-
-private:
-
- void detach()
- {
- if (m_data)
- {
- if (m_data->refCount == 1)
- {
- typename MapType::iterator it = sm_map.find(m_data->ptr);
- if (it != sm_map.end()) sm_map.erase(it);
-
- delete (m_data->ptr);
- delete (m_data);
- }
- else
- {
- m_data->refCount--;
- }
-
- m_data = NULL;
- }
- }
-
- void attach(T* const ptr)
- {
- detach();
-
- typename MapType::iterator it = sm_map.find(ptr);
-
- if (it != sm_map.end())
- {
- (*it).second->refCount++;
- }
- else
- {
- m_data = new data;
- m_data->refCount = 1;
- m_data->ptr = ptr;
-
- sm_map.insert(typename MapType::value_type(ptr, m_data));
- }
- }
-
- void attach(smart_ptr <T>& ptr)
- {
- data* newData = ptr.m_data;
- if (newData) newData->refCount++;
-
- detach();
-
- m_data = newData;
- }
-};
-
-
-template <class T>
-typename smart_ptr <T>::MapType smart_ptr <T>::sm_map;
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
diff --git a/src/utility/stream.cpp b/src/utility/stream.cpp
index 38d12e9f..ede2332b 100644
--- a/src/utility/stream.cpp
+++ b/src/utility/stream.cpp
@@ -17,8 +17,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "utility/stream.hpp"
-#include "utility/stringProxy.hpp"
+#include "vmime/utility/stream.hpp"
+#include "vmime/utility/stringProxy.hpp"
#include <algorithm> // for std::copy
#include <iterator> // for std::back_inserter
diff --git a/src/utility/stream.hpp b/src/utility/stream.hpp
deleted file mode 100644
index f05df243..00000000
--- a/src/utility/stream.hpp
+++ /dev/null
@@ -1,274 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_STREAM_HPP_INCLUDED
-#define VMIME_UTILITY_STREAM_HPP_INCLUDED
-
-
-#include <istream>
-#include <ostream>
-
-#include "types.hpp"
-
-
-namespace vmime {
-namespace utility {
-
-
-class stringProxy;
-
-
-/** Base class for input/output stream.
- */
-
-class stream
-{
-public:
-
- virtual ~stream() { }
-
- /** Type used to read/write one byte in the stream.
- */
- typedef string::value_type value_type;
-
- /** Type used for lengths in streams.
- */
- typedef string::size_type size_type;
-};
-
-
-
-/** Simple output stream.
- */
-
-class outputStream : public stream
-{
-public:
-
- /** Write data to the stream.
- *
- * @param data buffer containing data to write
- * @param count number of bytes to write
- */
- virtual void write(const value_type* const data, const size_type count) = 0;
-};
-
-
-
-/** Simple input stream.
- */
-
-class inputStream : public stream
-{
-public:
-
- /** Test for end of stream (no more data to read).
- *
- * @return true if we have reached the end of stream, false otherwise
- */
- virtual const bool eof() const = 0;
-
- /** Set the read pointer to the beginning of the stream.
- *
- * @warning WARNING: this may not work for all stream types.
- */
- virtual void reset() = 0;
-
- /** Read data from the stream.
- *
- * @param data will receive the data read
- * @param count maximum number of bytes to read
- * @return number of bytes read
- */
- virtual const size_type read(value_type* const data, const size_type count) = 0;
-
- /** Skip a number of bytes.
- *
- * @param count maximum number of bytes to ignore
- * @return number of bytes skipped
- */
- virtual const size_type skip(const size_type count) = 0;
-};
-
-
-
-// Helpers functions
-
-outputStream& operator<<(outputStream& os, const string& str);
-outputStream& operator<<(outputStream& os, const stream::value_type c);
-
-
-template <int N>
-outputStream& operator<<(outputStream& os, const char (&str)[N])
-{
- os.write(str, N - 1);
- return (os);
-}
-
-
-/** Copy data from one stream into another stream using a buffered method.
- *
- * @param is input stream (source data)
- * @param os output stream (destination for data)
- * @return number of bytes copied
- */
-
-const stream::size_type bufferedStreamCopy(inputStream& is, outputStream& os);
-
-
-
-// Adapters
-
-
-/** An adapter class for C++ standard output streams.
- */
-
-class outputStreamAdapter : public outputStream
-{
-public:
-
- /** @param os output stream to wrap
- */
- outputStreamAdapter(std::ostream& os);
-
- void write(const value_type* const data, const size_type count);
-
-private:
-
- std::ostream& m_stream;
-};
-
-
-/** An adapter class for string output.
- */
-
-class outputStreamStringAdapter : public outputStream
-{
-public:
-
- outputStreamStringAdapter(string& buffer);
-
- void write(const value_type* const data, const size_type count);
-
-private:
-
- string& m_buffer;
-};
-
-
-/** An adapter class for C++ standard input streams.
- */
-
-class inputStreamAdapter : public inputStream
-{
-public:
-
- /** @param is input stream to wrap
- */
- inputStreamAdapter(std::istream& is);
-
- const bool eof() const;
- void reset();
- const size_type read(value_type* const data, const size_type count);
- const size_type skip(const size_type count);
-
-private:
-
- std::istream& m_stream;
-};
-
-
-/** An adapter class for string input.
- */
-
-class inputStreamStringAdapter : public inputStream
-{
-public:
-
- inputStreamStringAdapter(const string& buffer);
- inputStreamStringAdapter(const string& buffer, const string::size_type begin, const string::size_type end);
-
- const bool eof() const;
- void reset();
- const size_type read(value_type* const data, const size_type count);
- const size_type skip(const size_type count);
-
-private:
-
- const string m_buffer; // do _NOT_ keep a reference...
- const string::size_type m_begin;
- const string::size_type m_end;
- string::size_type m_pos;
-};
-
-
-/** An adapter class for stringProxy input.
- */
-
-class inputStreamStringProxyAdapter : public inputStream
-{
-public:
-
- /** @param buffer stringProxy object to wrap
- */
- inputStreamStringProxyAdapter(const stringProxy& buffer);
-
- const bool eof() const;
- void reset();
- const size_type read(value_type* const data, const size_type count);
- const size_type skip(const size_type count);
-
-private:
-
- const stringProxy& m_buffer;
- string::size_type m_pos;
-};
-
-
-/** An adapter class for pointer to C++ standard input stream.
- */
-
-class inputStreamPointerAdapter : public inputStream
-{
-public:
-
- /** @param is input stream to wrap
- * @param own if set to 'true', the pointer will be deleted when
- * this object is destroyed
- */
- inputStreamPointerAdapter(std::istream* is, const bool own = true);
- ~inputStreamPointerAdapter();
-
- const bool eof() const;
- void reset();
- const size_type read(value_type* const data, const size_type count);
- const size_type skip(const size_type count);
-
-private:
-
- std::istream* m_stream;
- const bool m_own;
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_STREAM_HPP_INCLUDED
diff --git a/src/utility/stringProxy.cpp b/src/utility/stringProxy.cpp
index 463b11b7..3569f411 100644
--- a/src/utility/stringProxy.cpp
+++ b/src/utility/stringProxy.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "utility/stringProxy.hpp"
+#include "vmime/utility/stringProxy.hpp"
#include <iterator>
#include <algorithm>
diff --git a/src/utility/stringProxy.hpp b/src/utility/stringProxy.hpp
deleted file mode 100644
index 97a27ecd..00000000
--- a/src/utility/stringProxy.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_STRINGPROXY_HPP_INCLUDED
-#define VMIME_UTILITY_STRINGPROXY_HPP_INCLUDED
-
-
-#include <limits>
-
-#include "types.hpp"
-#include "utility/stream.hpp"
-
-
-namespace vmime {
-namespace utility {
-
-
-/** This class is a proxy for the string class. This takes
- * advantage of the COW (copy-on-write) system that might
- * be used in "std::string" implementation.
- */
-
-class stringProxy
-{
-public:
-
- typedef string::size_type size_type;
- typedef string string_type;
-
-
- // Consruction
- stringProxy();
- stringProxy(const stringProxy& s);
- stringProxy(const string_type& s, const size_type start = 0, const size_type end = std::numeric_limits <size_type>::max());
-
- // Assignment
- void set(const string_type& s, const size_type start = 0, const size_type end = std::numeric_limits <size_type>::max());
- void detach();
-
- stringProxy& operator=(const stringProxy& s);
- stringProxy& operator=(const string_type& s);
-
- // Extract some portion (or whole) of the string
- // and output it into a stream.
- void extract(outputStream& os, const size_type start = 0, const size_type end = std::numeric_limits <size_type>::max()) const;
-
- // Return the "virtual" length of the string
- const size_type length() const;
-
- // Return the boundaries of the "virtual" string
- const size_type start() const;
- const size_type end() const;
-
- string::const_iterator it_begin() const { return (m_buffer.begin() + m_start); }
- string::const_iterator it_end() const { return (m_buffer.begin() + m_end); }
-
-private:
-
- string_type m_buffer;
-
- size_type m_start;
- size_type m_end;
-};
-
-
-std::ostream& operator<<(std::ostream& os, const stringProxy& s);
-outputStream& operator<<(outputStream& os, const stringProxy& s);
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_STRINGPROXY_HPP_INCLUDED
diff --git a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
index ab6e06c1..59e9bffd 100644
--- a/src/utility/stringUtils.cpp
+++ b/src/utility/stringUtils.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "utility/stringUtils.hpp"
+#include "vmime/utility/stringUtils.hpp"
namespace vmime
diff --git a/src/utility/stringUtils.hpp b/src/utility/stringUtils.hpp
deleted file mode 100644
index 95b94a52..00000000
--- a/src/utility/stringUtils.hpp
+++ /dev/null
@@ -1,131 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_STRINGUTILS_HPP_INCLUDED
-#define VMIME_STRINGUTILS_HPP_INCLUDED
-
-
-#include "types.hpp"
-#include "base.hpp"
-
-#include <sstream>
-
-
-namespace vmime
-{
-
-
-/** Miscellaneous functions related to strings.
- */
-
-class stringUtils
-{
-public:
-
- /** Test two strings for equality (case insensitive).
- * \warning Use this with ASCII-only strings.
- *
- * @param s1 first string
- * @param s2 second string (must be in lower-case!)
- * @param n length of the second string
- * @return true if the two strings compare equally, false otherwise
- */
- static const bool isStringEqualNoCase(const string& s1, const char* s2, const string::size_type n);
-
- /** Test two strings for equality (case insensitive).
- * \warning Use this with ASCII-only strings.
- *
- * @param s1 first string
- * @param s2 second string
- * @return true if the two strings compare equally, false otherwise
- */
- static const bool isStringEqualNoCase(const string& s1, const string& s2);
-
- /** Test two strings for equality (case insensitive).
- * \warning Use this with ASCII-only strings.
- *
- * @param begin start position of the first string
- * @param end end position of the first string
- * @param s second string (must be in lower-case!)
- * @param n length of the second string
- * @return true if the two strings compare equally, false otherwise
- */
- static const bool isStringEqualNoCase(const string::const_iterator begin, const string::const_iterator end, const char* s, const string::size_type n);
-
- /** Transform all the characters in a string to lower-case.
- * \warning Use this with ASCII-only strings.
- *
- * @param str the string to transform
- * @return a new string in lower-case
- */
- static const string toLower(const string& str);
-
- /** Strip the space characters (SPC, TAB, CR, LF) at the beginning
- * and at the end of the specified string.
- *
- * @param str string in which to strip spaces
- * @return a new string with space characters removed
- */
- static const string trim(const string& str);
-
- /** Return the number of 7-bit US-ASCII characters in a string.
- *
- * @param begin start position
- * @param end end position
- * @return number of ASCII characters
- */
- static const string::size_type countASCIIchars(const string::const_iterator begin, const string::const_iterator end);
-
- /** Convert the specified value to a string value.
- *
- * @param value to convert
- * @return value converted from type 'TYPE'
- */
- template <class TYPE>
- static const string toString(const TYPE& value)
- {
- std::ostringstream oss;
- oss << value;
-
- return (oss.str());
- }
-
- /** Convert the specified string value to a value of
- * the specified type.
- *
- * @param value value to convert
- * @return value converted into type 'TYPE'
- */
- template <class TYPE>
- static const TYPE fromString(const string& value)
- {
- TYPE ret;
-
- std::istringstream iss(value);
- iss >> ret;
-
- return (ret);
- }
-};
-
-
-} // vmime
-
-
-#endif // VMIME_STRINGUTILS_HPP_INCLUDED
diff --git a/src/vmime b/src/vmime
deleted file mode 100644
index 0c417f3a..00000000
--- a/src/vmime
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_INCLUDED
-#define VMIME_INCLUDED
-
-
-// Configuration
-#include "config.hpp"
-
-// Base definitions
-#include "base.hpp"
-#include "exception.hpp"
-#include "options.hpp"
-#include "platformDependant.hpp"
-
-// Base components
-#include "dateTime.hpp"
-#include "message.hpp"
-#include "bodyPart.hpp"
-#include "charset.hpp"
-#include "text.hpp"
-#include "encoding.hpp"
-#include "contentDisposition.hpp"
-#include "mailbox.hpp"
-#include "mailboxGroup.hpp"
-#include "mailboxList.hpp"
-#include "addressList.hpp"
-#include "mediaType.hpp"
-#include "messageId.hpp"
-#include "relay.hpp"
-
-// Message components
-#include "message.hpp"
-
-// Header fields
-#include "headerFieldFactory.hpp"
-#include "mailboxField.hpp"
-#include "parameterizedHeaderField.hpp"
-#include "standardFields.hpp"
-
-// Encoders
-#include "encoderFactory.hpp"
-
-// Message builder/parser
-#include "messageBuilder.hpp"
-#include "messageParser.hpp"
-
-#include "fileAttachment.hpp"
-#include "defaultAttachment.hpp"
-
-#include "plainTextPart.hpp"
-#include "htmlTextPart.hpp"
-
-// Property set
-#include "propertySet.hpp"
-
-// Messaging features
-#if VMIME_HAVE_MESSAGING_FEATURES
- #include "messaging/socket.hpp"
-
- #include "messaging/service.hpp"
- #include "messaging/store.hpp"
- #include "messaging/transport.hpp"
-
- #include "messaging/session.hpp"
- #include "messaging/authenticator.hpp"
- #include "messaging/defaultAuthenticator.hpp"
- #include "messaging/simpleAuthenticator.hpp"
-
- #include "messaging/folder.hpp"
- #include "messaging/message.hpp"
-#endif // VMIME_HAVE_MESSAGING_FEATURES
-
-
-#endif // VMIME_INCLUDED
diff --git a/src/word.cpp b/src/word.cpp
index 6c213f5a..e1ed77c9 100644
--- a/src/word.cpp
+++ b/src/word.cpp
@@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
-#include "word.hpp"
+#include "vmime/word.hpp"
namespace vmime
diff --git a/src/word.hpp b/src/word.hpp
deleted file mode 100644
index 22f791ca..00000000
--- a/src/word.hpp
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2004 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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_WORD_HPP_INCLUDED
-#define VMIME_WORD_HPP_INCLUDED
-
-
-#include "charset.hpp"
-
-
-namespace vmime
-{
-
-
-/** A class that encapsulates an encoded-word (RFC-2047):
- * some text encoded into one specified charset.
- */
-
-class word
-{
-public:
-
- word();
- word(const word& w);
- word(const string& buffer); // Defaults to locale charset
- word(const string& buffer, const charset& charset);
-
- /** Return the raw data for this encoded word.
- *
- * @return raw data buffer
- */
- const string& getBuffer() const;
-
- /** Return the raw data for this encoded word.
- *
- * @return raw data buffer
- */
- string& getBuffer();
-
- /** Set the raw data for this encoded word.
- *
- * @param buffer raw data buffer
- */
- void setBuffer(const string& buffer);
-
- /** Return the charset of this word.
- *
- * @return charset for this word
- */
- const charset& getCharset() const;
-
- /** Set the charset of this word.
- *
- * @param ch charset of this word
- */
- void setCharset(const charset& ch);
-
-
- word& operator=(const word& w);
- word& operator=(const string& s);
-
- const bool operator==(const word& w) const;
- const bool operator!=(const word& w) const;
-
-#if VMIME_WIDE_CHAR_SUPPORT
- const wstring getDecodedText() const;
-#endif
-
- /** Return the contained text converted to the specified charset.
- *
- * @param dest output charset
- * @return word converted to the specified charset
- */
- const string getConvertedText(const charset& dest) const;
-
- /** Replace data in this word by data in other word.
- *
- * @param other other word to copy data from
- */
- void copyFrom(const word& other);
-
- /** Clone this word.
- *
- * @return a copy of this word
- */
- word* clone() const;
-
-private:
-
- // The "m_buffer" of this word holds the data, and this data is encoded
- // in the specified "m_charset".
- string m_buffer;
- charset m_charset;
-};
-
-
-} // vmime
-
-
-#endif // VMIME_WORD_HPP_INCLUDED