aboutsummaryrefslogtreecommitdiffstats
path: root/vmime
diff options
context:
space:
mode:
Diffstat (limited to 'vmime')
-rw-r--r--vmime/constants.hpp13
-rw-r--r--vmime/header.hpp5
-rw-r--r--vmime/mailbox.hpp4
-rw-r--r--vmime/mdn/MDNHelper.hpp113
-rw-r--r--vmime/mdn/MDNInfos.hpp53
-rw-r--r--vmime/mdn/receivedMDNInfos.hpp79
-rw-r--r--vmime/mdn/sendableMDNInfos.hpp67
-rw-r--r--vmime/path.hpp96
-rw-r--r--vmime/standardFields.hpp4
-rw-r--r--vmime/vmime.hpp3
10 files changed, 435 insertions, 2 deletions
diff --git a/vmime/constants.hpp b/vmime/constants.hpp
index 929796fd..bbb11a9a 100644
--- a/vmime/constants.hpp
+++ b/vmime/constants.hpp
@@ -57,6 +57,7 @@ namespace vmime
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 MESSAGE_DISPOSITION_NOTIFICATION;
extern const string::value_type* const APPLICATION_OCTET_STREAM;
@@ -199,22 +200,34 @@ namespace vmime
/** Constants for disposition action modes (RFC-3978). */
namespace dispositionActionModes
{
+ /** User implicitely displayed or deleted the message (filter or
+ * any other automatic action). */
extern const string::value_type* const MANUAL;
+
+ /** User explicitely displayed or deleted the message (manual action). */
extern const string::value_type* const AUTOMATIC;
}
/** Constants for disposition sending modes (RFC-3798). */
namespace dispositionSendingModes
{
+ /** The MDN was sent because the MUA had previously been configured
+ * to do so automatically. */
extern const string::value_type* const SENT_MANUALLY;
+
+ /** User explicitly gave permission for this particular MDN to be sent. */
extern const string::value_type* const SENT_AUTOMATICALLY;
}
/** Constants for disposition types (RFC-3798). */
namespace dispositionTypes
{
+ /** Message has been displayed to the user. */
extern const string::value_type* const DISPLAYED;
+ /** Message has been deleted without being displayed. */
extern const string::value_type* const DELETED;
+ /** Message has been denied. */
+ extern const string::value_type* const DENIED;
}
/** Constants for disposition modifiers (RFC-3798). */
diff --git a/vmime/header.hpp b/vmime/header.hpp
index 42b465b2..7050c1dd 100644
--- a/vmime/header.hpp
+++ b/vmime/header.hpp
@@ -68,6 +68,7 @@ public:
FIELD_ACCESS(ReplyTo, REPLY_TO, mailboxField)
FIELD_ACCESS(DeliveredTo, DELIVERED_TO, mailboxField)
FIELD_ACCESS(InReplyTo, IN_REPLY_TO, messageIdField)
+ FIELD_ACCESS(ReturnPath, RETURN_PATH, pathField)
FIELD_ACCESS(To, TO, addressListField)
FIELD_ACCESS(Cc, CC, addressListField)
@@ -86,6 +87,10 @@ public:
FIELD_ACCESS(MessageId, MESSAGE_ID, messageIdField)
FIELD_ACCESS(ContentLocation, CONTENT_LOCATION, defaultField)
+ FIELD_ACCESS(OriginalMessageId, ORIGINAL_MESSAGE_ID, messageIdField)
+ FIELD_ACCESS(Disposition, DISPOSITION, dispositionField)
+ FIELD_ACCESS(DispositionNotificationTo, DISPOSITION_NOTIFICATION_TO, mailboxListField)
+
#undef FIELD_ACCESS
/** Checks whether (at least) one field with this name exists.
diff --git a/vmime/mailbox.hpp b/vmime/mailbox.hpp
index b34300f0..1c30e102 100644
--- a/vmime/mailbox.hpp
+++ b/vmime/mailbox.hpp
@@ -52,7 +52,7 @@ public:
/** Set the full name of the mailbox.
*
- * @return full name of the mailbox
+ * @param name full name of the mailbox
*/
void setName(const text& name);
@@ -64,7 +64,7 @@ public:
/** Set the email of the mailbox.
*
- * @return email of the mailbox
+ * @param email email of the mailbox
*/
void setEmail(const string& email);
diff --git a/vmime/mdn/MDNHelper.hpp b/vmime/mdn/MDNHelper.hpp
new file mode 100644
index 00000000..7eaf64e8
--- /dev/null
+++ b/vmime/mdn/MDNHelper.hpp
@@ -0,0 +1,113 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 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_MDN_MDNHELPER_HPP_INCLUDED
+#define VMIME_MDN_MDNHELPER_HPP_INCLUDED
+
+
+#include "vmime/mdn/receivedMDNInfos.hpp"
+#include "vmime/mdn/sendableMDNInfos.hpp"
+
+
+namespace vmime {
+namespace mdn {
+
+
+/** Helper for creating or extracting Message Disposition
+ * Notifications (MDN), as defined in RFC-3798.
+ */
+
+class MDNHelper
+{
+public:
+
+ /** Return a list of possible MDNs that can be generated
+ * for the specified message.
+ *
+ * @param msg message for which to send a MDN
+ * @return list of possible MDNs
+ */
+ static const std::vector <sendableMDNInfos> getPossibleMDNs(const message* msg);
+
+ /** Test whether the specified message is a MDN.
+ *
+ * @param msg message
+ * @return true if the message is a MDN, false otherwise
+ */
+ static const bool isMDN(const message* msg);
+
+ /** If the specified message is a MDN, return information
+ * about it.
+ *
+ * @param msg message
+ * @throw exceptions::invalid_argument if the message is not a MDN
+ * @return information about the MDN
+ */
+ static receivedMDNInfos getReceivedMDN(const message* msg);
+
+ /** Check whether we need user confirmation for sending a MDN even
+ * if he/she explicitely allowed automatic send of MDNs. This can
+ * happen in some situations, described in RFC-3798.
+ *
+ * @param msg message for which to send a MDN
+ * @return true if user confirmation should be asked, false otherwise
+ */
+ static bool needConfirmation(const message* msg);
+
+ /** Build a new MDN for the message. The resulting MDN can then be
+ * sent over SMTP transport service.
+ *
+ * @param mdnInfos information about the MDN to construct
+ * @param text human readable message. The purpose of this message is
+ * to provide an easily-understood description of the
+ * condition(s) that caused the report to be generated.
+ * @param ch charset of the text
+ * @param dispo disposition information
+ * @param reportingUA name of reporting user-agent (optional)
+ * @param reportingUAProducts list of products in the reporting user-agent (optional)
+ * @return a new message object containing the MDN
+ */
+ static message* buildMDN(const sendableMDNInfos& mdnInfos,
+ const string& text,
+ const charset& ch,
+ const mailbox& expeditor,
+ const disposition& dispo,
+ const string& reportingUA = NULL_STRING,
+ const std::vector <string>& reportingUAProducts
+ = std::vector <string>());
+
+private:
+
+ static bodyPart* createFirstMDNPart(const sendableMDNInfos& mdnInfos,
+ const string& text, const charset& ch);
+
+ static bodyPart* createSecondMDNPart(const sendableMDNInfos& mdnInfos,
+ const disposition& dispo,
+ const string& reportingUA,
+ const std::vector <string>& reportingUAProducts);
+
+ static bodyPart* createThirdMDNPart(const sendableMDNInfos& mdnInfos);
+};
+
+
+} // mdn
+} // vmime
+
+
+#endif // VMIME_MDN_MDNHELPER_HPP_INCLUDED
diff --git a/vmime/mdn/MDNInfos.hpp b/vmime/mdn/MDNInfos.hpp
new file mode 100644
index 00000000..13347eed
--- /dev/null
+++ b/vmime/mdn/MDNInfos.hpp
@@ -0,0 +1,53 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 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_MDN_MDNINFOS_HPP_INCLUDED
+#define VMIME_MDN_MDNINFOS_HPP_INCLUDED
+
+
+#include "vmime/message.hpp"
+
+
+namespace vmime {
+namespace mdn {
+
+
+/** Holds information about Message Disposition Notifications (MDN).
+ */
+
+class MDNInfos
+{
+public:
+
+ virtual ~MDNInfos();
+
+
+ /** Return the message related to this MDN.
+ *
+ * @return related message
+ */
+ virtual const message* getMessage() const = 0;
+};
+
+
+} // mdn
+} // vmime
+
+
+#endif // VMIME_MDN_MDNINFOS_HPP_INCLUDED
diff --git a/vmime/mdn/receivedMDNInfos.hpp b/vmime/mdn/receivedMDNInfos.hpp
new file mode 100644
index 00000000..1f3d179c
--- /dev/null
+++ b/vmime/mdn/receivedMDNInfos.hpp
@@ -0,0 +1,79 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 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_MDN_RECEIVEDMDNINFOS_HPP_INCLUDED
+#define VMIME_MDN_RECEIVEDMDNINFOS_HPP_INCLUDED
+
+
+#include "vmime/mdn/MDNInfos.hpp"
+#include "vmime/disposition.hpp"
+
+
+namespace vmime {
+namespace mdn {
+
+
+/** Holds information about a Message Disposition Notification (MDN)
+ * that has been received.
+ */
+
+class receivedMDNInfos : public MDNInfos
+{
+public:
+
+ receivedMDNInfos(const message* msg);
+ receivedMDNInfos(const receivedMDNInfos& other);
+
+ receivedMDNInfos& operator=(const receivedMDNInfos& other);
+
+
+ const message* getMessage() const;
+
+ /** Return the identifier of the message for which this MDN
+ * has been generated.
+ *
+ * @return original message-id
+ */
+ const messageId getOriginalMessageId() const;
+
+ /** Return information about the disposition.
+ *
+ * @return disposition information
+ */
+ const disposition getDisposition() const;
+
+private:
+
+ void copyFrom(const receivedMDNInfos& other);
+
+ void extract();
+
+
+ const message* m_msg;
+
+ disposition m_disp;
+ messageId m_omid;
+};
+
+
+} // mdn
+} // vmime
+
+
+#endif // VMIME_MDN_RECEIVEDMDNINFOS_HPP_INCLUDED
diff --git a/vmime/mdn/sendableMDNInfos.hpp b/vmime/mdn/sendableMDNInfos.hpp
new file mode 100644
index 00000000..6e5a6f0a
--- /dev/null
+++ b/vmime/mdn/sendableMDNInfos.hpp
@@ -0,0 +1,67 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 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_MDN_SENDABLEMDNINFOS_HPP_INCLUDED
+#define VMIME_MDN_SENDABLEMDNINFOS_HPP_INCLUDED
+
+
+#include "vmime/mdn/MDNInfos.hpp"
+
+
+namespace vmime {
+namespace mdn {
+
+
+/** Holds information about a Message Disposition Notifications (MDN)
+ * that is to be sent.
+ */
+
+class sendableMDNInfos : public MDNInfos
+{
+public:
+
+ sendableMDNInfos(const message* msg, const mailbox& mbox);
+ sendableMDNInfos(const sendableMDNInfos& other);
+
+ sendableMDNInfos& operator=(const sendableMDNInfos& other);
+
+ const message* getMessage() const;
+
+ /** Return the recipient of the MDN (the mailbox that will receive
+ * the notification message).
+ *
+ * @return recipient of the MDN
+ */
+ const mailbox& getRecipient() const;
+
+private:
+
+ void copyFrom(const sendableMDNInfos& other);
+
+
+ const message* m_msg;
+ mailbox m_mailbox;
+};
+
+
+} // mdn
+} // vmime
+
+
+#endif // VMIME_MDN_SENDABLEMDNINFOS_HPP_INCLUDED
diff --git a/vmime/path.hpp b/vmime/path.hpp
new file mode 100644
index 00000000..5e50feb9
--- /dev/null
+++ b/vmime/path.hpp
@@ -0,0 +1,96 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2005 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_PATH_HPP_INCLUDED
+#define VMIME_PATH_HPP_INCLUDED
+
+
+#include "vmime/component.hpp"
+
+
+namespace vmime
+{
+
+
+/** A path: a local part + '@' + a domain.
+ */
+
+class path : public component
+{
+public:
+
+ path();
+ path(const string& localPart, const string& domain);
+ path(const path& p);
+
+ /** Return the local part of the address.
+ *
+ * @return local part of the address
+ */
+ const string& getLocalPart() const;
+
+ /** Set the local part of the address.
+ *
+ * @param localPart local part of the address
+ */
+ void setLocalPart(const string& localPart);
+
+ /** Return the domain of the address.
+ *
+ * @return domain of the address
+ */
+ const string& getDomain() const;
+
+ /** Set the domain of the address.
+ *
+ * @param domain domain of the address
+ */
+ void setDomain(const string& domain);
+
+ // Comparison
+ const bool operator==(const path& p) const;
+ const bool operator!=(const path& p) const;
+
+ // Assignment
+ void copyFrom(const component& other);
+ path* clone() const;
+ path& operator=(const path& other);
+
+ const std::vector <const component*> getChildComponents() const;
+
+protected:
+
+ string m_localPart;
+ string m_domain;
+
+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_PATH_HPP_INCLUDED
diff --git a/vmime/standardFields.hpp b/vmime/standardFields.hpp
index f75b77d8..7d0905dd 100644
--- a/vmime/standardFields.hpp
+++ b/vmime/standardFields.hpp
@@ -33,6 +33,8 @@
#include "vmime/messageId.hpp"
#include "vmime/relay.hpp"
#include "vmime/mailboxList.hpp"
+#include "vmime/disposition.hpp"
+#include "vmime/path.hpp"
namespace vmime
@@ -92,6 +94,8 @@ DECLARE_STANDARD_FIELD(messageIdField, messageId);
DECLARE_STANDARD_FIELD(defaultField, string);
DECLARE_STANDARD_FIELD(relayField, relay);
DECLARE_STANDARD_FIELD(mailboxListField, mailboxList);
+DECLARE_STANDARD_FIELD(dispositionField, disposition);
+DECLARE_STANDARD_FIELD(pathField, path);
#undef DECLARE_STANDARD_FIELD
diff --git a/vmime/vmime.hpp b/vmime/vmime.hpp
index 965b2184..694a2ba7 100644
--- a/vmime/vmime.hpp
+++ b/vmime/vmime.hpp
@@ -73,6 +73,9 @@
#include "vmime/plainTextPart.hpp"
#include "vmime/htmlTextPart.hpp"
+// MDN
+#include "vmime/mdn/MDNHelper.hpp"
+
// Property set
#include "vmime/propertySet.hpp"