From 58f9f9dea0865f900fa0c1e6e2ef8ffc18ecef74 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 19 Feb 2024 18:17:50 +0300 Subject: =?UTF-8?q?Revert=20"fixes=20#4208=20(NewStory:=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BD=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B9=D0=BA=D1=83=20=D1=86=D0=B2=D0=B5=D1=82=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=B0=D1=82=D1=8B)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2ce03c8195193380d133300fdf487ce6f78be963. --- plugins/NewStory/src/fonts.cpp | 1 - plugins/NewStory/src/fonts.h | 2 +- plugins/NewStory/src/templates.cpp | 35 +++++++++++------------------------ plugins/NewStory/src/templates.h | 1 - 4 files changed, 12 insertions(+), 27 deletions(-) diff --git a/plugins/NewStory/src/fonts.cpp b/plugins/NewStory/src/fonts.cpp index b0924ea535..844f5d0f62 100644 --- a/plugins/NewStory/src/fonts.cpp +++ b/plugins/NewStory/src/fonts.cpp @@ -22,7 +22,6 @@ MyColourID g_colorTable[COLOR_COUNT] = { { LPGEN("Incoming name"), "ColorNickIn", RGB(0x00, 0x00, 0x00) }, { LPGEN("Outgoing name"), "ColorNickOut", RGB(0x00, 0x00, 0x00) }, - { LPGEN("Date color"), "ColorDate", RGB(0x00, 0x00, 0x00) }, { LPGEN("Incoming messages"), "ColorMsgIn", RGB(0xd6, 0xf5, 0xc0) }, { LPGEN("Outgoing messages"), "ColorMsgOut", RGB(0xf5, 0xe7, 0xd8) }, diff --git a/plugins/NewStory/src/fonts.h b/plugins/NewStory/src/fonts.h index 60b55f1292..0a441c1931 100644 --- a/plugins/NewStory/src/fonts.h +++ b/plugins/NewStory/src/fonts.h @@ -5,7 +5,7 @@ enum { - COLOR_INNICK, COLOR_OUTNICK, COLOR_DATE, + COLOR_INNICK, COLOR_OUTNICK, COLOR_INMSG, COLOR_OUTMSG, COLOR_INFILE, COLOR_OUTFILE, COLOR_STATUS, diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp index 2d7d4fc1d6..b4e7438b4e 100644 --- a/plugins/NewStory/src/templates.cpp +++ b/plugins/NewStory/src/templates.cpp @@ -106,8 +106,6 @@ CMStringA ItemData::formatRtf(const wchar_t *pwszStr) COLORREF cr = F.cl; buf.AppendFormat("{\\colortbl \\red%u\\green%u\\blue%u;", GetRValue(cr), GetGValue(cr), GetBValue(cr)); cr = g_colorTable[(dbe.flags & DBEF_SENT) ? COLOR_OUTNICK : COLOR_INNICK].cl; - buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(cr), GetGValue(cr), GetBValue(cr)); - cr = g_colorTable[COLOR_DATE].cl; buf.AppendFormat("\\red%u\\green%u\\blue%u;}", GetRValue(cr), GetGValue(cr), GetBValue(cr)); buf.AppendFormat("\\uc1\\pard \\cf0\\f0\\b0\\i0\\fs%d ", GetFontHeight(F.lf)); @@ -266,44 +264,44 @@ void vfEvent(TemplateVars *vars, MCONTACT, ItemData *item) GetDateFormatW(iLocale, 0, &st, L"dd.MM.yyyy, ", buf, _countof(buf)); GetTimeFormatW(iLocale, 0, &st, L"HH:mm", buf + 12, _countof(buf)); - vars->SetDate('t', buf); + vars->SetVar('t', buf, true); // %h: hour (24 hour format, 0-23) GetTimeFormatW(iLocale, 0, &st, L"HH", buf, _countof(buf)); - vars->SetDate('h', buf); + vars->SetVar('h', buf, true); // %a: hour (12 hour format) GetTimeFormatW(iLocale, 0, &st, L"hh", buf, _countof(buf)); - vars->SetDate('a', buf); + vars->SetVar('a', buf, true); // %m: minute GetTimeFormatW(iLocale, 0, &st, L"mm", buf, _countof(buf)); - vars->SetDate('m', buf); + vars->SetVar('m', buf, true); // %s: second GetTimeFormatW(iLocale, 0, &st, L"ss", buf, _countof(buf)); - vars->SetDate('s', buf); + vars->SetVar('s', buf, true); // %o: month GetDateFormatW(iLocale, 0, &st, L"MM", buf, _countof(buf)); - vars->SetDate('o', buf); + vars->SetVar('o', buf, true); // %d: day of month GetDateFormatW(iLocale, 0, &st, L"dd", buf, _countof(buf)); - vars->SetDate('d', buf); + vars->SetVar('d', buf, true); // %y: year GetDateFormatW(iLocale, 0, &st, L"yyyy", buf, _countof(buf)); - vars->SetDate('y', buf); + vars->SetVar('y', buf, true); // %w: day of week (Sunday, Monday... translatable) - vars->SetDate('w', TranslateW(weekDays[st.wDayOfWeek])); + vars->SetVar('w', TranslateW(weekDays[st.wDayOfWeek]), false); // %p: AM/PM symbol - vars->SetDate('p', (st.wHour > 11) ? L"PM" : L"AM"); + vars->SetVar('p', (st.wHour > 11) ? L"PM" : L"AM", false); // %O: Name of month, translatable - vars->SetDate('O', TranslateW(months[st.wMonth-1])); + vars->SetVar('O', TranslateW(months[st.wMonth-1]), false); } } @@ -353,17 +351,6 @@ void vfOther(TemplateVars *vars, MCONTACT, ItemData *item) ///////////////////////////////////////////////////////////////////////////////////////// -void TemplateVars::SetDate(char option, const wchar_t *v) -{ - CMStringW wszDate(FORMAT, L"[c2]%s[c0]", v); - - auto &V = vars[option]; - if (V.del) - mir_free(V.val); - V.val = wszDate.Detach(); - V.del = true; -} - void TemplateVars::SetNick(wchar_t *v) { CMStringW wszNick(FORMAT, L"[c1]%s[c0]", v); diff --git a/plugins/NewStory/src/templates.h b/plugins/NewStory/src/templates.h index 62fd15ac1f..ffe904c16e 100644 --- a/plugins/NewStory/src/templates.h +++ b/plugins/NewStory/src/templates.h @@ -16,7 +16,6 @@ struct TemplateVars return vars[id].val; } - void SetDate(char option, const wchar_t *v); void SetNick(wchar_t *v); void SetVar(uint8_t id, wchar_t *v, bool d); }; -- cgit v1.2.3