From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewXstatusNotify/src/indsnd.cpp | 32 +++++----- plugins/NewXstatusNotify/src/indsnd.h | 2 +- plugins/NewXstatusNotify/src/main.cpp | 100 +++++++++++++++---------------- plugins/NewXstatusNotify/src/options.cpp | 34 +++++------ plugins/NewXstatusNotify/src/options.h | 26 ++++---- plugins/NewXstatusNotify/src/popup.cpp | 12 ++-- plugins/NewXstatusNotify/src/popup.h | 18 +++--- plugins/NewXstatusNotify/src/stdafx.h | 22 +++---- plugins/NewXstatusNotify/src/utils.cpp | 14 ++--- plugins/NewXstatusNotify/src/utils.h | 8 +-- plugins/NewXstatusNotify/src/xstatus.cpp | 56 ++++++++--------- plugins/NewXstatusNotify/src/xstatus.h | 12 ++-- 12 files changed, 167 insertions(+), 169 deletions(-) (limited to 'plugins/NewXstatusNotify/src') diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index d43a0677fb..ee0aae304d 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -23,7 +23,7 @@ void PreviewSound(HWND hList) { - TCHAR buff[MAX_PATH], stzSoundPath[MAX_PATH]; + wchar_t buff[MAX_PATH], stzSoundPath[MAX_PATH]; LVITEM lvi = { 0 }; lvi.mask = LVIF_PARAM; @@ -33,7 +33,7 @@ void PreviewSound(HWND hList) int hlpStatus = lvi.lParam; ListView_GetItemText(hList, lvi.iItem, 1, buff, _countof(buff)); - if (!mir_tstrcmp(buff, TranslateT(DEFAULT_SOUND))) { + if (!mir_tstrcmp(buff, TranslateTS(DEFAULT_SOUND))) { if (hlpStatus < ID_STATUS_MIN) SkinPlaySound(StatusListEx[hlpStatus].lpzSkinSoundName); else @@ -51,26 +51,26 @@ BOOL RemoveSoundFromList(HWND hList) if (iSel != -1) { iSel = -1; while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) - ListView_SetItemText(hList, iSel, 1, TranslateT(DEFAULT_SOUND)); + ListView_SetItemText(hList, iSel, 1, TranslateTS(DEFAULT_SOUND)); return TRUE; } return FALSE; } -TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff, size_t bufflen) +wchar_t *SelectSound(HWND hwndDlg, wchar_t *buff, size_t bufflen) { OPENFILENAME ofn = { 0 }; HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); ListView_GetItemText(hList, ListView_GetNextItem(hList, -1, LVNI_SELECTED), 1, buff, (DWORD)bufflen); - if (!mir_tstrcmp(buff, TranslateT(DEFAULT_SOUND))) + if (!mir_tstrcmp(buff, TranslateTS(DEFAULT_SOUND))) buff = NULL; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = GetParent(hwndDlg); ofn.hInstance = hInst; - TCHAR filter[MAX_PATH]; + wchar_t filter[MAX_PATH]; if (GetModuleHandle(L"bass_interface.dll")) mir_sntprintf(filter, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*.*)%c*%c", TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0); else @@ -132,7 +132,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (szProto) { DBVARIANT dbv; - TCHAR buff[MAX_PATH]; + wchar_t buff[MAX_PATH]; for (int i = ID_STATUS_MAX; i >= ID_STATUS_MIN; i--) { int flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0); @@ -153,8 +153,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA mir_tstrcpy(buff, dbv.ptszVal); db_free(&dbv); } - else - mir_tstrcpy(buff, TranslateT(DEFAULT_SOUND)); + else mir_tstrcpy(buff, TranslateTS(DEFAULT_SOUND)); ListView_SetItemText(hList, lvi.iItem, 1, buff); } @@ -171,11 +170,10 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvi.iItem = ListView_InsertItem(hList, &lvi); if (!db_get_ts(hContact, MODULE, StatusList[i].lpzSkinSoundName, &dbv)) { - _tcsncpy(buff, dbv.ptszVal, _countof(buff)-1); + wcsncpy(buff, dbv.ptszVal, _countof(buff)-1); db_free(&dbv); } - else - _tcsncpy(buff, TranslateT(DEFAULT_SOUND), _countof(buff)-1); + else wcsncpy(buff, TranslateTS(DEFAULT_SOUND), _countof(buff)-1); ListView_SetItemText(hList, lvi.iItem, 1, buff); } @@ -202,7 +200,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { int iSel = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_INDSNDLIST), -1, LVNI_SELECTED); if (iSel != -1) { - TCHAR stzFilePath[MAX_PATH]; + wchar_t stzFilePath[MAX_PATH]; if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != NULL) { iSel = -1; while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) @@ -229,7 +227,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - TCHAR buff[MAX_PATH]; + wchar_t buff[MAX_PATH]; LVITEM lvi = { 0 }; lvi.mask = LVIF_PARAM; @@ -238,14 +236,14 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ListView_GetItem(hList, &lvi); ListView_GetItemText(hList, lvi.iItem, 1, buff, _countof(buff)); - if (!mir_tstrcmp(buff, TranslateT(DEFAULT_SOUND))) { + if (!mir_tstrcmp(buff, TranslateTS(DEFAULT_SOUND))) { if (lvi.lParam < ID_STATUS_MIN) db_unset(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName); else db_unset(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName); } else { - TCHAR stzSoundPath[MAX_PATH] = { 0 }; + wchar_t stzSoundPath[MAX_PATH] = { 0 }; PathToRelativeT(buff, stzSoundPath); if (lvi.lParam < ID_STATUS_MIN) db_set_ws(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName, stzSoundPath); @@ -261,7 +259,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (hlpControlID) { case IDC_INDSNDLIST: if (((LPNMHDR)lParam)->code == NM_DBLCLK) { - TCHAR stzFilePath[MAX_PATH]; + wchar_t stzFilePath[MAX_PATH]; if (SelectSound(hwndDlg, stzFilePath, MAX_PATH - 1) != NULL) { int iSel = -1; while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) diff --git a/plugins/NewXstatusNotify/src/indsnd.h b/plugins/NewXstatusNotify/src/indsnd.h index e3d0245e4a..784f107018 100644 --- a/plugins/NewXstatusNotify/src/indsnd.h +++ b/plugins/NewXstatusNotify/src/indsnd.h @@ -34,7 +34,7 @@ #define STATUS_COLUMN 110 -#define DEFAULT_SOUND LPGEN("(default sound)") +#define DEFAULT_SOUND LPGENW("(default sound)") int UserInfoInitialise(WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcFiltering(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index fbf5aac0a4..db07011b5c 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -182,16 +182,16 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, return ret; } -TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) +wchar_t* GetStr(STATUSMSGINFO *n, const wchar_t *tmplt) { - if (n == NULL || tmplt == NULL || tmplt[0] == _T('\0')) + if (n == NULL || tmplt == NULL || tmplt[0] == '\0') return NULL; CMString res; size_t len = mir_tstrlen(tmplt); for (size_t i = 0; i < len; i++) { - if (tmplt[i] == _T('%')) { + if (tmplt[i] == '%') { i++; switch (tmplt[i]) { case 'n': @@ -202,7 +202,7 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) break; case 'o': - if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == _T('\0') || mir_tstrcmp(n->oldstatusmsg, TranslateT("")) == 0) + if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == '\0' || mir_tstrcmp(n->oldstatusmsg, TranslateT("")) == 0) res.Append(TranslateT("")); else AddCR(res, n->oldstatusmsg); @@ -228,7 +228,7 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) break; } } - else if (tmplt[i] == _T('\\')) { + else if (tmplt[i] == '\\') { i++; switch (tmplt[i]) { case 'n': @@ -260,7 +260,7 @@ bool SkipHiddenContact(MCONTACT hContact) return (!opt.HiddenContactsToo && (db_get_b(hContact, "CList", "Hidden", 0) == 1)); } -void LogSMsgToDB(STATUSMSGINFO *smi, const TCHAR *tmplt) +void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt) { ptrT str(GetStr(smi, tmplt)); T2Utf blob(str); @@ -284,32 +284,32 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const TCHAR *tmplt) } } -void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, TCHAR *stzStatusText) +void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, wchar_t *stzStatusText) { if (opt.UseAlternativeText) { switch (GetGender(hContact)) { case GENDER_MALE: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT); + wcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT); break; case GENDER_FEMALE: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT); + wcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT); break; case GENDER_UNSPECIFIED: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT); + wcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT); break; } } else - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT); + wcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT); if (opt.ShowPreviousStatus) { - TCHAR buff[MAX_STATUSTEXT]; + wchar_t buff[MAX_STATUSTEXT]; mir_sntprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText); mir_tstrcat(mir_tstrcat(stzStatusText, L" "), buff); } } -void BlinkIcon(MCONTACT hContact, HICON hIcon, TCHAR *stzText) +void BlinkIcon(MCONTACT hContact, HICON hIcon, wchar_t *stzText) { CLISTEVENT cle = {}; cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; @@ -325,15 +325,15 @@ void PlayChangeSound(MCONTACT hContact, const char *name) { if (opt.UseIndSnd) { DBVARIANT dbv; - TCHAR stzSoundFile[MAX_PATH] = { 0 }; + wchar_t stzSoundFile[MAX_PATH] = { 0 }; if (!db_get_ts(hContact, MODULE, name, &dbv)) { - _tcsncpy(stzSoundFile, dbv.ptszVal, _countof(stzSoundFile)-1); + wcsncpy(stzSoundFile, dbv.ptszVal, _countof(stzSoundFile)-1); db_free(&dbv); } if (stzSoundFile[0]) { //Now make path to IndSound absolute, as it isn't registered - TCHAR stzSoundPath[MAX_PATH]; + wchar_t stzSoundPath[MAX_PATH]; PathToAbsoluteT(stzSoundFile, stzSoundPath); SkinPlaySoundFile(stzSoundPath); return; @@ -347,7 +347,7 @@ void PlayChangeSound(MCONTACT hContact, const char *name) int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) { if (opt.LogToDB && (!opt.LogToDB_WinOpen || CheckMsgWnd(hContact))) { - TCHAR stzStatusText[MAX_SECONDLINE] = { 0 }; + wchar_t stzStatusText[MAX_SECONDLINE] = { 0 }; GetStatusText(hContact, newStatus, oldStatus, stzStatusText); T2Utf blob(stzStatusText); @@ -423,7 +423,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) { WORD wStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0); - TCHAR str[MAX_SECONDLINE] = { 0 }; + wchar_t str[MAX_SECONDLINE] = { 0 }; if (opt.ShowStatus) GetStatusText(hContact, newStatus, oldStatus, str); @@ -440,7 +440,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) if (opt.BlinkIcon && !opt.TempDisabled) { HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, newStatus) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE); - TCHAR str[256]; + wchar_t str[256]; mir_sntprintf(str, TranslateT("%s is now %s"), pcli->pfnGetContactDisplayName(hContact, 0), StatusList[Index(newStatus)].lpzStandardText); BlinkIcon(hContact, hIcon, str); } @@ -453,7 +453,7 @@ int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus) } if (opt.LogToFile) { - TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN]; + wchar_t stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", stzTime, _countof(stzTime)); GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, L"dd/MM/yyyy", stzDate, _countof(stzDate)); @@ -628,7 +628,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) //don't show popup when mradio connecting and disconnecting if (_stricmp(szProto, "mRadio") == 0 && !cws->value.type == DBVT_DELETED) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; mir_sntprintf(buf, L" (%s)", TranslateT("connecting")); T2Utf pszUtf(buf); mir_sntprintf(buf, L" (%s)", TranslateT("aborting")); @@ -680,17 +680,17 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (bEnablePopup && db_get_b(hContact, MODULE, "EnablePopups", 1) && !opt.TempDisabled) { // cut message if needed - TCHAR *copyText = NULL; + wchar_t *copyText = NULL; if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_tstrlen(smi.newstatusmsg) > opt.PSMsgLen)) { - TCHAR buff[MAX_TEXT_LEN + 3]; + wchar_t buff[MAX_TEXT_LEN + 3]; copyText = mir_tstrdup(smi.newstatusmsg); - _tcsncpy(buff, smi.newstatusmsg, opt.PSMsgLen); + wcsncpy(buff, smi.newstatusmsg, opt.PSMsgLen); buff[opt.PSMsgLen] = 0; mir_tstrcat(buff, L"..."); replaceStrT(smi.newstatusmsg, buff); } - TCHAR *str; + wchar_t *str; if (smi.compare == COMPARE_DEL) { char protoname[MAX_PATH]; mir_snprintf(protoname, "%s_TPopupSMsgRemoved", szProto); @@ -730,7 +730,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (opt.BlinkIcon && opt.BlinkIcon_ForMsgs && !opt.TempDisabled) { HICON hIcon = opt.BlinkIcon_Status ? Skin_LoadProtoIcon(szProto, db_get_w(hContact, szProto, "Status", ID_STATUS_ONLINE)) : Skin_LoadIcon(SKINICON_OTHER_USERONLINE); - TCHAR str[256]; + wchar_t str[256]; mir_sntprintf(str, TranslateT("%s changed status message to %s"), pcli->pfnGetContactDisplayName(hContact, 0), smi.newstatusmsg); BlinkIcon(hContact, hIcon, str); } @@ -747,12 +747,12 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) LogSMsgToDB(&smi, smi.compare == COMPARE_DEL ? templates.LogSMsgRemoved : templates.LogSMsgChanged); if (opt.SMsgLogToFile && db_get_b(hContact, MODULE, "EnableSMsgLogging", 1)) { - TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN]; + wchar_t stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT], stzText[MAX_TEXT_LEN]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", stzTime, _countof(stzTime)); GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, L"dd/MM/yyyy", stzDate, _countof(stzDate)); - TCHAR *str; + wchar_t *str; if (smi.compare == COMPARE_DEL) str = GetStr(&smi, templates.LogSMsgRemoved); else @@ -855,7 +855,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is back online!"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Online"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnline", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Online"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Online"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"global.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40072bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40072tx", COLOR_TX_DEFAULT); @@ -867,7 +867,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went offline! :("), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Offline"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOffline", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Offline"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Offline"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"offline.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40071bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40071tx", COLOR_TX_DEFAULT); @@ -879,7 +879,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) hides in shadows..."), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Invisible"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserInvisible", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Invisible"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Invisible"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"invisible.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40078bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40078tx", COLOR_TX_DEFAULT); @@ -891,7 +891,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) feels talkative!"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Free for chat"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Free for chat"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Free for chat"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"free4chat.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40077tx", COLOR_TX_DEFAULT); @@ -903,7 +903,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went away"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Away"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Away"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Away"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"away.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40073bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40073tx", COLOR_TX_DEFAULT); @@ -915,7 +915,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) isn't there anymore!"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Not available"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Not available"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Not available"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"na.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40075tx", COLOR_TX_DEFAULT); @@ -927,7 +927,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Occupied"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Occupied"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Occupied"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"occupied.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40076bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40076tx", COLOR_TX_DEFAULT); @@ -939,7 +939,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) doesn't want to be disturbed!"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Do not disturb"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Do not disturb"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Do not disturb"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"dnd.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40074tx", COLOR_TX_DEFAULT); @@ -951,7 +951,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is eating something"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Out to lunch"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Out to lunch"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Out to lunch"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"lunch.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40080tx", COLOR_TX_DEFAULT); @@ -963,7 +963,7 @@ void InitStatusList() mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) had to answer the phone"), MAX_STATUSTEXT); mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("On the phone"), MAX_STANDARDTEXT); mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: On the phone"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: On the phone"), MAX_SKINSOUNDDESC); mir_tstrncpy(StatusList[index].lpzSkinSoundFile, L"phone.wav", MAX_PATH); StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT); StatusList[index].colorText = db_get_dw(NULL, MODULE, "40079tx", COLOR_TX_DEFAULT); @@ -981,37 +981,37 @@ void InitStatusList() //From offline index = ID_STATUS_FROMOFFLINE; mir_strncpy(StatusListEx[index].lpzSkinSoundName, "UserFromOffline", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("User: from offline (has priority!)"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("User: from offline (has priority!)"), MAX_SKINSOUNDDESC); //Status message removed index = ID_STATUS_SMSGREMOVED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgRemoved", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message removed"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message removed"), MAX_SKINSOUNDDESC); //Status message changed index = ID_STATUS_SMSGCHANGED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgChanged", MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message changed"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Status message changed"), MAX_SKINSOUNDDESC); //Extra status removed index = ID_STATUS_XREMOVED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_REMOVED, MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status removed"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status removed"), MAX_SKINSOUNDDESC); //Extra status message changed index = ID_STATUS_XMSGCHANGED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGCHANGED, MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message changed"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message changed"), MAX_SKINSOUNDDESC); //Extra status changed index = ID_STATUS_XCHANGED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_CHANGED, MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status changed"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status changed"), MAX_SKINSOUNDDESC); //Extra status message removed index = ID_STATUS_XMSGREMOVED; mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGREMOVED, MAX_SKINSOUNDNAME); - mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message removed"), MAX_SKINSOUNDDESC); + mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENW("Extra status message removed"), MAX_SKINSOUNDDESC); } void CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD) @@ -1060,9 +1060,9 @@ INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM) db_set_b(0, MODULE, "TempDisable", opt.TempDisabled = !opt.TempDisabled); if (opt.TempDisabled) - Menu_ModifyItem(hEnableDisableMenu, LPGENT("Enable status notification"), GetIconHandle(ICO_NOTIFICATION_OFF)); + Menu_ModifyItem(hEnableDisableMenu, LPGENW("Enable status notification"), GetIconHandle(ICO_NOTIFICATION_OFF)); else - Menu_ModifyItem(hEnableDisableMenu, LPGENT("Disable status notification"), GetIconHandle(ICO_NOTIFICATION_ON)); + Menu_ModifyItem(hEnableDisableMenu, LPGENW("Disable status notification"), GetIconHandle(ICO_NOTIFICATION_ON)); CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hToolbarButton, opt.TempDisabled ? 0 : TTBST_PUSHED); return 0; @@ -1074,7 +1074,7 @@ void InitMainMenuItem() SET_UID(mi, 0x22b7b4db, 0xa9a1, 0x4d43, 0x88, 0x80, 0x4c, 0x23, 0x20, 0x31, 0xc6, 0xa0); mi.flags = CMIF_TCHAR; if (ServiceExists(MS_POPUP_ADDPOPUPT)) - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Popups"), 0); mi.pszService = MS_STATUSCHANGE_MENUCOMMAND; hEnableDisableMenu = Menu_AddMainMenuItem(&mi); @@ -1096,10 +1096,10 @@ void InitIcolib() void InitSound() { for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) - SkinAddNewSoundExT(StatusList[Index(i)].lpzSkinSoundName, LPGENT("Status Notify"), StatusList[Index(i)].lpzSkinSoundDesc); + SkinAddNewSoundExT(StatusList[Index(i)].lpzSkinSoundName, LPGENW("Status Notify"), StatusList[Index(i)].lpzSkinSoundDesc); for (int i = 0; i <= ID_STATUSEX_MAX; i++) - SkinAddNewSoundExT(StatusListEx[i].lpzSkinSoundName, LPGENT("Status Notify"), StatusListEx[i].lpzSkinSoundDesc); + SkinAddNewSoundExT(StatusListEx[i].lpzSkinSoundName, LPGENW("Status Notify"), StatusListEx[i].lpzSkinSoundDesc); } int InitTopToolbar(WPARAM, LPARAM) diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index f981556d39..61ca3ad9a7 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case IDC_BT_CHOOSELOGFILE: { - TCHAR buff[MAX_PATH]; + wchar_t buff[MAX_PATH]; OPENFILENAME ofn = { 0 }; GetDlgItemText(hwndDlg, IDC_LOGFILE, buff, _countof(buff)); @@ -255,7 +255,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ofn.lpstrFile = buff; ofn.nMaxFile = MAX_PATH; ofn.hwndOwner = hwndDlg; - TCHAR filter[MAX_PATH]; + wchar_t filter[MAX_PATH]; mir_sntprintf(filter, L"%s (*.*)%c*.*%c%s (*.log)%c*.log%c%s (*.txt)%c*.txt%c", TranslateT("All Files"), 0, 0, TranslateT("Log"), 0, 0, TranslateT("Text"), 0, 0); ofn.lpstrFilter = filter; ofn.nFilterIndex = 2; @@ -379,18 +379,18 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case IDC_PREVIEW: { - TCHAR str[MAX_SECONDLINE] = { 0 }; + wchar_t str[MAX_SECONDLINE] = { 0 }; for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) { - _tcsncpy(str, L"", _countof(str)); + wcsncpy(str, L"", _countof(str)); if (opt.ShowStatus) { if (opt.UseAlternativeText == 1) - _tcsncpy(str, StatusList[Index(i)].lpzUStatusText, _countof(str)); + wcsncpy(str, StatusList[Index(i)].lpzUStatusText, _countof(str)); else - _tcsncpy(str, StatusList[Index(i)].lpzStandardText, _countof(str)); + wcsncpy(str, StatusList[Index(i)].lpzStandardText, _countof(str)); if (opt.ShowPreviousStatus) { - TCHAR buff[MAX_STATUSTEXT]; + wchar_t buff[MAX_STATUSTEXT]; mir_sntprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(i)].lpzStandardText); mir_tstrcat(str, L" "); mir_tstrcat(str, buff); @@ -405,9 +405,9 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, i), i, str); } - _tcsncpy(str, TranslateT("This is extra status"), _countof(str)); + wcsncpy(str, TranslateT("This is extra status"), _countof(str)); ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, str); - _tcsncpy(str, TranslateT("This is status message"), _countof(str)); + wcsncpy(str, TranslateT("This is status message"), _countof(str)); ShowChangePopup(NULL, Skin_LoadProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_STATUSMSG, str); return FALSE; @@ -557,12 +557,12 @@ INT_PTR CALLBACK DlgProcXPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TREMOVEMSG), templates.PopupXFlags & NOTIFY_REMOVE_MESSAGE); // Buttons - SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show available variables"), BATF_TCHAR); + SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Show available variables"), BATF_TCHAR); HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_VARIABLES)); SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); DestroyIcon(hIcon); - SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Reset all templates to default"), BATF_TCHAR); + SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Reset all templates to default"), BATF_TCHAR); hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RESET)); SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); DestroyIcon(hIcon); @@ -691,12 +691,12 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TSMSGREMOVE), templates.PopupSMsgFlags & NOTIFY_REMOVE_MESSAGE); // Buttons - SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show available variables"), BATF_TCHAR); + SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Show available variables"), BATF_TCHAR); HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_VARIABLES)); SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); DestroyIcon(hIcon); - SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Reset all templates to default"), BATF_TCHAR); + SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Reset all templates to default"), BATF_TCHAR); hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RESET)); SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); DestroyIcon(hIcon); @@ -731,17 +731,17 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char protoname[MAX_PATH] = { 0 }; mir_snprintf(protoname, "%s_TPopupSMsgChanged", protos[i]->szModuleName); if (db_get_ts(NULL, MODULE, protoname, &dbVar)) - _tcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, _countof(prototemplate->ProtoTemplateMsg)); + wcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, _countof(prototemplate->ProtoTemplateMsg)); else { - _tcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, _countof(prototemplate->ProtoTemplateMsg)); + wcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, _countof(prototemplate->ProtoTemplateMsg)); db_free(&dbVar); } mir_snprintf(protoname, "%s_TPopupSMsgRemoved", protos[i]->szModuleName); if (db_get_ts(NULL, MODULE, protoname, &dbVar)) - _tcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, _countof(prototemplate->ProtoTemplateRemoved)); + wcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, _countof(prototemplate->ProtoTemplateRemoved)); else { - _tcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, _countof(prototemplate->ProtoTemplateRemoved)); + wcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, _countof(prototemplate->ProtoTemplateRemoved)); db_free(&dbVar); } diff --git a/plugins/NewXstatusNotify/src/options.h b/plugins/NewXstatusNotify/src/options.h index 1753401455..adf561dd00 100644 --- a/plugins/NewXstatusNotify/src/options.h +++ b/plugins/NewXstatusNotify/src/options.h @@ -49,7 +49,7 @@ typedef struct tagOPTIONS { BYTE BlinkIcon; BYTE BlinkIcon_Status; BYTE BlinkIcon_ForMsgs; - TCHAR LogFilePath[MAX_PATH]; + wchar_t LogFilePath[MAX_PATH]; // IDD_AUTODISABLE BYTE OnlyGlobalChanges; BYTE DisableSoundGlobally; @@ -86,18 +86,18 @@ typedef struct tagTEMPLATES { BYTE PopupSMsgFlags; BYTE LogXFlags; BYTE LogSMsgFlags; - TCHAR PopupXstatusChanged[256]; - TCHAR PopupXstatusRemoved[256]; - TCHAR PopupXMsgChanged[256]; - TCHAR PopupXMsgRemoved[256]; - TCHAR LogXstatusChanged[256]; - TCHAR LogXstatusRemoved[256]; - TCHAR LogXMsgChanged[256]; - TCHAR LogXMsgRemoved[256]; - TCHAR LogXstatusOpening[256]; - TCHAR LogSMsgChanged[256]; - TCHAR LogSMsgRemoved[256]; - TCHAR LogSMsgOpening[256]; + wchar_t PopupXstatusChanged[256]; + wchar_t PopupXstatusRemoved[256]; + wchar_t PopupXMsgChanged[256]; + wchar_t PopupXMsgRemoved[256]; + wchar_t LogXstatusChanged[256]; + wchar_t LogXstatusRemoved[256]; + wchar_t LogXMsgChanged[256]; + wchar_t LogXMsgRemoved[256]; + wchar_t LogXstatusOpening[256]; + wchar_t LogSMsgChanged[256]; + wchar_t LogSMsgRemoved[256]; + wchar_t LogSMsgOpening[256]; } TEMPLATES; int OptionsInitialize(WPARAM wParam, LPARAM lParam); diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp index c4aad62f4f..a6346e67d9 100644 --- a/plugins/NewXstatusNotify/src/popup.cpp +++ b/plugins/NewXstatusNotify/src/popup.cpp @@ -21,7 +21,7 @@ #include "stdafx.h" -void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const TCHAR *stzText, PLUGINDATA *pdp) +void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const wchar_t *stzText, PLUGINDATA *pdp) { POPUPDATAT ppd = { 0 }; ppd.lchContact = hContact; @@ -34,9 +34,9 @@ void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const TCHAR if (tszGroup) buf.AppendFormat(L" (%s)", tszGroup); } - _tcsncpy_s(ppd.lptzContactName, buf, _TRUNCATE); + wcsncpy_s(ppd.lptzContactName, buf, _TRUNCATE); - _tcsncpy(ppd.lptzText, stzText, _countof(ppd.lptzText)); + wcsncpy(ppd.lptzText, stzText, _countof(ppd.lptzText)); switch (opt.Colors) { case POPUP_COLOR_OWN: @@ -79,15 +79,15 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj) MCONTACT hContact = PUGetContact(pdp->hWnd); ptrT pstzLast(db_get_tsa(hContact, MODULE, "LastPopupText")); - TCHAR *tszStatus = (TCHAR *)ack->lParam; + wchar_t *tszStatus = (wchar_t *)ack->lParam; if (tszStatus == NULL || *tszStatus == 0) return 0; - TCHAR stzText[1024]; + wchar_t stzText[1024]; if (pstzLast) mir_sntprintf(stzText, L"%s\n%s", pstzLast, tszStatus); else - _tcsncpy(stzText, tszStatus, _countof(stzText)); + wcsncpy(stzText, tszStatus, _countof(stzText)); SendMessage(pdp->hWnd, WM_SETREDRAW, FALSE, 0); PUChangeTextT(pdp->hWnd, stzText); SendMessage(pdp->hWnd, WM_SETREDRAW, TRUE, 0); diff --git a/plugins/NewXstatusNotify/src/popup.h b/plugins/NewXstatusNotify/src/popup.h index 5bcce77072..1ffc9b7875 100644 --- a/plugins/NewXstatusNotify/src/popup.h +++ b/plugins/NewXstatusNotify/src/popup.h @@ -35,7 +35,7 @@ #define PCA_OPENHISTORY 4 // open contact history #define PCA_DONOTHING 5 // do nothing -#define STRING_SHOWPREVIOUSSTATUS LPGENT("(was %s)") +#define STRING_SHOWPREVIOUSSTATUS LPGENW("(was %s)") typedef struct tagPLUGINDATA { @@ -47,18 +47,18 @@ typedef struct tagPLUGINDATA } PLUGINDATA; static struct { - TCHAR *Text; + wchar_t *Text; int Action; } PopupActions[] = { - LPGENT("Open message window"), PCA_OPENMESSAGEWND, - LPGENT("Close popup"), PCA_CLOSEPOPUP, - LPGENT("Open contact details window"), PCA_OPENDETAILS, - LPGENT("Open contact menu"), PCA_OPENMENU, - LPGENT("Open contact history"), PCA_OPENHISTORY, - LPGENT("Do nothing"), PCA_DONOTHING + LPGENW("Open message window"), PCA_OPENMESSAGEWND, + LPGENW("Close popup"), PCA_CLOSEPOPUP, + LPGENW("Open contact details window"), PCA_OPENDETAILS, + LPGENW("Open contact menu"), PCA_OPENMENU, + LPGENW("Open contact history"), PCA_OPENHISTORY, + LPGENW("Do nothing"), PCA_DONOTHING }; -void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const TCHAR *stzText, PLUGINDATA *pdp = NULL); +void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const wchar_t *stzText, PLUGINDATA *pdp = NULL); LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); #endif \ No newline at end of file diff --git a/plugins/NewXstatusNotify/src/stdafx.h b/plugins/NewXstatusNotify/src/stdafx.h index 5b6218084f..32feb569d4 100644 --- a/plugins/NewXstatusNotify/src/stdafx.h +++ b/plugins/NewXstatusNotify/src/stdafx.h @@ -109,21 +109,21 @@ typedef struct tagSTATUS { - TCHAR lpzMStatusText[MAX_STATUSTEXT]; - TCHAR lpzFStatusText[MAX_STATUSTEXT]; - TCHAR lpzUStatusText[MAX_STATUSTEXT]; - TCHAR lpzStandardText[MAX_STANDARDTEXT]; + wchar_t lpzMStatusText[MAX_STATUSTEXT]; + wchar_t lpzFStatusText[MAX_STATUSTEXT]; + wchar_t lpzUStatusText[MAX_STATUSTEXT]; + wchar_t lpzStandardText[MAX_STANDARDTEXT]; char lpzSkinSoundName[MAX_SKINSOUNDNAME]; - TCHAR lpzSkinSoundDesc[MAX_SKINSOUNDDESC]; - TCHAR lpzSkinSoundFile[MAX_PATH]; + wchar_t lpzSkinSoundDesc[MAX_SKINSOUNDDESC]; + wchar_t lpzSkinSoundFile[MAX_PATH]; COLORREF colorBack; COLORREF colorText; } STATUS; typedef struct { MCONTACT hContact; - TCHAR *oldstatusmsg; - TCHAR *newstatusmsg; + wchar_t *oldstatusmsg; + wchar_t *newstatusmsg; char *proto; int compare; } STATUSMSGINFO; @@ -150,8 +150,8 @@ extern HGENMENU hEnableDisableMenu; extern STATUS StatusList[STATUS_COUNT]; extern STATUS StatusListEx[STATUSEX_COUNT]; -TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt); -void LogSMsgToDB(STATUSMSGINFO *smi, const TCHAR *tmplt); -void BlinkIcon(MCONTACT hContact, HICON hIcon, TCHAR *stzText); +wchar_t* GetStr(STATUSMSGINFO *n, const wchar_t *tmplt); +void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt); +void BlinkIcon(MCONTACT hContact, HICON hIcon, wchar_t *stzText); void PlayChangeSound(MCONTACT hContact, const char *name); #endif //COMMON_H diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp index 3a72826c56..f06b12914c 100644 --- a/plugins/NewXstatusNotify/src/utils.cpp +++ b/plugins/NewXstatusNotify/src/utils.cpp @@ -41,20 +41,20 @@ bool CheckMsgWnd(MCONTACT hContact) return false; } -int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue) +int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, wchar_t *setting, int size, const wchar_t *defaultValue) { DBVARIANT dbv; if (!db_get_ts(hContact, szModule, szSetting, &dbv)) { - _tcsncpy(setting, dbv.ptszVal, size); + wcsncpy(setting, dbv.ptszVal, size); db_free(&dbv); return 0; } - _tcsncpy(setting, defaultValue, size); + wcsncpy(setting, defaultValue, size); return 1; } -void ShowLog(TCHAR *file) +void ShowLog(wchar_t *file) { INT_PTR res = (INT_PTR)ShellExecute(NULL, L"open", file, NULL, NULL, SW_SHOW); if (res <= 32) // error @@ -83,16 +83,16 @@ BOOL StatusHasAwayMessage(char *szProto, int status) } } -void LogToFile(TCHAR *stzText) +void LogToFile(wchar_t *stzText) { - FILE *fp = _tfopen(opt.LogFilePath, L"a+b, ccs=UTF-8"); + FILE *fp = _wfopen(opt.LogFilePath, L"a+b, ccs=UTF-8"); if (fp) { fprintf(fp, T2Utf(stzText)); fclose(fp); } } -void AddCR(CMString &str, const TCHAR *stzText) +void AddCR(CMString &str, const wchar_t *stzText) { if (stzText == NULL) return; diff --git a/plugins/NewXstatusNotify/src/utils.h b/plugins/NewXstatusNotify/src/utils.h index d7496edf30..bdc32806fb 100644 --- a/plugins/NewXstatusNotify/src/utils.h +++ b/plugins/NewXstatusNotify/src/utils.h @@ -23,10 +23,10 @@ #define UTILS_H bool CheckMsgWnd(MCONTACT hContact); -int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue); -void ShowLog(TCHAR *file); +int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSetting, wchar_t *setting, int size, const wchar_t *defaultValue); +void ShowLog(wchar_t *file); BOOL StatusHasAwayMessage(char *szProto, int status); -void LogToFile(TCHAR *stzText); -void AddCR(CMString &str, const TCHAR *statusmsg); +void LogToFile(wchar_t *stzText); +void AddCR(CMString &str, const wchar_t *statusmsg); #endif diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 13c6e07f8d..5640113053 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -19,7 +19,7 @@ #include "stdafx.h" -XSTATUSCHANGE *NewXSC(MCONTACT hContact, char *szProto, int xstatusType, int action, TCHAR *stzTitle, TCHAR *stzText) +XSTATUSCHANGE *NewXSC(MCONTACT hContact, char *szProto, int xstatusType, int action, wchar_t *stzTitle, wchar_t *stzText) { XSTATUSCHANGE *xsc = (XSTATUSCHANGE *)mir_alloc(sizeof(XSTATUSCHANGE)); xsc->hContact = hContact; @@ -76,7 +76,7 @@ void RemoveLoggedEventsSMsg(MCONTACT hContact) } } -TCHAR* GetStatusTypeAsString(int type, TCHAR *buff) +wchar_t* GetStatusTypeAsString(int type, wchar_t *buff) { switch (type) { case TYPE_JABBER_MOOD: @@ -90,32 +90,32 @@ TCHAR* GetStatusTypeAsString(int type, TCHAR *buff) } } -CMString ReplaceVars(XSTATUSCHANGE *xsc, const TCHAR *tmplt) +CMString ReplaceVars(XSTATUSCHANGE *xsc, const wchar_t *tmplt) { - if (xsc == NULL || tmplt == NULL || tmplt[0] == _T('\0')) + if (xsc == NULL || tmplt == NULL || tmplt[0] == '\0') return CMString(); size_t len = mir_tstrlen(tmplt); CMString res; for (size_t i = 0; i < len; i++) { - if (tmplt[i] == _T('%')) { + if (tmplt[i] == '%') { i++; switch (tmplt[i]) { case 'n': - TCHAR stzType[32]; + wchar_t stzType[32]; res.Append(GetStatusTypeAsString(xsc->type, stzType)); break; case 't': - if (xsc->stzTitle == NULL || xsc->stzTitle[0] == _T('\0')) + if (xsc->stzTitle == NULL || xsc->stzTitle[0] == '\0') res.Append(TranslateT("")); else res.Append(xsc->stzTitle); break; case 'm': - if (xsc->stzText == NULL || xsc->stzText[0] == _T('\0')) + if (xsc->stzText == NULL || xsc->stzText[0] == '\0') res.Append(TranslateT("")); else AddCR(res, xsc->stzText); @@ -134,7 +134,7 @@ CMString ReplaceVars(XSTATUSCHANGE *xsc, const TCHAR *tmplt) break; } } - else if (tmplt[i] == _T('\\')) { + else if (tmplt[i] == '\\') { i++; switch (tmplt[i]) { case 'n': @@ -188,17 +188,17 @@ void ShowXStatusPopup(XSTATUSCHANGE *xsc) hIcon = Skin_LoadProtoIcon(xsc->szProto, db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_ONLINE)); // cut message if needed - TCHAR *copyText = NULL; + wchar_t *copyText = NULL; if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (mir_tstrlen(xsc->stzText) > opt.PXMsgLen)) { - TCHAR buff[MAX_TEXT_LEN + 3]; + wchar_t buff[MAX_TEXT_LEN + 3]; copyText = mir_tstrdup(xsc->stzText); - _tcsncpy(buff, xsc->stzText, opt.PXMsgLen); + wcsncpy(buff, xsc->stzText, opt.PXMsgLen); buff[opt.PXMsgLen] = 0; mir_tstrcat(buff, L"..."); replaceStrT(xsc->stzText, buff); } - TCHAR *Template = L""; + wchar_t *Template = L""; switch (xsc->action) { case NOTIFY_NEW_XSTATUS: Template = templates.PopupXstatusChanged; break; @@ -224,8 +224,8 @@ void BlinkXStatusIcon(XSTATUSCHANGE *xsc) return; HICON hIcon = NULL; - TCHAR str[256] = { 0 }; - TCHAR stzType[32]; + wchar_t str[256] = { 0 }; + wchar_t stzType[32]; mir_sntprintf(str, TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType)); if (opt.BlinkIcon_Status) { @@ -273,7 +273,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) if (xsc == NULL || (opt.XLogToDB_WinOpen && !CheckMsgWnd(xsc->hContact))) return; - TCHAR *Template = L""; + wchar_t *Template = L""; switch (xsc->action) { case NOTIFY_NEW_XSTATUS: Template = templates.LogXstatusChanged; break; @@ -287,7 +287,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) Template = templates.LogXstatusOpening; break; } - TCHAR stzLastLog[2 * MAX_TEXT_LEN]; + wchar_t stzLastLog[2 * MAX_TEXT_LEN]; CMString stzLogText(ReplaceVars(xsc, Template)); DBGetStringDefault(xsc->hContact, MODULE, DB_LASTLOG, stzLastLog, _countof(stzLastLog), L""); @@ -320,12 +320,12 @@ void LogChangeToFile(XSTATUSCHANGE *xsc) if (xsc == NULL) return; - TCHAR stzDate[32], stzTime[32], stzText[MAX_TEXT_LEN]; + wchar_t stzDate[32], stzTime[32], stzText[MAX_TEXT_LEN]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, L"HH':'mm", stzTime, _countof(stzTime)); GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, L"dd/MM/yyyy", stzDate, _countof(stzDate)); - TCHAR *Template = L""; + wchar_t *Template = L""; switch (xsc->action) { case NOTIFY_NEW_XSTATUS: Template = templates.LogXstatusChanged; break; @@ -409,9 +409,9 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc) FreeXSC(xsc); } -TCHAR* GetDefaultXstatusName(int statusID, char *szProto, TCHAR *buff, int bufflen) +wchar_t* GetDefaultXstatusName(int statusID, char *szProto, wchar_t *buff, int bufflen) { - TCHAR nameBuff[64]; + wchar_t nameBuff[64]; buff[0] = 0; CUSTOM_STATUS xstatus = { 0 }; @@ -420,12 +420,12 @@ TCHAR* GetDefaultXstatusName(int statusID, char *szProto, TCHAR *buff, int buffl xstatus.ptszName = nameBuff; xstatus.wParam = (WPARAM*)&statusID; if (!CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus)) - _tcsncpy_s(buff, bufflen, TranslateTS(nameBuff), _TRUNCATE); + wcsncpy_s(buff, bufflen, TranslateTS(nameBuff), _TRUNCATE); return buff; } -TCHAR* GetIcqXStatus(MCONTACT hContact, char *szProto, char *szValue, TCHAR *buff, int bufflen) +wchar_t* GetIcqXStatus(MCONTACT hContact, char *szProto, char *szValue, wchar_t *buff, int bufflen) { DBVARIANT dbv; buff[0] = 0; @@ -436,7 +436,7 @@ TCHAR* GetIcqXStatus(MCONTACT hContact, char *szProto, char *szValue, TCHAR *buf if ((mir_strcmp(szValue, "XStatusName") == 0) && dbv.ptszVal[0] == 0) GetDefaultXstatusName(statusID, szProto, buff, bufflen); else - _tcsncpy(buff, dbv.ptszVal, bufflen); + wcsncpy(buff, dbv.ptszVal, bufflen); buff[bufflen - 1] = 0; db_free(&dbv); @@ -446,7 +446,7 @@ TCHAR* GetIcqXStatus(MCONTACT hContact, char *szProto, char *szValue, TCHAR *buf return buff; } -TCHAR* GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, char *szValue, TCHAR *buff, int bufflen) +wchar_t* GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, char *szValue, wchar_t *buff, int bufflen) { DBVARIANT dbv; char szSetting[128]; @@ -454,7 +454,7 @@ TCHAR* GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, ch mir_snprintf(szSetting, "%s/%s/%s", szProto, szSlot, szValue); if (!db_get_ts(hContact, "AdvStatus", szSetting, &dbv)) { - _tcsncpy(buff, dbv.ptszVal, bufflen); + wcsncpy(buff, dbv.ptszVal, bufflen); buff[bufflen - 1] = 0; db_free(&dbv); } @@ -462,7 +462,7 @@ TCHAR* GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, ch return buff; } -void LogXstatusChange(MCONTACT hContact, char *szProto, int xstatusType, TCHAR *stzTitle, TCHAR *stzText) +void LogXstatusChange(MCONTACT hContact, char *szProto, int xstatusType, wchar_t *stzTitle, wchar_t *stzText) { XSTATUSCHANGE *xsc = NewXSC(hContact, szProto, xstatusType, NOTIFY_OPENING_ML, stzTitle[0] ? mir_tstrdup(stzTitle) : NULL, stzText[0] ? mir_tstrdup(stzText) : NULL); @@ -478,7 +478,7 @@ void AddXStatusEventThread(void *arg) if (szProto == NULL) return; - TCHAR stzTitle[MAX_TITLE_LEN], stzText[MAX_TEXT_LEN]; + wchar_t stzTitle[MAX_TITLE_LEN], stzText[MAX_TEXT_LEN]; if (ProtoServiceExists(szProto, JS_PARSE_XMPP_URI)) { GetJabberAdvStatusText(hContact, szProto, "mood", "title", stzTitle, _countof(stzTitle)); if (stzTitle[0]) { diff --git a/plugins/NewXstatusNotify/src/xstatus.h b/plugins/NewXstatusNotify/src/xstatus.h index 1c82461245..403400caba 100644 --- a/plugins/NewXstatusNotify/src/xstatus.h +++ b/plugins/NewXstatusNotify/src/xstatus.h @@ -88,8 +88,8 @@ typedef struct tagXSTATUSCHANGE char *szProto; int type; int action; - TCHAR *stzTitle; - TCHAR *stzText; + wchar_t *stzTitle; + wchar_t *stzText; } XSTATUSCHANGE; typedef struct tagDBEVENT @@ -101,12 +101,12 @@ typedef struct tagDBEVENT typedef struct tagPROTOTEMPLATE { char *ProtoName; - TCHAR ProtoTemplateMsg[MAX_PATH]; - TCHAR ProtoTemplateRemoved[MAX_PATH]; + wchar_t ProtoTemplateMsg[MAX_PATH]; + wchar_t ProtoTemplateRemoved[MAX_PATH]; } PROTOTEMPLATE; -TCHAR *GetDefaultXstatusName(int statusID, char *szProto, TCHAR *buff, int bufflen); -XSTATUSCHANGE *NewXSC(MCONTACT hContact, char *szProto, int xstatusType, int action, TCHAR *stzTitle, TCHAR *stzText); +wchar_t *GetDefaultXstatusName(int statusID, char *szProto, wchar_t *buff, int bufflen); +XSTATUSCHANGE *NewXSC(MCONTACT hContact, char *szProto, int xstatusType, int action, wchar_t *stzTitle, wchar_t *stzText); void ExtraStatusChanged(XSTATUSCHANGE *xsc); void FreeXSC(XSTATUSCHANGE *xsc); int OnWindowEvent(WPARAM wParam, LPARAM lParam); -- cgit v1.2.3