diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewStory/src/fonts.cpp | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/fonts.h | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/templates.cpp | 35 | ||||
-rw-r--r-- | plugins/NewStory/src/templates.h | 1 |
4 files changed, 27 insertions, 12 deletions
diff --git a/plugins/NewStory/src/fonts.cpp b/plugins/NewStory/src/fonts.cpp index 844f5d0f62..b0924ea535 100644 --- a/plugins/NewStory/src/fonts.cpp +++ b/plugins/NewStory/src/fonts.cpp @@ -22,6 +22,7 @@ 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 0a441c1931..60b55f1292 100644 --- a/plugins/NewStory/src/fonts.h +++ b/plugins/NewStory/src/fonts.h @@ -5,7 +5,7 @@ enum { - COLOR_INNICK, COLOR_OUTNICK, + COLOR_INNICK, COLOR_OUTNICK, COLOR_DATE, 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 b4e7438b4e..2d7d4fc1d6 100644 --- a/plugins/NewStory/src/templates.cpp +++ b/plugins/NewStory/src/templates.cpp @@ -106,6 +106,8 @@ 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)); @@ -264,44 +266,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->SetVar('t', buf, true); + vars->SetDate('t', buf); // %h: hour (24 hour format, 0-23) GetTimeFormatW(iLocale, 0, &st, L"HH", buf, _countof(buf)); - vars->SetVar('h', buf, true); + vars->SetDate('h', buf); // %a: hour (12 hour format) GetTimeFormatW(iLocale, 0, &st, L"hh", buf, _countof(buf)); - vars->SetVar('a', buf, true); + vars->SetDate('a', buf); // %m: minute GetTimeFormatW(iLocale, 0, &st, L"mm", buf, _countof(buf)); - vars->SetVar('m', buf, true); + vars->SetDate('m', buf); // %s: second GetTimeFormatW(iLocale, 0, &st, L"ss", buf, _countof(buf)); - vars->SetVar('s', buf, true); + vars->SetDate('s', buf); // %o: month GetDateFormatW(iLocale, 0, &st, L"MM", buf, _countof(buf)); - vars->SetVar('o', buf, true); + vars->SetDate('o', buf); // %d: day of month GetDateFormatW(iLocale, 0, &st, L"dd", buf, _countof(buf)); - vars->SetVar('d', buf, true); + vars->SetDate('d', buf); // %y: year GetDateFormatW(iLocale, 0, &st, L"yyyy", buf, _countof(buf)); - vars->SetVar('y', buf, true); + vars->SetDate('y', buf); // %w: day of week (Sunday, Monday... translatable) - vars->SetVar('w', TranslateW(weekDays[st.wDayOfWeek]), false); + vars->SetDate('w', TranslateW(weekDays[st.wDayOfWeek])); // %p: AM/PM symbol - vars->SetVar('p', (st.wHour > 11) ? L"PM" : L"AM", false); + vars->SetDate('p', (st.wHour > 11) ? L"PM" : L"AM"); // %O: Name of month, translatable - vars->SetVar('O', TranslateW(months[st.wMonth-1]), false); + vars->SetDate('O', TranslateW(months[st.wMonth-1])); } } @@ -351,6 +353,17 @@ 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 ffe904c16e..62fd15ac1f 100644 --- a/plugins/NewStory/src/templates.h +++ b/plugins/NewStory/src/templates.h @@ -16,6 +16,7 @@ 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); }; |