diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-01-19 08:40:02 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-01-19 08:40:02 +0000 |
commit | 9983ccb17775804f3985ed0d3c69852c7cad0348 (patch) | |
tree | 17b37447365df3bf48984b5f1afd846f4f77fba0 /plugins | |
parent | 66b9ccda8318b710b7856960577bb0861f9488c0 (diff) |
- Another portion of _T replacement when it's not needed (from person)
git-svn-id: http://svn.miranda-ng.org/main/trunk@3160 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Boltun/src/actionQueue.cpp | 7 | ||||
-rw-r--r-- | plugins/Boltun/src/boltun.cpp | 2 | ||||
-rw-r--r-- | plugins/Boltun/src/config.cpp | 2 | ||||
-rw-r--r-- | plugins/SplashScreen/src/bitmap_funcs.cpp | 6 | ||||
-rw-r--r-- | plugins/SplashScreen/src/main.cpp | 72 | ||||
-rwxr-xr-x | plugins/StopSpamMod/src/init.cpp | 377 | ||||
-rwxr-xr-x | plugins/StopSpamMod/src/options.cpp | 187 | ||||
-rwxr-xr-x | plugins/StopSpamMod/src/stopspam.cpp | 92 | ||||
-rwxr-xr-x | plugins/StopSpamMod/src/utilities.cpp | 77 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/options.cpp | 16 | ||||
-rw-r--r-- | plugins/TabSRMM/src/selectcontainer.cpp | 10 | ||||
-rw-r--r-- | plugins/TabSRMM/src/srmm.cpp | 2 |
12 files changed, 388 insertions, 462 deletions
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index cc9e642600..4da1b56178 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -87,9 +87,9 @@ void UpdateTimer() static bool NotifyTyping(HANDLE hContact)
{
- int res = DBGetContactSettingByte(hContact, "SRMsg", "SupportTyping", 2);
+ int res = db_get_b(hContact, "SRMsg", "SupportTyping", 2);
if (res == 2)
- res = DBGetContactSettingByte(NULL, "SRMsg", "DefaultTyping", 1);
+ res = db_get_b(NULL, "SRMsg", "DefaultTyping", 1);
return res != 0;
}
@@ -238,8 +238,7 @@ void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = f void AnswerToContact(HANDLE hContact, const TCHAR* messageToAnswer)
{
- if (Config.TalkWarnContacts && DBGetContactSettingByte(hContact, BOLTUN_KEY,
- DB_CONTACT_WARNED, FALSE) == FALSE)
+ if (Config.TalkWarnContacts && db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE) == FALSE)
{
DoAnswer(hContact, new TalkBot::MessageInfo((const TCHAR*)Config.WarnText), true);
db_set_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, TRUE);
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 9c519fcebd..2248b79d16 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -470,7 +470,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (!bTranslated)
{
TCHAR* message = new TCHAR[5000];
- wsprintf(message, TranslateTS(FAILED_TO_LOAD_BASE), line, c);
+ wsprintf(message, FAILED_TO_LOAD_BASE, line, c);
MessageBox(NULL, message, BOLTUN_ERROR, MB_ICONERROR|MB_TASKMODAL|MB_OK);
delete[] message;
}
diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index 2b4e2157e0..2ecce4326e 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -106,7 +106,7 @@ BUILDINTETTERS(AnswerPauseTime, DB_WAIT_TIME, 2); BUILDINTETTERS(AnswerThinkTime, DB_THINK_TIME, 4);
BUILDETTERS(PauseDepends, DB_PAUSE_DEPENDS, TRUE);
BUILDETTERS(PauseRandom, DB_PAUSE_RANDOM, TRUE);
-BUILDSTRETTERS(WarnText, DB_WARN_TEXT, TranslateTS(DEFAULT_WARN_TEXT));
+BUILDSTRETTERS(WarnText, DB_WARN_TEXT, DEFAULT_WARN_TEXT);
BUILDSTRETTERS(MindFileName, DB_MIND_FILE_NAME, DEFAULT_MIND_FILE);
BUILDETTERS(EngineStaySilent, DB_ENGINE_SILENT, FALSE);
BUILDETTERS(EngineMakeLowerCase, DB_ENGINE_LOWERCASE, FALSE);
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp index f6f2ce5f4b..46792eed26 100644 --- a/plugins/SplashScreen/src/bitmap_funcs.cpp +++ b/plugins/SplashScreen/src/bitmap_funcs.cpp @@ -210,7 +210,7 @@ bool MyBitmap::loadFromFile(TCHAR *fn, TCHAR *fnAlpha) TCHAR *ext;
ext = &fn[lstrlen(fn)-4];
- if (!lstrcmpi(ext, _T(".png")))
+ if (!lstrcmpi(ext, L".png"))
{
HANDLE hFile, hMap = NULL;
BYTE* ppMap = NULL;
@@ -238,7 +238,7 @@ bool MyBitmap::loadFromFile(TCHAR *fn, TCHAR *fnAlpha) else
cbFileSize = 0;
#ifdef _DEBUG
- logMessage(_T("Loading splash file"), _T("done"));
+ logMessage(L"Loading splash file", L"done");
#endif
}
@@ -301,7 +301,7 @@ bool MyBitmap::loadFromFile(TCHAR *fn, TCHAR *fnAlpha) if (!hBmpLoaded)
{
#ifdef _DEBUG
- logMessage(_T("MyBitmap::loadFromFile"), _T("Bitmap load failed"));
+ logMessage(L"MyBitmap::loadFromFile", L"Bitmap load failed");
#endif
return false;
}
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 4a18a103c1..9b55118edc 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -73,18 +73,18 @@ void SplashMain() if (bstartup)
{
// Retrive path to exe of current running Miranda is located
- szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
- mir_sntprintf(szhAdvaimgPath, SIZEOF(szhAdvaimgPath), _T("%s\\plugins\\advaimg.dll"), szMirDir);
+ szMirDir = Utils_ReplaceVarsT(L"%miranda_path%");
+ mir_sntprintf(szhAdvaimgPath, SIZEOF(szhAdvaimgPath), L"%s\\plugins\\advaimg.dll", szMirDir);
CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVersion);
#ifdef _DEBUG
- mir_sntprintf(szLogFile, SIZEOF(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__PLUGIN_NAME));
+ mir_sntprintf(szLogFile, SIZEOF(szLogFile), L"%s\\%s.log", szMirDir, _T(__PLUGIN_NAME));
initLog();
TCHAR* mirandaVerString = mir_a2t(szVersion);
- logMessage(_T("Miranda version"), mirandaVerString);
+ logMessage(L"Miranda version", mirandaVerString);
mir_free(mirandaVerString);
- logMessage(_T("Dll Name"), _T(__FILENAME));
- logMessage(_T("Advaimg path"), szhAdvaimgPath);
+ logMessage(L"Dll Name", _T(__FILENAME));
+ logMessage(L"Advaimg path", szhAdvaimgPath);
#endif
ReadIniConfig();
@@ -100,7 +100,7 @@ void SplashMain() if (hUserDll == NULL)
{
- hUserDll = LoadLibrary(_T("user32.dll"));
+ hUserDll = LoadLibrary(L"user32.dll");
if (hUserDll)
MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))GetProcAddress(hUserDll, "UpdateLayeredWindow");
}
@@ -126,7 +126,7 @@ void SplashMain() }
#ifdef _DEBUG
if (png2dibConvertor)
- logMessage(_T("Loading advaimg"), _T("done"));
+ logMessage(L"Loading advaimg", L"done");
#endif
}
}
@@ -136,7 +136,7 @@ void SplashMain() DBGetContactSettingTString(NULL, MODNAME, "VersionPrefix", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
- _tcscpy_s(szPrefix, _T(""));
+ _tcscpy_s(szPrefix, L"");
DBFreeVariant(&dbv);
}
else
@@ -146,7 +146,7 @@ void SplashMain() DBGetContactSettingTString(NULL, MODNAME, "Path", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
- _tcscpy_s(inBuf, _T("splash\\splash.png"));
+ _tcscpy_s(inBuf, L"splash\\splash.png");
DBFreeVariant(&dbv);
}
else
@@ -160,14 +160,14 @@ void SplashMain() TCHAR *pos3 = 0;
pos3 = _tcsrchr(inBuf, _T(':'));
if (pos3 == NULL)
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szMirDir, inBuf);
+ mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), L"%s\\%s", szMirDir, inBuf);
else
lstrcpy(szSplashFile, inBuf);
DBGetContactSettingTString(NULL, MODNAME, "Sound", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
{
- _tcscpy_s(inBuf, _T("sounds\\startup.wav"));
+ _tcscpy_s(inBuf, L"sounds\\startup.wav");
DBFreeVariant(&dbv);
}
else
@@ -180,12 +180,12 @@ void SplashMain() TCHAR *pos2;
pos2 = _tcschr(inBuf, _T(':'));
if (pos2 == NULL)
- mir_sntprintf(szSoundFile, SIZEOF(szSoundFile), _T("%s\\%s"), szMirDir, inBuf);
+ mir_sntprintf(szSoundFile, SIZEOF(szSoundFile), L"%s\\%s", szMirDir, inBuf);
else
lstrcpy(szSoundFile, inBuf);
#ifdef _DEBUG
- logMessage(_T("SoundFilePath"), szSoundFile);
+ logMessage(L"SoundFilePath", szSoundFile);
#endif
TCHAR szOldPath[MAX_PATH] = {0};
@@ -203,7 +203,7 @@ void SplashMain() p = _tcsrchr(szSplashDir, _T('\\'));
if (p) *p = 0;
// create the search filter
- mir_sntprintf(szSearch, SIZEOF(szSearch), _T("%s\\*.*"), szSplashDir);
+ mir_sntprintf(szSearch, SIZEOF(szSearch), L"%s\\*.*", szSplashDir);
// FFFN will return filenames
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
@@ -215,7 +215,7 @@ void SplashMain() if (!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
{
#ifdef _DEBUG
- logMessage(_T("Found file"), ffd.cFileName);
+ logMessage(L"Found file", ffd.cFileName);
#endif
//files = new char[strlen(ffd.cFileName)];
//files[filescount] = new char[strlen(ffd.cFileName)];
@@ -223,14 +223,14 @@ void SplashMain() tmemcpy(ext, ffd.cFileName + (_tcslen(ffd.cFileName)-4), 5);
#ifdef _DEBUG
- logMessage(_T("Extention"), ext);
+ logMessage(L"Extention", ext);
#endif
- if (lstrcmpi(ext, _T(".png")) & lstrcmpi(ext, _T(".bmp")))
+ if (lstrcmpi(ext, L".png") & lstrcmpi(ext, L".bmp"))
continue;
#ifdef _DEBUG
- logMessage(_T("File has valid ext"), ext);
+ logMessage(L"File has valid ext", ext);
#endif
_tcscpy_s(files[filescount++], ffd.cFileName);
} //if
@@ -240,10 +240,10 @@ void SplashMain() int r = 0;
if (filescount) r = (rand() % filescount) + 1;
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szSplashDir, files[r-1]);
+ mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), L"%s\\%s", szSplashDir, files[r-1]);
#ifdef _DEBUG
- logMessage(_T("final file"), szSplashFile);
+ logMessage(L"final file", szSplashFile);
#endif
FindClose(hFind);
} //if
@@ -280,25 +280,25 @@ int PlugDisableHook(WPARAM wParam, LPARAM lParam) TCHAR * tszModule= mir_a2t(cws->szModule), *tszSetting = mir_a2t(cws->szSetting);
if(options.inheritGS)
{
- if (!lstrcmp(tszModule, _T("Skin")) & !lstrcmp(tszSetting, _T("UseSound")))
+ if (!lstrcmp(tszModule, L"Skin") & !lstrcmp(tszSetting, L"UseSound"))
{
DBWriteContactSettingByte(NULL, MODNAME, "PlaySound", cws->value.bVal);
#ifdef _DEBUG
- cws->value.bVal ? _DebugPopup(NULL, _T("Sounds enabled."), _T("")) : _DebugPopup(NULL, _T("Sounds disabled."), _T(""));
- logMessage(_T("Module"), tszModule);
- logMessage(_T("Setting"), tszSetting);
- logMessage(_T("Value"), _itot(cws->value.bVal, buf, 10));
+ cws->value.bVal ? _DebugPopup(NULL, L"Sounds enabled.", L"") : _DebugPopup(NULL, L"Sounds disabled.", L"");
+ logMessage(L"Module", tszModule);
+ logMessage(L"Setting", tszSetting);
+ logMessage(L"Value", _itot(cws->value.bVal, buf, 10));
#endif
}
- if (!lstrcmp(tszModule, _T("PluginDisable")) & (!lstrcmp(tszSetting, szDllName)))
+ if (!lstrcmp(tszModule, L"PluginDisable") & (!lstrcmp(tszSetting, szDllName)))
{
DBWriteContactSettingByte(NULL, MODNAME, "Active", cws->value.bVal);
#ifdef _DEBUG
- cws->value.bVal ? _DebugPopup(NULL, _T("Disabled."), "") : _DebugPopup(NULL, _T("Enabled."), _T(""));
- logMessage(_T("PlugDisableHook"), _T("Triggered"));
- logMessage(_T("Module"), tszModule);
- logMessage(_T("Setting"), tszSetting);
- logMessage(_T("Value"), _itot(cws->value.bVal, buf, 10));
+ cws->value.bVal ? _DebugPopup(NULL, L"Disabled.", "") : _DebugPopup(NULL, L"Enabled.", L"");
+ logMessage(L"PlugDisableHook", L"Triggered");
+ logMessage(L"Module", tszModule);
+ logMessage(L"Setting", tszSetting);
+ logMessage(L"Value", _itot(cws->value.bVal, buf, 10));
#endif
}
}
@@ -317,7 +317,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) if (PostMessage(hwndSplash, WM_LOADED, 0, 0))
{
#ifdef _DEBUG
- logMessage(_T("Posted WM_LOADED message"), _T("done"));
+ logMessage(L"Posted WM_LOADED message", L"done");
#endif
}
}
@@ -338,13 +338,13 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
mi.hotKey = 0;
mi.position = -0x7FFFFFFF;
- mi.ptszName = LPGENT("Call Splash Service");
+ mi.pszName = LPGEN("Call Splash Service");
mi.pszService = "Splash/Test";
Menu_AddMainMenuItem(&mi);
#endif
#ifdef _DEBUG
- logMessage(_T("Loading modules"), _T("done"));
+ logMessage(L"Loading modules", L"done");
#endif
return 0;
@@ -380,7 +380,7 @@ extern "C" int __declspec(dllexport) Unload(void) if (hAdvaimg) FreeLibrary(hAdvaimg);
#ifdef _DEBUG
- logMessage(_T("Unload"), _T("Job done"));
+ logMessage(L"Unload", L"Job done");
#endif
return 0;
diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 9a7e7abb24..2d1da2bf5d 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -1,190 +1,189 @@ -/* Copyright (C) Miklashevsky Roman, sss, elzor -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - - -#include "headers.h" - - - -BOOL gbDosServiceExist = 0; -BOOL gbVarsServiceExist = 0; - -DWORD gbMaxQuestCount = 5; -BOOL gbInfTalkProtection = 0; -BOOL gbAddPermanent = 0; -BOOL gbHandleAuthReq = 1; -BOOL gbSpecialGroup = 0; -BOOL gbHideContacts = 1; -BOOL gbIgnoreContacts = 0; -BOOL gbExclude = 1; -BOOL gbDelExcluded = 0; -BOOL gbDelAllTempory = 0; -BOOL gbHistoryLog = 0; -BOOL gbDosServiceIntegration = 0; -BOOL gbCaseInsensitive = 0; -BOOL gbRegexMatch = 0; -BOOL gbInvisDisable = 0; -BOOL gbIgnoreURL = 1; -BOOL gbLogToFile=0; -BOOL gbAutoAuth=0; -BOOL gbAutoAddToServerList=0; -BOOL gbAutoReqAuth=1; -BOOL gbMathExpression = 0; - -HANDLE hStopSpamLogDirH=0; - -tstring gbSpammersGroup = _T("Spammers"); -tstring gbAutoAuthGroup = _T("NotSpammers"); - -tstring gbQuestion; -tstring gbAnswer; -tstring gbCongratulation; -std::wstring gbAuthRepl; -extern char * pluginDescription; -extern TCHAR const * defQuestion; -extern int RemoveTmp(WPARAM,LPARAM); - - - -///////////////////////////////////////////////////////////////////////////////////////// -// returns plugin's extended information - -// {553811EE-DEB6-48b8-8902-A8A00C1FD679} -#define MIID_STOPSPAM { 0x553811ee, 0xdeb6, 0x48b8, { 0x89, 0x2, 0xa8, 0xa0, 0xc, 0x1f, 0xd6, 0x79 } } - -PLUGININFOEX pluginInfoEx = { - sizeof(PLUGININFOEX), - pluginName" mod", - PLUGIN_MAKE_VERSION(0, 0, 2, 0), - pluginDescription, - "Roman Miklashevsky, sss, Elzor", - "sss123next@list.ru", - "© 2004-2012 Roman Miklashevsky, A. Petkevich, Kosh&chka, sss, Elzor", - "http://sss.chaoslab.ru/tracker/mim_plugs/", - UNICODE_AWARE, - MIID_STOPSPAM -}; - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) -{ - return &pluginInfoEx; -} - -extern tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue); - -void InitVars() -{ - gbDosServiceIntegration = DBGetContactSettingByte(NULL, pluginName, "DOSIntegration", 0); - 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.")); - gbInfTalkProtection = DBGetContactSettingByte(NULL, pluginName, "infTalkProtection", 0); - gbAddPermanent = DBGetContactSettingByte(NULL, pluginName, "addPermanent", 0); - gbMaxQuestCount = DBGetContactSettingDword(NULL, pluginName, "maxQuestCount", 5); - gbHandleAuthReq = DBGetContactSettingByte(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 a anti-spam bot question.")); - gbSpecialGroup = DBGetContactSettingByte(NULL, pluginName, "SpecialGroup", 0); - gbHideContacts = DBGetContactSettingByte(NULL, pluginName, "HideContacts", 0); - gbIgnoreContacts = DBGetContactSettingByte(NULL, pluginName, "IgnoreContacts", 0); - gbExclude = DBGetContactSettingByte(NULL, pluginName, "ExcludeContacts", 1); - gbDelExcluded = DBGetContactSettingByte(NULL, pluginName, "DelExcluded", 0); - gbDelAllTempory = DBGetContactSettingByte(NULL, pluginName, "DelAllTempory", 0); - gbCaseInsensitive = DBGetContactSettingByte(NULL, pluginName, "CaseInsensitive", 0); - gbRegexMatch = DBGetContactSettingByte(NULL, pluginName, "RegexMatch", 0); - gbInvisDisable = DBGetContactSettingByte(NULL, pluginName, "DisableInInvis", 0); - gbIgnoreURL = DBGetContactSettingByte(NULL, pluginName, "IgnoreURL", 0); - gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("Not Spammers")); - gbAutoAuth=DBGetContactSettingByte(NULL, pluginName, "AutoAuth", 0); - gbAutoAddToServerList=DBGetContactSettingByte(NULL, pluginName, "AutoAddToServerList", 0); - gbAutoReqAuth=DBGetContactSettingByte(NULL, pluginName, "AutoReqAuth", 0); - gbLogToFile=DBGetContactSettingByte(NULL, pluginName, "LogSpamToFile", 0); - gbHistoryLog = DBGetContactSettingByte(NULL, pluginName, "HistoryLog", 0); - gbMathExpression = DBGetContactSettingByte(NULL, pluginName, "MathExpression", 0); - -} - -static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) -{ -/* if (ServiceExists(MS_DOS_SERVICE)) - gbDosServiceExist = TRUE; */ - if (ServiceExists(MS_VARS_FORMATSTRING)) - gbVarsServiceExist = TRUE; - InitVars(); - void CleanThread(); - if(gbDelAllTempory || gbDelExcluded) - boost::thread *thr = new boost::thread(&CleanThread); - // Folders plugin support - if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) - { - hStopSpamLogDirH = (HANDLE) FoldersRegisterCustomPath("StopSpam", "StopSpam Logs", - PROFILE_PATH "\\" CURRENT_PROFILE "\\StopSpamLog"); - } - return 0; -} - -HANDLE hEventFilter = 0, hOptInitialise = 0, hSettingChanged = 0; - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) -{ - /*if(DLL_PROCESS_ATTACH == fdwReason) - hInst=hinstDLL; - return TRUE;*/ - hInst = hinstDLL; - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// returns plugin's interfaces information - -static const MUUID interfaces[] = { MIID_STOPSPAM, MIID_LAST }; - -extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) -{ - return interfaces; -} - -int hLangpack = 0; - -extern "C" int __declspec(dllexport) Load() -{ - mir_getLP(&pluginInfoEx); - - CreateServiceFunction("/RemoveTmp", (MIRANDASERVICE)RemoveTmp); - HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); - +/* Copyright (C) Miklashevsky Roman, sss, elzor
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+
+#include "headers.h"
+
+
+
+BOOL gbDosServiceExist = 0;
+BOOL gbVarsServiceExist = 0;
+
+DWORD gbMaxQuestCount = 5;
+BOOL gbInfTalkProtection = 0;
+BOOL gbAddPermanent = 0;
+BOOL gbHandleAuthReq = 1;
+BOOL gbSpecialGroup = 0;
+BOOL gbHideContacts = 1;
+BOOL gbIgnoreContacts = 0;
+BOOL gbExclude = 1;
+BOOL gbDelExcluded = 0;
+BOOL gbDelAllTempory = 0;
+BOOL gbHistoryLog = 0;
+BOOL gbDosServiceIntegration = 0;
+BOOL gbCaseInsensitive = 0;
+BOOL gbRegexMatch = 0;
+BOOL gbInvisDisable = 0;
+BOOL gbIgnoreURL = 1;
+BOOL gbLogToFile=0;
+BOOL gbAutoAuth=0;
+BOOL gbAutoAddToServerList=0;
+BOOL gbAutoReqAuth=1;
+BOOL gbMathExpression = 0;
+
+HANDLE hStopSpamLogDirH=0;
+
+tstring gbSpammersGroup = _T("Spammers");
+tstring gbAutoAuthGroup = _T("NotSpammers");
+
+tstring gbQuestion;
+tstring gbAnswer;
+tstring gbCongratulation;
+std::wstring gbAuthRepl;
+extern char * pluginDescription;
+extern TCHAR const * defQuestion;
+extern int RemoveTmp(WPARAM,LPARAM);
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// returns plugin's extended information
+
+// {553811EE-DEB6-48b8-8902-A8A00C1FD679}
+#define MIID_STOPSPAM { 0x553811ee, 0xdeb6, 0x48b8, { 0x89, 0x2, 0xa8, 0xa0, 0xc, 0x1f, 0xd6, 0x79 } }
+
+PLUGININFOEX pluginInfoEx = {
+ sizeof(PLUGININFOEX),
+ pluginName" mod",
+ PLUGIN_MAKE_VERSION(0, 0, 2, 0),
+ pluginDescription,
+ "Roman Miklashevsky, sss, Elzor",
+ "sss123next@list.ru",
+ "© 2004-2012 Roman Miklashevsky, A. Petkevich, Kosh&chka, sss, Elzor",
+ "http://sss.chaoslab.ru/tracker/mim_plugs/",
+ UNICODE_AWARE,
+ MIID_STOPSPAM
+};
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfoEx;
+}
+
+extern tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue);
+
+void InitVars()
+{
+ gbDosServiceIntegration = db_get_b(NULL, pluginName, "DOSIntegration", 0);
+ 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."));
+ 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 a 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);
+ gbExclude = db_get_b(NULL, pluginName, "ExcludeContacts", 1);
+ gbDelExcluded = db_get_b(NULL, pluginName, "DelExcluded", 0);
+ gbDelAllTempory = db_get_b(NULL, pluginName, "DelAllTempory", 0);
+ gbCaseInsensitive = db_get_b(NULL, pluginName, "CaseInsensitive", 0);
+ 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"));
+ gbAutoAuth = db_get_b(NULL, pluginName, "AutoAuth", 0);
+ gbAutoAddToServerList = db_get_b(NULL, pluginName, "AutoAddToServerList", 0);
+ gbAutoReqAuth = db_get_b(NULL, pluginName, "AutoReqAuth", 0);
+ gbLogToFile = db_get_b(NULL, pluginName, "LogSpamToFile", 0);
+ gbHistoryLog = db_get_b(NULL, pluginName, "HistoryLog", 0);
+ gbMathExpression = db_get_b(NULL, pluginName, "MathExpression", 0);
+
+}
+
+static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam)
+{
+/* if (ServiceExists(MS_DOS_SERVICE))
+ gbDosServiceExist = TRUE; */
+ if (ServiceExists(MS_VARS_FORMATSTRING))
+ gbVarsServiceExist = TRUE;
+ InitVars();
+ void CleanThread();
+ if(gbDelAllTempory || gbDelExcluded)
+ boost::thread *thr = new boost::thread(&CleanThread);
+ // Folders plugin support
+ if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
+ {
+ hStopSpamLogDirH = (HANDLE) FoldersRegisterCustomPath("StopSpam", "StopSpam Logs", PROFILE_PATH "\\" CURRENT_PROFILE "\\StopSpamLog");
+ }
+ return 0;
+}
+
+HANDLE hEventFilter = 0, hOptInitialise = 0, hSettingChanged = 0;
+
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ /*if(DLL_PROCESS_ATTACH == fdwReason)
+ hInst=hinstDLL;
+ return TRUE;*/
+ hInst = hinstDLL;
+ return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// returns plugin's interfaces information
+
+static const MUUID interfaces[] = { MIID_STOPSPAM, MIID_LAST };
+
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ return interfaces;
+}
+
+int hLangpack = 0;
+
+extern "C" int __declspec(dllexport) Load()
+{
+ mir_getLP(&pluginInfoEx);
+
+ CreateServiceFunction("/RemoveTmp", (MIRANDASERVICE)RemoveTmp);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
+
CLISTMENUITEM mi = { sizeof(mi) };
- mi.position=-0x7FFFFFFF; - mi.flags=0; - mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - mi.pszName="Remove Temporary Contacts"; - mi.pszService="/RemoveTmp"; - - Menu_AddMainMenuItem(&mi); - - miranda::EventHooker::HookAll(); - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - miranda::EventHooker::UnhookAll(); - return 0; -} + mi.position=-0x7FFFFFFF;
+ mi.flags=0;
+ mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ mi.pszName=LPGEN("Remove Temporary Contacts");
+ mi.pszService="/RemoveTmp";
+
+ Menu_AddMainMenuItem(&mi);
+
+ miranda::EventHooker::HookAll();
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ miranda::EventHooker::UnhookAll();
+ return 0;
+}
diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index 5757f06fe7..7f03d86ed5 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -19,16 +19,15 @@ #define MIRANDA_VER 0x0800 #include "headers.h" -char * pluginDescription = "No more spam! Robots can't go! Only human beings invited!\r\n\r\n" +char * pluginDescription = LPGEN("No more spam! Robots can't go! Only human beings invited!\r\n\r\n" "This plugin works pretty simple:\r\n" "While messages from users on your contact list go as there is no any anti-spam software, " "messages from unknown users are not delivered to you. " "But also they are not ignored, this plugin replies with a simple question, " "and if user gives the right answer plugin adds him to your contact list " -"so that he can contact you."; -TCHAR const * defQuestion = -_T("Spammers made me to install small anti-spam system you are now speaking with.\r\n") -_T("Please reply \"nospam\" without quotes and spaces if you want to contact me."); +"so that he can contact you."); +TCHAR const * defQuestion = TranslateT("Spammers made me to install small anti-spam system you are now speaking with.\r\n" +"Please reply \"nospam\" without quotes and spaces if you want to contact me."); INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -69,20 +68,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { case PSN_APPLY: { - DBWriteContactSettingDword(NULL, pluginName, "maxQuestCount", gbMaxQuestCount = - GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE)); - DBWriteContactSettingByte(NULL, pluginName, "infTalkProtection", gbInfTalkProtection = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_INFTALKPROT, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "addPermanent", gbAddPermanent = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_ADDPERMANENT, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "handleAuthReq", gbHandleAuthReq = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_HANDLEAUTHREQ, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "HideContacts", gbHideContacts = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_HIDECONTACTS, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "IgnoreContacts", gbIgnoreContacts = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNORESPAMMERS, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "LogSpamToFile", gbLogToFile = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_LOGSPAMTOFILE, BM_GETCHECK, 0, 0)); + db_set_dw(NULL, pluginName, "maxQuestCount", gbMaxQuestCount = GetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, NULL, FALSE)); + db_set_b(NULL, pluginName, "infTalkProtection", gbInfTalkProtection = BST_CHECKED == SendDlgItemMessage(hwnd, ID_INFTALKPROT, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "addPermanent", gbAddPermanent = BST_CHECKED == SendDlgItemMessage(hwnd, ID_ADDPERMANENT, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "handleAuthReq", gbHandleAuthReq = BST_CHECKED == SendDlgItemMessage(hwnd, ID_HANDLEAUTHREQ, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "HideContacts", gbHideContacts = BST_CHECKED == SendDlgItemMessage(hwnd, ID_HIDECONTACTS, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "IgnoreContacts", gbIgnoreContacts = BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNORESPAMMERS, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "LogSpamToFile", gbLogToFile = BST_CHECKED == SendDlgItemMessage(hwnd, ID_LOGSPAMTOFILE, BM_GETCHECK, 0, 0)); } return TRUE; } @@ -123,10 +115,10 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break; } case ID_RESTOREDEFAULTS: - SetDlgItemText(hwnd, ID_QUESTION, TranslateTS(defQuestion)); - SetDlgItemText(hwnd, ID_ANSWER, TranslateTS(_T("nospam"))); - SetDlgItemText(hwnd, ID_AUTHREPL, TranslateTS(_T("StopSpam: send a message and reply to a anti-spam bot question."))); - SetDlgItemText(hwnd, ID_CONGRATULATION, TranslateTS(_T("Congratulations! You just passed human/robot test. Now you can write me a message."))); + SetDlgItemText(hwnd, ID_QUESTION, defQuestion); + SetDlgItemText(hwnd, ID_ANSWER, TranslateT("nospam")); + SetDlgItemText(hwnd, ID_AUTHREPL, TranslateT("StopSpam: send a message and reply to a 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); return TRUE; case IDC_VARS: @@ -143,30 +135,25 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { case PSN_APPLY: { - DBWriteContactSettingTString(NULL, pluginName, "question", - GetDlgItemString(hwnd, ID_QUESTION).c_str()); + db_set_ws(NULL, pluginName, "question", GetDlgItemString(hwnd, ID_QUESTION).c_str()); gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion); - DBWriteContactSettingTString(NULL, pluginName, "answer", - GetDlgItemString(hwnd, ID_ANSWER).c_str()); - gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam")); - DBWriteContactSettingTString(NULL, pluginName, "authrepl", - GetDlgItemString(hwnd, ID_AUTHREPL).c_str()); - gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", _T("StopSpam: send a message and reply to a anti-spam bot question.")); - DBWriteContactSettingTString(NULL, pluginName, "congratulation", - GetDlgItemString(hwnd, ID_CONGRATULATION).c_str()); - gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", _T("Congratulations! You just passed human/robot test. Now you can write me a message.")); + db_set_ws(NULL, pluginName, "answer", GetDlgItemString(hwnd, ID_ANSWER).c_str()); + gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", TranslateT("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 a anti-spam bot question.")); + db_set_ws(NULL, pluginName, "congratulation", GetDlgItemString(hwnd, ID_CONGRATULATION).c_str()); + gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message.")); } return TRUE; } } - break; + break; } return FALSE; } INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(msg) { case WM_INITDIALOG: @@ -175,10 +162,8 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int n; PROTOACCOUNT **pppd; if(!ProtoEnumAccounts(&n, &pppd)) - for(int i = 0; i < n; ++i) - { - SendDlgItemMessageA(hwnd, (ProtoInList(pppd[i]->szModuleName) ? ID_USEDPROTO : ID_ALLPROTO), - LB_ADDSTRING, 0, (LPARAM)pppd[i]->szModuleName); + for (int i = 0; i < n; ++i) { + SendDlgItemMessageA(hwnd, (ProtoInList(pppd[i]->szModuleName) ? ID_USEDPROTO : ID_ALLPROTO), LB_ADDSTRING, 0, (LPARAM)pppd[i]->szModuleName); } } return TRUE; @@ -188,11 +173,9 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case ID_ADD: { WPARAM n = (WPARAM)SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETCURSEL, 0, 0); - if(LB_ERR != n) - { + if(LB_ERR != n) { size_t len = SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETTEXTLEN, n, 0); - if(LB_ERR != len) - { + if(LB_ERR != len) { TCHAR * buf = new TCHAR[len + 1]; SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETTEXT, n, (LPARAM)buf); SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_ADDSTRING, 0, (LPARAM)buf); @@ -205,11 +188,9 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case ID_REMOVE: { WPARAM n = (WPARAM)SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETCURSEL, 0, 0); - if(LB_ERR != n) - { + if(LB_ERR != n) { size_t len = SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETTEXTLEN, n, 0); - if(LB_ERR != len) - { + if(LB_ERR != len) { TCHAR * buf = new TCHAR[len + 1]; SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETTEXT, n, (LPARAM)buf); SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_ADDSTRING, 0, (LPARAM)buf); @@ -253,34 +234,30 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT count = SendDlgItemMessage(hwnd, ID_USEDPROTO, LB_GETCOUNT, 0, 0); std::ostringstream out; - for(int i = 0; i < count; ++i) - { + for(int i = 0; i < count; ++i) { size_t len = SendDlgItemMessageA(hwnd, ID_USEDPROTO, LB_GETTEXTLEN, i, 0); - if(LB_ERR != len) - { + if(LB_ERR != len) { char * buf = new char[len + 1]; SendDlgItemMessageA(hwnd, ID_USEDPROTO, LB_GETTEXT, i, (LPARAM)buf); out << buf << "\r\n"; delete []buf; } } - DBWriteContactSettingString(NULL, pluginName, "protoList", out.str().c_str()); + db_set_s(NULL, pluginName, "protoList", out.str().c_str()); } return TRUE; - } + } } - break; + break; } return FALSE; } INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(msg) { - case WM_INITDIALOG: - { + case WM_INITDIALOG: { TranslateDialogDefault(hwnd); SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_SETCHECK, gbInvisDisable ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_SETCHECK, gbCaseInsensitive ? BST_CHECKED : BST_UNCHECKED, 0); @@ -302,12 +279,11 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetDlgItemText(hwnd, IDC_AUTOADDGROUP, gbAutoAuthGroup.c_str()); } return TRUE; - case WM_COMMAND:{ + case WM_COMMAND: { switch (LOWORD(wParam)) { - case IDC_MATH_DETAILS: - { - MessageBox(NULL, TranslateT("If math expression is turned on you can use following expression in message text:\nXX+XX-X/X*X\neach X will be replaced by one ruandom number and answer will be expression result\nMessage must contain only one expression without spaces"), _T("Info"), MB_OK); + case IDC_MATH_DETAILS: { + MessageBox(NULL, TranslateT("If math expression is turned on you can use following expression in message text:\nXX+XX-X/X*X\neach X will be replaced by one ruandom number and answer will be expression result\nMessage must contain only one expression without spaces"), TranslateT("Info"), MB_OK); } break; case IDC_INVIS_DISABLE: @@ -327,106 +303,82 @@ INT_PTR CALLBACK AdvancedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case IDC_HISTORY_LOG: SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; - } - } + } break; - case WM_NOTIFY: - { + case WM_NOTIFY: { NMHDR* nmhdr = (NMHDR*)lParam; switch (nmhdr->code) { - case PSN_APPLY: - { - DBWriteContactSettingByte(NULL, pluginName, "CaseInsensitive", gbCaseInsensitive = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "DisableInInvis", gbInvisDisable = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_GETCHECK, 0, 0)); + case PSN_APPLY: { + db_set_b(NULL, pluginName, "CaseInsensitive", gbCaseInsensitive = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_CASE_INSENSITIVE, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DisableInInvis", gbInvisDisable = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_INVIS_DISABLE, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DOSIntegration", gbDosServiceIntegration = BST_CHECKED == SendDlgItemMessage(hwnd, ID_DOS_INTEGRATION, BM_GETCHECK, 0, 0)); { static tstring NewGroupName, CurrentGroupName; NewGroupName = GetDlgItemString(hwnd, ID_SPECIALGROUPNAME); CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("0")); - if(wcscmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0) - { + if (wcscmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0) { int GroupNumber = 0; BYTE GroupExist = 0; TCHAR szValue[96] = {0}; char szNumber[32] = {0}; extern int CreateCListGroup(TCHAR* szGroupName); strcpy(szNumber, "0"); - while(strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0) - { + while (strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0) { _itoa(GroupNumber, szNumber, 10); wcscpy(szValue, DBGetContactSettingStringPAN(NULL, "CListGroups", szNumber, _T("0")).c_str()); - if(wcscmp(NewGroupName.c_str(), szValue + 1) == 0) - { + if (wcscmp(NewGroupName.c_str(), szValue + 1) == 0) { GroupExist = 1; break; } GroupNumber++; } - DBWriteContactSettingTString(NULL,pluginName, "SpammersGroup", NewGroupName.c_str()); + db_set_ws(NULL,pluginName, "SpammersGroup", NewGroupName.c_str()); gbSpammersGroup = DBGetContactSettingStringPAN(NULL,pluginName,"SpammersGroup", _T("Spammers")); if(!GroupExist && gbSpecialGroup) CreateCListGroup((TCHAR*)gbSpammersGroup.c_str()); } } - DBWriteContactSettingByte(NULL, pluginName, "SpecialGroup", gbSpecialGroup = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "ExcludeContacts", gbExclude = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "DelExcluded", gbDelExcluded = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "DelAllTempory", gbDelAllTempory = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP_ALL, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "IgnoreURL", gbIgnoreURL = - BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "SpecialGroup", gbSpecialGroup = BST_CHECKED == SendDlgItemMessage(hwnd, ID_SPECIALGROUP, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "ExcludeContacts", gbExclude = BST_CHECKED == SendDlgItemMessage(hwnd, ID_EXCLUDE, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DelExcluded", gbDelExcluded = BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "DelAllTempory", gbDelAllTempory = BST_CHECKED == SendDlgItemMessage(hwnd, ID_REMOVE_TMP_ALL, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "IgnoreURL", gbIgnoreURL = BST_CHECKED == SendDlgItemMessage(hwnd, ID_IGNOREURL, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "AutoAuth", gbAutoAuth = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_AUTOAUTH, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "AutoAddToServerList", gbAutoAddToServerList = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_ADDTOSRVLST, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "AutoReqAuth", gbAutoReqAuth = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REQAUTH, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "RegexMatch", gbRegexMatch = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REGEX, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "HistoryLog", gbHistoryLog = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_HISTORY_LOG, BM_GETCHECK, 0, 0)); - DBWriteContactSettingByte(NULL, pluginName, "MathExpression", gbMathExpression = - BST_CHECKED == SendDlgItemMessage(hwnd, IDC_MATH_QUESTION, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "AutoAuth", gbAutoAuth = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_AUTOAUTH, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "AutoAddToServerList", gbAutoAddToServerList = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_ADDTOSRVLST, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "AutoReqAuth", gbAutoReqAuth = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REQAUTH, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "RegexMatch", gbRegexMatch = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_REGEX, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "HistoryLog", gbHistoryLog = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_HISTORY_LOG, BM_GETCHECK, 0, 0)); + db_set_b(NULL, pluginName, "MathExpression", gbMathExpression = BST_CHECKED == SendDlgItemMessage(hwnd, IDC_MATH_QUESTION, BM_GETCHECK, 0, 0)); { static tstring NewAGroupName, CurrentAGroupName; NewAGroupName = GetDlgItemString(hwnd, IDC_AUTOADDGROUP); CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, pluginName, "AutoAuthGroup", _T("0")); - if(wcscmp(CurrentAGroupName.c_str(), NewAGroupName.c_str()) != 0) - { + if (wcscmp(CurrentAGroupName.c_str(), NewAGroupName.c_str()) != 0) { int GroupNumber = 0; BYTE GroupExist = 0; TCHAR szValue[96] = {0}; char szNumber[32] = {0}; extern int CreateCListGroup(TCHAR* szGroupName); strcpy(szNumber, "0"); - while(strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0) - { + while (strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0) { _itoa(GroupNumber, szNumber, 10); wcscpy(szValue, DBGetContactSettingStringPAN(NULL, "CListGroups", szNumber, _T("0")).c_str()); - if(wcscmp(NewAGroupName.c_str(), szValue + 1) == 0) - { + if (wcscmp(NewAGroupName.c_str(), szValue + 1) == 0) { GroupExist = 1; break; } GroupNumber++; } - DBWriteContactSettingTString(NULL,pluginName, "AutoAuthGroup", NewAGroupName.c_str()); + db_set_ws(NULL,pluginName, "AutoAuthGroup", NewAGroupName.c_str()); gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL,pluginName,"AutoAuthGroup", _T("Not Spammers")); if(!GroupExist && gbAutoAddToServerList) CreateCListGroup((TCHAR*)gbAutoAuthGroup.c_str()); } } - } return TRUE; } @@ -442,33 +394,32 @@ MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) { OPTIONSDIALOGPAGE odp = {0}; odp.cbSize = sizeof(odp); - odp.ptszGroup = _T("Message Sessions"); - odp.ptszTitle = _T(pluginName); + odp.pszGroup = LPGEN("Message Sessions"); + odp.pszTitle = LPGEN("StopSpam"); odp.position = -1; odp.hInstance = hInst; odp.flags = ODPF_TCHAR; - odp.ptszTab = _T("Main"); + odp.pszTab = LPGEN("Main"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN); odp.pfnDlgProc = MainDlgProc; Options_AddPage(w, &odp); - odp.ptszTab = _T("Messages"); + odp.pszTab = LPGEN("Messages"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_MESSAGES); odp.pfnDlgProc = MessagesDlgProc; Options_AddPage(w, &odp); - odp.ptszTab = _T("Protocols"); + odp.pszTab = LPGEN("Protocols"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROTO); odp.pfnDlgProc = ProtoDlgProc; Options_AddPage(w, &odp); - odp.ptszTab = _T("Advanced"); + odp.pszTab = LPGEN("Advanced"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_ADVANCED); odp.pfnDlgProc = AdvancedDlgProc; Options_AddPage(w, &odp); return 0; } - diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index f8d9f205c7..4ac29df394 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -33,7 +33,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); - if(-1 == dbei.cbBlob) + if(-1 == dbei.cbBlob) return 0; dbei.pBlob = new BYTE[dbei.cbBlob]; @@ -53,17 +53,17 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) HANDLE hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact - int a = DBGetContactSettingByte(hcntct, "CList", "NotOnList", 0); - int b = !DBGetContactSettingByte(hcntct, pluginName, "Answered", 0); + int a = db_get_b(hcntct, "CList", "NotOnList", 0); + int b = !db_get_b(hcntct, pluginName, "Answered", 0); - if(a && b)// + if(a && b)// { // ...send message if(gbHideContacts) - DBWriteContactSettingByte(hcntct, "CList", "Hidden", 1); + db_set_b(hcntct, "CList", "Hidden", 1); if(gbSpecialGroup) - DBWriteContactSettingTString(hcntct, "CList", "Group", gbSpammersGroup.c_str()); + db_set_ws(hcntct, "CList", "Group", gbSpammersGroup.c_str()); BYTE msg = 1; if(gbIgnoreURL){ TCHAR* EventText = ReqGetText(&dbei); //else return NULL @@ -74,8 +74,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) { if(CallProtoService(dbei.szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) msg = 0; - else if(DBGetContactSettingWord(hContact,dbei.szModule,"ApparentMode",0) == ID_STATUS_OFFLINE) - msg = 0; //is it useful ? + else if(db_get_w(hContact,dbei.szModule,"ApparentMode",0) == ID_STATUS_OFFLINE) + msg = 0; //is it useful ? } if(msg) { @@ -107,12 +107,12 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) } //do not check excluded contact - if(DBGetContactSettingByte(hContact, pluginName, "Answered", 0)) + if(db_get_b(hContact, pluginName, "Answered", 0)) return 0; - if(DBGetContactSettingByte(hContact, pluginName, "Excluded", 0)) + if(db_get_b(hContact, pluginName, "Excluded", 0)) { - if(!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) - DBDeleteContactSetting(hContact, pluginName, "Excluded"); + if(!db_get_b(hContact, "CList", "NotOnList", 0)) + db_unset(hContact, pluginName, "Excluded"); return 0; } //we want block not only messages, i seen many types other eventtype flood @@ -120,14 +120,14 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // ...let the event go its way return 0; //mark contact which we trying to contact for exclude from check - if((dbei->flags & DBEF_SENT) && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) - && (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) && gbExclude) + if((dbei->flags & DBEF_SENT) && db_get_b(hContact, "CList", "NotOnList", 0) + && (!gbMaxQuestCount || db_get_dw(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) && gbExclude) { - DBWriteContactSettingByte(hContact, pluginName, "Excluded", 1); + db_set_b(hContact, pluginName, "Excluded", 1); return 0; } // if message is from known or marked Answered contact - if(!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) + if(!db_get_b(hContact, "CList", "NotOnList", 0)) // ...let the event go its way return 0; // if message is corrupted or empty it cannot be an answer. @@ -157,7 +157,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) { if(CallProtoService(dbei->szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) msg = 0; - else if(DBGetContactSettingWord(hContact,dbei->szModule,"ApparentMode",0) == ID_STATUS_OFFLINE) + else if(db_get_w(hContact,dbei->szModule,"ApparentMode",0) == ID_STATUS_OFFLINE) msg = 0; //is it useful ? } bool answered = false; @@ -189,20 +189,20 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) boost::regex expr(check); answered = boost::regex_search(msg.begin(), msg.end(), expr); } - } + } if(answered) { // unhide contact - DBDeleteContactSetting(hContact, "CList", "Hidden"); + db_unset(hContact, "CList", "Hidden"); - DBDeleteContactSetting(hContact, pluginName, "MathAnswer"); + db_unset(hContact, pluginName, "MathAnswer"); // mark contact as Answered - DBWriteContactSettingByte(hContact, pluginName, "Answered", 1); + db_set_b(hContact, pluginName, "Answered", 1); //add contact permanently if(gbAddPermanent) //do not use this ) - DBDeleteContactSetting(hContact, "CList", "NotOnList"); + db_unset(hContact, "CList", "NotOnList"); // send congratulation if(msg) @@ -211,13 +211,9 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // for notICQ protocols or disable auto auth. reqwest if((Stricmp(_T("ICQ"),prot.c_str()))||(!gbAutoReqAuth)) { -#ifdef _UNICODE char * buf=mir_utf8encodeW(variables_parse(gbCongratulation, hContact).c_str()); CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); -#else - CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)GetCongratulation().c_str()); -#endif }; // Note: For ANSI can be not work if(!Stricmp(_T("ICQ"),prot.c_str())){ @@ -227,9 +223,9 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // add contact to server list and local group if(gbAutoAddToServerList) { - DBWriteContactSettingTString(hContact, "CList", "Group", gbAutoAuthGroup.c_str()); + db_set_ws(hContact, "CList", "Group", gbAutoAuthGroup.c_str()); CallProtoService(dbei->szModule, "/AddServerContact", w, 0); - DBDeleteContactSetting(hContact, "CList", "NotOnList"); + db_unset(hContact, "CList", "NotOnList"); }; // auto auth. reqwest with send congratulation if(gbAutoReqAuth) @@ -245,7 +241,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) if(msg) { if((!gbInfTalkProtection || tstring::npos==message.find(_T("StopSpam automatic message:\r\n"))) - && (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount)) + && (!gbMaxQuestCount || db_get_dw(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount)) { // send question tstring q; @@ -262,18 +258,12 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) { std::string arg; p2 = p1; -#ifdef UNICODE for(p1 = gbQuestion.find(_T("X"), p1); (p1 < gbQuestion.length()) && (gbQuestion[p1] == L'X'); ++p1) -#else - for(p1 = gbQuestion.find(_T("X"), p1); gbQuestion[p1] == 'X'; ++p1) -#endif arg += get_random_num(1); -#ifdef UNICODE + tmp_question.replace(p2, arg.size(), toUTF16(arg)); -#else - tmp_question.replace(p2, arg.size(), arg); -#endif args.push_back(atoi(arg.c_str())); + if((p1 < gbQuestion.length()) && (p1 != tstring::npos) && (expr_acts.find(gbQuestion[p1]) != tstring::npos)) actions.push_back(gbQuestion[p1]); ++p1; @@ -317,23 +307,19 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) else break; } - DBWriteContactSettingDword(hContact, pluginName, "MathAnswer", math_answer); + db_set_dw(hContact, pluginName, "MathAnswer", math_answer); q += variables_parse(tmp_question, hContact); } else q += variables_parse(gbQuestion, hContact); -#ifdef _UNICODE char * buf=mir_utf8encodeW(q.c_str()); CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); -#else - CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)q.c_str()); -#endif // increment question count - DWORD questCount = DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0); - DBWriteContactSettingDword(hContact, pluginName, "QuestionCount", questCount + 1); + DWORD questCount = db_get_dw(hContact, pluginName, "QuestionCount", 0); + db_set_dw(hContact, pluginName, "QuestionCount", questCount + 1); } else { @@ -348,18 +334,18 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) } */ if(gbIgnoreContacts) { - DBWriteContactSettingDword(hContact, "Ignore", "Mask1", 0x0000007F); + db_set_dw(hContact, "Ignore", "Mask1", 0x0000007F); } } } if(gbHideContacts) - DBWriteContactSettingByte(hContact, "CList", "Hidden", 1); + db_set_b(hContact, "CList", "Hidden", 1); if(gbSpecialGroup) - DBWriteContactSettingTString(hContact, "CList", "Group", gbSpammersGroup.c_str()); - DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1); + db_set_ws(hContact, "CList", "Group", gbSpammersGroup.c_str()); + db_set_b(hContact, "CList", "NotOnList", 1); // save first message from contact - if (DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0)<2){ + if (db_get_dw(hContact, pluginName, "QuestionCount", 0)<2){ dbei->flags |= DBEF_READ; CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)dbei); }; @@ -368,7 +354,6 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) return 1; } - MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) { HANDLE hContact = (HANDLE)w; @@ -381,12 +366,9 @@ MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) return 0; if(!cws->value.type) { - DBDeleteContactSetting(hContact, pluginName, "Answered"); - DBDeleteContactSetting(hContact, pluginName, "QuestionCount"); + db_unset(hContact, pluginName, "Answered"); + db_unset(hContact, pluginName, "QuestionCount"); } return 0; } - - - diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index e4c3813211..84eeaf79f0 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -22,7 +22,7 @@ tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, cha { DBVARIANT dbv; //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv)) - if(DBGetContactSettingTString(hContact, szModule, szSetting, &dbv)) + if(db_get_s(hContact, szModule, szSetting, &dbv)) return errorValue; // if(DBVT_TCHAR == dbv.type ) errorValue = dbv.ptszVal; @@ -34,7 +34,7 @@ std::string DBGetContactSettingStringPAN_A(HANDLE hContact, char const * szModul { DBVARIANT dbv; //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv)) - if(DBGetContactSettingString(hContact, szModule, szSetting, &dbv)) + if(db_get_s(hContact, szModule, szSetting, &dbv)) return errorValue; // if(DBVT_ASCIIZ == dbv.type ) errorValue = dbv.pszVal; @@ -52,7 +52,7 @@ tstring &GetDlgItemString(HWND hwnd, int id) s = buf; delete []buf; return s; -} +} std::string &GetProtoList() { @@ -60,7 +60,6 @@ std::string &GetProtoList() return s = DBGetContactSettingStringPAN_A(NULL, pluginName, "protoList", "ICQ\r\n"); } - bool ProtoInList(std::string proto) { return std::string::npos != GetProtoList().find(proto + "\r\n"); @@ -89,23 +88,23 @@ void DeleteCListGroupsByName(TCHAR* szGroupName) TCHAR szValue[96] = {0}; char szNumber[32] = {0}; strcpy(szNumber, "0"); - BYTE ConfirmDelete=DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT); - if(ConfirmDelete) - DBWriteContactSettingByte(NULL, "CList", "ConfirmDelete",0); + BYTE ConfirmDelete=db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT); + if(ConfirmDelete) + db_set_b(NULL, "CList", "ConfirmDelete", 0); while(strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0) { wcscpy(szValue, DBGetContactSettingStringPAN(NULL, "CListGroups", szNumber, _T("0")).c_str()); if(wcscmp(szGroupName, szValue + 1) == 0) - CallService(MS_CLIST_GROUPDELETE,(WPARAM)(HANDLE)GroupNumber+1,0); // bug or ??? @_@ + CallService(MS_CLIST_GROUPDELETE, (WPARAM)(HANDLE)GroupNumber+1, 0); // bug or ??? @_@ GroupNumber++; #if defined(_MSC_VER) && _MSC_VER >= 1300 _itoa_s(GroupNumber, szNumber, sizeof(szNumber), 10); #else _itoa(GroupNumber, szNumber, 10); -#endif +#endif }; - if(ConfirmDelete) - DBWriteContactSettingByte(NULL, "CList", "ConfirmDelete",ConfirmDelete); + if(ConfirmDelete) + db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete); } /* @@ -135,7 +134,7 @@ void RemoveExcludedUsers() std::string proto=DBGetContactSettingStringPAN_A(plist->hContact,"Protocol","p",""); UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0); - if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){ + if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){ LogSpamToFile(plist->hContact, _T("Mark for delete")); DBWriteContactSettingByte(plist->hContact,"CList","Delete", 1); }else{ @@ -161,7 +160,7 @@ void RemoveTemporaryUsers() if(hContact) { do{ - if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)|| + if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)|| (_T("Not In List")== DBGetContactSettingStringPAN(hContact,"CList","Group",_T(""))) ) { @@ -186,7 +185,7 @@ void RemoveTemporaryUsers() CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0); }; - tmp = plist; + tmp = plist; plist = plist->next; delete tmp; } @@ -224,7 +223,7 @@ tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){ // case-insensitive _tcscmp //by nullbie as i remember... -#define NEWTSTR_MALLOC(A) (A==NULL)?NULL:_tcscpy((TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(A)+1)),A) +#define NEWTSTR_MALLOC(A) (A==NULL) ? NULL : _tcscpy((TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(A)+1)),A) const int Stricmp(const TCHAR *str, const TCHAR *substr) { int i = 0; @@ -239,20 +238,20 @@ const int Stricmp(const TCHAR *str, const TCHAR *substr) mir_free(str_up); mir_free(substr_up); - + return i; } TCHAR* ReqGetText(DBEVENTINFO* dbei) { - if ( !dbei->pBlob ) + if ( !dbei->pBlob ) return 0; char * ptr=(char *)&dbei->pBlob[sizeof(DWORD)*2]; - int len=dbei->cbBlob-sizeof(DWORD)*2; + int len=dbei->cbBlob-sizeof(DWORD)*2; int i=0; - - while(len&&(i<4)) + + while(len && (i<4)) { if(!ptr[0]) i++; ptr++; @@ -272,7 +271,6 @@ TCHAR* ReqGetText(DBEVENTINFO* dbei) return 0; } - BOOL IsUrlContains(TCHAR * Str) { const int CountUrl=11; @@ -289,11 +287,11 @@ BOOL IsUrlContains(TCHAR * Str) _T(".su"), _T(".ua"), _T(".tv") - }; + }; - if(Str&&_tcslen(Str)>0) { + if(Str && _tcslen(Str)>0) { TCHAR *StrLower = NEWTSTR_MALLOC(Str); - CharLowerBuff(StrLower, lstrlen(StrLower)); + CharLowerBuff(StrLower, lstrlen(StrLower)); for (int i=0; i<CountUrl; i++) if(_tcsstr (StrLower, URL[i])) { @@ -332,7 +330,7 @@ tstring GetContactUid(HANDLE hContact, tstring Protocol) #else _itoa(ci.dVal,aUid,10); -#endif +#endif OemToChar(aUid, dUid); Uid=dUid; break; @@ -340,21 +338,19 @@ tstring GetContactUid(HANDLE hContact, tstring Protocol) Uid=_T(""); break; }; - } + } mir_free(szProto); return Uid; } - void LogSpamToFile(HANDLE hContact, tstring message) { - if (!gbLogToFile) return; tstring LogStrW, LogTime, LogProtocol, LogContactId, LogContactName; std::string filename; std::fstream file; - + UINT cbName=255; char* pszName = (char *)mir_alloc(cbName); extern HANDLE hStopSpamLogDirH; @@ -372,15 +368,15 @@ void LogSpamToFile(HANDLE hContact, tstring message) tm *TimeNow; time(&time_now); TimeNow = localtime(&time_now); - LogTime=_wasctime( TimeNow ); + LogTime=_wasctime( TimeNow ); // Time Log line - + // Name, UID and Protocol Log line LogProtocol=DBGetContactSettingStringPAN(hContact,"Protocol","p",_T("")); LogContactName=(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR); LogContactId=(LogProtocol==_T(""))?_T(""):GetContactUid(hContact,LogProtocol); // Name, UID and Protocol Log line - + LogStrW=_T("[")+LogTime.substr(0,LogTime.length()-1)+_T("] ")+ LogContactId+_T(" - ")+ LogContactName+_T(" (")+ @@ -392,7 +388,6 @@ void LogSpamToFile(HANDLE hContact, tstring message) mir_free(buf); file.close(); - } boost::mutex clean_mutex; @@ -412,14 +407,14 @@ void CleanProtocolTmpThread(std::string proto) char *proto_tmp = GetContactProto(hContact); if(proto_tmp) if(!strcmp(proto.c_str(), proto_tmp)) - if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)|| (_T("Not In List")== DBGetContactSettingStringPAN(hContact,"CList","Group",_T("")))) + if(db_get_b(hContact, "CList", "NotOnList", 0)|| (_T("Not In List")== DBGetContactSettingStringPAN(hContact,"CList","Group",_T("")))) contacts.push_back(hContact); } boost::this_thread::sleep(boost::posix_time::seconds(5)); clean_mutex.lock(); std::list<HANDLE>::iterator end = contacts.end(); for(std::list<HANDLE>::iterator i = contacts.begin(); i != end; ++i) - { + { LogSpamToFile(*i, _T("Deleted")); HistoryLogFunc(*i, "Deleted"); CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0); @@ -432,7 +427,7 @@ void CleanProtocolExclThread(std::string proto) while(true) { UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0); - if(status > ID_STATUS_OFFLINE) + if(status > ID_STATUS_OFFLINE) break; boost::this_thread::sleep(boost::posix_time::seconds(2)); } @@ -442,14 +437,14 @@ void CleanProtocolExclThread(std::string proto) char *proto_tmp = GetContactProto(hContact); if(proto_tmp) if(!strcmp(proto.c_str(), proto_tmp)) - if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingByte(hContact, pluginName, "Excluded", 0)) + if(db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, pluginName, "Excluded", 0)) contacts.push_back(hContact); } boost::this_thread::sleep(boost::posix_time::seconds(5)); clean_mutex.lock(); std::list<HANDLE>::iterator end = contacts.end(); for(std::list<HANDLE>::iterator i = contacts.begin(); i != end; ++i) - { + { LogSpamToFile(*i, _T("Deleted")); HistoryLogFunc(*i, "Deleted"); CallService(MS_DB_CONTACT_DELETE, (WPARAM)*i, 0); @@ -457,7 +452,6 @@ void CleanProtocolExclThread(std::string proto) clean_mutex.unlock(); } - void CleanThread() { std::list<std::string> protocols; @@ -478,6 +472,7 @@ void CleanThread() boost::thread *thr = new boost::thread(boost::bind(&CleanProtocolExclThread, *i)); } } + void HistoryLog(HANDLE hContact, char *data, int event_type, int flags) { DBEVENTINFO Event = {0}; @@ -490,6 +485,7 @@ void HistoryLog(HANDLE hContact, char *data, int event_type, int flags) Event.pBlob = (PBYTE)_strdup(data); CallService(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)hContact,(LPARAM)&Event); } + void HistoryLogFunc(HANDLE hContact, std::string message) { if(gbHistoryLog) @@ -523,7 +519,6 @@ std::string toUTF8(std::string str) return toUTF8(toUTF16(str)); } - std::wstring toUTF16(std::string str) //convert as much as possible { std::wstring ustr; @@ -545,7 +540,7 @@ std::string get_random_num(int length) std::string data; boost::random_device rng; boost::variate_generator<boost::random_device&, boost::uniform_int<>> gen(rng, boost::uniform_int<>(0, chars.length()-1)); - for(int i = 0; i < length; ++i) + for(int i = 0; i < length; ++i) data += chars[gen()]; return data; } diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index 505e0dc801..71becfa3fa 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -1,13 +1,13 @@ #include "headers.h"
-TCHAR * pluginDescription = _T("No more spam! Robots can't go! Only human beings invited!\r\n\r\n")
-_T("This plugin works pretty simple:\r\n")
-_T("While messages from users on your contact list go as there is no any anti-spam software, ")
-_T("messages from unknown users are not delivered to you. ")
-_T("But also they are not ignored, this plugin replies with a simple question, ")
-_T("and if user gives the right answer plugin adds him to your contact list ")
-_T("so that he can contact you.");
-TCHAR const * infTalkProtPrefix = _T("StopSpam automatic message:\r\n");
+TCHAR * pluginDescription = TranslateT("No more spam! Robots can't go! Only human beings invited!\r\n\r\n"
+"This plugin works pretty simple:\r\n"
+"While messages from users on your contact list go as there is no any anti-spam software, "
+"messages from unknown users are not delivered to you. "
+"But also they are not ignored, this plugin replies with a simple question, "
+"and if user gives the right answer plugin adds him to your contact list "
+"so that he can contact you.");
+TCHAR const * infTalkProtPrefix = TranslateT("StopSpam automatic message:\r\n");
char const * answeredSetting = "Answered";
char const * questCountSetting = "QuestionCount";
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index 5b76fba13e..cf5acbf816 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -95,7 +95,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM) iItem, (LPARAM) szName);
if (!_tcsncmp(szName, _T("default"), CONTAINER_NAMELEN) || !_tcsncmp(szName, TranslateT("Default container"), CONTAINER_NAMELEN))
- MessageBox(hwndDlg, TranslateT("You cannot delete the default container"), _T("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(hwndDlg, TranslateT("You cannot delete the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
else {
int iIndex = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETITEMDATA, (WPARAM)iItem, 0);
DeleteContainer(iIndex);
@@ -115,7 +115,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iLen) {
GetWindowText(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME), szNewName, CONTAINER_NAMELEN);
if (!_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN) || !_tcsncmp(szNewName, TranslateT("Default container"), CONTAINER_NAMELEN)) {
- MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), _T("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
}
@@ -124,7 +124,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TCHAR szOldName[CONTAINER_NAMELEN + 1];
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM) iItem, (LPARAM) szOldName);
if (lstrlen(szOldName) == lstrlen(szNewName)) {
- MessageBox(0, TranslateT("This name is already in use"), _T("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
break;
}
@@ -132,7 +132,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM) iItem, (LPARAM) szName);
if (!_tcsncmp(szName, _T("default"), CONTAINER_NAMELEN) || !_tcsncmp(szName, TranslateT("Default container"), CONTAINER_NAMELEN))
- MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), _T("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
else {
int iIndex = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETITEMDATA, (WPARAM)iItem, 0);
RenameContainer(iIndex, szNewName);
@@ -162,7 +162,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iItem != LB_ERR || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
if (lstrlen(szName) == lstrlen(szNewName) || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
- MessageBox(0, TranslateT("This name is already in use"), _T("Error"), MB_OK | MB_ICONERROR);
+ MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
break;
}
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index ac7e94a2e5..ab760a1e0e 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -84,7 +84,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SRMM, M extern "C" int __declspec(dllexport) Load(void)
{
if (WinVerMajor() < 5) {
- MessageBox(0, _T("This version of tabSRMM requires Windows 2000 or later."), _T("tabSRMM"), MB_OK | MB_ICONERROR);
+ MessageBox(0, TranslateT("This version of tabSRMM requires Windows 2000 or later."), _T("tabSRMM"), MB_OK | MB_ICONERROR);
return 1;
}
|