aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincent-richard <[email protected]>2020-05-10 08:34:48 +0000
committervincent-richard <[email protected]>2020-05-10 08:34:48 +0000
commit16912a5ed743940ea9d9342a289950a92bdb6515 (patch)
tree51255802243e02cdf4866fda39062f8a30857b3e
parentFixed false positives in tests. (diff)
downloadvmime-16912a5ed743940ea9d9342a289950a92bdb6515.tar.gz
vmime-16912a5ed743940ea9d9342a289950a92bdb6515.zip
Expose Content-Disposition on net message parts.
Diffstat (limited to '')
-rw-r--r--src/vmime/net/imap/IMAPMessagePart.cpp13
-rw-r--r--src/vmime/net/imap/IMAPMessagePart.hpp2
-rw-r--r--src/vmime/net/maildir/maildirMessagePart.cpp11
-rw-r--r--src/vmime/net/maildir/maildirMessagePart.hpp2
-rw-r--r--src/vmime/net/message.hpp7
5 files changed, 35 insertions, 0 deletions
diff --git a/src/vmime/net/imap/IMAPMessagePart.cpp b/src/vmime/net/imap/IMAPMessagePart.cpp
index 37ccfd97..746fe9a4 100644
--- a/src/vmime/net/imap/IMAPMessagePart.cpp
+++ b/src/vmime/net/imap/IMAPMessagePart.cpp
@@ -95,6 +95,13 @@ IMAPMessagePart::IMAPMessagePart(
}
}
}
+
+ if (part->body_ext_1part && part->body_ext_1part->body_fld_dsp) {
+ auto *cdisp = part->body_ext_1part->body_fld_dsp->str();
+ if (cdisp) {
+ m_dispType = contentDisposition(cdisp->value);
+ }
+ }
}
m_structure = null;
@@ -133,6 +140,12 @@ const mediaType& IMAPMessagePart::getType() const {
}
+const contentDisposition &IMAPMessagePart::getDisposition() const {
+
+ return m_dispType;
+}
+
+
size_t IMAPMessagePart::getSize() const {
return m_size;
diff --git a/src/vmime/net/imap/IMAPMessagePart.hpp b/src/vmime/net/imap/IMAPMessagePart.hpp
index 4a636dd8..34ea1725 100644
--- a/src/vmime/net/imap/IMAPMessagePart.hpp
+++ b/src/vmime/net/imap/IMAPMessagePart.hpp
@@ -66,6 +66,7 @@ public:
shared_ptr <const IMAPMessagePart> getParent() const;
const mediaType& getType() const;
+ const contentDisposition &getDisposition() const;
size_t getSize() const;
size_t getNumber() const;
string getName() const;
@@ -92,6 +93,7 @@ private:
size_t m_size;
string m_name;
mediaType m_mediaType;
+ contentDisposition m_dispType;
};
diff --git a/src/vmime/net/maildir/maildirMessagePart.cpp b/src/vmime/net/maildir/maildirMessagePart.cpp
index 9d30e24d..7448d7ee 100644
--- a/src/vmime/net/maildir/maildirMessagePart.cpp
+++ b/src/vmime/net/maildir/maildirMessagePart.cpp
@@ -54,6 +54,11 @@ maildirMessagePart::maildirMessagePart(
m_size = part.getBody()->getContents()->getLength();
m_mediaType = part.getBody()->getContentType();
+
+ auto cdispField = part.getHeader()->ContentDisposition();
+ if (cdispField) {
+ m_dispType = dynamic_cast <const contentDisposition&>(*cdispField->getValue());
+ }
}
@@ -103,6 +108,12 @@ const mediaType& maildirMessagePart::getType() const {
}
+const contentDisposition &maildirMessagePart::getDisposition() const {
+
+ return m_dispType;
+}
+
+
size_t maildirMessagePart::getSize() const {
return m_size;
diff --git a/src/vmime/net/maildir/maildirMessagePart.hpp b/src/vmime/net/maildir/maildirMessagePart.hpp
index dd863a2b..5ecc739e 100644
--- a/src/vmime/net/maildir/maildirMessagePart.hpp
+++ b/src/vmime/net/maildir/maildirMessagePart.hpp
@@ -61,6 +61,7 @@ public:
weak_ptr <const maildirMessagePart> getParent() const { return (m_parent); }
const mediaType& getType() const;
+ const contentDisposition &getDisposition() const;
size_t getSize() const;
size_t getNumber() const;
@@ -85,6 +86,7 @@ private:
size_t m_number;
size_t m_size;
mediaType m_mediaType;
+ contentDisposition m_dispType;
size_t m_headerParsedOffset;
size_t m_headerParsedLength;
diff --git a/src/vmime/net/message.hpp b/src/vmime/net/message.hpp
index c0a2839b..86798795 100644
--- a/src/vmime/net/message.hpp
+++ b/src/vmime/net/message.hpp
@@ -33,6 +33,7 @@
#include "vmime/header.hpp"
#include "vmime/mediaType.hpp"
+#include "vmime/contentDisposition.hpp"
#include "vmime/utility/progressListener.hpp"
#include "vmime/utility/stream.hpp"
@@ -85,6 +86,12 @@ public:
*/
virtual const mediaType& getType() const = 0;
+ /** Return the disposition type of the content in this part.
+ *
+ * @return content disposition type
+ */
+ virtual const contentDisposition &getDisposition() const = 0;
+
/** Return the size of this part.
*
* @return size of the part (in bytes)