summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-16 20:01:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-16 20:01:14 +0300
commit39390b02dbd5aa7eb21a83773fa561b39f8828bc (patch)
tree7982eda1257f7466b5663c2865fdb7804c397257 /plugins/New_GPG/src
parent5046973a41e412afd06d6a78a3b9bce226e3cf50 (diff)
always hated these long expressions: contact_iter makes them much shorter
Diffstat (limited to 'plugins/New_GPG/src')
-rwxr-xr-xplugins/New_GPG/src/icons.cpp2
-rwxr-xr-xplugins/New_GPG/src/options.cpp8
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp4
3 files changed, 6 insertions, 8 deletions
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp
index 8fec21dd53..87faa64938 100755
--- a/plugins/New_GPG/src/icons.cpp
+++ b/plugins/New_GPG/src/icons.cpp
@@ -68,7 +68,7 @@ void setSrmmIcon(MCONTACT h)
void RefreshContactListIcons()
{
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
setClistIcon(hContact);
Clist_EndRebuild();
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 4aa3d0bb7f..07e3840372 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -59,10 +59,8 @@ public:
list_USERLIST.AddColumn(4, TranslateT("Protocol"), 60);
list_USERLIST.SetExtendedListViewStyle(LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_SINGLEROW);
int i = 1;
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
- {
- if (isContactHaveKey(hContact))
- {
+ for (auto &hContact : contact_iter()) {
+ if (isContactHaveKey(hContact)) {
wchar_t *name = pcli->pfnGetContactDisplayName(hContact, 0);
int row = list_USERLIST.AddItem(L"", 0);
@@ -173,7 +171,7 @@ public:
ismetacontact = true;
}
tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", "");
- for (MCONTACT hcnttmp = db_find_first(); hcnttmp != NULL; hcnttmp = db_find_next(hcnttmp)) {
+ for (auto &hcnttmp : contact_iter()) {
if (hcnttmp != hContact) {
char *tmp2 = UniGetContactSettingUtf(hcnttmp, szGPGModuleName, "KeyID", "");
if (!mir_strcmp(tmp, tmp2)) {
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index d82259f9c8..99eb4e35f7 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -1249,7 +1249,7 @@ void ExportGpGKeysFunc(int type)
if (!file.is_open())
return; //TODO: handle error
if (!type || type == 2) {
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
char *k = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", "");
std::string key;
if (!k[0]) {
@@ -1531,7 +1531,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM)
}
if (acc.length()) {
const char * uid = (const char*)CallProtoService(acc.c_str(), PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
- for (MCONTACT hContact = db_find_first(acc.c_str()); hContact; hContact = db_find_next(hContact, acc.c_str())) {
+ for (auto &hContact : contact_iter(acc.c_str())) {
DBVARIANT dbv = { 0 };
db_get(hContact, acc.c_str(), uid, &dbv);
std::string id;