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 +++++++++++++++++---------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'plugins/Clist_modern/src/modern_clc.cpp') 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); -- cgit v1.2.3