Commit 71112a9a authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

MessageFactory::createRedirect: generate Resent-Date same way as KMime does for Date

KMime uses QDateTime to generate the date headers, so we need to use the same
way otherwise we get timezone inconsistencies (when system timezone != UTC)
in MessageFactoryTest, because it's using fake XDG_CONFIG_HOME, so KDateTime
does not have access to the configured timezone (Qt uses different way to get
timezones).
parent af57c83c
......@@ -525,7 +525,12 @@ KMime::Message::Ptr MessageFactory::createRedirect(const QString &toStr, const Q
.arg(ident.primaryEmailAddress());
// format the current date to be used in Resent-Date:
const QString newDate = KDateTime::currentLocalDateTime().toString(KDateTime::RFCDateDay);
// FIXME: generate datetime the same way as KMime, otherwise we get inconsistency
// in unit-tests. Unfortunatelly RFC2822Date is not enough for us, we need the
// composition hack below
const QDateTime dt = QDateTime::currentDateTime();
const QString newDate = QLocale::c().toString(dt, QStringLiteral("ddd, ")) +
dt.toString(Qt::RFC2822Date);
// Clean up any resent headers
msg->removeHeader("Resent-Cc");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment