summaryrefslogtreecommitdiff
path: root/plugins/Import
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-04-13 17:04:11 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-04-13 17:04:11 +0000
commit5e8e5414eec286c561d2f8203b820a4c2839a766 (patch)
treeaff6d5a5f53e145a2849ff0b612871e9a355beef /plugins/Import
parent5524ecbe269270a1fdc624c041c5a979f00d9468 (diff)
various old / unused junk
git-svn-id: http://svn.miranda-ng.org/main/trunk@16647 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Import')
-rw-r--r--plugins/Import/src/utils.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp
index f6b7567825..25f856e5bb 100644
--- a/plugins/Import/src/utils.cpp
+++ b/plugins/Import/src/utils.cpp
@@ -34,33 +34,17 @@ int CreateGroup(const TCHAR *group, MCONTACT hContact)
if (group == NULL)
return 0;
- size_t cbName = mir_tstrlen(group);
- TCHAR *tszGrpName = (TCHAR*)_alloca((cbName + 2)*sizeof(TCHAR));
- tszGrpName[0] = 1 | GROUPF_EXPANDED;
- mir_tstrcpy(tszGrpName + 1, group);
-
- // Check for duplicate & find unused id
- char groupIdStr[11];
- for (int groupId = 0;; groupId++) {
- itoa(groupId, groupIdStr, 10);
- ptrT tszDbGroup(db_get_tsa(NULL, "CListGroups", groupIdStr));
- if (tszDbGroup == NULL)
- break;
-
- if (!mir_tstrcmp((TCHAR*)tszDbGroup+1, tszGrpName+1)) {
- if (hContact)
- db_set_ts(hContact, "CList", "Group", tszGrpName + 1);
- else
- AddMessage(LPGENT("Skipping duplicate group %s."), tszGrpName + 1);
- return 0;
- }
+ if (Clist_GroupExists(group)) {
+ if (hContact)
+ db_set_ts(hContact, "CList", "Group", group);
+ else
+ AddMessage(LPGENT("Skipping duplicate group %s."), group);
+ return 0;
}
- db_set_ts(NULL, "CListGroups", groupIdStr, tszGrpName);
-
+ Clist_CreateGroup(NULL, group);
if (hContact)
- db_set_ts(hContact, "CList", "Group", tszGrpName + 1);
-
+ db_set_ts(hContact, "CList", "Group", group);
return 1;
}