summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_util.cpp')
-rw-r--r--protocols/JabberG/src/jabber_util.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 2a365c562e..2f5a02f792 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -75,8 +75,7 @@ HANDLE CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid)
return (HANDLE)NULL;
HANDLE hContactMatched = NULL;
- HANDLE hContact = (HANDLE)db_find_first();
- while (hContact != NULL) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(m_szModuleName, szProto)) {
DBVARIANT dbv;
@@ -91,10 +90,7 @@ HANDLE CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid)
if ( !result && JGetByte(hContact, "ChatRoom", 0) != 0) {
hContactMatched = hContact;
break;
- } } }
-
- hContact = db_find_next(hContact);
- }
+ } } } }
return hContactMatched;
}
@@ -110,8 +106,8 @@ HANDLE CJabberProto::HContactFromJID(const TCHAR *jid , BOOL bStripResource)
JABBER_LIST_ITEM* item = ListGetItemPtr(LIST_CHATROOM, jid);
HANDLE hContactMatched = NULL;
- HANDLE hContact = (HANDLE)db_find_first();
- while (hContact != NULL) {
+
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(m_szModuleName, szProto)) {
DBVARIANT dbv;
@@ -144,10 +140,7 @@ HANDLE CJabberProto::HContactFromJID(const TCHAR *jid , BOOL bStripResource)
if ( !result) {
hContactMatched = hContact;
break;
- } } }
-
- hContact = db_find_next(hContact);
- }
+ } } } }
return hContactMatched;
}