From 1c3bbb283ca5f0d25658e190c4c41a4667f71ff2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 19 Jun 2023 17:54:32 +0300 Subject: nick search went to core --- plugins/TabSRMM/src/msgdialog.cpp | 57 --------------------------------------- 1 file changed, 57 deletions(-) (limited to 'plugins/TabSRMM/src/msgdialog.cpp') diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index a93a455a2a..02b5eb8de5 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1976,63 +1976,6 @@ LRESULT CMsgDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) PostMessage(m_hwnd, WM_CLOSE, 0, 1); return TRUE; } - - if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT || wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) { - m_wszSearch[0] = 0; - m_iSearchItem = -1; - } - break; - - case WM_SETFOCUS: - case WM_KILLFOCUS: - m_wszSearch[0] = 0; - m_iSearchItem = -1; - break; - - case WM_CHAR: - case WM_UNICHAR: - // simple incremental search for the user (nick) - list control - // typing esc or movement keys will clear the current search string - if (wParam == 27 && m_wszSearch[0]) { // escape - reset everything - m_wszSearch[0] = 0; - m_iSearchItem = -1; - break; - } - if (wParam == '\b' && m_wszSearch[0]) // backspace - m_wszSearch[mir_wstrlen(m_wszSearch) - 1] = '\0'; - else if (wParam < ' ') - break; - else { - if (mir_wstrlen(m_wszSearch) >= _countof(m_wszSearch) - 2) { - MessageBeep(MB_OK); - break; - } - wchar_t szNew[2]; - szNew[0] = (wchar_t)wParam; - szNew[1] = '\0'; - mir_wstrcat(m_wszSearch, szNew); - } - if (m_wszSearch[0]) { - // iterate over the (sorted) list of nicknames and search for the - // string we have - int i, iItems = m_nickList.SendMsg(LB_GETCOUNT, 0, 0); - for (i = 0; i < iItems; i++) { - if (auto *ui = (USERINFO *)m_nickList.GetItemData(i)) { - if (!wcsnicmp(ui->pszNick, m_wszSearch, mir_wstrlen(m_wszSearch))) { - m_nickList.SendMsg(LB_SETSEL, FALSE, -1); - m_nickList.SendMsg(LB_SETSEL, TRUE, i); - m_iSearchItem = i; - InvalidateRect(m_nickList.GetHwnd(), nullptr, FALSE); - return 0; - } - } - } - if (i == iItems) { - MessageBeep(MB_OK); - m_wszSearch[mir_wstrlen(m_wszSearch) - 1] = '\0'; - return 0; - } - } break; } -- cgit v1.2.3