diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-07-19 21:14:42 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-07-19 21:14:42 +0300 |
commit | 62ca8b07d9cf4f0cfdaa29099d6fdc5de5deb2cf (patch) | |
tree | f4a902db9aac80dee55614601c3d5c1c41381647 | |
parent | 44b74b8166c88c5d1ee0bd999f2c5cc4115d8b3e (diff) | |
parent | 9d0f2d026293f0ed794cefaa796f756efd01e84a (diff) |
Merge remote branch 'origin/stopspam_mod_elzor' into stopspam_mod
Conflicts:
utilities.cpp
-rw-r--r-- | globals.h | 40 | ||||
-rw-r--r-- | headers.h | 3 | ||||
-rw-r--r-- | stopspam.cpp | 7 | ||||
-rw-r--r-- | utilities.cpp | 616 | ||||
-rw-r--r-- | utilities.h | 10 |
5 files changed, 386 insertions, 290 deletions
@@ -1,20 +1,20 @@ -#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.");*/ - - -#ifdef _UNICODE -typedef std::wstring tstring; -#define PREF_TCHAR2 PREF_UTF -#else -typedef std::string tstring; -#define PREF_TCHAR2 0 -#endif //_UNICODE - +#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.");*/
+
+
+#ifdef _UNICODE
+typedef std::wstring tstring;
+#define PREF_TCHAR2 PREF_UTF
+#else
+typedef std::string tstring;
+#define PREF_TCHAR2 0
+#endif //_UNICODE
+
@@ -5,6 +5,8 @@ #include <time.h> #include <string> #include <sstream> +#include<fstream> + //#include <boost/scoped_array.hpp> #include <newpluginapi.h> #include <m_database.h> @@ -15,6 +17,7 @@ #include <m_clistint.h> #include <m_skin.h> #include <m_button.h> +#include <m_contacts.h> //#define VARIABLES_NOHELPER #include <m_variables.h> diff --git a/stopspam.cpp b/stopspam.cpp index 92d2658..e7ff9b9 100644 --- a/stopspam.cpp +++ b/stopspam.cpp @@ -83,8 +83,10 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) { HANDLE hContact = (HANDLE)w; + if(!l) //fix potential DEP crash + return 0; DBEVENTINFO * dbei = (DBEVENTINFO*)l; - + // if event is in protocol that is not despammed if(!ProtoInList(dbei->szModule)) { @@ -192,7 +194,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) DBDeleteContactSetting(hContact, "CList", "NotOnList"); }; // auto auth. reqwest with send congratulation - if(gbAutoReqAuth) // ANSI may be not work + if(gbAutoReqAuth) CallContactService(hContact,PSS_AUTHREQUESTW,0, (LPARAM)variables_parse(gbCongratulation, hContact).c_str()); } } @@ -251,6 +253,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)dbei); }; // reject processing of the event + LogSpamToFile(hContact, message); return 1; } diff --git a/utilities.cpp b/utilities.cpp index fcc98ad..a65576c 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -1,267 +1,349 @@ -#include "headers.h" - -tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue) -{ - DBVARIANT dbv; - //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv)) - if(DBGetContactSettingTString(hContact, szModule, szSetting, &dbv)) - return errorValue; -// if(DBVT_TCHAR == dbv.type ) - errorValue = dbv.ptszVal; - DBFreeVariant(&dbv); - return errorValue; -} - -std::string DBGetContactSettingStringPAN_A(HANDLE hContact, char const * szModule, char const * szSetting, std::string errorValue) -{ - DBVARIANT dbv; - //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv)) - if(DBGetContactSettingString(hContact, szModule, szSetting, &dbv)) - return errorValue; -// if(DBVT_ASCIIZ == dbv.type ) - errorValue = dbv.pszVal; - DBFreeVariant(&dbv); - return errorValue; -} - -tstring &GetDlgItemString(HWND hwnd, int id) -{ - HWND h = GetDlgItem(hwnd, id); - int len = GetWindowTextLength(h); - TCHAR * buf = new TCHAR[len + 1]; - GetWindowText(h, buf, len + 1); - static tstring s; - s = buf; - delete []buf; - return s; -} - -std::string &GetProtoList() -{ - static std::string s; - return s = DBGetContactSettingStringPAN_A(NULL, pluginName, "protoList", "ICQ\r\n"); -} - - -bool ProtoInList(std::string proto) -{ - return std::string::npos != GetProtoList().find(proto + "\r\n"); -} - -int CreateCListGroup(TCHAR* szGroupName) -{ - int hGroup; - CLIST_INTERFACE *clint = NULL; - - if (ServiceExists(MS_CLIST_RETRIEVE_INTERFACE)) - clint = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0); - - hGroup = CallService(MS_CLIST_GROUPCREATE, 0, 0); - - TCHAR* usTmp = szGroupName; - - clint->pfnRenameGroup(hGroup, usTmp); - - return hGroup; -} - -struct hContact_entry -{ - HANDLE hContact; - struct hContact_entry *next; -}; - -void RemoveExcludedUsers() -{ - HANDLE hContact; - hContact_entry *first, *plist, *tmp; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - first = new hContact_entry; - plist = first; - plist->hContact = INVALID_HANDLE_VALUE; - if(hContact) - { - do - { - if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingByte(hContact, pluginName, "Excluded", 0)) - { - plist->hContact = hContact; - plist->next = new hContact_entry; - plist = plist->next; - plist->hContact = INVALID_HANDLE_VALUE; - } - } - while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0)) - ; - plist = first; - while(plist->hContact != INVALID_HANDLE_VALUE) - { - CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0); - tmp = plist; - plist = plist->next; - delete tmp; - } - delete plist; - } -} - -void RemoveTemporaryUsers() -{ - HANDLE hContact; - hContact_entry *first, *plist, *tmp; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - first = new hContact_entry; - plist = first; - plist->hContact = INVALID_HANDLE_VALUE; - if(hContact) - { - do - { - if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) - { - plist->hContact = hContact; - plist->next = new hContact_entry; - plist = plist->next; - plist->hContact = INVALID_HANDLE_VALUE; - } - } - while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0)) - ; - plist = first; - while(plist->hContact != INVALID_HANDLE_VALUE) - { - CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0); - tmp = plist; - plist = plist->next; - delete tmp; - } - delete plist; - } -} -int RemoveTmp(WPARAM,LPARAM) -{ - RemoveTemporaryUsers(); - return 0; -} -tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){ - if (gbVarsServiceExist) { - FORMATINFO fi; - TCHAR *tszParsed; - tstring tstrResult; - - ZeroMemory(&fi, sizeof(fi)); - fi.cbSize = sizeof(fi); - fi.tszFormat = _tcsdup(tstrFormat.c_str()); - fi.hContact = hContact; - fi.flags |= FIF_TCHAR; - tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); - free(fi.tszFormat); - if (tszParsed) { - tstrResult = tszParsed; - CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0); - return tstrResult; - } - } - return tstrFormat; -} - -// 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) -const int Stricmp(const TCHAR *str, const TCHAR *substr) -{ - int i = 0; - - TCHAR *str_up = NEWTSTR_MALLOC(str); - TCHAR *substr_up = NEWTSTR_MALLOC(substr); - - CharUpperBuff(str_up, lstrlen(str_up)); - CharUpperBuff(substr_up, lstrlen(substr_up)); - - i = _tcscmp(str_up, substr_up); - - mir_free(str_up); - mir_free(substr_up); - - return i; -} -/* -const int Stristr(const TCHAR *str, const TCHAR *substr) -{ - int i = 0; - TCHAR *str_up = NEWTSTR_MALLOC(str); - TCHAR *substr_up = NEWTSTR_MALLOC(substr); - - CharUpperBuff(str_up, lstrlen(str_up)); - CharUpperBuff(substr_up, lstrlen(substr_up)); - - if(_tcsstr (str_up, substr_up)) - i = 1; - - mir_free(str_up); - mir_free(substr_up); - - return i; -} -*/ -TCHAR* ReqGetText(DBEVENTINFO* dbei) -{ - if ( !dbei->pBlob ) - return 0; - - char * ptr=(char *)&dbei->pBlob[sizeof(DWORD)*2]; - int len=dbei->cbBlob-sizeof(DWORD)*2; - int i=0; - - while(len&&(i<4)) - { - if(!ptr[0]) i++; - ptr++; - len--; - }; - - if(len) - { - char * tstr=(char *)mir_alloc(len+1); - memcpy(tstr, ptr, len); - tstr[len]=0; - WCHAR* msg = NULL; - msg=(dbei->flags&DBEF_UTF)?mir_utf8decodeW(tstr):mir_a2u(tstr); - mir_free(tstr); - return (TCHAR *)msg; - }; - return 0; -} - - -BOOL IsUrlContains(TCHAR * Str) -{ - const int CountUrl=11; - const TCHAR URL[CountUrl][5]= - { - _T("http"), - _T("www"), - _T(".ru"), - _T(".com"), - _T(".de"), - _T(".cz"), - _T(".org"), - _T(".net"), - _T(".su"), - _T(".ua"), - _T(".tv") - }; - - if(Str&&_tcslen(Str)>0) { - TCHAR *StrLower = NEWTSTR_MALLOC(Str); - CharLowerBuff(StrLower, lstrlen(StrLower)); - for (int i=0; i<CountUrl; i++) - if(_tcsstr (StrLower, URL[i])) - { - mir_free(StrLower); - return 1; - } - mir_free(StrLower); - } - return 0; -} +#include "headers.h"
+
+tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue)
+{
+ DBVARIANT dbv;
+ //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv))
+ if(DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
+ return errorValue;
+// if(DBVT_TCHAR == dbv.type )
+ errorValue = dbv.ptszVal;
+ DBFreeVariant(&dbv);
+ return errorValue;
+}
+
+std::string DBGetContactSettingStringPAN_A(HANDLE hContact, char const * szModule, char const * szSetting, std::string errorValue)
+{
+ DBVARIANT dbv;
+ //if(DBGetContactSetting(hContact, szModule, szSetting, &dbv))
+ if(DBGetContactSettingString(hContact, szModule, szSetting, &dbv))
+ return errorValue;
+// if(DBVT_ASCIIZ == dbv.type )
+ errorValue = dbv.pszVal;
+ DBFreeVariant(&dbv);
+ return errorValue;
+}
+
+tstring &GetDlgItemString(HWND hwnd, int id)
+{
+ HWND h = GetDlgItem(hwnd, id);
+ int len = GetWindowTextLength(h);
+ TCHAR * buf = new TCHAR[len + 1];
+ GetWindowText(h, buf, len + 1);
+ static tstring s;
+ s = buf;
+ delete []buf;
+ return s;
+}
+
+std::string &GetProtoList()
+{
+ static std::string s;
+ return s = DBGetContactSettingStringPAN_A(NULL, pluginName, "protoList", "ICQ\r\n");
+}
+
+
+bool ProtoInList(std::string proto)
+{
+ return std::string::npos != GetProtoList().find(proto + "\r\n");
+}
+
+int CreateCListGroup(TCHAR* szGroupName)
+{
+ int hGroup;
+ CLIST_INTERFACE *clint = NULL;
+
+ if (ServiceExists(MS_CLIST_RETRIEVE_INTERFACE))
+ clint = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0);
+
+ hGroup = CallService(MS_CLIST_GROUPCREATE, 0, 0);
+
+ TCHAR* usTmp = szGroupName;
+
+ clint->pfnRenameGroup(hGroup, usTmp);
+
+ return hGroup;
+}
+
+void DeleteCListGroupsByName(TCHAR* szGroupName)
+{
+ int GroupNumber = 0;
+ TCHAR szValue[96] = {0};
+ char szNumber[32] = {0};
+ strcpy(szNumber, "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 ??? @_@
+ GroupNumber++;
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+ _itoa_s(GroupNumber, szNumber, sizeof(szNumber), 10);
+#else
+ _itoa(GroupNumber, szNumber, 10);
+#endif
+ };
+}
+
+void RemoveExcludedUsers()
+{
+ HANDLE hContact;
+ hContact_entry *first, *plist, *tmp;
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ first = new hContact_entry;
+ plist = first;
+ plist->hContact = INVALID_HANDLE_VALUE;
+ if(hContact)
+ {
+ do{
+ if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && DBGetContactSettingByte(hContact, pluginName, "Excluded", 0))
+ {
+ plist->hContact = hContact;
+ plist->next = new hContact_entry;
+ plist = plist->next;
+ plist->hContact = INVALID_HANDLE_VALUE;
+ }
+ }while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0));
+
+ plist = first;
+ while(plist->hContact != INVALID_HANDLE_VALUE)
+ {
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0);
+ tmp = plist;
+ plist = plist->next;
+ delete tmp;
+ }
+ delete plist;
+ }
+}
+
+void RemoveTemporaryUsers()
+{
+ HANDLE hContact;
+ hContact_entry *first, *plist, *tmp;
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ first = new hContact_entry;
+ plist = first;
+ plist->hContact = INVALID_HANDLE_VALUE;
+ if(hContact)
+ {
+ do{
+ if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)||
+ (_T("Not In List")== DBGetContactSettingStringPAN(hContact,"CList","Group",_T("")))
+ )
+ {
+ plist->hContact = hContact;
+ plist->next = new hContact_entry;
+ plist = plist->next;
+ plist->hContact = INVALID_HANDLE_VALUE;
+ }
+ }while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0));
+
+ plist = first;
+ while(plist->hContact != INVALID_HANDLE_VALUE)
+ {
+ LogSpamToFile(plist->hContact, _T("Deleted"));
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0);
+ tmp = plist;
+ plist = plist->next;
+ delete tmp;
+ }
+ delete plist;
+ };
+ DeleteCListGroupsByName(_T("Not In List"));
+}
+int RemoveTmp(WPARAM,LPARAM)
+{
+ RemoveTemporaryUsers();
+ return 0;
+}
+tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){
+ if (gbVarsServiceExist) {
+ FORMATINFO fi;
+ TCHAR *tszParsed;
+ tstring tstrResult;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = _tcsdup(tstrFormat.c_str());
+ fi.hContact = hContact;
+ fi.flags |= FIF_TCHAR;
+ tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ free(fi.tszFormat);
+ if (tszParsed) {
+ tstrResult = tszParsed;
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
+ return tstrResult;
+ }
+ }
+ return tstrFormat;
+}
+
+// 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)
+const int Stricmp(const TCHAR *str, const TCHAR *substr)
+{
+ int i = 0;
+
+ TCHAR *str_up = NEWTSTR_MALLOC(str);
+ TCHAR *substr_up = NEWTSTR_MALLOC(substr);
+
+ CharUpperBuff(str_up, lstrlen(str_up));
+ CharUpperBuff(substr_up, lstrlen(substr_up));
+
+ i = _tcscmp(str_up, substr_up);
+
+ mir_free(str_up);
+ mir_free(substr_up);
+
+ return i;
+}
+
+TCHAR* ReqGetText(DBEVENTINFO* dbei)
+{
+ if ( !dbei->pBlob )
+ return 0;
+
+ char * ptr=(char *)&dbei->pBlob[sizeof(DWORD)*2];
+ int len=dbei->cbBlob-sizeof(DWORD)*2;
+ int i=0;
+
+ while(len&&(i<4))
+ {
+ if(!ptr[0]) i++;
+ ptr++;
+ len--;
+ };
+
+ if(len)
+ {
+ char * tstr=(char *)mir_alloc(len+1);
+ memcpy(tstr, ptr, len);
+ tstr[len]=0;
+ WCHAR* msg = NULL;
+ msg=(dbei->flags&DBEF_UTF)?mir_utf8decodeW(tstr):mir_a2u(tstr);
+ mir_free(tstr);
+ return (TCHAR *)msg;
+ };
+ return 0;
+}
+
+
+BOOL IsUrlContains(TCHAR * Str)
+{
+ const int CountUrl=11;
+ const TCHAR URL[CountUrl][5]=
+ {
+ _T("http"),
+ _T("www"),
+ _T(".ru"),
+ _T(".com"),
+ _T(".de"),
+ _T(".cz"),
+ _T(".org"),
+ _T(".net"),
+ _T(".su"),
+ _T(".ua"),
+ _T(".tv")
+ };
+
+ if(Str&&_tcslen(Str)>0) {
+ TCHAR *StrLower = NEWTSTR_MALLOC(Str);
+ CharLowerBuff(StrLower, lstrlen(StrLower));
+ for (int i=0; i<CountUrl; i++)
+ if(_tcsstr (StrLower, URL[i]))
+ {
+ mir_free(StrLower);
+ return 1;
+ }
+ mir_free(StrLower);
+ }
+ return 0;
+}
+
+tstring GetContactUid(HANDLE hContact, tstring Protocol)
+{
+ tstring Uid;
+ TCHAR dUid[32]={0};
+ char *szProto = mir_utf8encodeW(Protocol.c_str());
+ CONTACTINFO ci;
+ ZeroMemory((void *)&ci, sizeof(ci));
+
+ ci.hContact = hContact;
+ ci.szProto = szProto;
+ ci.cbSize = sizeof(ci);
+
+ ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ switch (ci.type) {
+ case CNFT_ASCIIZ:
+ Uid=ci.pszVal;
+ mir_free((void *)ci.pszVal);
+ break;
+ case CNFT_DWORD:
+ _itow_s(ci.dVal,dUid,32,10);
+ Uid=dUid;
+ break;
+ default:
+ Uid=_T("");
+ break;
+ };
+ }
+ mir_free(szProto);
+ return Uid;
+}
+
+
+void LogSpamToFile(HANDLE hContact, tstring message)
+{
+
+ tstring LogStrW;
+ tstring LogTime;
+ tstring LogProtocol;
+ tstring LogContactId;
+ tstring LogContactName;
+ std::string filename;
+ std::fstream file;
+
+ UINT cbName=255;
+ char* pszName = (char *)mir_alloc(cbName);
+
+ CallService(MS_DB_GETPROFILEPATH,(WPARAM) cbName, (LPARAM)pszName);
+
+
+ filename=pszName;
+ filename=filename+"\\stopspam_mod.log";
+ mir_free(pszName);
+
+ file.open(filename.c_str(),std::ios::out |std::ios::app);
+
+ // Time Log line
+ time_t time_now;
+ tm *TimeNow;
+ time(&time_now);
+ TimeNow = localtime(&time_now);
+ 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
+
+ //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);
+
+ file.close();
+}
\ No newline at end of file diff --git a/utilities.h b/utilities.h index ee56cc2..dd6bfe0 100644 --- a/utilities.h +++ b/utilities.h @@ -8,4 +8,12 @@ tstring variables_parse(tstring const &tstrFormat, HANDLE hContact); const int Stricmp(const TCHAR *str, const TCHAR *substr); //const int Stristr(const TCHAR *str, const TCHAR *substr); TCHAR* ReqGetText(DBEVENTINFO* dbei); -BOOL IsUrlContains(TCHAR * Str);
\ No newline at end of file +BOOL IsUrlContains(TCHAR * Str); +void DeleteCListGroupsByName(TCHAR* szGroupName); +tstring GetContactUid(HANDLE hContact, std::string Protocol); +void LogSpamToFile(HANDLE hContact, tstring message); +struct hContact_entry +{ + HANDLE hContact; + struct hContact_entry *next; +}; |