summaryrefslogtreecommitdiff
path: root/plugins/SecureIM
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/SecureIM
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/SecureIM')
-rw-r--r--plugins/SecureIM/src/crypt_icons.cpp5
-rw-r--r--plugins/SecureIM/src/crypt_lists.cpp5
-rw-r--r--plugins/SecureIM/src/options.cpp12
3 files changed, 5 insertions, 17 deletions
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp
index d5eacbd51b..5907fb5b62 100644
--- a/plugins/SecureIM/src/crypt_icons.cpp
+++ b/plugins/SecureIM/src/crypt_icons.cpp
@@ -107,12 +107,9 @@ void RefreshContactListIcons(void)
for (int i=0; i < arIcoList.getCount(); i++)
arIcoList[i].hCLIcon = 0;
- HANDLE hContact = db_find_first();
- while (hContact) { // и снова зажигаем иконку
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
if (isSecureProtocol(hContact))
ShowStatusIcon(hContact);
- hContact = db_find_next(hContact);
- }
}
// EOF
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp
index 784cb2378d..47d53a7878 100644
--- a/plugins/SecureIM/src/crypt_lists.cpp
+++ b/plugins/SecureIM/src/crypt_lists.cpp
@@ -118,11 +118,8 @@ void loadContactList()
freeContactList();
loadSupportedProtocols();
- HANDLE hContact = db_find_first();
- while (hContact) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
addContact(hContact);
- hContact = db_find_next(hContact);
- }
}
// free list of secureIM users
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp
index 386fc023bf..795e88b14c 100644
--- a/plugins/SecureIM/src/options.cpp
+++ b/plugins/SecureIM/src/options.cpp
@@ -985,10 +985,9 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit)
LVITEM lvi; memset(&lvi,0,sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- HANDLE hContact = db_find_first();
char tmp[NAMSIZE];
- while (hContact) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
pUinKey ptr = getUinKey(hContact);
if (ptr && isSecureProtocol(hContact) && !isChatRoom(hContact)) {
if (iInit) {
@@ -1013,7 +1012,6 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit)
else setListViewPUB(hLV, itemNum, hasKey(ptr));
setListViewIcon(hLV, itemNum, ptr);
}
- hContact = db_find_next(hContact);
}
ListView_Sort(hLV,0);
}
@@ -1073,10 +1071,9 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit)
LVITEM lvi; memset(&lvi,0,sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- HANDLE hContact = db_find_first();
char tmp[NAMSIZE];
- while (hContact) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
pUinKey ptr = getUinKey(hContact);
if (ptr && ptr->mode == MODE_PGP && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) {
LPSTR szKeyID = db_get_sa(hContact,MODULENAME,"pgp_abbr");
@@ -1095,7 +1092,6 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit)
LV_SetItemTextA(hLV, itemNum, 2, (szKeyID)?szKeyID:Translate(sim221));
SAFE_FREE(szKeyID);
}
- hContact = db_find_next(hContact);
}
ListView_Sort(hLV,(LPARAM)0x10);
}
@@ -1135,10 +1131,9 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit)
LVITEM lvi; memset(&lvi,0,sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- HANDLE hContact = db_find_first();
char tmp[NAMSIZE];
- while (hContact) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
pUinKey ptr = getUinKey(hContact);
if (ptr && ptr->mode == MODE_GPG && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) {
if (iInit )
@@ -1161,7 +1156,6 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit)
LV_SetItemTextA(hLV, itemNum, 3, (ptr->tgpgMode)?Translate(sim228):Translate(sim229));
SAFE_FREE(szKeyID);
}
- hContact = db_find_next(hContact);
}
ListView_Sort(hLV,(LPARAM)0x20);
}