summaryrefslogtreecommitdiff
path: root/plugins/SimpleStatusMsg/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
commit6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch)
tree2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/SimpleStatusMsg/src
parenta61c8728b379057fe7f0a0d86fe0b037598229dd (diff)
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
Diffstat (limited to 'plugins/SimpleStatusMsg/src')
-rw-r--r--plugins/SimpleStatusMsg/src/awaymsg.cpp44
-rw-r--r--plugins/SimpleStatusMsg/src/main.cpp170
-rw-r--r--plugins/SimpleStatusMsg/src/msgbox.cpp66
-rw-r--r--plugins/SimpleStatusMsg/src/options.cpp32
-rw-r--r--plugins/SimpleStatusMsg/src/simplestatusmsg.h4
-rw-r--r--plugins/SimpleStatusMsg/src/utils.cpp2
6 files changed, 159 insertions, 159 deletions
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp
index c8b0f37e56..dc3896efa3 100644
--- a/plugins/SimpleStatusMsg/src/awaymsg.cpp
+++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp
@@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
static HGENMENU hAwayMsgMenuItem, hCopyMsgMenuItem, hGoToURLMenuItem;
static MWindowList hWindowList, hWindowList2;
-static TCHAR *StrNormNewline(TCHAR *tszStr)
+static wchar_t *StrNormNewline(wchar_t *tszStr)
{
if (tszStr == NULL)
return NULL;
@@ -43,7 +43,7 @@ static TCHAR *StrNormNewline(TCHAR *tszStr)
if (!nCR)
return mir_tstrdup(tszStr);
- TCHAR *tszNewStr = (TCHAR *)mir_alloc((mir_tstrlen(tszStr) + nCR + 1) * sizeof(TCHAR)), *ptszStr = tszNewStr;
+ wchar_t *tszNewStr = (wchar_t *)mir_alloc((mir_tstrlen(tszStr) + nCR + 1) * sizeof(wchar_t)), *ptszStr = tszNewStr;
while (*tszStr) {
if (*tszStr == 0x0A)
*ptszStr++ = 0x0D;
@@ -79,11 +79,11 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL;
WindowList_Add(hWindowList, hwndDlg, dat->hContact);
{
- TCHAR str[256], format[128];
- TCHAR *contactName = (TCHAR *)pcli->pfnGetContactDisplayName(dat->hContact, 0);
+ wchar_t str[256], format[128];
+ wchar_t *contactName = (wchar_t *)pcli->pfnGetContactDisplayName(dat->hContact, 0);
char *szProto = GetContactProto(dat->hContact);
WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE);
- TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
+ wchar_t *status = pcli->pfnGetStatusModeDescription(dwStatus, 0);
GetWindowText(hwndDlg, format, _countof(format));
mir_sntprintf(str, format, status, contactName);
@@ -115,7 +115,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
dat->hAwayMsgEvent = NULL;
}
- TCHAR *tszMsg = StrNormNewline((TCHAR *)ack->lParam);
+ wchar_t *tszMsg = StrNormNewline((wchar_t *)ack->lParam);
SetDlgItemText(hwndDlg, IDC_MSG, tszMsg);
mir_free(tszMsg);
@@ -138,18 +138,18 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
if (!OpenClipboard(hwndDlg))
break;
if (EmptyClipboard()) {
- TCHAR msg[1024];
+ wchar_t msg[1024];
int len = GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg));
if (len) {
LPTSTR lptstrCopy;
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
if (hglbCopy == NULL) {
CloseClipboard();
break;
}
lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
- memcpy(lptstrCopy, msg, len * sizeof(TCHAR));
- lptstrCopy[len] = (TCHAR)0;
+ memcpy(lptstrCopy, msg, len * sizeof(wchar_t));
+ lptstrCopy[len] = (wchar_t)0;
GlobalUnlock(hglbCopy);
SetClipboardData(CF_UNICODETEXT, hglbCopy);
@@ -202,8 +202,8 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
dat->hSeq = (HANDLE)ProtoChainSend(dat->hContact, PSS_GETAWAYMSG, 0, 0);
dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL;
WindowList_Add(hWindowList2, hwndDlg, dat->hContact);
- TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
- TCHAR str[256], format[128];
+ wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+ wchar_t str[256], format[128];
GetWindowText(hwndDlg, format, _countof(format));
mir_sntprintf(str, format, contactName);
SetWindowText(hwndDlg, str);
@@ -233,22 +233,22 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
break;
}
if (EmptyClipboard()) {
- TCHAR msg[1024];
- TCHAR *tszMsg = StrNormNewline((TCHAR *)ack->lParam);
- _tcsncpy_s(msg, tszMsg, _TRUNCATE);
+ wchar_t msg[1024];
+ wchar_t *tszMsg = StrNormNewline((wchar_t *)ack->lParam);
+ wcsncpy_s(msg, tszMsg, _TRUNCATE);
mir_free(tszMsg);
size_t len = mir_tstrlen(msg);
if (len) {
LPTSTR lptstrCopy;
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
if (hglbCopy == NULL) {
CloseClipboard();
DestroyWindow(hwndDlg);
break;
}
lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
- memcpy(lptstrCopy, msg, len * sizeof(TCHAR));
- lptstrCopy[len] = (TCHAR)0;
+ memcpy(lptstrCopy, msg, len * sizeof(wchar_t));
+ lptstrCopy[len] = (wchar_t)0;
GlobalUnlock(hglbCopy);
SetClipboardData(CF_UNICODETEXT, hglbCopy);
@@ -339,7 +339,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
if (szProto == NULL || db_get_b(hContact, szProto, "ChatRoom", 0))
return 0;
- TCHAR str[128];
+ wchar_t str[128];
int iStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus)) {
@@ -388,7 +388,7 @@ int LoadAwayMsgModule(void)
SET_UID(mi, 0xd3282acc, 0x9ff1, 0x4ede, 0x8a, 0x1e, 0x36, 0x72, 0x3f, 0x44, 0x4f, 0x84);
CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand);
mi.position = -2000005000;
- mi.name.t = LPGENT("Re&ad Away message");
+ mi.name.w = LPGENW("Re&ad Away message");
mi.pszService = MS_AWAYMSG_SHOWAWAYMSG;
hAwayMsgMenuItem = Menu_AddContactMenuItem(&mi);
@@ -396,7 +396,7 @@ int LoadAwayMsgModule(void)
CreateServiceFunction(MS_SIMPLESTATUSMSG_COPYMSG, CopyAwayMsgCommand);
mi.position = -2000006000;
mi.hIcolibItem = GetIconHandle(IDI_COPY);
- mi.name.t = LPGENT("Copy Away message");
+ mi.name.w = LPGENW("Copy Away message");
mi.pszService = MS_SIMPLESTATUSMSG_COPYMSG;
hCopyMsgMenuItem = Menu_AddContactMenuItem(&mi);
@@ -404,7 +404,7 @@ int LoadAwayMsgModule(void)
CreateServiceFunction(MS_SIMPLESTATUSMSG_GOTOURLMSG, GoToURLMsgCommand);
mi.position = -2000007000;
mi.hIcolibItem = GetIconHandle(IDI_GOTOURL);
- mi.name.t = LPGENT("&Go to URL in Away message");
+ mi.name.w = LPGENW("&Go to URL in Away message");
mi.pszService = MS_SIMPLESTATUSMSG_GOTOURLMSG;
hGoToURLMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp
index 5bcc8ea109..942eaa19a5 100644
--- a/plugins/SimpleStatusMsg/src/main.cpp
+++ b/plugins/SimpleStatusMsg/src/main.cpp
@@ -28,7 +28,7 @@ PROTOACCOUNTS *accounts;
static int g_iIdleTime = -1;
UINT_PTR g_uUpdateMsgTimer = 0, *g_uSetStatusTimer;
-static TCHAR *g_ptszWinampSong;
+static wchar_t *g_ptszWinampSong;
HANDLE hTTBButton = 0, h_statusmodechange;
HWND hwndSAMsgDialog;
static HANDLE *hProtoStatusMenuItem;
@@ -90,9 +90,9 @@ void log2file(const char *fmt, ...)
}
#endif
-static TCHAR *GetWinampSong(void)
+static wchar_t *GetWinampSong(void)
{
- TCHAR *szTitle, *pstr, *res = NULL;
+ wchar_t *szTitle, *pstr, *res = NULL;
HWND hwndWinamp = FindWindow(L"STUDIO", NULL);
int iTitleLen;
@@ -103,7 +103,7 @@ static TCHAR *GetWinampSong(void)
return NULL;
iTitleLen = GetWindowTextLength(hwndWinamp);
- szTitle = (TCHAR *)mir_alloc((iTitleLen + 1) * sizeof(TCHAR));
+ szTitle = (wchar_t *)mir_alloc((iTitleLen + 1) * sizeof(wchar_t));
if (szTitle == NULL)
return NULL;
@@ -113,7 +113,7 @@ static TCHAR *GetWinampSong(void)
return NULL;
}
- pstr = _tcsstr(szTitle, L" - Winamp");
+ pstr = wcsstr(szTitle, L" - Winamp");
if (pstr == NULL)
{
mir_free(szTitle);
@@ -122,8 +122,8 @@ static TCHAR *GetWinampSong(void)
if (pstr < szTitle + (iTitleLen / 2))
{
- memmove(szTitle, pstr + 9, mir_tstrlen(pstr + 9) * sizeof(TCHAR));
- pstr = _tcsstr(pstr + 1, L" - Winamp");
+ memmove(szTitle, pstr + 9, mir_tstrlen(pstr + 9) * sizeof(wchar_t));
+ pstr = wcsstr(pstr + 1, L" - Winamp");
if (pstr == NULL)
{
mir_free(szTitle);
@@ -132,7 +132,7 @@ static TCHAR *GetWinampSong(void)
}
*pstr = 0;
- pstr = _tcschr(szTitle, _T('.'));
+ pstr = wcschr(szTitle, '.');
if (pstr == NULL)
{
mir_free(szTitle);
@@ -146,16 +146,16 @@ static TCHAR *GetWinampSong(void)
return res;
}
-TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
+wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int)
{
int i, count = 0, len;
- TCHAR substituteStr[1024], *msg = mir_tstrdup(in);
+ wchar_t substituteStr[1024], *msg = mir_tstrdup(in);
for (i = 0; msg[i]; i++)
{
if (msg[i] == 0x0D && db_get_b(NULL, "SimpleStatusMsg", "RemoveCR", 0))
{
- TCHAR *p = msg + i;
+ wchar_t *p = msg + i;
if (i + 1 <= 1024 && msg[i + 1])
{
if (msg[i + 1] == 0x0A)
@@ -163,7 +163,7 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
if (i + 2 <= 1024 && msg[i + 2])
{
count++;
- memmove(p, p + 1, (mir_tstrlen(p) - 1) * sizeof(TCHAR));
+ memmove(p, p + 1, (mir_tstrlen(p) - 1) * sizeof(wchar_t));
}
else
{
@@ -177,9 +177,9 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
if (msg[i] != '%')
continue;
- if (!_tcsnicmp(msg+i, L"%winampsong%", 12))
+ if (!wcsnicmp(msg+i, L"%winampsong%", 12))
{
- TCHAR *ptszWinampTitle = GetWinampSong();
+ wchar_t *ptszWinampTitle = GetWinampSong();
if (ptszWinampTitle != NULL)
{
@@ -195,14 +195,14 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
continue;
if (mir_tstrlen(ptszWinampTitle) > 12)
- msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(ptszWinampTitle) - 12) * sizeof(TCHAR));
+ msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(ptszWinampTitle) - 12) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(ptszWinampTitle), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(TCHAR));
- memcpy(msg + i, ptszWinampTitle, mir_tstrlen(ptszWinampTitle) * sizeof(TCHAR));
+ memmove(msg + i + mir_tstrlen(ptszWinampTitle), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(wchar_t));
+ memcpy(msg + i, ptszWinampTitle, mir_tstrlen(ptszWinampTitle) * sizeof(wchar_t));
mir_free(ptszWinampTitle);
}
- else if (!_tcsnicmp(msg + i, L"%time%", 6))
+ else if (!wcsnicmp(msg + i, L"%time%", 6))
{
MIRANDA_IDLE_INFO mii = {0};
mii.cbSize = sizeof(mii);
@@ -230,31 +230,31 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, _countof(substituteStr));
if (mir_tstrlen(substituteStr) > 6)
- msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
+ msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(TCHAR));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
+ memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
}
- else if (!_tcsnicmp(msg + i, L"%date%", 6))
+ else if (!wcsnicmp(msg + i, L"%date%", 6))
{
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr));
if (mir_tstrlen(substituteStr) > 6)
- msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
+ msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(TCHAR));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
+ memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
}
- else if (!_tcsnicmp(msg+i, L"%rand(", 6))
+ else if (!wcsnicmp(msg+i, L"%rand(", 6))
{
- TCHAR *temp, *token;
+ wchar_t *temp, *token;
int ran_from, ran_to, k;
temp = mir_tstrdup(msg + i + 6);
- token = _tcstok(temp, L",)");
- ran_from = _ttoi(token);
- token = _tcstok(NULL, L",)%%");
- ran_to = _ttoi(token);
+ token = wcstok(temp, L",)");
+ ran_from = _wtoi(token);
+ token = wcstok(NULL, L",)%%");
+ ran_to = _wtoi(token);
if (ran_to > ran_from)
{
@@ -262,14 +262,14 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
for (k = i + 1; msg[k]; k++) if (msg[k] == '%') { k++; break; }
if (mir_tstrlen(substituteStr) > k - i)
- msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - (k - i)) * sizeof(TCHAR));
+ msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - (k - i)) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + (k - i), (mir_tstrlen(msg) - i - (k - i - 1)) * sizeof(TCHAR));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
+ memmove(msg + i + mir_tstrlen(substituteStr), msg + i + (k - i), (mir_tstrlen(msg) - i - (k - i - 1)) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
}
mir_free(temp);
}
- else if (!_tcsnicmp(msg+i, L"%randmsg%", 9))
+ else if (!wcsnicmp(msg+i, L"%randmsg%", 9))
{
char buff[16];
int k, k2 = 0;
@@ -289,7 +289,7 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
mir_snprintf(buff, "SMsg%d", k);
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
if (tszStatusMsg == NULL)
continue;
@@ -299,7 +299,7 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
if (!mir_tstrlen(substituteStr))
continue;
- if (_tcsstr(substituteStr, L"%randmsg%") != NULL || _tcsstr(substituteStr, L"%randdefmsg%") != NULL)
+ if (wcsstr(substituteStr, L"%randmsg%") != NULL || wcsstr(substituteStr, L"%randdefmsg%") != NULL)
{
if (k == maxk) maxk--;
}
@@ -309,12 +309,12 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, L"");
if (mir_tstrlen(substituteStr) > 9)
- msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 9) * sizeof(TCHAR));
+ msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 9) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 9, (mir_tstrlen(msg) - i - 8) * sizeof(TCHAR));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
+ memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 9, (mir_tstrlen(msg) - i - 8) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
}
- else if (!_tcsnicmp(msg+i, L"%randdefmsg%", 12))
+ else if (!wcsnicmp(msg+i, L"%randdefmsg%", 12))
{
char buff[16];
int k, k2 = 0;
@@ -334,7 +334,7 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
mir_snprintf(buff, "DefMsg%d", k);
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
if (tszStatusMsg == NULL)
continue;
@@ -344,7 +344,7 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
if (!mir_tstrlen(substituteStr))
continue;
- if (_tcsstr(substituteStr, L"%randmsg%") != NULL || _tcsstr(substituteStr, L"%randdefmsg%") != NULL)
+ if (wcsstr(substituteStr, L"%randmsg%") != NULL || wcsstr(substituteStr, L"%randdefmsg%") != NULL)
{
if (k == maxk) maxk--;
}
@@ -354,10 +354,10 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, L"");
if (mir_tstrlen(substituteStr) > 12)
- msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg)+1+mir_tstrlen(substituteStr)-12) * sizeof(TCHAR));
+ msg = (wchar_t *)mir_realloc(msg, (mir_tstrlen(msg)+1+mir_tstrlen(substituteStr)-12) * sizeof(wchar_t));
- memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(TCHAR));
- memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
+ memmove(msg + i + mir_tstrlen(substituteStr), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(wchar_t));
+ memcpy(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(wchar_t));
}
}
@@ -370,7 +370,7 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
len = db_get_w(NULL, "SimpleStatusMsg", szSetting, 1024);
if (len < mir_tstrlen(msg))
{
- msg = (TCHAR *)mir_realloc(msg, len * sizeof(TCHAR));
+ msg = (wchar_t *)mir_realloc(msg, len * sizeof(wchar_t));
msg[len] = 0;
}
}
@@ -378,14 +378,14 @@ TCHAR* InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int)
return msg;
}
-TCHAR *InsertVarsIntoMsg(TCHAR *tszMsg, const char *szProto, int iStatus, MCONTACT hContact)
+wchar_t *InsertVarsIntoMsg(wchar_t *tszMsg, const char *szProto, int iStatus, MCONTACT hContact)
{
if (ServiceExists(MS_VARS_FORMATSTRING) && db_get_b(NULL, "SimpleStatusMsg", "EnableVariables", 1))
{
- TCHAR *tszVarsMsg = variables_parse(tszMsg, NULL, hContact);
+ wchar_t *tszVarsMsg = variables_parse(tszMsg, NULL, hContact);
if (tszVarsMsg != NULL)
{
- TCHAR *format = InsertBuiltinVarsIntoMsg(tszVarsMsg, szProto, iStatus);
+ wchar_t *format = InsertBuiltinVarsIntoMsg(tszVarsMsg, szProto, iStatus);
mir_free(tszVarsMsg);
return format;
}
@@ -394,10 +394,10 @@ TCHAR *InsertVarsIntoMsg(TCHAR *tszMsg, const char *szProto, int iStatus, MCONTA
return InsertBuiltinVarsIntoMsg(tszMsg, szProto, iStatus);
}
-static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto)
+static wchar_t *GetAwayMessageFormat(int iStatus, const char *szProto)
{
char szSetting[80];
- TCHAR *format;
+ wchar_t *format;
mir_snprintf(szSetting, "%sFlags", szProto ? szProto : "");
int flags = db_get_b(NULL, "SimpleStatusMsg", StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
@@ -446,7 +446,7 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto)
return format;
}
-void DBWriteMessage(char *szSetting, TCHAR *tszMsg)
+void DBWriteMessage(char *szSetting, wchar_t *tszMsg)
{
if (tszMsg && mir_tstrlen(tszMsg))
db_set_ts(NULL, "SimpleStatusMsg", szSetting, tszMsg);
@@ -454,7 +454,7 @@ void DBWriteMessage(char *szSetting, TCHAR *tszMsg)
db_unset(NULL, "SimpleStatusMsg", szSetting);
}
-void SaveMessageToDB(const char *szProto, TCHAR *tszMsg, BOOL bIsFormat)
+void SaveMessageToDB(const char *szProto, wchar_t *tszMsg, BOOL bIsFormat)
{
char szSetting[80];
@@ -504,9 +504,9 @@ void SaveStatusAsCurrent(const char *szProto, int iStatus)
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)iStatus);
}
-static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, MCONTACT hContact)
+static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, MCONTACT hContact)
{
- TCHAR *format;
+ wchar_t *format;
char szSetting[80];
if ((!iStatus || iStatus == ID_STATUS_CURRENT) && szProto)
@@ -553,7 +553,7 @@ static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars,
if (bInsertVars && format != NULL)
{
- TCHAR *tszVarsMsg = InsertVarsIntoMsg(format, szProto, iStatus, hContact); // TODO random values not the same!
+ wchar_t *tszVarsMsg = InsertVarsIntoMsg(format, szProto, iStatus, hContact); // TODO random values not the same!
mir_free(format);
return tszVarsMsg;
}
@@ -583,13 +583,13 @@ int CheckProtoSettings(const char *szProto, int iInitialStatus)
return iInitialStatus;
}
-static void Proto_SetAwayMsgT(const char *szProto, int iStatus, TCHAR *tszMsg)
+static void Proto_SetAwayMsgT(const char *szProto, int iStatus, wchar_t *tszMsg)
{
if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_INDIVMODEMSG))
CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iStatus, (LPARAM)tszMsg);
}
-static void Proto_SetStatus(const char *szProto, int iInitialStatus, int iStatus, TCHAR *tszMsg)
+static void Proto_SetStatus(const char *szProto, int iInitialStatus, int iStatus, wchar_t *tszMsg)
{
if (iStatus == ID_STATUS_OFFLINE && iStatus != iInitialStatus)
{
@@ -627,11 +627,11 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus
else if (flags & PROTO_THIS_MSG)
{
mir_snprintf(szSetting, "Proto%sDefault", szProto);
- TCHAR *szSimpleStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *szSimpleStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (szSimpleStatusMsg != NULL)
{
SaveMessageToDB(szProto, szSimpleStatusMsg, TRUE);
- TCHAR *msg = InsertVarsIntoMsg(szSimpleStatusMsg, szProto, iStatus, NULL);
+ wchar_t *msg = InsertVarsIntoMsg(szSimpleStatusMsg, szProto, iStatus, NULL);
mir_free(szSimpleStatusMsg);
Proto_SetStatus(szProto, iInitialStatus, iStatus, msg);
SaveMessageToDB(szProto, msg, FALSE);
@@ -679,15 +679,15 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam)
if ((Proto_Status2Flag(newStatus) & status_modes_msg) || (newStatus == ID_STATUS_OFFLINE && (Proto_Status2Flag(ID_STATUS_INVISIBLE) & status_modes_msg)))
{
- TCHAR *msg = NULL;
+ wchar_t *msg = NULL;
if (HasProtoStaticStatusMsg(accounts->pa[i]->szModuleName, GetCurrentStatus(accounts->pa[i]->szModuleName), newStatus))
continue;
if (lParam)
- msg = InsertVarsIntoMsg((TCHAR *)lParam, accounts->pa[i]->szModuleName, newStatus, NULL);
+ msg = InsertVarsIntoMsg((wchar_t *)lParam, accounts->pa[i]->szModuleName, newStatus, NULL);
- SaveMessageToDB(accounts->pa[i]->szModuleName, (TCHAR *)lParam, TRUE);
+ SaveMessageToDB(accounts->pa[i]->szModuleName, (wchar_t *)lParam, TRUE);
SaveMessageToDB(accounts->pa[i]->szModuleName, msg, FALSE);
Proto_SetStatus(accounts->pa[i]->szModuleName, GetCurrentStatus(accounts->pa[i]->szModuleName), newStatus, msg /*? msg : L""*/);
mir_free(msg);
@@ -701,9 +701,9 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam)
int ChangeStatusMessage(WPARAM wParam, LPARAM lParam);
-void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, TCHAR *message, BOOL bOnStartup)
+void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, wchar_t *message, BOOL bOnStartup)
{
- TCHAR *msg = NULL;
+ wchar_t *msg = NULL;
#ifdef _DEBUG
log2file("SetStatusMessage(\"%s\", %d, %d, \"%S\", %d)", szProto, iInitialStatus, iStatus, message, bOnStartup);
#endif
@@ -1012,7 +1012,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam)
}
else if (iProtoFlags & PROTO_NOCHANGE && !bOnStartup) {
mir_snprintf(szSetting, "FCur%sMsg", szProto);
- TCHAR *msg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *msg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
#ifdef _DEBUG
log2file("ChangeStatusMessage(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), msg, szProto);
@@ -1023,7 +1023,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam)
}
if (!bShowDlg || bScreenSaverRunning) {
- TCHAR *msg = GetAwayMessageFormat(iStatus, szProto);
+ wchar_t *msg = GetAwayMessageFormat(iStatus, szProto);
#ifdef _DEBUG
log2file("ChangeStatusMessage(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), msg, szProto);
#endif
@@ -1073,7 +1073,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam)
!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- TCHAR *msg;
+ wchar_t *msg;
if (iProtoFlags & PROTO_NOCHANGE) {
mir_snprintf(szSetting, "FCur%sMsg", accounts->pa[i]->szModuleName);
msg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
@@ -1134,7 +1134,7 @@ static int ProcessProtoAck(WPARAM , LPARAM lParam)
int SetStartupStatus(int i)
{
char szSetting[80];
- TCHAR *fmsg, *msg = NULL;
+ wchar_t *fmsg, *msg = NULL;
int iStatus = GetStartupStatus(accounts->pa[i]->szModuleName);
if (iStatus == ID_STATUS_OFFLINE)
@@ -1277,7 +1277,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD)
if (!hwndSAMsgDialog)
{
char szBuffer[64];
- TCHAR *tszMsg;
+ wchar_t *tszMsg;
int iCurrentStatus;
for (int i = 0; i < accounts->count; ++i)
@@ -1296,7 +1296,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD)
continue;
mir_snprintf(szBuffer, "FCur%sMsg", accounts->pa[i]->szModuleName);
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szBuffer);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szBuffer);
if (tszStatusMsg == NULL)
continue;
@@ -1348,8 +1348,8 @@ void RegisterHotkey(void)
hkd.cbSize = sizeof(hkd);
hkd.dwFlags = HKD_TCHAR;
hkd.pszName = "SimpleStatusMsg_OpenDialog";
- hkd.ptszDescription = LPGENT("Open status message dialog");
- hkd.ptszSection = LPGENT("Status message");
+ hkd.ptszDescription = LPGENW("Open status message dialog");
+ hkd.ptszSection = LPGENW("Status message");
hkd.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_OEM_3);
Hotkey_Register(&hkd);
@@ -1389,7 +1389,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM)
mi.flags |= CMIF_HIDDEN;
mi.hIcolibItem = GetIconHandle(IDI_CSMSG);
mi.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
- mi.name.t = LPGENT("Status message...");
+ mi.name.w = LPGENW("Status message...");
mi.position = 2000200000;
Menu_AddStatusMenuItem(&mi);
@@ -1418,7 +1418,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM)
if (Proto_IsAccountLocked(pa[i]))
{
- TCHAR szBuffer[256];
+ wchar_t szBuffer[256];
mir_sntprintf(szBuffer, TranslateT("%s (locked)"), pa[i]->tszAccountName);
mi.root = Menu_CreateRoot(MO_STATUS, szBuffer, mi.position);
}
@@ -1477,8 +1477,8 @@ static int OnIdleChanged(WPARAM, LPARAM lParam)
{
if (!(lParam & IDF_ISIDLE))
iStatus = ID_STATUS_ONLINE;
- TCHAR *tszMsg = GetAwayMessage(iStatus, accounts->pa[i]->szModuleName, FALSE, NULL);
- TCHAR *tszVarsMsg = InsertVarsIntoMsg(tszMsg, accounts->pa[i]->szModuleName, iStatus, NULL);
+ wchar_t *tszMsg = GetAwayMessage(iStatus, accounts->pa[i]->szModuleName, FALSE, NULL);
+ wchar_t *tszVarsMsg = InsertVarsIntoMsg(tszMsg, accounts->pa[i]->szModuleName, iStatus, NULL);
SaveMessageToDB(accounts->pa[i]->szModuleName, tszMsg, TRUE);
SaveMessageToDB(accounts->pa[i]->szModuleName, tszVarsMsg, FALSE);
mir_free(tszMsg);
@@ -1494,7 +1494,7 @@ static int CSStatusChange(WPARAM wParam, LPARAM)
PROTOCOLSETTINGEX **ps = *(PROTOCOLSETTINGEX***)wParam;
int status_mode, CSProtoCount;
char szSetting[80];
- TCHAR *msg = NULL;
+ wchar_t *msg = NULL;
if (ps == NULL) return -1;
@@ -1530,7 +1530,7 @@ static int CSStatusChange(WPARAM wParam, LPARAM)
for (int j = 1; j <= max_hist_msgs; j++)
{
mir_snprintf(buff, "SMsg%d", j);
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
if (tszStatusMsg != NULL)
{
if (!mir_tstrcmp(tszStatusMsg, szMsgW))
@@ -1568,13 +1568,13 @@ static int CSStatusChange(WPARAM wParam, LPARAM)
return 0;
}
-static TCHAR *ParseWinampSong(ARGUMENTSINFO *ai)
+static wchar_t *ParseWinampSong(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
ai->flags |= AIF_DONTPARSE;
- TCHAR *ptszWinampTitle = GetWinampSong();
+ wchar_t *ptszWinampTitle = GetWinampSong();
if (ptszWinampTitle != NULL) {
mir_free(g_ptszWinampSong);
@@ -1586,12 +1586,12 @@ static TCHAR *ParseWinampSong(ARGUMENTSINFO *ai)
return ptszWinampTitle;
}
-static TCHAR *ParseDate(ARGUMENTSINFO *ai)
+static wchar_t *ParseDate(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
- TCHAR szStr[128] = {0};
+ wchar_t szStr[128] = {0};
ai->flags |= AIF_DONTPARSE;
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szStr, _countof(szStr));
@@ -1634,7 +1634,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam)
return 0;
int iStatus = ICQMsgTypeToStatus(wParam);
- TCHAR *tszMsg = GetAwayMessage(iStatus, szProto, TRUE, hContact);
+ wchar_t *tszMsg = GetAwayMessage(iStatus, szProto, TRUE, hContact);
Proto_SetAwayMsgT(szProto, iStatus, tszMsg);
mir_free(tszMsg);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp
index c6099f9aef..6162d10dbe 100644
--- a/plugins/SimpleStatusMsg/src/msgbox.cpp
+++ b/plugins/SimpleStatusMsg/src/msgbox.cpp
@@ -99,7 +99,7 @@ HIMAGELIST AddStatusIconsToImageList(const char *szProto, int status_flags)
HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
{
int j = 0, cur_sel = 0;
- TCHAR *status_desc;
+ wchar_t *status_desc;
if (!(data->m_iDlgFlags & DLG_SHOW_STATUS))
return NULL;
@@ -115,9 +115,9 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
cbei.mask = CBEIF_LPARAM | CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;
if (data->m_bOnStartup)
- status_desc = (TCHAR *)TranslateT("<startup>");
+ status_desc = (wchar_t *)TranslateT("<startup>");
else
- status_desc = (TCHAR *)TranslateT("<current>");
+ status_desc = (wchar_t *)TranslateT("<current>");
cbei.iItem = j;
cbei.pszText = (LPTSTR)status_desc;
@@ -171,7 +171,7 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
int profileCount = (int)CallService(MS_SS_GETPROFILECOUNT, (WPARAM)&defaultProfile, 0);
for (int i = 0; i < profileCount; ++i) {
- TCHAR tszProfileName[128];
+ wchar_t tszProfileName[128];
CallService(MS_SS_GETPROFILENAME, (WPARAM)i, (LPARAM)tszProfileName);
cbei.iItem = j;
@@ -217,7 +217,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
{
char buff[16];
BOOL found = FALSE;
- TCHAR text[128];
+ wchar_t text[128];
HWND handle = CreateWindowEx(0, WC_COMBOBOXEX, NULL,
WS_TABSTOP | CBS_NOINTEGRALHEIGHT | WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST,
@@ -238,7 +238,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
mir_snprintf(buff, "SMsg%d", j);
j--;
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
if (tszStatusMsg != NULL) {
if (*tszStatusMsg != '\0') {
found = TRUE;
@@ -332,7 +332,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
for (int i = 1; i <= data->num_def_msgs; ++i) {
// predefined messages
mir_snprintf(buff, "DefMsg%d", i);
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
if (tszStatusMsg != NULL) {
if (*tszStatusMsg != '\0') {
cbei.iItem = -1;
@@ -465,20 +465,20 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control)
break;
if (EmptyClipboard()) {
- TCHAR item_string[128];
+ wchar_t item_string[128];
GetMenuString(hmenu, m_selection, (LPTSTR)&item_string, 128, MF_BYCOMMAND);
int len = (int)mir_tstrlen(item_string);
if (len) {
LPTSTR lptstrCopy;
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
if (hglbCopy == NULL) {
CloseClipboard();
break;
}
lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
- memcpy(lptstrCopy, item_string, len * sizeof(TCHAR));
- lptstrCopy[len] = (TCHAR)0;
+ memcpy(lptstrCopy, item_string, len * sizeof(wchar_t));
+ lptstrCopy[len] = (wchar_t)0;
GlobalUnlock(hglbCopy);
SetClipboardData(CF_UNICODETEXT, hglbCopy);
@@ -531,15 +531,15 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) { // Ctrl + Backspace
DWORD start, end;
- TCHAR *text;
+ wchar_t *text;
int textLen;
SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, NULL);
SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, NULL);
textLen = GetWindowTextLength(hwndDlg);
- text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
+ text = (wchar_t *)mir_alloc(sizeof(wchar_t) * (textLen + 1));
GetWindowText(hwndDlg, text, textLen + 1);
- memmove(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
+ memmove(text + start, text + end, sizeof(wchar_t) * (textLen + 1 - end));
SetWindowText(hwndDlg, text);
mir_free(text);
SendMessage(hwndDlg, EM_SETSEL, start, start);
@@ -593,7 +593,7 @@ int AddToPredefined(HWND hwndDlg, struct MsgBoxData *data)
{
COMBOBOXEXITEM newitem = {0};
int len = 0, num_items;
- TCHAR msg[1024], text[1024];
+ wchar_t msg[1024], text[1024];
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1)))
len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg));
@@ -676,8 +676,8 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel)
void DisplayCharsCount(struct MsgBoxData *dlg_data, HWND hwndDlg)
{
- TCHAR msg[1024];
- TCHAR status_text[128];
+ wchar_t msg[1024];
+ wchar_t status_text[128];
int len, lines = 1;
if (dlg_data->m_iCountdown != -2)
@@ -716,7 +716,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus)
char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
if (szSetting != NULL) {
if (*szSetting != '\0') {
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg != NULL) {
if (*tszStatusMsg != '\0') {
SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg);
@@ -745,7 +745,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus)
else
mir_snprintf(setting, "Default");
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting));
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting));
if (tszStatusMsg != NULL) {
SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg);
fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)tszStatusMsg);
@@ -760,7 +760,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus)
else
mir_snprintf(setting, "Msg");
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting));
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(iStatus, setting));
if (tszStatusMsg != NULL) {
SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg);
fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)tszStatusMsg);
@@ -776,7 +776,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus)
void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus)
{
- TCHAR szTitle[256], szProtoName[128];
+ wchar_t szTitle[256], szProtoName[128];
BOOL bDisabled = msgbox_data->m_szProto && !(CallProtoService(msgbox_data->m_szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND);
mir_sntprintf(szProtoName, msgbox_data->m_szProto ? Proto_GetAccount(msgbox_data->m_szProto)->tszAccountName : TranslateT("global"));
@@ -787,7 +787,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus)
mir_sntprintf(szTitle, TranslateT("%s message (%s)"), TranslateT("<current>"), szProtoName);
}
else if (iStatus > ID_STATUS_CURRENT) {
- TCHAR buff[128];
+ wchar_t buff[128];
char buff1[128];
CallService(MS_SS_GETPROFILENAME, iStatus - 40083, (LPARAM)buff1);
@@ -812,7 +812,7 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus)
{
int num_items = SendMessage(msgbox_data->recent_cbex, CB_GETCOUNT, 0, 0);
int fcursel = CB_ERR, num_start = num_items - msgbox_data->num_def_msgs - 1;
- TCHAR msg[1024];
+ wchar_t msg[1024];
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1)))
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT1), TRUE);
@@ -890,7 +890,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
switch (uMsg) {
case WM_INITDIALOG:
{
- TCHAR szTitle[256], szFormat[256], szProtoName[128];
+ wchar_t szTitle[256], szFormat[256], szProtoName[128];
struct MsgBoxInitData *init_data;
struct MsgBoxData *copy_init_data;
INITCOMMONCONTROLSEX icex = {0};
@@ -997,7 +997,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
SetEditControlText(copy_init_data, hwndDlg, copy_init_data->m_iStatus);
if ((copy_init_data->m_iDlgFlags & DLG_SHOW_BUTTONS) || (copy_init_data->m_iDlgFlags & DLG_SHOW_BUTTONS_FLAT)) {
- TCHAR msg[1024];
+ wchar_t msg[1024];
if (!GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg)))
EnableWindow(GetDlgItem(hwndDlg, IDC_BADD), FALSE);
@@ -1096,7 +1096,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
break;
}
else {
- TCHAR str[64];
+ wchar_t str[64];
mir_sntprintf(str, TranslateT("Closing in %d"), msgbox_data->m_iCountdown);
SetDlgItemText(hwndDlg, IDC_OK, str);
}
@@ -1107,7 +1107,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
switch (LOWORD(wParam)) {
case IDC_OK:
{
- TCHAR tszMsg[1024];
+ wchar_t tszMsg[1024];
int iStatus, iMsgLen = 0, iProfileStatus = 0;
BOOL bCurrentStatus = FALSE;
@@ -1172,7 +1172,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
for (int i = 1; i <= msgbox_data->max_hist_msgs; i++) {
mir_snprintf(buff, "SMsg%d", i);
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", buff);
if (tszStatusMsg != NULL) {
if (!mir_tstrcmp(tszStatusMsg, tszMsg)) {
found = true;
@@ -1285,7 +1285,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
DisplayCharsCount(msgbox_data, hwndDlg);
SendMessage(msgbox_data->recent_cbex, CB_SETCURSEL, -1, 0);
if ((msgbox_data->m_iDlgFlags & DLG_SHOW_BUTTONS) || (msgbox_data->m_iDlgFlags & DLG_SHOW_BUTTONS_FLAT)) {
- TCHAR msg[1024];
+ wchar_t msg[1024];
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BDEL)))
EnableWindow(GetDlgItem(hwndDlg, IDC_BDEL), FALSE);
@@ -1337,7 +1337,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
switch (HIWORD(wParam)) {
case CBN_SELENDOK:
{
- TCHAR text[1024];
+ wchar_t text[1024];
int cur_sel = SendMessage(msgbox_data->recent_cbex, CB_GETCURSEL, 0, 0);
COMBOBOXEXITEM cbitem = {0};
@@ -1366,7 +1366,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES)
ClearHistory(msgbox_data, cur_sel);
else if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1))) {
- TCHAR msg[1024];
+ wchar_t msg[1024];
int fcursel = CB_ERR, num_start;
num_start = SendMessage(msgbox_data->recent_cbex, CB_GETCOUNT, 0, 0);
num_start -= msgbox_data->num_def_msgs + 1;
@@ -1518,7 +1518,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_BDEL), FALSE);
}
else {
- TCHAR text[1024];
+ wchar_t text[1024];
if (cur_sel - 1 >= 0)
cur_sel--;
@@ -1583,7 +1583,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (msgbox_data->m_bPredefChanged) {
int i, num_items, new_num_def_msgs = 0;
COMBOBOXEXITEM cbitem = {0};
- TCHAR text[1024];
+ wchar_t text[1024];
char buff[64];
num_items = SendMessage(msgbox_data->recent_cbex, CB_GETCOUNT, 0, 0);
diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp
index e990901469..e7695ca304 100644
--- a/plugins/SimpleStatusMsg/src/options.cpp
+++ b/plugins/SimpleStatusMsg/src/options.cpp
@@ -61,15 +61,15 @@ static LRESULT CALLBACK OptEditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
{
DWORD start, end;
- TCHAR *text;
+ wchar_t *text;
int textLen;
SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, NULL);
SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, NULL);
textLen = GetWindowTextLength(hwndDlg);
- text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
+ text = (wchar_t *)mir_alloc(sizeof(wchar_t) * (textLen + 1));
GetWindowText(hwndDlg, text, textLen + 1);
- memmove(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
+ memmove(text + start, text + end, sizeof(wchar_t) * (textLen + 1 - end));
SetWindowText(hwndDlg, text);
mir_free(text);
SendMessage(hwndDlg, EM_SETSEL, start, start);
@@ -85,14 +85,14 @@ static LRESULT CALLBACK OptEditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
struct SingleProtoMsg
{
int flags;
- TCHAR *msg;
+ wchar_t *msg;
int max_length;
};
struct SingleStatusMsg
{
int flags[9];
- TCHAR msg[9][1024];
+ wchar_t msg[9][1024];
};
struct OptDlgData
@@ -451,7 +451,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
if (szSetting)
{
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg && mir_tstrlen(tszStatusMsg))
{
if (tszStatusMsg && mir_tstrlen(tszStatusMsg))
@@ -489,7 +489,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
else
mir_snprintf(setting, "Msg");
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
if (tszStatusMsg)
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -602,7 +602,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
if (szSetting != NULL)
{
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg)
{
if (tszStatusMsg[0])
@@ -639,7 +639,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
else
mir_snprintf(setting, "Msg");
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
if (tszStatusMsg != NULL)
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -697,7 +697,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
if (szSetting != NULL)
{
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg)
{
if (tszStatusMsg[0])
@@ -726,7 +726,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
else
mir_snprintf(setting, "Msg");
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting));
if (tszStatusMsg != NULL)
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -807,7 +807,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
char *szSetting = db_get_sa(NULL, "SimpleStatusMsg", setting);
if (szSetting != NULL)
{
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg)
{
if (tszStatusMsg[0])
@@ -837,7 +837,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
else
mir_snprintf(setting, "Msg");
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting));
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting));
if (tszStatusMsg != NULL)
{
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -862,7 +862,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (HIWORD(wParam) == EN_KILLFOCUS)
{
- TCHAR msg[1024];
+ wchar_t msg[1024];
if (data->proto_msg[j].flags & PROTO_THIS_MSG)
{
@@ -1181,7 +1181,7 @@ static bool IsHistoryMsgsFound(HWND, int histMax)
if (j < 1)
j = histMax;
mir_snprintf(szSetting, "SMsg%d", j);
- TCHAR *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
+ wchar_t *tszStatusMsg = db_get_tsa(NULL, "SimpleStatusMsg", szSetting);
if (tszStatusMsg != NULL) {
if (*tszStatusMsg != '\0') {
mir_free(tszStatusMsg);
@@ -1234,7 +1234,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w
SendDlgItemMessage(hwndDlg, IDC_CBOPTBUTTONS, CB_SETCURSEL, (WPARAM)i_btnhide, 0);
if (!ServiceExists(MS_SS_GETPROFILECOUNT)) {
- TCHAR szText[100];
+ wchar_t szText[100];
mir_sntprintf(szText, L"%s *", TranslateT("Show status profiles in status list"));
SetDlgItemText(hwndDlg, IDC_CPROFILES, szText);
EnableWindow(GetDlgItem(hwndDlg, IDC_CPROFILES), FALSE);
diff --git a/plugins/SimpleStatusMsg/src/simplestatusmsg.h b/plugins/SimpleStatusMsg/src/simplestatusmsg.h
index c1ca255b19..c5fd123b6d 100644
--- a/plugins/SimpleStatusMsg/src/simplestatusmsg.h
+++ b/plugins/SimpleStatusMsg/src/simplestatusmsg.h
@@ -81,7 +81,7 @@ int LoadAwayMsgModule(void);
int AwayMsgPreShutdown(void);
/* main.cpp */
-void SetStatusMessage(const char *szProto, int initial_status_mode, int status_mode, TCHAR *message, BOOL on_startup);
+void SetStatusMessage(const char *szProto, int initial_status_mode, int status_mode, wchar_t *message, BOOL on_startup);
/* msgbox.cpp */
INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -97,7 +97,7 @@ void ReleaseIconEx(const char* name);
HANDLE HookProtoEvent(const char *szModule, const char *szEvent, MIRANDAHOOKPARAM hookProc);
void UnhookProtoEvents(void);
int GetRandom(int from, int to);
-const TCHAR *GetDefaultMessage(int status);
+const wchar_t *GetDefaultMessage(int status);
const char *StatusModeToDbSetting(int status, const char *suffix);
int GetCurrentStatus(const char *szProto);
int GetStartupStatus(const char *szProto);
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp
index d27b1ad5ae..f0bbf520b5 100644
--- a/plugins/SimpleStatusMsg/src/utils.cpp
+++ b/plugins/SimpleStatusMsg/src/utils.cpp
@@ -89,7 +89,7 @@ int GetRandom(int from, int to)
}
// From SRAway module
-const TCHAR *GetDefaultMessage(int status)
+const wchar_t *GetDefaultMessage(int status)
{
switch (status) {
case ID_STATUS_AWAY: return TranslateT("I've been away since %time%.");