From 5e8e5414eec286c561d2f8203b820a4c2839a766 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 13 Apr 2016 17:04:11 +0000 Subject: various old / unused junk git-svn-id: http://svn.miranda-ng.org/main/trunk@16647 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clcitems.cpp | 26 ---------------------- plugins/Import/src/utils.cpp | 32 +++++++--------------------- 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index d9d6b31f46..138822e1c5 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -226,32 +226,6 @@ static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, ClcCacheEntr return group->cl.items[i]; } -void* AddTempGroup(HWND hwnd, ClcData *dat, const TCHAR *szName) -{ - if (wildcmp(_T2A(szName), "-@-HIDDEN-GROUP-@-")) - return NULL; - - int i; - DWORD groupFlags; - for (i = 1;; i++) { - TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); - if (szGroupName == NULL) - break; - if (!mir_tstrcmpi(szGroupName, szName)) - return NULL; - } - - char buf[20]; - _itoa_s(i - 1, buf, 10); - - TCHAR b2[255]; - mir_sntprintf(b2, _T("#%s"), szName); - b2[0] = 1 | GROUPF_EXPANDED; - db_set_ts(NULL, "CListGroups", buf, b2); - pcli->pfnGetGroupName(i, &groupFlags); - return cli_AddGroup(hwnd, dat, szName, groupFlags, i, 0); -} - void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline) { ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); 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; } -- cgit v1.2.3