diff options
Diffstat (limited to 'protocols/IRCG')
-rw-r--r-- | protocols/IRCG/src/clist.cpp | 136 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 74 |
2 files changed, 105 insertions, 105 deletions
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index a60353a8e5..9ea40c9512 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -144,24 +144,22 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) DisconnectAllDCCSessions(false);
- 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 ) {
- if ( ChatsToo )
- setWord(hContact, "Status", ID_STATUS_OFFLINE);
- }
- else if ( !getTString( hContact, "Default", &dbv )) {
- setTString( hContact, "Nick", dbv.ptszVal);
- setWord( hContact, "Status", ID_STATUS_OFFLINE );
- db_free( &dbv );
- }
- db_unset( hContact, m_szModuleName, "IP" );
- setString( hContact, "User", "" );
- setString( hContact, "Host", "" );
- }
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ if ( getByte( hContact, "ChatRoom", 0 ))
+ continue;
+
+ if ( getByte(hContact, "DCC", 0 ) != 0 ) {
+ if ( ChatsToo )
+ setWord(hContact, "Status", ID_STATUS_OFFLINE);
+ }
+ else if ( !getTString( hContact, "Default", &dbv )) {
+ setTString( hContact, "Nick", dbv.ptszVal);
+ setWord( hContact, "Status", ID_STATUS_OFFLINE );
+ db_free( &dbv );
}
+ db_unset( hContact, m_szModuleName, "IP" );
+ setString( hContact, "User", "" );
+ setString( hContact, "Host", "" );
}
return true;
}
@@ -180,64 +178,62 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user) DBVARIANT dbv4;
DBVARIANT dbv5;
- 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;
- TCHAR* DBDefault = NULL;
- TCHAR* DBNick = NULL;
- TCHAR* DBWildcard = NULL;
- TCHAR* DBUser = NULL;
- TCHAR* DBHost = NULL;
- if ( !getTString(hContact, "Default", &dbv1)) DBDefault = dbv1.ptszVal;
- if ( !getTString(hContact, "Nick", &dbv2)) DBNick = dbv2.ptszVal;
- if ( !getTString(hContact, "UWildcard", &dbv3)) DBWildcard = dbv3.ptszVal;
- if ( !getTString(hContact, "UUser", &dbv4)) DBUser = dbv4.ptszVal;
- if ( !getTString(hContact, "UHost", &dbv5)) DBHost = dbv5.ptszVal;
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ if ( getByte( hContact, "ChatRoom", 0))
+ continue;
+
+ HANDLE hContact_temp = NULL;
+ TCHAR* DBDefault = NULL;
+ TCHAR* DBNick = NULL;
+ TCHAR* DBWildcard = NULL;
+ TCHAR* DBUser = NULL;
+ TCHAR* DBHost = NULL;
+ if ( !getTString(hContact, "Default", &dbv1)) DBDefault = dbv1.ptszVal;
+ if ( !getTString(hContact, "Nick", &dbv2)) DBNick = dbv2.ptszVal;
+ if ( !getTString(hContact, "UWildcard", &dbv3)) DBWildcard = dbv3.ptszVal;
+ if ( !getTString(hContact, "UUser", &dbv4)) DBUser = dbv4.ptszVal;
+ if ( !getTString(hContact, "UHost", &dbv5)) DBHost = dbv5.ptszVal;
- if ( DBWildcard )
- CharLower( DBWildcard );
- if ( IsChannel( user->name )) {
- if ( DBDefault && !lstrcmpi( DBDefault, user->name ))
- hContact_temp = (HANDLE)-1;
- }
- else if ( user->ExactNick && DBNick && !lstrcmpi( DBNick, user->name ))
- hContact_temp = hContact;
+ if ( DBWildcard )
+ CharLower( DBWildcard );
+ if ( IsChannel( user->name )) {
+ if ( DBDefault && !lstrcmpi( DBDefault, user->name ))
+ hContact_temp = (HANDLE)-1;
+ }
+ else if ( user->ExactNick && DBNick && !lstrcmpi( DBNick, user->name ))
+ hContact_temp = hContact;
- else if ( user->ExactOnly && DBDefault && !lstrcmpi( DBDefault, user->name ))
- hContact_temp = hContact;
+ else if ( user->ExactOnly && DBDefault && !lstrcmpi( DBDefault, user->name ))
+ hContact_temp = hContact;
- else if ( user->ExactWCOnly ) {
- if ( DBWildcard && !lstrcmpi( DBWildcard, lowercasename )
- || ( DBWildcard && !lstrcmpi( DBNick, lowercasename ) && !WCCmp( DBWildcard, lowercasename ))
- || ( !DBWildcard && !lstrcmpi(DBNick, lowercasename)))
- {
- hContact_temp = hContact;
- }
- }
- else if ( _tcschr(user->name, ' ' ) == 0 ) {
- if (( DBDefault && !lstrcmpi(DBDefault, user->name) || DBNick && !lstrcmpi(DBNick, user->name) ||
- DBWildcard && WCCmp( DBWildcard, lowercasename ))
- && ( WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host)))
- {
- hContact_temp = hContact;
- } }
-
- if ( DBDefault ) db_free(&dbv1);
- if ( DBNick ) db_free(&dbv2);
- if ( DBWildcard ) db_free(&dbv3);
- if ( DBUser ) db_free(&dbv4);
- if ( DBHost ) db_free(&dbv5);
-
- if ( hContact_temp != NULL ) {
- mir_free(lowercasename);
- if ( hContact_temp != (HANDLE)-1 )
- return hContact_temp;
- return 0;
- }
+ else if ( user->ExactWCOnly ) {
+ if ( DBWildcard && !lstrcmpi( DBWildcard, lowercasename )
+ || ( DBWildcard && !lstrcmpi( DBNick, lowercasename ) && !WCCmp( DBWildcard, lowercasename ))
+ || ( !DBWildcard && !lstrcmpi(DBNick, lowercasename)))
+ {
+ hContact_temp = hContact;
}
}
+ else if ( _tcschr(user->name, ' ' ) == 0 ) {
+ if (( DBDefault && !lstrcmpi(DBDefault, user->name) || DBNick && !lstrcmpi(DBNick, user->name) ||
+ DBWildcard && WCCmp( DBWildcard, lowercasename ))
+ && ( WCCmp(DBUser, user->user) && WCCmp(DBHost, user->host)))
+ {
+ hContact_temp = hContact;
+ } }
+
+ if ( DBDefault ) db_free(&dbv1);
+ if ( DBNick ) db_free(&dbv2);
+ if ( DBWildcard ) db_free(&dbv3);
+ if ( DBUser ) db_free(&dbv4);
+ if ( DBHost ) db_free(&dbv5);
+
+ if ( hContact_temp != NULL ) {
+ mir_free(lowercasename);
+ if ( hContact_temp != (HANDLE)-1 )
+ return hContact_temp;
+ return 0;
+ }
}
mir_free(lowercasename);
return 0;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index e91473722a..085431f8de 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -139,42 +139,46 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) if ( name.IsEmpty() && name2.IsEmpty()) {
DBVARIANT dbv;
- 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);
- BYTE bHidden = db_get_b(hContact,"CList", "Hidden", 0);
- if ( bDCC == 0 && bHidden == 0 ) {
- if ( !ppro->getTString( hContact, "Default", &dbv )) {
- BYTE bAdvanced = ppro->getByte(hContact, "AdvancedMode", 0) ;
- if ( !bAdvanced ) {
- db_free( &dbv );
- if ( !ppro->getTString( hContact, "Nick", &dbv )) {
- ppro->m_namesToUserhost += CMString(dbv.ptszVal) + _T(" ");
- db_free( &dbv );
- }
- }
- else {
- db_free( &dbv );
- DBVARIANT dbv2;
+ for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) {
+ if ( ppro->getByte(hContact, "ChatRoom", 0))
+ continue;
+
+ BYTE bDCC = ppro->getByte(hContact, "DCC", 0);
+ BYTE bHidden = db_get_b(hContact,"CList", "Hidden", 0);
+ if ( bDCC || bHidden)
+ continue;
+ if ( ppro->getTString( hContact, "Default", &dbv ))
+ continue;
+
+ BYTE bAdvanced = ppro->getByte(hContact, "AdvancedMode", 0) ;
+ if ( !bAdvanced ) {
+ db_free( &dbv );
+ if ( !ppro->getTString( hContact, "Nick", &dbv )) {
+ ppro->m_namesToUserhost += CMString(dbv.ptszVal) + _T(" ");
+ db_free( &dbv );
+ }
+ }
+ else {
+ db_free( &dbv );
+ DBVARIANT dbv2;
- TCHAR* DBNick = NULL;
- TCHAR* DBWildcard = NULL;
- if ( !ppro->getTString( hContact, "Nick", &dbv ))
- DBNick = dbv.ptszVal;
- if ( !ppro->getTString( hContact, "UWildcard", &dbv2 ))
- DBWildcard = dbv2.ptszVal;
-
- if ( DBNick && ( !DBWildcard || !WCCmp(CharLower(DBWildcard), CharLower(DBNick))))
- ppro->m_namesToWho += CMString(DBNick) + _T(" ");
- else if ( DBWildcard )
- ppro->m_namesToWho += CMString(DBWildcard) + _T(" ");
-
- if ( DBNick ) db_free(&dbv);
- if ( DBWildcard ) db_free(&dbv2);
- } } } } } } }
+ TCHAR* DBNick = NULL;
+ TCHAR* DBWildcard = NULL;
+ if ( !ppro->getTString( hContact, "Nick", &dbv ))
+ DBNick = dbv.ptszVal;
+ if ( !ppro->getTString( hContact, "UWildcard", &dbv2 ))
+ DBWildcard = dbv2.ptszVal;
+
+ if ( DBNick && ( !DBWildcard || !WCCmp(CharLower(DBWildcard), CharLower(DBNick))))
+ ppro->m_namesToWho += CMString(DBNick) + _T(" ");
+ else if ( DBWildcard )
+ ppro->m_namesToWho += CMString(DBWildcard) + _T(" ");
+
+ if ( DBNick ) db_free(&dbv);
+ if ( DBWildcard ) db_free(&dbv2);
+ }
+ }
+ }
if ( ppro->m_namesToWho.IsEmpty() && ppro->m_namesToUserhost.IsEmpty()) {
ppro->SetChatTimer( ppro->OnlineNotifTimer, 60*1000, OnlineNotifTimerProc );
|