diff options
author | George Hazan <ghazan@miranda.im> | 2019-07-08 14:46:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-07-08 14:46:56 +0300 |
commit | c0bc29a576c5e9318a16e91599d5fbbde4042a1e (patch) | |
tree | 4a2ebe0d27432102addad2e837c2d8654f0e0a0b /plugins/TabSRMM/src | |
parent | ee05a4f6a032ca925608a6f1265c969eeff73191 (diff) |
fixes #1989 (TabSRMM: option "Add a comma instead of a colon to auto-completed user names" doesn't work in a nick list)
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 35 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 2 |
2 files changed, 34 insertions, 3 deletions
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 70e1b140ca..4f6234c0f9 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -398,13 +398,13 @@ LBL_SkipEnd: end++; if (pszText[start] == '#') - isRoom = TRUE; + isRoom = true; else { int topicStart = start; while (topicStart > 0 && (pszText[topicStart - 1] == ' ' || pszText[topicStart - 1] == 13 || pszText[topicStart - 1] == VK_TAB)) topicStart--; if (topicStart > 5 && wcsstr(&pszText[topicStart - 6], L"/topic") == &pszText[topicStart - 6]) - isTopic = TRUE; + isTopic = true; } if (m_wszSearchQuery == nullptr) { m_wszSearchQuery = mir_wstrndup(pszText + start, end - start); @@ -469,7 +469,9 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) m_btnOk.OnClick = Callback(this, &CChatRoomDlg::onClick_OK); m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::onClick_Filter); m_btnNickList.OnClick = Callback(this, &CChatRoomDlg::onClick_ShowNickList); - + + m_nickList.OnDblClick = Callback(this, &CChatRoomDlg::onDblClick_List); + m_message.OnChange = Callback(this, &CChatRoomDlg::onChange_Message); } @@ -716,6 +718,33 @@ void CChatRoomDlg::onChange_Message(CCtrlEdit*) } } +void CChatRoomDlg::onDblClick_List(CCtrlListBox *pList) +{ + TVHITTESTINFO hti; + hti.pt.x = (short)LOWORD(GetMessagePos()); + hti.pt.y = (short)HIWORD(GetMessagePos()); + ScreenToClient(pList->GetHwnd(), &hti.pt); + + int item = LOWORD(pList->SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); + USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, item); + if (ui == nullptr) + return; + + bool bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; + if (g_Settings.bDoubleClick4Privat ? bShift : !bShift) { + int selStart = LOWORD(m_message.SendMsg(EM_GETSEL, 0, 0)); + CMStringW tszName(ui->pszNick); + if (selStart == 0) + tszName.AppendChar(g_Settings.bUseCommaAsColon ? ',' : ':'); + tszName.AppendChar(' '); + + m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)tszName.GetString()); + PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); + SetFocus(m_message.GetHwnd()); + } + else Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0); +} + ///////////////////////////////////////////////////////////////////////////////////////// void CChatRoomDlg::AddLog() diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 9a880891c6..cd1c320ad7 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -555,6 +555,8 @@ public: void onClick_Filter(CCtrlButton*);
void onClick_ShowNickList(CCtrlButton*);
+ void onDblClick_List(CCtrlListBox*);
+
void onChange_Message(CCtrlEdit*);
void UpdateWindowState(UINT msg);
|