From 19e55c9c066703b870c116740821cc6727e72697 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 28 May 2016 10:20:32 +0000 Subject: code simplification git-svn-id: http://svn.miranda-ng.org/main/trunk@16880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clcitems.cpp | 7 +++---- plugins/Clist_nicer/src/clcitems.cpp | 15 ++++++--------- plugins/Clist_nicer/src/init.cpp | 16 ++++++++-------- 3 files changed, 17 insertions(+), 21 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 578a8b8fd0..08f2aed6fe 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -176,10 +176,9 @@ static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hCo if (group->cl[i]->type != CLCIT_INFO || !(group->cl[i]->flags & CLCIIF_BELOWCONTACTS)) break; - i = pcli->pfnAddItemToGroup(group, i + 1); - - _LoadDataToContact(group->cl[i], group, dat, hContact); - return group->cl[i]; + ClcContact *cc = pcli->pfnAddItemToGroup(group, i + 1); + _LoadDataToContact(cc, group, dat, hContact); + return cc; } void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline) diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index bf91386ba2..82c614643d 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -53,13 +53,11 @@ ClcContact* CreateClcContact(void) return p; } -int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) +ClcContact* AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) { - int i = coreCli.pfnAddInfoItemToGroup(group, flags, pszText); - - ClcContact* p = group->cl[i]; + ClcContact *p = coreCli.pfnAddInfoItemToGroup(group, flags, pszText); p->avatarLeft = p->extraIconRightBegin = -1; - return i; + return p; } ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers) @@ -97,10 +95,9 @@ void LoadAvatarForContact(ClcContact *p) p->cFlags &= ~ECF_AVATAR; } -int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) +ClcContact* AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) { - int i = coreCli.pfnAddContactToGroup(dat, group, hContact); - ClcContact* p = group->cl[i]; + ClcContact *p = coreCli.pfnAddContactToGroup(dat, group, hContact); p->wStatus = db_get_w(hContact, p->proto, "Status", ID_STATUS_OFFLINE); p->xStatus = db_get_b(hContact, p->proto, "XStatusId", 0); @@ -140,7 +137,7 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) p->avatarLeft = p->extraIconRightBegin = -1; p->flags |= db_get_b(p->hContact, "CList", "Priority", 0) ? CONTACTF_PRIORITY : 0; - return i; + return p; } void RebuildEntireList(HWND hwnd, struct ClcData *dat) diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 6fa5357254..eb83a1df9d 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -50,14 +50,14 @@ int ShowHide(WPARAM wParam, LPARAM lParam); int ClcShutdown(WPARAM wParam, LPARAM lParam); CListEvent* AddEvent(CLISTEVENT *cle); -ClcGroup* AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); - -int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact); -int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); -LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); -int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent); -INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); -void RecalcScrollBar(HWND hwnd, struct ClcData *dat); +ClcGroup* AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); + +ClcContact* AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact); +ClcContact* AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); +LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); +int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent); +INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); +void RecalcScrollBar(HWND hwnd, struct ClcData *dat); LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -- cgit v1.2.3