From df7344aa9c44e8a2736df02b8569cf32b41cb03a Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Tue, 27 Aug 2024 23:17:45 +0000 Subject: Show mail expiry time Server does not communicate sent time.. or it did, until 2017 ?? See src/map/clif.c #if PACKETVER >= 20170419 The RODEX_EXPIRY constant seems not to be communicated either, preventing us from deducing send time from expiry time. **** mana/plus!90 --- src/gui/windows/mailviewwindow.cpp | 4 ++++ src/gui/windows/mailviewwindow.h | 1 + src/utils/stringutils.cpp | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index d0d42f168..df2fe1eec 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -69,6 +69,9 @@ MailViewWindow::MailViewWindow(MailMessage *const message, // TRANSLATORS: mail view window label mTimeLabel(new Label(this, strprintf("%s %s", _("Time:"), message->strTime.c_str()))), + // TRANSLATORS: mail view window label - mail expiry time + mExpireTimeLabel(new Label(this, strprintf("%s %s", _("Expires at:"), + timeToStr(message->expireTime).c_str()))), mMoneyLabel(nullptr), // TRANSLATORS: mail view window label mFromLabel(new Label(this, strprintf("%s %s", _("From:"), @@ -107,6 +110,7 @@ MailViewWindow::MailViewWindow(MailMessage *const message, int n = 0; placer(0, n++, mTimeLabel, 1, 1); + placer(0, n++, mExpireTimeLabel, 1, 1); placer(0, n++, mFromLabel, 1, 1); placer(0, n++, mSubjectLabel, 1, 1); if (message->money != 0) diff --git a/src/gui/windows/mailviewwindow.h b/src/gui/windows/mailviewwindow.h index 201fea426..6a5da1157 100644 --- a/src/gui/windows/mailviewwindow.h +++ b/src/gui/windows/mailviewwindow.h @@ -66,6 +66,7 @@ class MailViewWindow final : public Window, Button *mNextButton; Button *mReplyButton; Label *mTimeLabel; + Label *mExpireTimeLabel; Label *mMoneyLabel; Label *mFromLabel; Label *mSubjectLabel; diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 8daaf3be2..cd2a87ab2 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -947,7 +947,8 @@ std::string timeToStr(const uint32_t time) char buf[101]; const time_t tempTime = time; tm *const timeInfo = localtime(&tempTime); - if (strftime(&buf[0], 100, "%Y-%m-%d_%H-%M-%S", timeInfo) != 0U) + // %c is locale-defined format + if (strftime(&buf[0], 100, "%c", timeInfo) != 0U) return std::string(buf); return "unknown"; } -- cgit v1.2.3-70-g09d2