summaryrefslogtreecommitdiff
path: root/plugins/StopSpamMod/src/utilities.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-09 20:03:46 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-09 20:03:46 +0000
commitbcb27264ba737778e5d3edad36088bacf74f0236 (patch)
treefd1f57744dd380b7babe312a0ab5dc60b48854f2 /plugins/StopSpamMod/src/utilities.cpp
parent940231dc5a484b03a278900e1880aa083472b601 (diff)
- short function names allows to write database loops in one string;
- 'continue' operator can be used then; - multiple bugs fixed in clists; - code becomes much more compact; git-svn-id: http://svn.miranda-ng.org/main/trunk@4403 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StopSpamMod/src/utilities.cpp')
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp91
1 files changed, 3 insertions, 88 deletions
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index 44ad773675..4e31ebfbb3 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -100,92 +100,6 @@ void DeleteCListGroupsByName(TCHAR* szGroupName)
db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete);
}
-/*
-void RemoveExcludedUsers()
-{
- HANDLE hContact;
- hContact_entry *first, *plist, *tmp;
- hContact = db_find_first();
- first = new hContact_entry;
- plist = first;
- plist->hContact = INVALID_HANDLE_VALUE;
- if(hContact)
- {
- do{
- if(db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, pluginName, "Excluded", 0))
- {
- plist->hContact = hContact;
- plist->next = new hContact_entry;
- plist = plist->next;
- plist->hContact = INVALID_HANDLE_VALUE;
- }
- }while(hContact = db_find_next(hContact));
-
- plist = first;
- while(plist->hContact != INVALID_HANDLE_VALUE)
- {
- std::string proto=DBGetContactSettingStringPAN_A(plist->hContact,"Protocol","p","");
- UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0);
-
- if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){
- LogSpamToFile(plist->hContact, _T("Mark for delete"));
- db_set_b(plist->hContact,"CList","Delete", 1);
- }else{
- LogSpamToFile(plist->hContact, _T("Deleted"));
- 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 = db_find_first();
- first = new hContact_entry;
- plist = first;
- plist->hContact = INVALID_HANDLE_VALUE;
- if(hContact)
- {
- do{
- if(db_get_b(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 = db_find_next(hContact));
-
- plist = first;
- while(plist->hContact != INVALID_HANDLE_VALUE)
- {
- std::string proto=DBGetContactSettingStringPAN_A(plist->hContact,"Protocol","p","");
- UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0);
-
- if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){
- LogSpamToFile(plist->hContact, _T("Mark for delete"));
- db_set_b(plist->hContact,"CList","Delete", 1);
- }else{
- 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)
{
void CleanThread();
@@ -394,9 +308,9 @@ void CleanProtocolTmpThread(std::string proto)
break;
boost::this_thread::sleep(boost::posix_time::seconds(2));
}
+
std::list<HANDLE> contacts;
- for(HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- {
+ for(HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *proto_tmp = GetContactProto(hContact);
if(proto_tmp)
if(!strcmp(proto.c_str(), proto_tmp))
@@ -424,6 +338,7 @@ void CleanProtocolExclThread(std::string proto)
break;
boost::this_thread::sleep(boost::posix_time::seconds(2));
}
+
std::list<HANDLE> contacts;
for(HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
{