summaryrefslogtreecommitdiff
path: root/protocols/IRCG
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/IRCG')
-rw-r--r--protocols/IRCG/src/clist.cpp23
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp14
2 files changed, 14 insertions, 23 deletions
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index d3f4aed5de..a60353a8e5 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -144,9 +144,8 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo)
DisconnectAllDCCSessions(false);
- HANDLE hContact = db_find_first();
- while ( hContact ) {
- char* szProto = GetContactProto(hContact);
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ char *szProto = GetContactProto(hContact);
if (szProto != NULL && !lstrcmpiA( szProto, m_szModuleName)) {
if ( getByte( hContact, "ChatRoom", 0 ) == 0 ) {
if ( getByte(hContact, "DCC", 0 ) != 0 ) {
@@ -161,9 +160,8 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo)
db_unset( hContact, m_szModuleName, "IP" );
setString( hContact, "User", "" );
setString( hContact, "Host", "" );
- } }
-
- hContact = db_find_next(hContact);
+ }
+ }
}
return true;
}
@@ -176,15 +174,14 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user)
TCHAR* lowercasename = mir_tstrdup( user->name );
CharLower(lowercasename);
- char *szProto;
DBVARIANT dbv1;
DBVARIANT dbv2;
DBVARIANT dbv3;
DBVARIANT dbv4;
DBVARIANT dbv5;
- HANDLE hContact = db_find_first();
- while (hContact) {
- szProto = GetContactProto(hContact);
+
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ char *szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, m_szModuleName )) {
if ( getByte( hContact, "ChatRoom", 0) == 0) {
HANDLE hContact_temp = NULL;
@@ -238,9 +235,9 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user)
if ( hContact_temp != (HANDLE)-1 )
return hContact_temp;
return 0;
- } } }
-
- hContact = db_find_next(hContact);
+ }
+ }
+ }
}
mir_free(lowercasename);
return 0;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index a38c11fe2a..e91473722a 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -139,12 +139,9 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
if ( name.IsEmpty() && name2.IsEmpty()) {
DBVARIANT dbv;
- char* szProto;
-
- HANDLE hContact = db_find_first();
- while ( hContact ) {
- szProto = GetContactProto(hContact);
- if ( szProto != NULL && !lstrcmpiA( szProto, ppro->m_szModuleName )) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ char *szProto = GetContactProto(hContact);
+ if (szProto != NULL && !lstrcmpiA( szProto, ppro->m_szModuleName)) {
BYTE bRoom = ppro->getByte(hContact, "ChatRoom", 0);
if ( bRoom == 0 ) {
BYTE bDCC = ppro->getByte(hContact, "DCC", 0);
@@ -177,10 +174,7 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
if ( DBNick ) db_free(&dbv);
if ( DBWildcard ) db_free(&dbv2);
- } } } } }
-
- hContact = db_find_next(hContact);
- } }
+ } } } } } } }
if ( ppro->m_namesToWho.IsEmpty() && ppro->m_namesToUserhost.IsEmpty()) {
ppro->SetChatTimer( ppro->OnlineNotifTimer, 60*1000, OnlineNotifTimerProc );