From 6c174c43ea46ffdd89fcfbe6cdd0497a64b06fc9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 Apr 2016 15:11:35 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@16653 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clc.cpp | 59 ++++++++++++++------------- plugins/Clist_modern/src/modern_clcidents.cpp | 2 +- plugins/Clist_modern/src/modern_clcitems.cpp | 6 --- 3 files changed, 32 insertions(+), 35 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 5b79dede54..169089957b 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1243,38 +1243,41 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_INSERTION: - { ClcContact *contact, *destcontact; ClcGroup *group, *destgroup; - BOOL NeedRename = FALSE; - TCHAR newName[128] = { 0 }; - pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); - int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); - if (i != -1 && group->groupId != destgroup->groupId) { - TCHAR *groupName = mir_tstrdup(pcli->pfnGetGroupName(contact->groupId, 0)); - TCHAR *shortGroup = NULL; - TCHAR *sourceGrName = mir_tstrdup(pcli->pfnGetGroupName(destgroup->groupId, 0)); - if (groupName) { - int len = (int)mir_tstrlen(groupName); - do { len--; } while (len >= 0 && groupName[len] != '\\'); - if (len >= 0) shortGroup = groupName + len + 1; - else shortGroup = groupName; - } - if (shortGroup) { - NeedRename = TRUE; - if (sourceGrName) - mir_sntprintf(newName, _T("%s\\%s"), sourceGrName, shortGroup); - else - mir_tstrncpy(newName, shortGroup, _countof(newName)); + { + BOOL NeedRename = FALSE; + TCHAR newName[128] = { 0 }; + pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); + int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); + if (i != -1 && group->groupId != destgroup->groupId) { + TCHAR *groupName = mir_tstrdup(pcli->pfnGetGroupName(contact->groupId, 0)); + TCHAR *shortGroup = NULL; + TCHAR *sourceGrName = mir_tstrdup(pcli->pfnGetGroupName(destgroup->groupId, 0)); + if (groupName) { + int len = (int)mir_tstrlen(groupName); + do { len--; } while (len >= 0 && groupName[len] != '\\'); + if (len >= 0) + shortGroup = groupName + len + 1; + else + shortGroup = groupName; + } + if (shortGroup) { + NeedRename = TRUE; + if (sourceGrName) + mir_sntprintf(newName, _T("%s\\%s"), sourceGrName, shortGroup); + else + mir_tstrncpy(newName, shortGroup, _countof(newName)); + } + mir_free(groupName); + mir_free(sourceGrName); } - mir_free(groupName); - mir_free(sourceGrName); + int newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); + newIndex = newIndex ? newIndex : contact->groupId; + if (NeedRename) + pcli->pfnRenameGroup(newIndex, newName); } - int newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); - newIndex = newIndex ? newIndex : contact->groupId; - if (NeedRename) pcli->pfnRenameGroup(newIndex, newName); - } - break; + break; case DROPTARGET_OUTSIDE: corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 1cdad14a07..1ae357f3b7 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "modern_commonprototypes.h" #define CacheArrSize 255 -ClcGroup *CacheIndex[CacheArrSize] = { NULL }; +ClcGroup* CacheIndex[CacheArrSize] = { NULL }; bool CacheIndexClear = TRUE; /* the CLC uses 3 different ways to identify elements in its list, this file diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 138822e1c5..d393cd87dc 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -104,12 +104,6 @@ int cli_AddItemToGroup(ClcGroup *group, int iAboveItem) ClcGroup* cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers) { ClearRowByIndexCache(); - if (!dat->force_in_dialog && !(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN)) - if (!mir_tstrcmp(_T("-@-HIDDEN-GROUP-@-"), szName)) { //group is hidden - ClearRowByIndexCache(); - return NULL; - } - ClcGroup *result = corecli.pfnAddGroup(hwnd, dat, szName, flags, groupId, calcTotalMembers); ClearRowByIndexCache(); return result; -- cgit v1.2.3