aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-11-28 11:00:39 +0000
committersaturneric <[email protected]>2024-11-28 11:00:39 +0000
commit193a9ee85b1a491955a7181250ebf0296ccc5d0d (patch)
tree5df4a071f9fe1301d389ff4649475913352ab72e
parentgh: add a GitHub workflow for compile+testsuite testing (#313) (diff)
downloadvmime-193a9ee85b1a491955a7181250ebf0296ccc5d0d.tar.gz
vmime-193a9ee85b1a491955a7181250ebf0296ccc5d0d.zip
feat: remember boundary from parsing
-rw-r--r--src/vmime/body.cpp11
-rw-r--r--src/vmime/body.hpp3
2 files changed, 9 insertions, 5 deletions
diff --git a/src/vmime/body.cpp b/src/vmime/body.cpp
index 1d8ae847..0ef365e3 100644
--- a/src/vmime/body.cpp
+++ b/src/vmime/body.cpp
@@ -381,6 +381,10 @@ void body::parseImpl(
m_contents = make_shared <streamContentHandler>(contentStream, length, enc);
}
+ if (!boundary.empty()) {
+ m_boundary = boundary;
+ }
+
setParsedBounds(position, end);
if (newPosition) {
@@ -439,8 +443,7 @@ void body::generateImpl(
if (!m_part) {
- boundary = generateRandomBoundaryString();
-
+ boundary = m_boundary.empty() ? generateRandomBoundaryString() : m_boundary;
} else {
// Use current boundary string, if specified. If no "Content-Type" field is
@@ -457,13 +460,13 @@ void body::generateImpl(
} else {
// No boundary string specified
- boundary = generateRandomBoundaryString();
+ boundary = m_boundary.empty() ? generateRandomBoundaryString() : m_boundary;
}
} else {
// No Content-Type (and no boundary string specified)
- boundary = generateRandomBoundaryString();
+ boundary = m_boundary.empty() ? generateRandomBoundaryString() : m_boundary;
}
}
diff --git a/src/vmime/body.hpp b/src/vmime/body.hpp
index a17d1dbe..fad59bcd 100644
--- a/src/vmime/body.hpp
+++ b/src/vmime/body.hpp
@@ -306,7 +306,8 @@ private:
string m_prologText;
- string m_epilogText;
+ string m_epilogText;
+ string m_boundary;
shared_ptr <const contentHandler> m_contents;