summaryrefslogtreecommitdiff
path: root/plugins/Scriver/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 /plugins/Scriver/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 'plugins/Scriver/src')
-rw-r--r--plugins/Scriver/src/chat/chat.h1
-rw-r--r--plugins/Scriver/src/chat/clist.cpp57
2 files changed, 4 insertions, 54 deletions
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index 23322099b3..0a702cd0f6 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -406,7 +406,6 @@ INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam);
INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam);
INT_PTR CList_PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam);
int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
-void CList_CreateGroup(TCHAR* group);
BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, TCHAR* fmt, ... ) ;
HANDLE CList_FindRoom (const char* pszModule, const TCHAR* pszRoom) ;
int WCCmp(TCHAR* wild, TCHAR*string);
diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp
index 64fe7dfd7f..25ea62df58 100644
--- a/plugins/Scriver/src/chat/clist.cpp
+++ b/plugins/Scriver/src/chat/clist.cpp
@@ -38,33 +38,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
if (pszGroup[0]) {
- for (int i = 0;; i++) {
- char str[50];
- _itoa(i, str, 10);
-
- DBVARIANT dbv, dbv2;
- 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);
- }
+ 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;
@@ -221,37 +203,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);
- }
-
- // CallService(MS_CLIST_GROUPCREATE, (WPARAM)group, 0);
- 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 Icon, HANDLE event, int type, TCHAR* fmt, ... )
{
if (!fmt || lstrlen(fmt) < 1 || lstrlen(fmt) > 2000)