diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-07 12:09:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-07 12:09:27 +0000 |
commit | 03a0b643b94d5aa7f9c129fe73eea314d099cf56 (patch) | |
tree | 221081ffe0602905765815d302b02d1f761cf100 /plugins/UserInfoEx/src/ex_import | |
parent | 0ac4b544972fb011e7c7c69e60a1d5d180ada0ac (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/UserInfoEx/src/ex_import')
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp | 28 |
1 files changed, 5 insertions, 23 deletions
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);
}
}
}
|