From 03d8ca472d6d868907c58162086a3d7d513a4f0d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Nov 2023 18:53:03 +0300 Subject: =?UTF-8?q?fixes=20#3814=20(NewXStatusNotify:=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=BF=D0=B0=D0=BB=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=BE=D0=B2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewXstatusNotify/src/main.cpp | 5 ++--- plugins/NewXstatusNotify/src/options.cpp | 22 ++++++++++------------ plugins/NewXstatusNotify/src/popup.h | 2 -- 3 files changed, 12 insertions(+), 17 deletions(-) (limited to 'plugins/NewXstatusNotify/src') diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index f0317beacb..70fba89f5f 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -302,12 +302,11 @@ void GetStatusText(MCONTACT hContact, uint16_t newStatus, uint16_t oldStatus, wc break; } } - else - wcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT); + else wcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT); if (opt.ShowPreviousStatus) { wchar_t buff[MAX_STATUSTEXT]; - mir_snwprintf(buff, TranslateW(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText); + mir_snwprintf(buff, TranslateT("(was %s)"), StatusList[Index(oldStatus)].lpzStandardText); mir_wstrcat(mir_wstrcat(stzStatusText, L" "), buff); } } diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 3bca081936..fcd5c307d8 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -377,31 +377,29 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case IDC_PREVIEW: - wchar_t str[MAX_SECONDLINE]; for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) { - str[0] = 0; + auto &pStatus = StatusList[Index(i)]; + CMStringW buf; if (opt.ShowStatus) { if (opt.UseAlternativeText == 1) - wcsncpy(str, StatusList[Index(i)].lpzUStatusText, _countof(str)); + buf.Append(TranslateW(pStatus.lpzUStatusText)); else - wcsncpy(str, StatusList[Index(i)].lpzStandardText, _countof(str)); + buf.Append(TranslateW(pStatus.lpzStandardText)); if (opt.ShowPreviousStatus) { - wchar_t buff[MAX_STATUSTEXT]; - mir_snwprintf(buff, TranslateW(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(i)].lpzStandardText); - mir_wstrcat(str, L" "); - mir_wstrcat(str, buff); + buf.AppendChar(' '); + buf.AppendFormat(TranslateT("(was %s)"), pStatus.lpzStandardText); } } if (opt.ReadAwayMsg) { - if (str[0]) - mir_wstrcat(str, L"\n"); - mir_wstrcat(str, TranslateT("This is status message")); + if (!buf.IsEmpty()) + buf += L"\n"; + buf += TranslateT("This is status message"); } - ShowChangePopup(NULL, Skin_LoadProtoIcon(nullptr, i), i, str); + ShowChangePopup(NULL, Skin_LoadProtoIcon(nullptr, i), i, buf); } ShowChangePopup(NULL, Skin_LoadProtoIcon(nullptr, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, TranslateT("This is extra status")); diff --git a/plugins/NewXstatusNotify/src/popup.h b/plugins/NewXstatusNotify/src/popup.h index aa067c80b0..917c756309 100644 --- a/plugins/NewXstatusNotify/src/popup.h +++ b/plugins/NewXstatusNotify/src/popup.h @@ -35,8 +35,6 @@ #define PCA_OPENHISTORY 4 // open contact history #define PCA_DONOTHING 5 // do nothing -#define STRING_SHOWPREVIOUSSTATUS LPGENW("(was %s)") - typedef struct tagPLUGINDATA { uint16_t newStatus; -- cgit v1.2.3