From 8c4ce511abdbfb4dba04e4f845e85c96c0471312 Mon Sep 17 00:00:00 2001 From: "Sergey (Elzor) Bolhovskoy" Date: Tue, 20 Jul 2010 18:02:26 +0600 Subject: add folders support, add options for spammers log and remove all tempory contacts, silent remove group, version bump --- utilities.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index a65576c..b56fa4b 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -71,6 +71,9 @@ 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); while(strcmp(DBGetContactSettingStringPAN_A(NULL, "CListGroups", szNumber, "0").c_str(), "0") != 0) { wcscpy(szValue, DBGetContactSettingStringPAN(NULL, "CListGroups", szNumber, _T("0")).c_str()); @@ -83,6 +86,8 @@ void DeleteCListGroupsByName(TCHAR* szGroupName) _itoa(GroupNumber, szNumber, 10); #endif }; + if(ConfirmDelete) + DBWriteContactSettingByte(NULL, "CList", "ConfirmDelete",ConfirmDelete); } void RemoveExcludedUsers() @@ -297,21 +302,19 @@ tstring GetContactUid(HANDLE hContact, tstring Protocol) void LogSpamToFile(HANDLE hContact, tstring message) { + + if (!gbLogToFile) return; - tstring LogStrW; - tstring LogTime; - tstring LogProtocol; - tstring LogContactId; - tstring LogContactName; + tstring LogStrW, LogTime, LogProtocol, LogContactId, LogContactName; std::string filename; std::fstream file; UINT cbName=255; char* pszName = (char *)mir_alloc(cbName); + extern HANDLE hStopSpamLogDirH; - CallService(MS_DB_GETPROFILEPATH,(WPARAM) cbName, (LPARAM)pszName); - - + if (FoldersGetCustomPath(hStopSpamLogDirH, pszName, cbName, "")) + CallService(MS_DB_GETPROFILEPATH,(WPARAM) cbName, (LPARAM)pszName); filename=pszName; filename=filename+"\\stopspam_mod.log"; mir_free(pszName); @@ -332,15 +335,12 @@ void LogSpamToFile(HANDLE hContact, tstring message) LogContactId=(LogProtocol==_T(""))?_T(""):GetContactUid(hContact,LogProtocol); // Name, UID and Protocol Log line - //MessageBox(0,LogProtocol.c_str(),_T(""),0); LogStrW=_T("[")+LogTime.substr(0,LogTime.length()-1)+_T("] ")+ LogContactId+_T(" - ")+ LogContactName+_T(" (")+ LogProtocol+_T("): ")+ message+_T("\n"); - - //char * buf=mir_utf8encodeW(LogStrW.c_str()); char * buf=mir_u2a(LogStrW.c_str()); file.write(buf,LogStrW.length()); mir_free(buf); -- cgit v1.2.3