From 5ef0585dbd3bfbc09093bc8f24f41e4ae2349c59 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 9 Feb 2023 18:21:23 +0300 Subject: SRMM: better support for group chats in database --- plugins/Scriver/src/msgdialog.cpp | 12 ++++-------- plugins/Scriver/src/msgs.cpp | 1 + plugins/Scriver/src/msgs.h | 4 ++-- plugins/Scriver/src/msgutils.cpp | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 3618b9a1aa..8f7a405723 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -236,20 +236,16 @@ bool CMsgDialog::OnInitDialog() UpdateStatusBar(); UpdateTitle(); UpdateNickList(); + UpdateChatLog(); m_pParent->AddChild(this); PopupWindow(false); - - if (m_si->pMI->bDatabase) { - FindFirstEvent(); - SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); - } } else { m_nickList.Hide(); m_splitterX.Hide(); - bool notifyUnread = FindFirstEvent(); + bool notifyUnread = GetFirstEvent(); m_pParent->AddChild(this); @@ -1170,7 +1166,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case HM_DBEVENTADDED: - if (wParam == m_hContact) { + if (wParam == m_hContact && !isChat()) { MEVENT hDbEvent = lParam; DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); @@ -1194,7 +1190,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) PopupWindow(true); } - if (isChat() || (hDbEvent != m_hDbEventFirst && db_event_next(m_hContact, hDbEvent) == 0)) + if (hDbEvent != m_hDbEventFirst && db_event_next(m_hContact, hDbEvent) == 0) m_pLog->LogEvents(hDbEvent, 1, 1); else SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index ffb08f4e3c..01ffec8586 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -109,6 +109,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) return 0; } } + if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd))) { wchar_t toolTip[256]; mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact)); diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 0a2d30257e..7b92e8ce24 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -88,7 +88,6 @@ class CMsgDialog : public CSrmmBaseDialog friend INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); void ClearLog(void); - bool FindFirstEvent(void); HICON GetTabIcon(void); void GetTitlebarIcon(struct TitleBarData *tbd); void Init(void); @@ -110,7 +109,7 @@ class CMsgDialog : public CSrmmBaseDialog bool m_bIncoming, m_bWindowCascaded; - MEVENT m_hDbEventFirst, m_hDbEventLast, m_hDbUnreadEventFirst; + MEVENT m_hDbUnreadEventFirst; int m_minLogBoxHeight, m_minEditBoxHeight; int m_iShowUnread; uint16_t m_wStatus; @@ -173,6 +172,7 @@ public: void onType(CTimer *); void CloseTab() override; + bool GetFirstEvent() override; void LoadSettings() override; void SetStatusText(const wchar_t *, HICON) override; void ShowFilterMenu() override; diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 68eaf56b40..01210cdcbd 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -36,7 +36,7 @@ void CMsgDialog::CloseTab() Close(); } -bool CMsgDialog::FindFirstEvent() +bool CMsgDialog::GetFirstEvent() { bool notifyUnread = false; -- cgit v1.2.3