summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-07 12:09:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-07 12:09:27 +0000
commit03a0b643b94d5aa7f9c129fe73eea314d099cf56 (patch)
tree221081ffe0602905765815d302b02d1f761cf100 /src
parent0ac4b544972fb011e7c7c69e60a1d5d180ada0ac (diff)
shameful end of the group processing zoo, part 1
git-svn-id: http://svn.miranda-ng.org/main/trunk@5994 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdchat/src/chat.h1
-rw-r--r--src/core/stdchat/src/clist.cpp63
2 files changed, 6 insertions, 58 deletions
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h
index e496c6489a..72e3ecd5cf 100644
--- a/src/core/stdchat/src/chat.h
+++ b/src/core/stdchat/src/chat.h
@@ -512,7 +512,6 @@ INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam);
INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam);
int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
INT_PTR CList_PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam);
-void CList_CreateGroup(TCHAR* group);
BOOL CList_AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ... ) ;
HANDLE CList_FindRoom (const char* pszModule, const TCHAR* pszRoom) ;
int WCCmp(TCHAR* wild, TCHAR*string);
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp
index 8ddc8c40d8..b25f555ecf 100644
--- a/src/core/stdchat/src/clist.cpp
+++ b/src/core/stdchat/src/clist.cpp
@@ -35,34 +35,15 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p
else lstrcpyn( pszGroup, _T("Chat rooms"), 50);
if ( pszGroup[0] )
- CList_CreateGroup( pszGroup );
+ Clist_CreateGroup(0, pszGroup);
if ( hContact ) { //contact exist, make sure it is in the right group
- DBVARIANT dbv;
- DBVARIANT dbv2;
- char str[50];
- int i;
-
- if ( pszGroup[0] ) {
- for (i = 0;; i++) {
- _itoa( i, str, 10 );
- if ( db_get_ts( NULL, "CListGroups", str, &dbv )) {
- db_set_ts(hContact, "CList", "Group", pszGroup);
- goto END_GROUPLOOP;
- }
-
- if ( !db_get_ts( hContact, "CList", "Group", &dbv2 )) {
- if ( dbv.ptszVal[0] != '\0' && dbv2.ptszVal[0] != '\0' && !lstrcmpi( dbv.ptszVal + 1, dbv2.ptszVal )) {
- db_free( &dbv );
- db_free( &dbv2 );
- goto END_GROUPLOOP;
- }
- db_free(&dbv2);
- }
- db_free(&dbv);
- } }
+ if (pszGroup[0]) {
+ ptrT grpName( db_get_tsa(hContact, "CList", "Group"));
+ if ( !lstrcmp(pszGroup, grpName))
+ db_set_ts(hContact, "CList", "Group", pszGroup);
+ }
-END_GROUPLOOP:
db_set_w( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
db_set_ts(hContact, pszModule, "Nick", pszDisplayName );
return hContact;
@@ -217,38 +198,6 @@ INT_PTR CList_PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam)
return CList_PrebuildContactMenu(wParam, lParam);
}
-
-void CList_CreateGroup(TCHAR* group)
-{
- int i;
- char str[50];
- TCHAR name[256];
- DBVARIANT dbv;
-
- if ( !group )
- return;
-
- for (i = 0;; i++)
- {
- _itoa(i, str, 10);
- if ( db_get_ts( NULL, "CListGroups", str, &dbv ))
- break;
-
- if ( dbv.pszVal[0] != '\0' && !lstrcmpi(dbv.ptszVal + 1, group)) {
- db_free(&dbv);
- return;
- }
-
- db_free(&dbv);
- }
-
- name[0] = 1 | GROUPF_EXPANDED;
- _tcsncpy(name + 1, group, SIZEOF(name) - 1);
- name[ lstrlen(group) + 1] = '\0';
- db_set_ts(NULL, "CListGroups", str, name);
- CallService(MS_CLUI_GROUPADDED, i + 1, 0);
-}
-
BOOL CList_AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ... )
{
CLISTEVENT cle = {0};