summaryrefslogtreecommitdiff
path: root/plugins
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
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')
-rw-r--r--plugins/Clist_modern/src/modern_groupmenu.cpp2
-rw-r--r--plugins/Clist_mw/src/groupmenu.cpp209
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp7
-rw-r--r--plugins/Clist_nicer/src/clui.cpp2
-rw-r--r--plugins/CryptoPP/src/cpp_rsam.cpp4
-rw-r--r--plugins/DbEditorPP/src/exportimport.cpp26
-rw-r--r--plugins/Scriver/src/chat/chat.h1
-rw-r--r--plugins/Scriver/src/chat/clist.cpp57
-rw-r--r--plugins/TabSRMM/src/chat/clist.cpp17
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp28
10 files changed, 118 insertions, 235 deletions
diff --git a/plugins/Clist_modern/src/modern_groupmenu.cpp b/plugins/Clist_modern/src/modern_groupmenu.cpp
index 74dc4383a5..e54e8e1908 100644
--- a/plugins/Clist_modern/src/modern_groupmenu.cpp
+++ b/plugins/Clist_modern/src/modern_groupmenu.cpp
@@ -200,7 +200,7 @@ INT_PTR CreateGroupHelper(WPARAM wParam,LPARAM lParam)
{
SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEEMPTYGROUPS, 0, 0);
SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETUSEGROUPS, 1, 0);
- CallService(MS_CLIST_GROUPCREATE, 0, 0);
+ Clist_CreateGroup(0, 0);
return 0;
};
diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp
index 821a57d754..3a79598ab5 100644
--- a/plugins/Clist_mw/src/groupmenu.cpp
+++ b/plugins/Clist_mw/src/groupmenu.cpp
@@ -240,7 +240,7 @@ void InitGroupMenus(void)
HICON hicon;
hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,0);
NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon );
-
+
CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService);
CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu",FreeOwnerDataGroupMenu);
CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService",GroupMenuonAddService);
@@ -263,13 +263,13 @@ void InitGroupMenus(void)
tmp.ExecService = "CLISTMENUSGroup/ExecService";
tmp.name = "Group Menu";
hGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
-
-
+
+
op.Handle = hGroupMenuObject;
op.Setting = OPT_USERDEFINEDITEMS;
op.Value = TRUE;
CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
+
op.Handle = hGroupMenuObject;
op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
op.Value = (INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu";
@@ -281,109 +281,104 @@ void InitGroupMenus(void)
CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
{
- //add exit command to menu
- GroupMenuParam gmp;
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = 1900000;
- mi.pszService = "CloseAction";
- mi.pszName = LPGEN("E&xit");
- AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 500;
- mi.pszService = MS_CLIST_SHOWHIDE;
- mi.pszName = LPGEN("&Hide/Show");
- hHideShowMainMenuItem = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 200000;
- mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER));
- mi.pszService = "FindAdd/FindAddCommand";
- mi.pszName = LPGEN("&Find/Add Contacts...");
- AddGroupMenuItem(0,(LPARAM)&mi);
-
-
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 300000;
- mi.pszService = "";
- mi.pszName = LPGEN("&Main Menu");
- hGroupMainMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 300100;
- mi.pszService = "";
- mi.pszName = LPGEN("&Status");
- hGroupStatusMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 400000;
- mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS));
- mi.pszService = "Options/OptionsCommand";
- mi.pszName = LPGEN("&Options...");
-
- AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 500000;
- mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
- mi.pszService = "Help/AboutCommand";
- mi.pszName = LPGEN("&About");
-
- //AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 100000;
- mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
- mi.pszService = MS_CLIST_GROUPCREATE;
- mi.pszName = LPGEN("&New Group");
- hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 100001;
- mi.hIcon = NULL;
- mi.pszService = MS_CLIST_SETHIDEOFFLINE;
- mi.pszName = LPGEN("&Hide Offline Users");
- gmp.lParam = 0;gmp.wParam = -1;
- hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 100002;
- mi.hIcon = NULL;
- mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
- mi.pszName = LPGEN("Hide &Offline Users out here");
- hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 100003;
- mi.hIcon = NULL;
- mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
- mi.pszName = LPGEN("Hide &Empty Groups");
- hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 100004;
- mi.hIcon = NULL;
- mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
- mi.pszName = LPGEN("Disable &Groups");
- hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
-
- HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged);
-
- //MS_CLIST_GROUPCREATE
-
+ //add exit command to menu
+ GroupMenuParam gmp;
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = 1900000;
+ mi.pszService = "CloseAction";
+ mi.pszName = LPGEN("E&xit");
+ AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 500;
+ mi.pszService = MS_CLIST_SHOWHIDE;
+ mi.pszName = LPGEN("&Hide/Show");
+ hHideShowMainMenuItem = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 200000;
+ mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER));
+ mi.pszService = "FindAdd/FindAddCommand";
+ mi.pszName = LPGEN("&Find/Add Contacts...");
+ AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 300000;
+ mi.pszService = "";
+ mi.pszName = LPGEN("&Main Menu");
+ hGroupMainMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 300100;
+ mi.pszService = "";
+ mi.pszName = LPGEN("&Status");
+ hGroupStatusMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 400000;
+ mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS));
+ mi.pszService = "Options/OptionsCommand";
+ mi.pszName = LPGEN("&Options...");
+
+ AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 500000;
+ mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
+ mi.pszService = "Help/AboutCommand";
+ mi.pszName = LPGEN("&About");
+
+ //AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 100000;
+ mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
+ mi.pszService = MS_CLIST_GROUPCREATE;
+ mi.pszName = LPGEN("&New Group");
+ hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 100001;
+ mi.hIcon = NULL;
+ mi.pszService = MS_CLIST_SETHIDEOFFLINE;
+ mi.pszName = LPGEN("&Hide Offline Users");
+ gmp.lParam = 0;gmp.wParam = -1;
+ hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 100002;
+ mi.hIcon = NULL;
+ mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
+ mi.pszName = LPGEN("Hide &Offline Users out here");
+ hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 100003;
+ mi.hIcon = NULL;
+ mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
+ mi.pszName = LPGEN("Hide &Empty Groups");
+ hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 100004;
+ mi.hIcon = NULL;
+ mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
+ mi.pszName = LPGEN("Disable &Groups");
+ hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
+
+ HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged);
}
}
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
index 580aa254f8..20d51f2385 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
@@ -363,9 +363,7 @@ void InitGroupMenus(void)
mi.cbSize=sizeof(mi);
mi.position=100000;
mi.hIcon=ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
- //mi.pszService=MS_CLIST_GROUPCREATE;
mi.pszService="CLISTMENUSSubGroup/GroupMenuExecProxy";
- //mi.pszService="CLISTMENUSGroup/ExecService";
mi.pszName=LPGEN("&New Group");
gmp.lParam=0;gmp.wParam=POPUP_NEWGROUP;
hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
@@ -402,10 +400,7 @@ void InitGroupMenus(void)
mi.pszService="CLISTMENUSGroup/UseGroupsHelper";
mi.pszName=LPGEN("Disable &Groups");
hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
-
- //MS_CLIST_GROUPCREATE
-
- };
+ }
}
HANDLE hSubGroupMenuObject;
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 2b02c47f1d..a758656de2 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -1520,7 +1520,7 @@ buttons_done:
case POPUP_NEWGROUP:
SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
- CallService(MS_CLIST_GROUPCREATE, 0, 0);
+ Clist_CreateGroup(NULL, NULL);
break;
case POPUP_HIDEOFFLINE:
case IDC_TBHIDEOFFLINE:
diff --git a/plugins/CryptoPP/src/cpp_rsam.cpp b/plugins/CryptoPP/src/cpp_rsam.cpp
index a356e7ad0a..2c0593bbfa 100644
--- a/plugins/CryptoPP/src/cpp_rsam.cpp
+++ b/plugins/CryptoPP/src/cpp_rsam.cpp
@@ -918,8 +918,8 @@ unsigned __stdcall sttConnectThread( LPVOID arg ) {
if ( p->thread_exit == 1 ) return 0;
if ( p->thread_exit == 2 ) {
// мы в свободном плавании - освободим память и завершим трэд
- CloseHandle( p->thread );
- CloseHandle( p->event );
+ CloseHandle(p->thread);
+ CloseHandle(p->event);
SAFE_DELETE(p->queue);
SAFE_DELETE(p);
return 0;
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp
index f1e24cfc7c..23cea2f5dd 100644
--- a/plugins/DbEditorPP/src/exportimport.cpp
+++ b/plugins/DbEditorPP/src/exportimport.cpp
@@ -339,30 +339,6 @@ HANDLE CheckNewContact(char *myProto, char *uid, char *myName)
return INVALID_HANDLE_VALUE;
}
-HANDLE Clist_GroupExists(WCHAR *tszGroup)
-{
- unsigned int i = 0;
- WCHAR *_t = 0;
- char str[10];
- INT_PTR result = 0;
- DBVARIANT dbv = {0};
- int match;
-
- do {
- _itoa(i, str, 10);
- result = db_get_ts(0, "CListGroups", str, &dbv);
- if (!result) {
- match = (!lstrcmpW(tszGroup, (LPCWSTR)&dbv.ptszVal[1]) && (lstrlenW(tszGroup) == lstrlenW((LPCWSTR)&dbv.ptszVal[1])));
- db_free(&dbv);
- if(match)
- return((HANDLE)(i + 1));
- }
- i++;
- }
- while(result == 0);
- return(0);
-}
-
void importSettings(HANDLE hContact, char *importstring )
{
char module[256] = "", setting[256] = "", *end;
@@ -463,7 +439,7 @@ void importSettings(HANDLE hContact, char *importstring )
WCHAR* GroupName = mir_a2u(end+2);
if (!GroupName)
continue;
- HANDLE GroupHandle = Clist_GroupExists(GroupName);
+ HANDLE GroupHandle = (HANDLE)CallService(MS_CLIST_GROUPEXISTS, 0, LPARAM(GroupName));
if(GroupHandle == 0) {
GroupHandle = (HANDLE)CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)GroupName);
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)
diff --git a/plugins/TabSRMM/src/chat/clist.cpp b/plugins/TabSRMM/src/chat/clist.cpp
index 644fdf2338..3afb600074 100644
--- a/plugins/TabSRMM/src/chat/clist.cpp
+++ b/plugins/TabSRMM/src/chat/clist.cpp
@@ -36,20 +36,6 @@ plugin, originally written by Jцrgen Persson
char *szChatIconString = "chaticon";
-static HANDLE Clist_GroupExists(TCHAR *tszGroup)
-{
- for (int i=0; ; i++) {
- char str[10];
- _itoa(i, str, 10);
- ptrT groupName( db_get_tsa(0, "CListGroups", str));
- if (groupName == NULL)
- return NULL;
-
- if (!_tcscmp(tszGroup, &groupName[1]) && lstrlen(tszGroup) == lstrlen(&groupName[1]))
- return HANDLE(i + 1);
- }
-}
-
HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType)
{
TCHAR pszGroup[50]; *pszGroup = '\0';
@@ -222,9 +208,8 @@ void CList_CreateGroup(TCHAR* group)
return;
g_Settings.hGroup = Clist_GroupExists(group);
-
if (g_Settings.hGroup == 0) {
- g_Settings.hGroup = (HANDLE)CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)group);
+ g_Settings.hGroup = Clist_CreateGroup(0, group);
if (g_Settings.hGroup) {
CallService(MS_CLUI_GROUPADDED, (WPARAM)g_Settings.hGroup, 0);
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
index 6a7851d374..a33df3f01f 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
@@ -21,25 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "..\commonheaders.h"
-HANDLE CListFindGroup(LPCSTR pszGroup)
-{
- CHAR buf[4];
- BYTE i;
- DBVARIANT dbv;
-
- for (i = 0; i < 255; i++) {
- _itoa(i, buf, 10);
- if (DB::Setting::GetUString(NULL, "CListGroups", buf, &dbv))
- break;
- if (dbv.pszVal && pszGroup && !_stricmp(dbv.pszVal + 1, pszGroup)) {
- db_free(&dbv);
- return (HANDLE)(INT_PTR)(i+1);
- }
- db_free(&dbv);
- }
- return INVALID_HANDLE_VALUE;
-}
-
/**
* name: CExImContactBase
* class: CExImContactBase
@@ -280,13 +261,14 @@ HANDLE CExImContactBase::toDB()
// add group
if (_pszGroup) {
- db_set_utf(_hContact, MOD_CLIST, "Group", _pszGroup);
- if (CListFindGroup(_pszGroup) == INVALID_HANDLE_VALUE) {
- WPARAM hGroup = (WPARAM)CallService(MS_CLIST_GROUPCREATE, 0, 0);
+ ptrT ptszGroup( mir_utf8decodeT(_pszGroup));
+ db_set_ts(_hContact, MOD_CLIST, "Group", ptszGroup);
+ if ( Clist_GroupExists(ptszGroup) == NULL) {
+ HANDLE hGroup = Clist_CreateGroup(NULL, NULL);
if (hGroup) {
// renaming twice is stupid but the only way to avoid error dialog telling shit like
// a group with that name does exist
- CallService(MS_CLIST_GROUPRENAME, (WPARAM)hGroup, (LPARAM)_pszGroup);
+ CallService(MS_CLIST_GROUPRENAME, (WPARAM)hGroup, (LPARAM)ptszGroup);
}
}
}