From 8ae3679aa1339ce9abee53adb69902bd6b7513dc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Jul 2016 10:31:04 +0000 Subject: hello, Unix. phase 1: removing _T() git-svn-id: http://svn.miranda-ng.org/main/trunk@17127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/StopSpamMod/src/init.cpp | 18 +++++++++--------- plugins/StopSpamMod/src/options.cpp | 12 ++++++------ plugins/StopSpamMod/src/stopspam.cpp | 16 ++++++++-------- plugins/StopSpamMod/src/utilities.cpp | 28 ++++++++++++++-------------- 4 files changed, 37 insertions(+), 37 deletions(-) (limited to 'plugins/StopSpamMod/src') diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 44f1bea69a..4b8ef5167e 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -43,8 +43,8 @@ BOOL gbMathExpression = 0; HANDLE hStopSpamLogDirH=0; -tstring gbSpammersGroup = _T("Spammers"); -tstring gbAutoAuthGroup = _T("NotSpammers"); +tstring gbSpammersGroup = L"Spammers"; +tstring gbAutoAuthGroup = L"NotSpammers"; tstring gbQuestion; tstring gbAnswer; @@ -79,17 +79,17 @@ extern tstring DBGetContactSettingStringPAN(MCONTACT hContact, char const * szMo void InitVars() { - gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("Spammers")); - gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam")); - gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", _T("Congratulations! You just passed human/robot test. Now you can write me a message.")); + gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", L"Spammers"); + gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", L"nospam"); + gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", L"Congratulations! You just passed human/robot test. Now you can write me a message."); gbInfTalkProtection = db_get_b(NULL, pluginName, "infTalkProtection", 0); gbAddPermanent = db_get_b(NULL, pluginName, "addPermanent", 0); gbMaxQuestCount = db_get_dw(NULL, pluginName, "maxQuestCount", 5); gbHandleAuthReq = db_get_b(NULL, pluginName, "handleAuthReq", 1); gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion); - gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam")); - gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", _T("Congratulations! You just passed human/robot test. Now you can write me a message.")); - gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", _T("StopSpam: send a message and reply to an anti-spam bot question.")); + gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", L"nospam"); + gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", L"Congratulations! You just passed human/robot test. Now you can write me a message."); + gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", L"StopSpam: send a message and reply to an anti-spam bot question."); gbSpecialGroup = db_get_b(NULL, pluginName, "SpecialGroup", 0); gbHideContacts = db_get_b(NULL, pluginName, "HideContacts", 0); gbIgnoreContacts = db_get_b(NULL, pluginName, "IgnoreContacts", 0); @@ -100,7 +100,7 @@ void InitVars() gbRegexMatch = db_get_b(NULL, pluginName, "RegexMatch", 0); gbInvisDisable = db_get_b(NULL, pluginName, "DisableInInvis", 0); gbIgnoreURL = db_get_b(NULL, pluginName, "IgnoreURL", 0); - gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("Not Spammers")); + gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", L"Not Spammers"); gbAutoAuth = db_get_b(NULL, pluginName, "AutoAuth", 0); gbAutoAddToServerList = db_get_b(NULL, pluginName, "AutoAddToServerList", 0); gbAutoReqAuth = db_get_b(NULL, pluginName, "AutoReqAuth", 0); diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index 5878c9ce40..7c4e557c06 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -91,7 +91,7 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case ID_RESTOREDEFAULTS: SetDlgItemText(hwnd, ID_QUESTION, defQuestion); - SetDlgItemText(hwnd, ID_ANSWER, _T("nospam")); + SetDlgItemText(hwnd, ID_ANSWER, L"nospam"); SetDlgItemText(hwnd, ID_AUTHREPL, TranslateT("StopSpam: send a message and reply to an anti-spam bot question.")); SetDlgItemText(hwnd, ID_CONGRATULATION, TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message.")); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -111,7 +111,7 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar db_set_ws(NULL, pluginName, "question", GetDlgItemString(hwnd, ID_QUESTION).c_str()); gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion); db_set_ws(NULL, pluginName, "answer", GetDlgItemString(hwnd, ID_ANSWER).c_str()); - gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam")); + gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", L"nospam"); db_set_ws(NULL, pluginName, "authrepl", GetDlgItemString(hwnd, ID_AUTHREPL).c_str()); gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", TranslateT("StopSpam: send a message and reply to an anti-spam bot question.")); db_set_ws(NULL, pluginName, "congratulation", GetDlgItemString(hwnd, ID_CONGRATULATION).c_str()); @@ -272,11 +272,11 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { static tstring NewGroupName, CurrentGroupName; NewGroupName = GetDlgItemString(hwnd, ID_SPECIALGROUPNAME); - CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("0")); + CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", L"0"); if (mir_wstrcmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0) { bool GroupExist = Clist_GroupExists(NewGroupName.c_str()) != NULL; db_set_ws(NULL, pluginName, "SpammersGroup", NewGroupName.c_str()); - gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("Spammers")); + gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", L"Spammers"); if (!GroupExist && gbSpecialGroup) Clist_GroupCreate(0, gbSpammersGroup.c_str()); } @@ -296,11 +296,11 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { static tstring NewAGroupName, CurrentAGroupName; NewAGroupName = GetDlgItemString(hwnd, IDC_AUTOADDGROUP); - CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("0")); + CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", L"0"); if (mir_wstrcmp(CurrentAGroupName.c_str(), NewAGroupName.c_str()) != 0) { bool GroupExist = Clist_GroupExists(NewAGroupName.c_str()) != NULL; db_set_ws(NULL, pluginName, "AutoAuthGroup", NewAGroupName.c_str()); - gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("Not Spammers")); + gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", L"Not Spammers"); if (!GroupExist && gbAutoAddToServerList) Clist_GroupCreate(0, gbAutoAuthGroup.c_str()); } diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index 81a31bda8e..918ec129aa 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -173,15 +173,15 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // send congratulation if (bSendMsg) { - tstring prot = DBGetContactSettingStringPAN(NULL, dbei->szModule, "AM_BaseProto", _T("")); + tstring prot = DBGetContactSettingStringPAN(NULL, dbei->szModule, "AM_BaseProto", L""); // for notICQ protocols or disable auto auth. reqwest - if ((Stricmp(_T("ICQ"), prot.c_str())) || (!gbAutoReqAuth)) { + if ((Stricmp(L"ICQ", prot.c_str())) || (!gbAutoReqAuth)) { char * buf = mir_utf8encodeW(variables_parse(gbCongratulation, hContact).c_str()); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)buf); mir_free(buf); } // Note: For ANSI can be not work - if (!Stricmp(_T("ICQ"), prot.c_str())) { + if (!Stricmp(L"ICQ", prot.c_str())) { // grand auth. if (gbAutoAuth) CallProtoService(dbei->szModule, "/GrantAuth", w, 0); @@ -203,22 +203,22 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // if message message does not contain infintite talk protection prefix // and question count for this contact is less then maximum if (bSendMsg) { - if ((!gbInfTalkProtection || tstring::npos == message.find(_T("StopSpam automatic message:\r\n"))) + if ((!gbInfTalkProtection || tstring::npos == message.find(L"StopSpam automatic message:\r\n")) && (!gbMaxQuestCount || db_get_dw(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount)) { // send question tstring q; if (gbInfTalkProtection) - q += _T("StopSpam automatic message:\r\n"); + q += L"StopSpam automatic message:\r\n"; if (gbMathExpression) { //parse math expression in question tstring tmp_question = gbQuestion; std::list args; std::list actions; - tstring::size_type p1 = gbQuestion.find(_T("X")), p2 = 0; - const tstring expr_chars = _T("X+-/*"), expr_acts = _T("+-/*"); + tstring::size_type p1 = gbQuestion.find(L"X"), p2 = 0; + const tstring expr_chars = L"X+-/*", expr_acts = L"+-/*"; while (p1 < gbQuestion.length() && p1 != tstring::npos && expr_chars.find(gbQuestion[p1]) != tstring::npos) { std::string arg; p2 = p1; - for (p1 = gbQuestion.find(_T("X"), p1); (p1 < gbQuestion.length()) && (gbQuestion[p1] == L'X'); ++p1) + for (p1 = gbQuestion.find(L"X", p1); (p1 < gbQuestion.length()) && (gbQuestion[p1] == L'X'); ++p1) arg += get_random_num(1); tmp_question.replace(p2, arg.size(), toUTF16(arg)); diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 16265231d2..bfa076de6a 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -192,7 +192,7 @@ tstring GetContactUid(MCONTACT hContact, tstring Protocol) { char *szProto = mir_utf8encodeW(Protocol.c_str()); ptrT uid(Contact_GetInfo(CNF_DISPLAYUID, hContact, szProto)); - return (uid) ? uid : _T(""); + return (uid) ? uid : L""; } void LogSpamToFile(MCONTACT hContact, tstring message) @@ -204,12 +204,12 @@ void LogSpamToFile(MCONTACT hContact, tstring message) TCHAR pszName[MAX_PATH]; if (hStopSpamLogDirH) - FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, _T("")); + FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, L""); else - mir_tstrncpy(pszName, VARST(_T("%miranda_logpath%")), _countof(pszName)); + mir_tstrncpy(pszName, VARST(L"%miranda_logpath%"), _countof(pszName)); tstring filename = pszName; - filename += _T("\\stopspam_mod.log"); + filename += L"\\stopspam_mod.log"; file.open(filename.c_str(), std::ios::out | std::ios::app); // Time Log line @@ -221,16 +221,16 @@ void LogSpamToFile(MCONTACT hContact, tstring message) // Time Log line // Name, UID and Protocol Log line - LogProtocol = DBGetContactSettingStringPAN(hContact, "Protocol", "p", _T("")); + LogProtocol = DBGetContactSettingStringPAN(hContact, "Protocol", "p", L""); LogContactName = (TCHAR*)pcli->pfnGetContactDisplayName(hContact, 0); - LogContactId = (LogProtocol == _T("")) ? _T("") : GetContactUid(hContact, LogProtocol); + LogContactId = (LogProtocol == L"") ? L"" : GetContactUid(hContact, LogProtocol); // Name, UID and Protocol Log line - LogStrW = _T("[") + LogTime.substr(0, LogTime.length() - 1) + _T("] ") + - LogContactId + _T(" - ") + - LogContactName + _T(" (") + - LogProtocol + _T("): ") + - message + _T("\n"); + LogStrW = L"[" + LogTime.substr(0, LogTime.length() - 1) + L"] " + + LogContactId + L" - " + + LogContactName + L" (" + + LogProtocol + L"): " + + message + L"\n"; char *buf = mir_u2a(LogStrW.c_str()); file.write(buf, LogStrW.length()); @@ -252,14 +252,14 @@ void CleanProtocolTmpThread(std::string proto) std::list contacts; for (MCONTACT hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str())) - if (db_get_b(hContact, "CList", "NotOnList", 0) || (_T("Not In List") == DBGetContactSettingStringPAN(hContact, "CList", "Group", _T("")))) + if (db_get_b(hContact, "CList", "NotOnList", 0) || (L"Not In List" == DBGetContactSettingStringPAN(hContact, "CList", "Group", L""))) contacts.push_back(hContact); boost::this_thread::sleep(boost::posix_time::seconds(5)); clean_mutex.lock(); std::list::iterator end = contacts.end(); for (std::list::iterator i = contacts.begin(); i != end; ++i) { - LogSpamToFile(*i, _T("Deleted")); + LogSpamToFile(*i, L"Deleted"); HistoryLogFunc(*i, "Deleted"); CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0); } @@ -284,7 +284,7 @@ void CleanProtocolExclThread(std::string proto) clean_mutex.lock(); std::list::iterator end = contacts.end(); for (std::list::iterator i = contacts.begin(); i != end; ++i) { - LogSpamToFile(*i, _T("Deleted")); + LogSpamToFile(*i, L"Deleted"); HistoryLogFunc(*i, "Deleted"); CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0); } -- cgit v1.2.3