summaryrefslogtreecommitdiff
path: root/plugins/NewEventNotify/src/popup.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-02-27 18:59:36 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-02-27 18:59:36 +0300
commit63cf6dce8b3151a02feeb88a40837b5039a32ea6 (patch)
tree962c1832f386a2d9f4bfe0be59e9cebb1a09755e /plugins/NewEventNotify/src/popup.cpp
parent7cdfba864b65e3c04a4db0e1f36c300912bfefb3 (diff)
NEN: fix for chinese & CRLF in popups
Diffstat (limited to 'plugins/NewEventNotify/src/popup.cpp')
-rw-r--r--plugins/NewEventNotify/src/popup.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp
index f9775c01cb..87ac31875a 100644
--- a/plugins/NewEventNotify/src/popup.cpp
+++ b/plugins/NewEventNotify/src/popup.cpp
@@ -427,21 +427,24 @@ int PopupUpdate(PLUGIN_DATA &pdata, MEVENT hEvent)
// take the active event as starting one
for (size_t i = iStart; i < iEnd; i++) {
+ if (!wszText.IsEmpty())
+ wszText.AppendChar('\n');
+
// get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
DB::EventInfo dbe;
if (g_plugin.bPreview)
dbe.cbBlob = -1;
db_event_get(pdata.events[i], &dbe);
- if (g_plugin.bShowDate || g_plugin.bShowTime) {
+ CMStringW wszFormat;
+ if (g_plugin.bShowDate)
+ wszFormat.Append(L"%Y.%m.%d ");
+ if (g_plugin.bShowTime)
+ wszFormat.Append(L"%H:%M");
+ if (!wszFormat.IsEmpty()) {
wchar_t timestamp[MAX_DATASIZE];
- wchar_t formatTime[MAX_DATASIZE];
- if (g_plugin.bShowDate)
- wcsncpy(formatTime, L"%Y.%m.%d", _countof(formatTime));
- else if (g_plugin.bShowTime)
- mir_wstrncat(formatTime, L" %H:%M", _countof(formatTime) - mir_wstrlen(formatTime));
time_t localTime = dbe.timestamp;
- wcsftime(timestamp, _countof(timestamp), formatTime, localtime(&localTime));
+ wcsftime(timestamp, _countof(timestamp), wszFormat, localtime(&localTime));
wszText.AppendFormat(L"[b][i]%s[/i][/b]\n", timestamp);
}