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/Non-IM Contact | |
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/Non-IM Contact')
-rw-r--r-- | plugins/Non-IM Contact/src/files.cpp | 47 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/timer.cpp | 12 |
2 files changed, 27 insertions, 32 deletions
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index cdf17aed7c..d559fc6df8 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -14,31 +14,28 @@ INT_PTR exportContacts(WPARAM wParam,LPARAM lParam) if (!file)
return 0;
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- const char* proto = GetContactProto(hContact);
- if (proto && !strcmp(proto, MODNAME)) {
- int tmp;
- char DBVar[1024];
- if (db_get_static(hContact, MODNAME, "Name", DBVar)) {
- fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ProgramString", DBVar))
- fprintf(file, "ProgramString=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar))
- fprintf(file, "ProgramParamString=%s\r\n", DBVar);
- if (db_get_static(hContact, MODNAME, "ToolTip", DBVar))
- fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
- if (db_get_static(hContact, "CList", "Group", DBVar))
- fprintf(file, "Group=%s\r\n", DBVar);
- if (tmp = db_get_w(hContact, MODNAME, "Icon", 40072))
- fprintf(file, "Icon=%d\r\n", tmp);
- if (tmp = db_get_b(hContact, MODNAME, "UseTimer", 0))
- fprintf(file, "UseTimer=%d\r\n", tmp);
- if (tmp = db_get_b(hContact, MODNAME, "Minutes", 1))
- fprintf(file, "Minutes=%d\r\n", tmp);
- if (tmp = db_get_w(hContact, MODNAME, "Timer", 0))
- fprintf(file, "Timer=%d\r\n", tmp);
- fprintf(file, "[/Non-IM Contact]\r\n");
- }
+ for (HANDLE hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) {
+ int tmp;
+ char DBVar[1024];
+ if (db_get_static(hContact, MODNAME, "Name", DBVar)) {
+ fprintf(file, "\r\n[Non-IM Contact]\r\nName=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ProgramString", DBVar))
+ fprintf(file, "ProgramString=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ProgramParamString", DBVar))
+ fprintf(file, "ProgramParamString=%s\r\n", DBVar);
+ if (db_get_static(hContact, MODNAME, "ToolTip", DBVar))
+ fprintf(file, "ToolTip=%s</tooltip>\r\n", DBVar);
+ if (db_get_static(hContact, "CList", "Group", DBVar))
+ fprintf(file, "Group=%s\r\n", DBVar);
+ if (tmp = db_get_w(hContact, MODNAME, "Icon", 40072))
+ fprintf(file, "Icon=%d\r\n", tmp);
+ if (tmp = db_get_b(hContact, MODNAME, "UseTimer", 0))
+ fprintf(file, "UseTimer=%d\r\n", tmp);
+ if (tmp = db_get_b(hContact, MODNAME, "Minutes", 1))
+ fprintf(file, "Minutes=%d\r\n", tmp);
+ if (tmp = db_get_w(hContact, MODNAME, "Timer", 0))
+ fprintf(file, "Timer=%d\r\n", tmp);
+ fprintf(file, "[/Non-IM Contact]\r\n");
}
}
fclose(file);
diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index 42e2b47df1..0abd79e458 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -40,13 +40,11 @@ void timerFunc(LPVOID di) }
/* update all the contacts */
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if (!strcmp(MODNAME, GetContactProto(hContact))) {
- int timer = db_get_w(hContact, MODNAME, "Timer", 15);
- if (timer && !(timerCount % timer))
- if (db_get_static(hContact, MODNAME, "Name", text))
- replaceAllStrings(hContact);
- }
+ for (HANDLE hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) {
+ int timer = db_get_w(hContact, MODNAME, "Timer", 15);
+ if (timer && !(timerCount % timer))
+ if (db_get_static(hContact, MODNAME, "Name", text))
+ replaceAllStrings(hContact);
}
}
|