summaryrefslogtreecommitdiff
path: root/plugins/Spamotron/src/options.cpp
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/Spamotron/src/options.cpp
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/Spamotron/src/options.cpp')
-rw-r--r--plugins/Spamotron/src/options.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp
index 5bf7c8a4d6..7f20587abc 100644
--- a/plugins/Spamotron/src/options.cpp
+++ b/plugins/Spamotron/src/options.cpp
@@ -1,31 +1,31 @@
#include "stdafx.h"
-TCHAR currentResponse[256] = {0};
+wchar_t currentResponse[256] = {0};
-TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, MCONTACT hContact, const char* option, const TCHAR *def)
+wchar_t* _getCOptS(wchar_t *buf, unsigned int buflen, MCONTACT hContact, const char* option, const wchar_t *def)
{
DBVARIANT dbv = {0};
_tcsnset(buf, 0, buflen);
if (db_get_ts(hContact, PLUGIN_NAME, option, &dbv) != 0)
- _tcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1));
+ wcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1));
else if (dbv.type == DBVT_TCHAR) {
- _tcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1));
+ wcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1));
}
db_free(&dbv);
return buf;
}
-TCHAR* _getMOptS(TCHAR *buf, unsigned int buflen, const char* module, const char* option, const TCHAR *def)
+wchar_t* _getMOptS(wchar_t *buf, unsigned int buflen, const char* module, const char* option, const wchar_t *def)
{
- TCHAR* tmp;
+ wchar_t* tmp;
DBVARIANT dbv = {0};
_tcsnset(buf, 0, buflen);
if (db_get_s(NULL, module, option, &dbv) != 0)
- _tcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1));
+ wcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1));
else if (dbv.type == DBVT_TCHAR) {
- _tcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1));
+ wcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1));
} else {
tmp = mir_a2u(dbv.pszVal);
- _tcsncpy(buf, tmp, min(buflen, mir_tstrlen(tmp)+1));
+ wcsncpy(buf, tmp, min(buflen, mir_tstrlen(tmp)+1));
mir_free(tmp);
}
db_free(&dbv);
@@ -36,9 +36,9 @@ TCHAR* _getMOptS(TCHAR *buf, unsigned int buflen, const char* module, const char
BOOL _saveDlgItemText(HWND hDialog, int controlID, char* option)
{
int len;
- TCHAR *tmp;
+ wchar_t *tmp;
len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
- tmp = (TCHAR *)malloc((len + 1)*sizeof(TCHAR));
+ tmp = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len + 1);
_setOptTS(option, tmp);
free(tmp);
@@ -49,9 +49,9 @@ int _saveDlgItemResponse(HWND hDialog, int controlID, char* option)
int ret = 0;
int isRegex = 0;
int len;
- TCHAR *tmp;
+ wchar_t *tmp;
len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
- tmp = (TCHAR*)malloc((len+1)*sizeof(TCHAR));
+ tmp = (wchar_t*)malloc((len+1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len+1);
isRegex = _isregex(tmp);
if (!isRegex)
@@ -68,20 +68,20 @@ int _saveDlgItemResponse(HWND hDialog, int controlID, char* option)
BOOL _saveDlgItemInt(HWND hDialog, int controlID, char* option)
{
int len;
- TCHAR *tmp;
+ wchar_t *tmp;
len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
- tmp = (TCHAR *)malloc((len + 1)*sizeof(TCHAR));
+ tmp = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len + 1);
- _setOptD(option, _ttoi(tmp));
+ _setOptD(option, _wtoi(tmp));
free(tmp);
return TRUE;
}
BOOL _saveDlgItemScore(HWND hDialog, int controlID, char* option)
{
int len;
- TCHAR *tmp;
+ wchar_t *tmp;
len = GetWindowTextLength(GetDlgItem(hDialog, controlID));
- tmp = (TCHAR *)malloc((len + 1)*sizeof(TCHAR));
+ tmp = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
GetDlgItemText(hDialog, controlID, tmp, len + 1);
_setOptD(option, _tcstod(tmp, NULL)/SCORE_C);
return TRUE;
@@ -93,12 +93,12 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
{
static int bInitializing = 0, i, j, numProtocols;
PROTOACCOUNT **pd;
- TCHAR pName[256] = {0};
+ wchar_t pName[256] = {0};
char protoOption[256] = {0};
HWND hProtocolsList = GetDlgItem(optDlg, IDC_OPT_PROTOCOLS);
LVITEM lvi = {0};
LVCOLUMN lvc = {0};
- TCHAR buf[512];
+ wchar_t buf[512];
switch (msg) {
case WM_INITDIALOG:
@@ -115,8 +115,8 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
CheckDlgButton(optDlg, IDC_OPT_LOG_ACTIONS, _getOptB("LogActions", defaultLogActions) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(optDlg, IDC_OPT_IN_MSG_APPROVE_WORDLIST, _getOptS(buf, _countof(buf), "ApproveOnMsgInWordlist", defaultApproveOnMsgInWordlist));
- SetDlgItemText(optDlg, IDC_OPT_MAX_MSG_CONTACT, _itot((unsigned int)_getOptD("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay), buf, 10));
- SetDlgItemText(optDlg, IDC_OPT_MAX_SAME_MSG, _itot((unsigned int)_getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay), buf, 10));
+ SetDlgItemText(optDlg, IDC_OPT_MAX_MSG_CONTACT, _itow((unsigned int)_getOptD("MaxMsgContactCountPerDay", defaultMaxMsgContactCountPerDay), buf, 10));
+ SetDlgItemText(optDlg, IDC_OPT_MAX_SAME_MSG, _itow((unsigned int)_getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay), buf, 10));
SetDlgItemText(optDlg, IDC_OPT_DONT_REPLY_MSG_WORDLIST, _getOptS(buf, _countof(buf), "DontReplyMsgWordlist", defaultDontReplyMsgWordlist));
///Individual protocols list
@@ -129,7 +129,7 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM
for (i = 0, j = 0; i < numProtocols; i++)
{
lvi.iItem = i;
- _getMOptS(pName, 200*sizeof(TCHAR), pd[i]->szModuleName, "AM_BaseProto", L"");
+ _getMOptS(pName, 200*sizeof(wchar_t), pd[i]->szModuleName, "AM_BaseProto", L"");
if (mir_tstrcmp(pName, L"ICQ") != 0)
continue;
lvi.pszText = mir_a2u(pd[i]->szModuleName);
@@ -217,7 +217,7 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP
static int bInitializing = 0;
int i, selectedMode;
HWND ht;
- TCHAR *buf;
+ wchar_t *buf;
unsigned int buflen = 500;
switch (msg) {
@@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP
}
}
SetDlgItemText(optDlg, IDC_OPT_MATH_RESPONSE, TranslateT("Will be automatically evaluated from %mathexpr%"));
- buf = (TCHAR *)malloc(buflen*sizeof(TCHAR));
+ buf = (wchar_t *)malloc(buflen*sizeof(wchar_t));
switch (selectedMode) {
case SPAMOTRON_MODE_PLAIN:
case SPAMOTRON_MODE_ROTATE:
@@ -289,7 +289,7 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP
return FALSE;
i = SendDlgItemMessage(optDlg, IDC_OPT_MODE, CB_GETCURSEL, 0, 0);
selectedMode = SendDlgItemMessage(optDlg, IDC_OPT_MODE, CB_GETITEMDATA, i, 0);
- buf = (TCHAR*)malloc(buflen*sizeof(TCHAR));
+ buf = (wchar_t*)malloc(buflen*sizeof(wchar_t));
switch (selectedMode) {
case SPAMOTRON_MODE_PLAIN:
case SPAMOTRON_MODE_ROTATE:
@@ -418,8 +418,8 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
{
static int bInitializing = 0, len;
BOOL bEnabled;
- TCHAR *dbuf;
- TCHAR buf[MAX_BUFFER_LENGTH];
+ wchar_t *dbuf;
+ wchar_t buf[MAX_BUFFER_LENGTH];
char cbuf[MAX_BUFFER_LENGTH];
switch (msg) {
case WM_INITDIALOG:
@@ -482,7 +482,7 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
case IDC_OPT_BAYES_HAM:
// Learn ham from learnbox
len = GetWindowTextLength(GetDlgItem(optDlg, IDC_OPT_BAYES_LEARNBOX))+1;
- dbuf = (TCHAR *)malloc(len*sizeof(TCHAR));
+ dbuf = (wchar_t *)malloc(len*sizeof(wchar_t));
if (!dbuf)
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
@@ -499,7 +499,7 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
case IDC_OPT_BAYES_SPAM:
// Learn spam from learnbox
len = GetWindowTextLength(GetDlgItem(optDlg, IDC_OPT_BAYES_LEARNBOX))+1;
- dbuf = (TCHAR *)malloc(len*sizeof(TCHAR));
+ dbuf = (wchar_t *)malloc(len*sizeof(wchar_t));
if (!dbuf)
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
@@ -515,7 +515,7 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
case IDC_CHECK_MSG:
len = GetWindowTextLength(GetDlgItem(optDlg, IDC_OPT_BAYES_LEARNBOX))+1;
- dbuf = (TCHAR *)malloc((len)*sizeof(TCHAR));
+ dbuf = (wchar_t *)malloc((len)*sizeof(wchar_t));
if (!dbuf)
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
@@ -556,21 +556,21 @@ int OnOptInitialize(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
- odp.ptszGroup = LPGENT("Message sessions");
- odp.ptszTitle = _T(PLUGIN_NAME);
+ odp.pwszGroup = LPGENW("Message sessions");
+ odp.pwszTitle = _T(PLUGIN_NAME);
odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS;
- odp.ptszTab = LPGENT("Settings");
+ odp.pwszTab = LPGENW("Settings");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_MAIN);
odp.pfnDlgProc = DlgProcOptionsMain;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Messages");
+ odp.pwszTab = LPGENW("Messages");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_Q);
odp.pfnDlgProc = DlgProcOptionsQuestion;
Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Bayes");
+ odp.pwszTab = LPGENW("Bayes");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_BAYES);
odp.pfnDlgProc = DlgProcOptionsBayes;
Options_AddPage(wParam, &odp);
@@ -578,8 +578,8 @@ int OnOptInitialize(WPARAM wParam, LPARAM)
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_POPUPS);
odp.pfnDlgProc = DlgProcOptionsPopups;
- odp.ptszGroup = LPGENT("Popups");
- odp.ptszTab = NULL;
+ odp.pwszGroup = LPGENW("Popups");
+ odp.pwszTab = NULL;
Options_AddPage(wParam, &odp);
}
return 0;