summaryrefslogtreecommitdiff
path: root/stopspam_mod/branches
diff options
context:
space:
mode:
Diffstat (limited to 'stopspam_mod/branches')
-rw-r--r--stopspam_mod/branches/0.0.1.7/BUGS.txt (renamed from stopspam_mod/branches/0.0.1.6/BUGS.txt)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/Makefile (renamed from stopspam_mod/branches/0.0.1.6/Makefile)8
-rw-r--r--stopspam_mod/branches/0.0.1.7/eventhooker.cpp (renamed from stopspam_mod/branches/0.0.1.6/eventhooker.cpp)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/eventhooker.h (renamed from stopspam_mod/branches/0.0.1.6/eventhooker.h)4
-rw-r--r--stopspam_mod/branches/0.0.1.7/globals.h (renamed from stopspam_mod/branches/0.0.1.6/globals.h)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/headers.h (renamed from stopspam_mod/branches/0.0.1.6/headers.h)4
-rw-r--r--stopspam_mod/branches/0.0.1.7/init.cpp (renamed from stopspam_mod/branches/0.0.1.6/init.cpp)26
-rw-r--r--stopspam_mod/branches/0.0.1.7/options.cpp (renamed from stopspam_mod/branches/0.0.1.6/options.cpp)4
-rw-r--r--stopspam_mod/branches/0.0.1.7/options.h (renamed from stopspam_mod/branches/0.0.1.6/options.h)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/resource.h (renamed from stopspam_mod/branches/0.0.1.6/resource.h)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/stopspam.cpp (renamed from stopspam_mod/branches/0.0.1.6/stopspam.cpp)8
-rw-r--r--stopspam_mod/branches/0.0.1.7/stopspam.h (renamed from stopspam_mod/branches/0.0.1.6/stopspam.h)2
-rw-r--r--stopspam_mod/branches/0.0.1.7/stopspam.rc (renamed from stopspam_mod/branches/0.0.1.6/stopspam.rc)4
-rw-r--r--stopspam_mod/branches/0.0.1.7/stopspam_8.sln (renamed from stopspam_mod/branches/0.0.1.6/stopspam_8.sln)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/stopspam_8.vcproj (renamed from stopspam_mod/branches/0.0.1.6/stopspam_8.vcproj)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/stopspam_9.sln (renamed from stopspam_mod/branches/0.0.1.6/stopspam_9.sln)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/stopspam_9.vcproj (renamed from stopspam_mod/branches/0.0.1.6/stopspam_9.vcproj)0
-rw-r--r--stopspam_mod/branches/0.0.1.7/utilities.cpp (renamed from stopspam_mod/branches/0.0.1.6/utilities.cpp)55
-rw-r--r--stopspam_mod/branches/0.0.1.7/utilities.h (renamed from stopspam_mod/branches/0.0.1.6/utilities.h)3
-rw-r--r--stopspam_mod/branches/0.0.1.7/version.h (renamed from stopspam_mod/branches/0.0.1.6/version.h)0
20 files changed, 95 insertions, 23 deletions
diff --git a/stopspam_mod/branches/0.0.1.6/BUGS.txt b/stopspam_mod/branches/0.0.1.7/BUGS.txt
index d17bd4a..d17bd4a 100644
--- a/stopspam_mod/branches/0.0.1.6/BUGS.txt
+++ b/stopspam_mod/branches/0.0.1.7/BUGS.txt
diff --git a/stopspam_mod/branches/0.0.1.6/Makefile b/stopspam_mod/branches/0.0.1.7/Makefile
index fc08dd9..fda598f 100644
--- a/stopspam_mod/branches/0.0.1.6/Makefile
+++ b/stopspam_mod/branches/0.0.1.7/Makefile
@@ -1,12 +1,12 @@
all:
- i686-pc-mingw32-g++ -c -DBUILD_DLL *.cpp -I../../include -I/usr/i686-pc-mingw32/usr/include -I. -w -march=i686 -msse -O2 -pipe
- i686-pc-mingw32-windres -i stopspam.rc -o resources.o
+ i686-pc-mingw32-g++ -c -DBUILD_DLL *.cpp -I../../include -I/usr/i686-pc-mingw32/usr/include -I. -w -march=i686 -msse -O2 -pipe
+ i686-pc-mingw32-windres -i stopspam.rc -o resources.o
i686-pc-mingw32-gcc -shared -o stopspam.dll *.o -Wl,-O1,-s
- upx -9 stopspam.dll
+ upx -9 stopspam.dll
clean:
rm *.o
clean-all:
- rm *.o *.dll
+ rm *.o *.dll
\ No newline at end of file
diff --git a/stopspam_mod/branches/0.0.1.6/eventhooker.cpp b/stopspam_mod/branches/0.0.1.7/eventhooker.cpp
index f29e5b7..f29e5b7 100644
--- a/stopspam_mod/branches/0.0.1.6/eventhooker.cpp
+++ b/stopspam_mod/branches/0.0.1.7/eventhooker.cpp
diff --git a/stopspam_mod/branches/0.0.1.6/eventhooker.h b/stopspam_mod/branches/0.0.1.7/eventhooker.h
index 2174691..b1ca2ab 100644
--- a/stopspam_mod/branches/0.0.1.6/eventhooker.h
+++ b/stopspam_mod/branches/0.0.1.7/eventhooker.h
@@ -37,9 +37,9 @@ namespace miranda
{
#define MIRANDA_HOOK_EVENT(NAME, WPARAMNAME, LPARAMNAME) \
- NAME##_Handler(WPARAM,LPARAM);\
+ int NAME##_Handler(WPARAM,LPARAM);\
miranda::EventHooker NAME##_Hooker(NAME, NAME##_Handler);\
- NAME##_Handler(WPARAM WPARAMNAME, LPARAM LPARAMNAME)
+ int NAME##_Handler(WPARAM WPARAMNAME, LPARAM LPARAMNAME)
struct EventHooker
{
diff --git a/stopspam_mod/branches/0.0.1.6/globals.h b/stopspam_mod/branches/0.0.1.7/globals.h
index 9ae64b3..9ae64b3 100644
--- a/stopspam_mod/branches/0.0.1.6/globals.h
+++ b/stopspam_mod/branches/0.0.1.7/globals.h
diff --git a/stopspam_mod/branches/0.0.1.6/headers.h b/stopspam_mod/branches/0.0.1.7/headers.h
index 088f622..db718df 100644
--- a/stopspam_mod/branches/0.0.1.6/headers.h
+++ b/stopspam_mod/branches/0.0.1.7/headers.h
@@ -11,6 +11,10 @@
#include <m_utils.h>
#include <m_langpack.h>
#include <m_clistint.h>
+#include <m_skin.h>
+#define VARIABLES_NOHELPER
+#include <m_variables.h>
+
#include "globals.h"
#include "stopspam.h"
diff --git a/stopspam_mod/branches/0.0.1.6/init.cpp b/stopspam_mod/branches/0.0.1.7/init.cpp
index fc32742..166ac15 100644
--- a/stopspam_mod/branches/0.0.1.6/init.cpp
+++ b/stopspam_mod/branches/0.0.1.7/init.cpp
@@ -19,9 +19,10 @@ tstring gbSpammersGroup = _T("Spammers");
tstring gbQuestion;
tstring gbAnswer;
tstring gbCongratulation;
-std::string gbAuthRepl;
+std::wstring gbAuthRepl;
extern char * pluginDescription;
extern TCHAR const * defQuestion;
+extern int RemoveTmp(WPARAM,LPARAM);
struct MM_INTERFACE mmi;
@@ -38,7 +39,7 @@ UTF8_INTERFACE utfi;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
0,
- PLUGIN_MAKE_VERSION(0, 0, 1, 6),
+ PLUGIN_MAKE_VERSION(0, 0, 1, 7),
pluginDescription,
"Roman Miklashevsky",
"sss123next@list.ru",
@@ -89,7 +90,10 @@ char *date()
d[5]=mn[0];
d[6]=mn[1];
d[7]='.';
- d[8]=tmp[4];
+ if (tmp[4] == ' ')
+ d[8] = '0';
+ else
+ d[8]=tmp[4];
d[9]=tmp[5];
return d;
}
@@ -97,7 +101,7 @@ char *date()
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- if ( mirandaVersion < PLUGIN_MAKE_VERSION( 0, 7, 0, 0 ))
+ if ( mirandaVersion < PLUGIN_MAKE_VERSION( 0, 7, 0, 1 ))
return NULL;
{
static char plugname[52];
@@ -126,7 +130,7 @@ void InitVars()
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_A(NULL, pluginName, "authrepl", "StopSpam: send a message and reply to a anti-spam bot question.");
+ 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);
@@ -168,12 +172,24 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
return interfaces;
}
+
+
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
pluginLink = link;
+ CLISTMENUITEM mi;
+ CreateServiceFunction("/RemoveTmp",RemoveTmp);
mir_getMMI(&mmi);
mir_getUTFI(&utfi);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
+ ZeroMemory(&mi,sizeof(mi));
+ mi.cbSize=sizeof(mi);
+ mi.position=-0x7FFFFFFF;
+ mi.flags=0;
+ mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ mi.pszName="Remove Temporary Contacts";
+ mi.pszService="/RemoveTmp";
+ CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
miranda::EventHooker::HookAll();
return 0;
diff --git a/stopspam_mod/branches/0.0.1.6/options.cpp b/stopspam_mod/branches/0.0.1.7/options.cpp
index 9983444..52fd4d5 100644
--- a/stopspam_mod/branches/0.0.1.6/options.cpp
+++ b/stopspam_mod/branches/0.0.1.7/options.cpp
@@ -134,7 +134,7 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
SetDlgItemText(hwnd, ID_QUESTION, gbQuestion.c_str());
SetDlgItemText(hwnd, ID_ANSWER, gbAnswer.c_str());
SetDlgItemText(hwnd, ID_CONGRATULATION, gbCongratulation.c_str());
- SetDlgItemTextA(hwnd, ID_AUTHREPL, gbAuthRepl.c_str());
+ SetDlgItemText(hwnd, ID_AUTHREPL, gbAuthRepl.c_str());
}
return TRUE;
case WM_COMMAND:
@@ -175,7 +175,7 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam"));
DBWriteContactSettingTString(NULL, pluginName, "authrepl",
GetDlgItemString(hwnd, ID_AUTHREPL).c_str());
- gbAuthRepl = DBGetContactSettingStringPAN_A(NULL, pluginName, "authrepl", "StopSpam: send a message and reply to a anti-spam bot question.");
+ 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."));
diff --git a/stopspam_mod/branches/0.0.1.6/options.h b/stopspam_mod/branches/0.0.1.7/options.h
index e32791e..e32791e 100644
--- a/stopspam_mod/branches/0.0.1.6/options.h
+++ b/stopspam_mod/branches/0.0.1.7/options.h
diff --git a/stopspam_mod/branches/0.0.1.6/resource.h b/stopspam_mod/branches/0.0.1.7/resource.h
index 4e5950e..4e5950e 100644
--- a/stopspam_mod/branches/0.0.1.6/resource.h
+++ b/stopspam_mod/branches/0.0.1.7/resource.h
diff --git a/stopspam_mod/branches/0.0.1.6/stopspam.cpp b/stopspam_mod/branches/0.0.1.7/stopspam.cpp
index e162837..005d67c 100644
--- a/stopspam_mod/branches/0.0.1.6/stopspam.cpp
+++ b/stopspam_mod/branches/0.0.1.7/stopspam.cpp
@@ -61,7 +61,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam)
if(gbSpecialGroup)
DBWriteContactSettingTString(hcntct, "CList", "Group", gbSpammersGroup.c_str());
- int a = CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)gbAuthRepl.c_str());
+ int a = CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)(variables_parse(gbAuthRepl, hcntct).c_str()));
//CallProtoService(dbei.szModule,PS_AUTHDENY,(WPARAM)hDbEvent,(LPARAM)GetAuthRepl().c_str());
delete dbei.pBlob;
@@ -155,7 +155,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
// if message contains right answer...
// if( tstring::npos!=message.find(gbAnswer) )
- if(!wcscmp(message.c_str(), gbAnswer.c_str()))
+ if(!wcscmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str())))
{
// unhide contact
DBDeleteContactSetting(hContact, "CList", "Hidden");
@@ -169,7 +169,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
// send congratulation
#ifdef _UNICODE
- char * buf=mir_utf8encodeW(gbCongratulation.c_str());
+ char * buf=mir_utf8encodeW(variables_parse(gbCongratulation, hContact).c_str());
CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
mir_free(buf);
#else
@@ -186,7 +186,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
&& (!gbMaxQuestCount || DBGetContactSettingDword(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) )
{
// send question
- tstring q = _T("StopSpam automatic message:\r\n") + gbQuestion;
+ tstring q = _T("StopSpam automatic message:\r\n") + variables_parse(gbQuestion, hContact);
#ifdef _UNICODE
char * buf=mir_utf8encodeW(q.c_str());
diff --git a/stopspam_mod/branches/0.0.1.6/stopspam.h b/stopspam_mod/branches/0.0.1.7/stopspam.h
index 10088bb..738ec15 100644
--- a/stopspam_mod/branches/0.0.1.6/stopspam.h
+++ b/stopspam_mod/branches/0.0.1.7/stopspam.h
@@ -15,5 +15,5 @@ extern tstring gbSpammersGroup;
extern tstring gbQuestion;
extern tstring gbAnswer;
extern tstring gbCongratulation;
-extern std::string gbAuthRepl;
+extern std::wstring gbAuthRepl;
diff --git a/stopspam_mod/branches/0.0.1.6/stopspam.rc b/stopspam_mod/branches/0.0.1.7/stopspam.rc
index b38c2d4..14ec700 100644
--- a/stopspam_mod/branches/0.0.1.6/stopspam.rc
+++ b/stopspam_mod/branches/0.0.1.7/stopspam.rc
@@ -142,12 +142,12 @@ BEGIN
VALUE "Comments", "Licensed under the terms of the GNU General Public License"
VALUE "CompanyName", " "
VALUE "FileDescription", "StopSpam plugin for Miranda IM"
- VALUE "FileVersion", "0.0.1.6 alpha build #0"
+ VALUE "FileVersion", "0.0.1.7 alpha build #0"
VALUE "InternalName", "stopspam"
VALUE "LegalCopyright", "Copyright © 2000-2009 Miranda IM Project. This software is released under the terms of the GNU General Public License."
VALUE "OriginalFilename", "stopspam.dll"
VALUE "ProductName", "StopSpam"
- VALUE "ProductVersion", "0.0.1.6 alpha build #0"
+ VALUE "ProductVersion", "0.0.1.7 alpha build #0"
END
END
BLOCK "VarFileInfo"
diff --git a/stopspam_mod/branches/0.0.1.6/stopspam_8.sln b/stopspam_mod/branches/0.0.1.7/stopspam_8.sln
index b7014bb..b7014bb 100644
--- a/stopspam_mod/branches/0.0.1.6/stopspam_8.sln
+++ b/stopspam_mod/branches/0.0.1.7/stopspam_8.sln
diff --git a/stopspam_mod/branches/0.0.1.6/stopspam_8.vcproj b/stopspam_mod/branches/0.0.1.7/stopspam_8.vcproj
index 2bc6d66..2bc6d66 100644
--- a/stopspam_mod/branches/0.0.1.6/stopspam_8.vcproj
+++ b/stopspam_mod/branches/0.0.1.7/stopspam_8.vcproj
diff --git a/stopspam_mod/branches/0.0.1.6/stopspam_9.sln b/stopspam_mod/branches/0.0.1.7/stopspam_9.sln
index db623ad..db623ad 100644
--- a/stopspam_mod/branches/0.0.1.6/stopspam_9.sln
+++ b/stopspam_mod/branches/0.0.1.7/stopspam_9.sln
diff --git a/stopspam_mod/branches/0.0.1.6/stopspam_9.vcproj b/stopspam_mod/branches/0.0.1.7/stopspam_9.vcproj
index 5d81d03..5d81d03 100644
--- a/stopspam_mod/branches/0.0.1.6/stopspam_9.vcproj
+++ b/stopspam_mod/branches/0.0.1.7/stopspam_9.vcproj
diff --git a/stopspam_mod/branches/0.0.1.6/utilities.cpp b/stopspam_mod/branches/0.0.1.7/utilities.cpp
index f2b35b3..bf00574 100644
--- a/stopspam_mod/branches/0.0.1.6/utilities.cpp
+++ b/stopspam_mod/branches/0.0.1.7/utilities.cpp
@@ -70,8 +70,7 @@ void RemoveExcludedUsers()
{
HANDLE hContact;
HANDLE ToRemove[4096];
- int i = 0;
- int a = 0;
+ int i = 0,a = 0;
hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
if(hContact)
{
@@ -92,3 +91,55 @@ void RemoveExcludedUsers()
}
}
}
+
+void RemoveTemporaryUsers()
+{
+ HANDLE hContact;
+ HANDLE ToRemove[4096];
+ int i = 0, a= 0;
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ if(hContact)
+ {
+ do
+ {
+ if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ {
+ ToRemove[i] = hContact;
+ i++;
+ }
+ }
+ while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0));
+ ToRemove[i] = INVALID_HANDLE_VALUE;
+ while(ToRemove[a] != INVALID_HANDLE_VALUE)
+ {
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)ToRemove[a], 0);
+ a++;
+ }
+ }
+}
+int RemoveTmp(WPARAM,LPARAM)
+{
+ RemoveTemporaryUsers();
+ return 0;
+}
+tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){
+ if (ServiceExists(MS_VARS_FORMATSTRING)) {
+ 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;
+} \ No newline at end of file
diff --git a/stopspam_mod/branches/0.0.1.6/utilities.h b/stopspam_mod/branches/0.0.1.7/utilities.h
index efe8a59..1b5f719 100644
--- a/stopspam_mod/branches/0.0.1.6/utilities.h
+++ b/stopspam_mod/branches/0.0.1.7/utilities.h
@@ -3,4 +3,5 @@ std::string DBGetContactSettingStringPAN_A(HANDLE hContact, char const * szModul
tstring &GetDlgItemString(HWND hwnd, int id);
std::string &GetProtoList();
bool ProtoInList(std::string proto);
-void RemoveExcludedUsers(); \ No newline at end of file
+void RemoveExcludedUsers();
+tstring variables_parse(tstring const &tstrFormat, HANDLE hContact); \ No newline at end of file
diff --git a/stopspam_mod/branches/0.0.1.6/version.h b/stopspam_mod/branches/0.0.1.7/version.h
index 9f7c792..9f7c792 100644
--- a/stopspam_mod/branches/0.0.1.6/version.h
+++ b/stopspam_mod/branches/0.0.1.7/version.h