From 025c15591978af17627e9cb061508a5b9ebc46aa Mon Sep 17 00:00:00 2001 From: Jacek Piszczek Date: Mon, 15 Mar 2021 20:38:04 -0400 Subject: [PATCH] Workaround a RECEIVED message field missing actual date info. --- src/vmime/messageParser.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vmime/messageParser.cpp b/src/vmime/messageParser.cpp index 21ac09bb..4f53b5d0 100644 --- a/src/vmime/messageParser.cpp +++ b/src/vmime/messageParser.cpp @@ -82,12 +82,18 @@ void messageParser::parse(const shared_ptr & msg) { // Date shared_ptr recv = msg->getHeader()->findField(fields::RECEIVED); + static const datetime unsetDate; + + m_date = unsetDate; if (recv) { m_date = recv->getValue ()->getDate(); - } else { + } + + // RECEIVED may in some cases contain no date at all + if (unsetDate == m_date) { shared_ptr date = msg->getHeader()->findField(fields::DATE);