From 3da4dd40a5437548bc4e089b85e4fa4cdfb8b728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Thu, 19 Jul 2012 16:53:36 +0000 Subject: clist_modern - another compatibility fix for old search. git-svn-id: http://svn.miranda-ng.org/main/trunk@1044 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clcitems.cpp | 1 - plugins/Clist_modern/src/modern_clcutils.cpp | 33 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index b077a3df59..d1acc918fa 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -760,7 +760,6 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc if (dat->filterSearch && dat->szQuickSearch) { // search filtering - //return _tcsnicmp(dat->szQuickSearch, pdnce->tszName, lstrlen(dat->szQuickSearch)); return _tcsstr(CharLowerW(pdnce->tszName), CharLowerW(dat->szQuickSearch)) ? 0 : 1; } if (g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0)) diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 4fb314fb12..ef1c374536 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -822,13 +822,15 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref contact = group->cl.items[group->scanIndex]; if (contact->type != CLCIT_DIVIDER) { - TCHAR* lowered = CharLowerW(NEWTSTR_ALLOCA(contact->szText)); - TCHAR* lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); - if (_tcsstr(lowered, lowered_text)) - - /*if ((prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || - (!prefixOk && !lstrcmpi(text, contact->szText))) */ - { + bool found; + if (dat->filterSearch) { + TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(contact->szText)); + TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); + found = _tcsstr(lowered_szText, lowered_text) != NULL; + } else { + found = (prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || (!prefixOk && !lstrcmpi(text, contact->szText)); + } + if (found) { struct ClcGroup *contactGroup = group; int contactScanIndex = group->scanIndex; for (; group; group = group->parent) @@ -853,13 +855,16 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref for (i=0; i < contact->SubAllocated; i++) { struct ClcContact * subcontact = &(contact->subcontacts[i]); - - TCHAR* lowered = CharLowerW(NEWTSTR_ALLOCA(subcontact->szText)); - TCHAR* lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); - if (_tcsstr(lowered, lowered_text)) -/* if ((prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || - (!prefixOk && !lstrcmpi(text, subcontact->szText))) */ - { + + bool found; + if (dat->filterSearch) { + TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(subcontact->szText)); + TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); + found = _tcsstr(lowered_szText, lowered_text) != NULL; + } else { + found = (prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || (!prefixOk && !lstrcmpi(text, subcontact->szText)); + } + if (found) { struct ClcGroup *contactGroup = group; int contactScanIndex = group->scanIndex; for (; group; group = group->parent) -- cgit v1.2.3