summaryrefslogtreecommitdiff
path: root/plugins/StopSpamMod
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-05-18 18:14:20 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-05-18 18:14:20 +0000
commitd259b413d0812e0181b91846a922a4ddc44aca47 (patch)
treeb417e384f8a03ac14c497327bf5ef9d1713ce17c /plugins/StopSpamMod
parent1e5e6e5b820861d32cddb5602e4b64c93f1b4ded (diff)
changed path for stopspam_mod.log
git-svn-id: http://svn.miranda-ng.org/main/trunk@4720 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StopSpamMod')
-rwxr-xr-xplugins/StopSpamMod/src/globals.h13
-rwxr-xr-xplugins/StopSpamMod/src/headers.h10
-rwxr-xr-xplugins/StopSpamMod/src/init.cpp2
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp19
4 files changed, 18 insertions, 26 deletions
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 <windows.h>
-#include<fstream>
+
+using namespace std;
+#include <fstream>
+#include <string>
+
#include <newpluginapi.h>
#include <m_database.h>
@@ -11,6 +15,7 @@
#include <m_clistint.h>
#include <m_skin.h>
#include <m_contacts.h>
+#include <m_system_cpp.h>
#include <m_variables.h>
#include <m_folders.h>
@@ -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