diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/NewXstatusNotify/src/xstatus.cpp | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (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/NewXstatusNotify/src/xstatus.cpp')
-rw-r--r-- | plugins/NewXstatusNotify/src/xstatus.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
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("<no title>"));
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("<no status message>"));
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]) {
|