summaryrefslogtreecommitdiff
path: root/plugins/Spamotron/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-25 10:31:04 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-25 10:31:04 +0000
commit8ae3679aa1339ce9abee53adb69902bd6b7513dc (patch)
tree94ef8927e12043ed6dcc15e1e640d68a8add520e /plugins/Spamotron/src
parent1e273e28d89b5838e3d0f0cafac9676577cb71ce (diff)
hello, Unix.
phase 1: removing _T() git-svn-id: http://svn.miranda-ng.org/main/trunk@17127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Spamotron/src')
-rw-r--r--plugins/Spamotron/src/options.cpp30
-rw-r--r--plugins/Spamotron/src/spamotron.cpp10
-rw-r--r--plugins/Spamotron/src/stdafx.h6
-rw-r--r--plugins/Spamotron/src/utils.cpp40
4 files changed, 43 insertions, 43 deletions
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp
index 6c65d556c4..5bf7c8a4d6 100644
--- a/plugins/Spamotron/src/options.cpp
+++ b/plugins/Spamotron/src/options.cpp
@@ -129,8 +129,8 @@ 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", _T(""));
- if (mir_tstrcmp(pName, _T("ICQ")) != 0)
+ _getMOptS(pName, 200*sizeof(TCHAR), pd[i]->szModuleName, "AM_BaseProto", L"");
+ if (mir_tstrcmp(pName, L"ICQ") != 0)
continue;
lvi.pszText = mir_a2u(pd[i]->szModuleName);
ListView_InsertItem(hProtocolsList, &lvi);
@@ -332,7 +332,7 @@ INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LP
return FALSE;
break;
case IDC_DEFAULTS:
- SetDlgItemText(optDlg, IDC_STATIC_MODEMSG, _T(""));
+ SetDlgItemText(optDlg, IDC_STATIC_MODEMSG, L"");
ShowWindow(GetDlgItem(optDlg, IDC_OPT_MATH_RESPONSE), 0);
ShowWindow(GetDlgItem(optDlg, IDC_OPT_RESPONSE), 1);
EnableWindow(GetDlgItem(optDlg, IDC_OPT_RESPONSE), TRUE);
@@ -436,17 +436,17 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
EnableControlsBayes(optDlg, bEnabled);
- mir_sntprintf(buf, _T("%0.02f"), (double)_getOptD("BayesSpamScore", defaultBayesSpamScore)*SCORE_C);
+ mir_sntprintf(buf, L"%0.02f", (double)_getOptD("BayesSpamScore", defaultBayesSpamScore)*SCORE_C);
SetDlgItemText(optDlg, IDC_OPT_BAYES_SPAM_SCORE, buf);
- mir_sntprintf(buf, _T("%.02f"), (double)_getOptD("BayesHamScore", defaultBayesHamScore)*SCORE_C);
+ mir_sntprintf(buf, L"%.02f", (double)_getOptD("BayesHamScore", defaultBayesHamScore)*SCORE_C);
SetDlgItemText(optDlg, IDC_OPT_BAYES_HAM_SCORE, buf);
- mir_sntprintf(buf, _T("%d"), _getOptD("BayesWaitApprove", defaultBayesWaitApprove));
+ mir_sntprintf(buf, L"%d", _getOptD("BayesWaitApprove", defaultBayesWaitApprove));
SetDlgItemText(optDlg, IDC_OPT_BAYES_WAIT_APPROVE, buf);
if (bEnabled) {
- mir_sntprintf(buf, _T("%d"), get_msg_count(SPAM));
+ mir_sntprintf(buf, L"%d", get_msg_count(SPAM));
SetDlgItemText(optDlg, IDC_STATIC_SPAM_COUNT, buf);
- mir_sntprintf(buf, _T("%d"), get_msg_count(HAM));
+ mir_sntprintf(buf, L"%d", get_msg_count(HAM));
SetDlgItemText(optDlg, IDC_STATIC_HAM_COUNT, buf);
}
@@ -487,12 +487,12 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
learn_ham(dbuf);
- SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, _T(""));
+ SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, L"");
free(dbuf);
- mir_sntprintf(buf, _T("%d"), get_msg_count(SPAM));
+ mir_sntprintf(buf, L"%d", get_msg_count(SPAM));
SetDlgItemText(optDlg, IDC_STATIC_SPAM_COUNT, buf);
- mir_sntprintf(buf, _T("%d"), get_msg_count(HAM));
+ mir_sntprintf(buf, L"%d", get_msg_count(HAM));
SetDlgItemText(optDlg, IDC_STATIC_HAM_COUNT, buf);
return FALSE;
@@ -504,12 +504,12 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
learn_spam(dbuf);
- SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, _T(""));
+ SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, L"");
free(dbuf);
- mir_sntprintf(buf, _T("%d"), get_msg_count(SPAM));
+ mir_sntprintf(buf, L"%d", get_msg_count(SPAM));
SetDlgItemText(optDlg, IDC_STATIC_SPAM_COUNT, buf);
- mir_sntprintf(buf, _T("%d"), get_msg_count(HAM));
+ mir_sntprintf(buf, L"%d", get_msg_count(HAM));
SetDlgItemText(optDlg, IDC_STATIC_HAM_COUNT, buf);
return FALSE;
@@ -520,7 +520,7 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
mir_snprintf(cbuf, "%0.04f", get_msg_score(dbuf));
- SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, _T(""));
+ SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, L"");
MessageBoxA(NULL, cbuf, Translate("Message score"), MB_OK);
free(dbuf);
return FALSE;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp
index c007f71d43..dceac13a6e 100644
--- a/plugins/Spamotron/src/spamotron.cpp
+++ b/plugins/Spamotron/src/spamotron.cpp
@@ -239,7 +239,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
if (_dbei != NULL) {
memcpy(&_dbei->cbBlob, _dbv.pbVal, sizeof(DWORD));
_dbei->eventType = EVENTTYPE_AUTHREQUEST;
- _getCOptS(AuthEventModule, 100, hContact, "AuthEventModule", _T("ICQ"));
+ _getCOptS(AuthEventModule, 100, hContact, "AuthEventModule", L"ICQ");
szAuthEventModule = mir_u2a(AuthEventModule);
_dbei->szModule = szAuthEventModule;
_dbei->timestamp = dbei->timestamp;
@@ -290,7 +290,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
// Completely reject if duplicate incoming message found
if (_getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) > 0 &&
_getCOptD(hContact, "SameMsgCount", 0) >= _getOptD("MaxSameMsgCountPerDay", defaultMaxSameMsgCountPerDay) &&
- mir_tstrcmp(message, _getCOptS(buf, buflen, hContact, "LastInMsg", _T(""))) == 0) {
+ mir_tstrcmp(message, _getCOptS(buf, buflen, hContact, "LastInMsg", L"")) == 0) {
_notify(hContact, POPUP_BLOCKED, TranslateT("Message from %s rejected because it reached a maximum for same responses per day."), message);
if (bayesEnabled)
queue_message(hContact, dbei->timestamp, message);
@@ -388,12 +388,12 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
case SPAMOTRON_MODE_MATH:
a = (rand() % 10) + 1;
b = (rand() % 10) + 1;
- mir_sntprintf(mexpr, _T("%d + %d"), a, b);
+ mir_sntprintf(mexpr, L"%d + %d", a, b);
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
_getOptS(challengeW, maxmsglen, "AuthChallengeMath", defaultAuthChallengeMath);
else
_getOptS(challengeW, maxmsglen, "ChallengeMath", defaultChallengeMath);
- ReplaceVar(challengeW, maxmsglen, _T("%mathexpr%"), mexpr);
+ ReplaceVar(challengeW, maxmsglen, L"%mathexpr%", mexpr);
_setCOptD(hContact, "ResponseMath", a + b);
ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
_notify(hContact, POPUP_CHALLENGE, TranslateT("Sending math expression challenge to %s."), message);
@@ -423,7 +423,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
// Save Last Msg and update SameMsgCount
if (message != NULL) {
- if (mir_tstrcmp(_getCOptS(buf, buflen, hContact, "LastInMsg", _T("")), message) == 0)
+ if (mir_tstrcmp(_getCOptS(buf, buflen, hContact, "LastInMsg", L""), message) == 0)
_setCOptD(hContact, "SameMsgCount", 1+_getCOptD(hContact, "SameMsgCount", 0));
else
_setCOptD(hContact, "SameMsgCount", 1);
diff --git a/plugins/Spamotron/src/stdafx.h b/plugins/Spamotron/src/stdafx.h
index 5e438adadd..2d584589ba 100644
--- a/plugins/Spamotron/src/stdafx.h
+++ b/plugins/Spamotron/src/stdafx.h
@@ -49,7 +49,7 @@ TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, MCONTACT hContact, const char*
#define defaultMode SPAMOTRON_MODE_PLAIN
#define defaultChallenge TranslateT("Spam-o-tron needs to verify you're not a bot. Reply with \"%response%\" without quotes.")
#define defaultChallengeMath TranslateT("Spam-o-tron needs to verify you're not a bot. Reply with a result of expression %mathexpr%.")
-#define defaultResponse _T("no-spam")
+#define defaultResponse L"no-spam"
#define defaultResponseCC TRUE
#define defaultSuccessResponse TranslateT("Verified.")
#define defaultAuthChallenge TranslateT("Spam-o-tron delayed authorization request. First reply with \"%response%\" without quotes.")
@@ -67,8 +67,8 @@ TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, MCONTACT hContact, const char*
#define defaultNotifyPopup FALSE
#define defaultDontReplySameMsg TRUE
#define defaultDontReplyMsg TRUE
-#define defaultApproveOnMsgInWordlist _T("")
-#define defaultDontReplyMsgWordlist _T("Spam-o-tron, StopSpam, Anti-Spam")
+#define defaultApproveOnMsgInWordlist L""
+#define defaultDontReplyMsgWordlist L"Spam-o-tron, StopSpam, Anti-Spam"
#define defaultMaxMsgContactCountPerDay 3
#define defaultMaxSameMsgCountPerDay 2
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp
index 20d0b0bd2e..7a9bf2fe3e 100644
--- a/plugins/Spamotron/src/utils.cpp
+++ b/plugins/Spamotron/src/utils.cpp
@@ -31,7 +31,7 @@ BOOL _isregex(TCHAR* strSearch)
const char *error;
int erroroffs, rc;
TCHAR *regex;
- TCHAR regex_parse[] = _T("/(.*)/([igsm]*)");
+ TCHAR regex_parse[] = L"/(.*)/([igsm]*)";
int ovector[9];
if (strSearch == NULL)
@@ -60,7 +60,7 @@ BOOL _isvalidregex(TCHAR* strSearch)
int erroroffs, rc;
TCHAR *regex, *regexp, *mod;
int opts = 0;
- TCHAR regex_parse[] = _T("/(.*)/([igsm]*)");
+ TCHAR regex_parse[] = L"/(.*)/([igsm]*)";
int ovector[9];
if (strSearch == NULL)
@@ -82,11 +82,11 @@ BOOL _isvalidregex(TCHAR* strSearch)
mod = regex + ovector[4];
mod[ovector[5] - ovector[4]] = 0;
- if (_tcsstr(mod, _T("i")))
+ if (_tcsstr(mod, L"i"))
opts |= PCRE_CASELESS;
- if (_tcsstr(mod, _T("m")))
+ if (_tcsstr(mod, L"m"))
opts |= PCRE_MULTILINE;
- if (_tcsstr(mod, _T("s")))
+ if (_tcsstr(mod, L"s"))
opts |= PCRE_DOTALL;
re = pcre16_compile(regexp, opts, &error, &erroroffs, NULL);
@@ -108,7 +108,7 @@ BOOL _regmatch(TCHAR* str, TCHAR* strSearch)
int erroroffs, rc;
TCHAR *regex, *regexp, *data = NULL, *mod;
int opts = 0;
- TCHAR regex_parse[] = _T("^/(.*)/([igsm]*)");
+ TCHAR regex_parse[] = L"^/(.*)/([igsm]*)";
int ovector[9];
if (str == NULL || strSearch == NULL)
@@ -133,11 +133,11 @@ BOOL _regmatch(TCHAR* str, TCHAR* strSearch)
data = mir_tstrdup(str);
if (data == NULL)
goto err_out;
- if (_tcsstr(mod, _T("i")))
+ if (_tcsstr(mod, L"i"))
opts |= PCRE_CASELESS;
- if (_tcsstr(mod, _T("m")))
+ if (_tcsstr(mod, L"m"))
opts |= PCRE_MULTILINE;
- if (_tcsstr(mod, _T("s")))
+ if (_tcsstr(mod, L"s"))
opts |= PCRE_DOTALL;
re = pcre16_compile(regexp, opts, &error, &erroroffs, NULL);
@@ -161,7 +161,7 @@ int get_response_id(const TCHAR* strvar)
const char *error;
int erroroffs, rc;
TCHAR *_str, *_strvar;
- TCHAR regex[] = _T("^%response([#-_]([0-9]+))?%$");
+ TCHAR regex[] = L"^%response([#-_]([0-9]+))?%$";
int ovector[9];
if (strvar == NULL)
@@ -198,10 +198,10 @@ int get_response_num(const TCHAR *str)
strc = mir_tstrdup(str);
if (strc == NULL)
return 0;
- tmp = _tcstok(strc, _T("\r\n"));
+ tmp = _tcstok(strc, L"\r\n");
while (tmp) {
i ++;
- tmp = _tcstok(NULL, _T("\r\n")); /* Move next. */
+ tmp = _tcstok(NULL, L"\r\n"); /* Move next. */
}
mir_free(strc);
@@ -219,7 +219,7 @@ TCHAR* get_response(TCHAR* dst, unsigned int dstlen, int num)
if (src == NULL)
goto err_out;
_getOptS(src, MAX_BUFFER_LENGTH, "Response", defaultResponse);
- tmp = _tcstok(src, _T("\r\n"));
+ tmp = _tcstok(src, L"\r\n");
while (tmp) {
if (i == num) {
mir_tstrcpy(dst, tmp);
@@ -227,7 +227,7 @@ TCHAR* get_response(TCHAR* dst, unsigned int dstlen, int num)
return dst;
}
i ++;
- tmp = _tcstok(NULL, _T("\r\n")); /* Move next. */
+ tmp = _tcstok(NULL, L"\r\n"); /* Move next. */
}
mir_free(src);
err_out:
@@ -274,10 +274,10 @@ BOOL Contains(TCHAR* dst, TCHAR* src) // Checks for occurence of substring from
goto err_out;
tdst = _tcstoupper(tdst);
dst_len = mir_tstrlen(tdst);
- token = _tcstok(tsrc, _T(","));
+ token = _tcstok(tsrc, L",");
while (token) {
token_end = (token + mir_tstrlen(token));
- while (!_tcsncmp(token, _T(" "), 1)) { /* Skeep spaces at start. */
+ while (!_tcsncmp(token, L" ", 1)) { /* Skeep spaces at start. */
token ++;
}
/* Skeep spaces at end. */
@@ -291,7 +291,7 @@ BOOL Contains(TCHAR* dst, TCHAR* src) // Checks for occurence of substring from
ret = TRUE;
break;
}
- token = _tcstok(NULL, _T(",")); /* Move next. */
+ token = _tcstok(NULL, L","); /* Move next. */
}
err_out:
mir_free(tsrc);
@@ -363,7 +363,7 @@ TCHAR* ReplaceVarsNum(TCHAR *dst, unsigned int len, int num)
const char *error;
int erroroffs, rc;
TCHAR *_str, *tmp, **r = NULL, **tr, *ttmp, *dstcopy;
- TCHAR regex[] = _T("%response([#-_]([0-9]+))?%");
+ TCHAR regex[] = L"%response([#-_]([0-9]+))?%";
int ovector[9];
re = pcre16_compile(regex, 0, &error, &erroroffs, NULL);
@@ -371,14 +371,14 @@ TCHAR* ReplaceVarsNum(TCHAR *dst, unsigned int len, int num)
return FALSE; // [TODO] and log some error
_getOptS(response, _countof(response), "Response", defaultResponse);
- ttmp = _tcstok(response, _T("\r\n"));
+ ttmp = _tcstok(response, L"\r\n");
for (i = 0; ttmp != NULL; i ++) {
tr = (TCHAR**)mir_realloc(r, ((i + 1) * sizeof(TCHAR*)));
if (tr == NULL)
goto err_out;
r = tr;
r[i] = ttmp;
- ttmp = _tcstok(NULL, _T("\r\n")); /* Move next. */
+ ttmp = _tcstok(NULL, L"\r\n"); /* Move next. */
}
do {