diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-19 18:18:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-19 18:18:58 +0000 |
commit | 405f1a1f9238fa24f749350a762695ad6e42361f (patch) | |
tree | 8ba5261aaae505bc2d6a006de384c17d54eb72d7 /src/modules/clist/clcitems.cpp | |
parent | c9a9db42fc216d6106e09def83a295c77ce080ab (diff) |
quick search code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@1049 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist/clcitems.cpp')
-rw-r--r-- | src/modules/clist/clcitems.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 554cb80dcf..77ae140f73 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -394,17 +394,15 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) if (group != NULL) {
group->totalMembers++;
- /*if (dat->filterSearch && dat->szQuickSearch) {
- // search filtering
-
- // how to get contact's visible name? this code is crashing :)
- ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
- if (cache) {
- //if (!_tcsstr(CharLowerW(pdnce->tszName), CharLowerW(dat->szQuickSearch)))
- if (_tcsnicmp(dat->szQuickSearch, cache->tszName, lstrlen(dat->szQuickSearch)))
- cli.pfnAddContactToGroup(dat, group, hContact);
- }
- } else*/ if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+
+ if (dat->filterSearch && dat->szQuickSearch[0] != '\0') {
+ TCHAR *name = cli.pfnGetContactDisplayName(hContact, GCDNF_TCHAR);
+ TCHAR *lowered_name = CharLowerW(NEWTSTR_ALLOCA(name));
+ TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
+
+ if (_tcsstr(lowered_name, lowered_search))
+ cli.pfnAddContactToGroup(dat, group, hContact);
+ } else if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL) {
if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
|