summaryrefslogtreecommitdiff
path: root/protocols/Xfire
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-09 21:40:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-09 21:40:22 +0000
commit3dc0d9b0b7c30ea2f77d74c4ce5b6ccd67bd525c (patch)
treeefee912ee654baafeb98efcd117921db6b7489bc /protocols/Xfire
parentbcb27264ba737778e5d3edad36088bacf74f0236 (diff)
- the kernel filters out contacts by proto names much faster than a plugin;
- database cycles simplified git-svn-id: http://svn.miranda-ng.org/main/trunk@4404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire')
-rw-r--r--protocols/Xfire/src/main.cpp113
1 files changed, 51 insertions, 62 deletions
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index d0024ef48f..c01716807b 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -1802,79 +1802,68 @@ BOOL IsXFireContact(HANDLE hContact)
HANDLE CList_FindContact (int uid)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char *szProto = GetContactProto(hContact);
- if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
- if ( db_get_dw(hContact, protocolname, "UserId",-1)==uid)
- return hContact;
- }
- }
+ for (HANDLE hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname))
+ if ( db_get_dw(hContact, protocolname, "UserId", -1) == uid)
+ return hContact;
+
return 0;
}
void CList_MakeAllOffline()
{
vector<HANDLE> fhandles;
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char *szProto = GetContactProto(hContact);
- if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
- //freunde von freunden in eine seperate liste setzen
- //nur wenn das nicht abgestellt wurde
- if(db_get_b(hContact,protocolname,"friendoffriend",0)==1&&
- db_get_b(NULL,protocolname,"fofdbremove",0)==1)
- {
- fhandles.push_back(hContact);
- }
-
- db_unset(hContact, "CList", "StatusMsg");
- db_unset(hContact, protocolname, "ServerIP");
- db_unset(hContact, protocolname, "Port");
- db_unset(hContact, protocolname, "ServerName");
- db_unset(hContact, protocolname, "GameType");
- db_unset(hContact, protocolname, "Map");
- db_unset(hContact, protocolname, "Players");
- db_unset(hContact, protocolname, "Passworded");
-
- db_unset(hContact, protocolname, "XStatusMsg");
- db_unset(hContact, protocolname, "XStatusId");
- db_unset(hContact, protocolname, "XStatusName");
-
- if(db_get_b(NULL,protocolname,"noavatars",-1)==1)
- {
- db_unset(hContact, "ContactPhoto", "File");
- db_unset(hContact, "ContactPhoto", "RFile");
- db_unset(hContact, "ContactPhoto", "Backup");
- db_unset(hContact, "ContactPhoto", "Format");
- db_unset(hContact, "ContactPhoto", "ImageHash");
- db_unset(hContact, "ContactPhoto", "XFireAvatarId");
- db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
- }
- else
+ for (HANDLE hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname)) {
+ //freunde von freunden in eine seperate liste setzen
+ //nur wenn das nicht abgestellt wurde
+ if(db_get_b(hContact,protocolname,"friendoffriend",0)==1 && db_get_b(NULL,protocolname,"fofdbremove",0)==1)
+ fhandles.push_back(hContact);
+
+ db_unset(hContact, "CList", "StatusMsg");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "ServerName");
+ db_unset(hContact, protocolname, "GameType");
+ db_unset(hContact, protocolname, "Map");
+ db_unset(hContact, protocolname, "Players");
+ db_unset(hContact, protocolname, "Passworded");
+
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
+
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==1)
+ {
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, "ContactPhoto", "RFile");
+ db_unset(hContact, "ContactPhoto", "Backup");
+ db_unset(hContact, "ContactPhoto", "Format");
+ db_unset(hContact, "ContactPhoto", "ImageHash");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarId");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
+ }
+ else
+ {
+ //prüf ob der avatar noch existiert
+ DBVARIANT dbv;
+ if(!db_get_s(hContact, "ContactPhoto", "File",&dbv))
{
- //prüf ob der avatar noch existiert
- DBVARIANT dbv;
- if(!db_get_s(hContact, "ContactPhoto", "File",&dbv))
+ FILE*f=fopen(dbv.pszVal,"r");
+ if(f==NULL)
{
- FILE*f=fopen(dbv.pszVal,"r");
- if(f==NULL)
- {
- db_unset(hContact, "ContactPhoto", "File");
- db_unset(hContact, "ContactPhoto", "RFile");
- db_unset(hContact, "ContactPhoto", "Backup");
- db_unset(hContact, "ContactPhoto", "Format");
- db_unset(hContact, "ContactPhoto", "ImageHash");
- db_unset(hContact, "ContactPhoto", "XFireAvatarId");
- db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
- }
- else
- {
- fclose(f);
- }
- db_free(&dbv);
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, "ContactPhoto", "RFile");
+ db_unset(hContact, "ContactPhoto", "Backup");
+ db_unset(hContact, "ContactPhoto", "Format");
+ db_unset(hContact, "ContactPhoto", "ImageHash");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarId");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
}
+ else fclose(f);
+
+ db_free(&dbv);
}
- db_set_w(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
}
+ db_set_w(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
}
//alle gefundenen handles lsöchen