diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-09 21:40:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-09 21:40:22 +0000 |
commit | 3dc0d9b0b7c30ea2f77d74c4ce5b6ccd67bd525c (patch) | |
tree | efee912ee654baafeb98efcd117921db6b7489bc /plugins/Clist_nicer | |
parent | bcb27264ba737778e5d3edad36088bacf74f0236 (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 'plugins/Clist_nicer')
-rw-r--r-- | plugins/Clist_nicer/src/extBackg.cpp | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 7e4f351407..b9a69e5e86 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1223,7 +1223,7 @@ void IMG_LoadItems() void LoadPerContactSkins(TCHAR *tszFileName)
{
- char *p, *szProto, *uid, szItem[100];
+ char *p, szItem[100];
char *szSections = reinterpret_cast<char *>(malloc(3002));
StatusItems_t *items = NULL, *this_item;
int i = 1;
@@ -1261,58 +1261,57 @@ void LoadPerContactSkins(TCHAR *tszFileName) if (items) {
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char UIN[40];
- int j;
+ char *szProto = GetContactProto(hContact);
+ if (szProto == NULL)
+ continue;
- szProto = GetContactProto(hContact);
- if (szProto) {
- uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR) uid != CALLSERVICE_NOTFOUND && uid != NULL) {
- DBVARIANT dbv = {0};
+ char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ if ((INT_PTR) uid != CALLSERVICE_NOTFOUND && uid != NULL) {
+ DBVARIANT dbv = {0};
+ db_get(hContact, szProto, uid, &dbv);
- db_get(hContact, szProto, uid, &dbv);
- switch(dbv.type) {
- case DBVT_DWORD:
- mir_snprintf(UIN, 40, "%d", dbv.dVal);
- break;
- case DBVT_ASCIIZ:
- mir_snprintf(UIN, 40, "%s", dbv.pszVal);
- db_free(&dbv);
- break;
- default:
- UIN[0] = 0;
+ char UIN[40];
+ switch(dbv.type) {
+ case DBVT_DWORD:
+ mir_snprintf(UIN, 40, "%d", dbv.dVal);
+ break;
+ case DBVT_ASCIIZ:
+ mir_snprintf(UIN, 40, "%s", dbv.pszVal);
+ db_free(&dbv);
+ break;
+ default:
+ UIN[0] = 0;
+ break;
+ }
+
+ int j;
+ for (j = 0; j < i - 1; j++) {
+ if ( !strcmp(szProto, items[j].szName) && !strcmp(UIN, items[j].szDBname) &&
+ lstrlenA(szProto) == lstrlenA(items[j].szName) && lstrlenA(UIN) == lstrlenA(items[j].szDBname)) {
+ cfg::writeDword(hContact, "EXTBK", "TEXT", items[j].TEXTCOLOR);
+ cfg::writeDword(hContact, "EXTBK", "COLOR1", items[j].COLOR);
+ cfg::writeDword(hContact, "EXTBK", "COLOR2", items[j].COLOR2);
+ cfg::writeByte(hContact, "EXTBK", "ALPHA", (BYTE)items[j].ALPHA);
+
+ cfg::writeByte(hContact, "EXTBK", "LEFT", (BYTE)items[j].MARGIN_LEFT);
+ cfg::writeByte(hContact, "EXTBK", "RIGHT", (BYTE)items[j].MARGIN_RIGHT);
+ cfg::writeByte(hContact, "EXTBK", "TOP", (BYTE)items[j].MARGIN_TOP);
+ cfg::writeByte(hContact, "EXTBK", "BOTTOM", (BYTE)items[j].MARGIN_BOTTOM);
+
+ cfg::writeByte(hContact, "EXTBK", "TRANS", items[j].COLOR2_TRANSPARENT);
+ cfg::writeDword(hContact, "EXTBK", "BDR", items[j].BORDERSTYLE);
+
+ cfg::writeByte(hContact, "EXTBK", "CORNER", items[j].CORNER);
+ cfg::writeByte(hContact, "EXTBK", "GRAD", items[j].GRADIENT);
+ cfg::writeByte(hContact, "EXTBK", "TRANS", items[j].COLOR2_TRANSPARENT);
+
+ cfg::writeByte(hContact, "EXTBK", "VALID", 1);
break;
}
- for (j = 0; j < i - 1; j++) {
- if ( !strcmp(szProto, items[j].szName) && !strcmp(UIN, items[j].szDBname)
- && lstrlenA(szProto) == lstrlenA(items[j].szName) && lstrlenA(UIN) == lstrlenA(items[j].szDBname)) {
-
- //_DebugPopup(hContact, "Found: %s, %s", szProto, UIN);
- cfg::writeDword(hContact, "EXTBK", "TEXT", items[j].TEXTCOLOR);
- cfg::writeDword(hContact, "EXTBK", "COLOR1", items[j].COLOR);
- cfg::writeDword(hContact, "EXTBK", "COLOR2", items[j].COLOR2);
- cfg::writeByte(hContact, "EXTBK", "ALPHA", (BYTE)items[j].ALPHA);
-
- cfg::writeByte(hContact, "EXTBK", "LEFT", (BYTE)items[j].MARGIN_LEFT);
- cfg::writeByte(hContact, "EXTBK", "RIGHT", (BYTE)items[j].MARGIN_RIGHT);
- cfg::writeByte(hContact, "EXTBK", "TOP", (BYTE)items[j].MARGIN_TOP);
- cfg::writeByte(hContact, "EXTBK", "BOTTOM", (BYTE)items[j].MARGIN_BOTTOM);
-
- cfg::writeByte(hContact, "EXTBK", "TRANS", items[j].COLOR2_TRANSPARENT);
- cfg::writeDword(hContact, "EXTBK", "BDR", items[j].BORDERSTYLE);
-
- cfg::writeByte(hContact, "EXTBK", "CORNER", items[j].CORNER);
- cfg::writeByte(hContact, "EXTBK", "GRAD", items[j].GRADIENT);
- cfg::writeByte(hContact, "EXTBK", "TRANS", items[j].COLOR2_TRANSPARENT);
-
- cfg::writeByte(hContact, "EXTBK", "VALID", 1);
- break;
- }
- }
- if (j == i - 1) { // disable the db copy if it has been disabled in the skin .ini file
- if (cfg::getByte(hContact, "EXTBK", "VALID", 0))
- cfg::writeByte(hContact, "EXTBK", "VALID", 0);
- }
+ }
+ if (j == i - 1) { // disable the db copy if it has been disabled in the skin .ini file
+ if (cfg::getByte(hContact, "EXTBK", "VALID", 0))
+ cfg::writeByte(hContact, "EXTBK", "VALID", 0);
}
}
}
|