summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/MirOTR/src/dllmain.cpp5
-rw-r--r--plugins/MirOTR/MirOTR/src/options.cpp8
-rw-r--r--plugins/MirOTR/MirOTR/src/utils.cpp5
3 files changed, 4 insertions, 14 deletions
diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp
index 9d788fac89..84499c11c6 100644
--- a/plugins/MirOTR/MirOTR/src/dllmain.cpp
+++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp
@@ -102,11 +102,8 @@ extern "C" __declspec(dllexport) int Load(void)
// remove us as a filter to all contacts - fix filter type problem
if(db_get_b(0, MODULENAME, "FilterOrderFix", 0) != 2) {
- HANDLE hContact = db_find_first();
- while ( hContact != NULL ) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME);
- hContact = db_find_next(hContact);
- }
db_set_b(0, MODULENAME, "FilterOrderFix", 2);
}
diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp
index 27de2987ea..41ea5f8209 100644
--- a/plugins/MirOTR/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/MirOTR/src/options.cpp
@@ -560,9 +560,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
const char *proto;
TCHAR *proto_t;
- HANDLE hContact = db_find_first();
- while ( hContact != NULL )
- {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
proto = contact_get_proto(hContact);
if(proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME) // ignore chatrooms
&& (g_metaproto == 0 || strcmp(proto, g_metaproto) != 0)) // and MetaContacts
@@ -580,13 +578,11 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
ListView_SetItemText(lv, lvI.iItem, 2, (TCHAR*)policy_to_string((OtrlPolicy)db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY)) );
ListView_SetItemText(lv, lvI.iItem, 3, (db_get_b(hContact, MODULENAME, "HTMLConv", 0))?TranslateT(LANG_YES):TranslateT(LANG_NO) );
}
-
-
- hContact = db_find_next(hContact);
}
}
return TRUE;
break;
+
case WM_COMMAND:
switch ( HIWORD( wParam )) {
case CBN_SELCHANGE:
diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp
index 148934b9cc..859d3b7be5 100644
--- a/plugins/MirOTR/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/MirOTR/src/utils.cpp
@@ -18,9 +18,7 @@ void lib_cs_unlock() {
}
HANDLE find_contact(const char* userid, const char* protocol) {
- HANDLE hContact = db_find_first();
- while ( hContact != NULL )
- {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
const char *proto = contact_get_proto(hContact);
if(proto && strcmp(proto, protocol) == 0) {
char *name = contact_get_id(hContact);
@@ -30,7 +28,6 @@ HANDLE find_contact(const char* userid, const char* protocol) {
}
mir_free(name);
}
- hContact = db_find_next(hContact);
}
return 0;