summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2009-06-23 05:54:45 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2009-06-23 05:54:45 +0300
commitc506453b8518a9bd7622756f24e24323ad97e375 (patch)
tree6cac9b33bac4a5dfae263e91f77aaf32e699a31c
parentb06a183ded8a1dbd07de2f706290da55d22c128a (diff)
added main menu entry for delete all temporary contacts.
-rw-r--r--stopspam_mod/tags/0.0.1.5/Makefile8
-rw-r--r--stopspam_mod/trunk/Makefile8
-rw-r--r--stopspam_mod/trunk/headers.h1
-rw-r--r--stopspam_mod/trunk/init.cpp13
-rw-r--r--stopspam_mod/trunk/utilities.cpp34
5 files changed, 54 insertions, 10 deletions
diff --git a/stopspam_mod/tags/0.0.1.5/Makefile b/stopspam_mod/tags/0.0.1.5/Makefile
index fc08dd9..fda598f 100644
--- a/stopspam_mod/tags/0.0.1.5/Makefile
+++ b/stopspam_mod/tags/0.0.1.5/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/trunk/Makefile b/stopspam_mod/trunk/Makefile
index fc08dd9..fda598f 100644
--- a/stopspam_mod/trunk/Makefile
+++ b/stopspam_mod/trunk/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/trunk/headers.h b/stopspam_mod/trunk/headers.h
index 088f622..f41fc97 100644
--- a/stopspam_mod/trunk/headers.h
+++ b/stopspam_mod/trunk/headers.h
@@ -11,6 +11,7 @@
#include <m_utils.h>
#include <m_langpack.h>
#include <m_clistint.h>
+#include <m_skin.h>
#include "globals.h"
#include "stopspam.h"
diff --git a/stopspam_mod/trunk/init.cpp b/stopspam_mod/trunk/init.cpp
index 17287f9..f762872 100644
--- a/stopspam_mod/trunk/init.cpp
+++ b/stopspam_mod/trunk/init.cpp
@@ -22,6 +22,7 @@ tstring gbCongratulation;
std::string gbAuthRepl;
extern char * pluginDescription;
extern TCHAR const * defQuestion;
+extern int RemoveTmp(WPARAM,LPARAM);
struct MM_INTERFACE mmi;
@@ -171,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/trunk/utilities.cpp b/stopspam_mod/trunk/utilities.cpp
index f2b35b3..655ba24 100644
--- a/stopspam_mod/trunk/utilities.cpp
+++ b/stopspam_mod/trunk/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,34 @@ 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;
+}