From d259b413d0812e0181b91846a922a4ddc44aca47 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 18 May 2013 18:14:20 +0000 Subject: changed path for stopspam_mod.log git-svn-id: http://svn.miranda-ng.org/main/trunk@4720 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/StopSpamMod/src/globals.h | 13 ------------- plugins/StopSpamMod/src/headers.h | 10 ++++++++-- plugins/StopSpamMod/src/init.cpp | 2 +- plugins/StopSpamMod/src/utilities.cpp | 19 +++++++++---------- 4 files changed, 18 insertions(+), 26 deletions(-) (limited to 'plugins/StopSpamMod/src') diff --git a/plugins/StopSpamMod/src/globals.h b/plugins/StopSpamMod/src/globals.h index 8c5912c223..e046e68f6f 100755 --- a/plugins/StopSpamMod/src/globals.h +++ b/plugins/StopSpamMod/src/globals.h @@ -1,16 +1,3 @@ #define pluginName "StopSpam" //const char* ? -/* -TCHAR const * defAnswer = _T("nospam"); -TCHAR const * defCongratulation = -_T("Congratulations! You just passed human/robot test. Now you can write me a message."); -char const * defProtoList = "ICQ\r\n"; -TCHAR const * infTalkProtPrefix = _T("StopSpam automatic message:\r\n"); -char const * answeredSetting = "Answered"; -char const * questCountSetting = "QuestionCount"; -TCHAR const * defAufrepl = _T("StopSpam: send a message and reply to a anti-spam bot question.");*/ - - - -typedef std::wstring tstring; #define PREF_TCHAR2 PREF_UTF diff --git a/plugins/StopSpamMod/src/headers.h b/plugins/StopSpamMod/src/headers.h index 40b22fe761..6366907403 100755 --- a/plugins/StopSpamMod/src/headers.h +++ b/plugins/StopSpamMod/src/headers.h @@ -1,7 +1,11 @@ #define _CRT_SECURE_NO_WARNINGS #include -#include + +using namespace std; +#include +#include + #include #include @@ -11,6 +15,7 @@ #include #include #include +#include #include #include @@ -30,4 +35,5 @@ #include "utilities.h" #include "utf8.h" -extern HINSTANCE hInst; \ No newline at end of file +extern HINSTANCE hInst; +extern HANDLE hStopSpamLogDirH; diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 4278ebef16..882434389c 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -124,7 +124,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) boost::thread *thr = new boost::thread(&CleanThread); // Folders plugin support - hStopSpamLogDirH = FoldersRegisterCustomPath(LPGEN("StopSpam"), LPGEN("StopSpam Logs"), PROFILE_PATH "\\" CURRENT_PROFILE "\\StopSpamLog"); + hStopSpamLogDirH = FoldersRegisterCustomPathT(LPGEN("StopSpam"), LPGEN("StopSpam Logs"), FOLDER_LOGS); return 0; } diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index c61b47f2d2..647293687a 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -255,18 +255,17 @@ void LogSpamToFile(HANDLE hContact, tstring message) if (!gbLogToFile) return; tstring LogStrW, LogTime, LogProtocol, LogContactId, LogContactName; - std::string filename; + tstring filename; std::fstream file; + TCHAR pszName[MAX_PATH]; - UINT cbName=255; - char* pszName = (char *)mir_alloc(cbName); - extern HANDLE hStopSpamLogDirH; + if (hStopSpamLogDirH) + FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, _T("")); + else + lstrcpyn(pszName, VARST( _T("%miranda_logpath%")), SIZEOF(pszName)); - if (FoldersGetCustomPath(hStopSpamLogDirH, pszName, cbName, "")) - CallService(MS_DB_GETPROFILEPATH,(WPARAM) cbName, (LPARAM)pszName); - filename=pszName; - filename=filename+"\\stopspam_mod.log"; - mir_free(pszName); + filename = pszName; + filename = filename + _T("\\stopspam_mod.log"); file.open(filename.c_str(),std::ios::out |std::ios::app); @@ -275,7 +274,7 @@ 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 -- cgit v1.2.3