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 --- src/core/stdmsg/src/msgdialog.cpp | 13 +++++-------- src/core/stdmsg/src/msgs.h | 4 +--- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 67401eea28..84ba0e1ca1 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -139,17 +139,13 @@ bool CMsgDialog::OnInitDialog() UpdateOptions(); UpdateStatusBar(); UpdateTitle(); - - if (m_si->pMI->bDatabase) { - FindFirstEvent(); - RemakeLog(); - } + UpdateChatLog(); } else { m_nickList.Hide(); m_splitterX.Hide(); - FindFirstEvent(); + GetFirstEvent(); bool bUpdate = false; DB::ECPTR pCursor(DB::EventsRev(m_hContact)); @@ -594,7 +590,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE; case HM_DBEVENTADDED: - if (wParam == m_hContact) { + if (wParam == m_hContact && !isChat()) { MEVENT hDbEvent = lParam; if (m_hDbEventFirst == 0) m_hDbEventFirst = hDbEvent; @@ -1300,7 +1296,7 @@ void CMsgDialog::CloseTab() else SendMessage(m_hwndParent, WM_CLOSE, 0, 0); } -void CMsgDialog::FindFirstEvent() +bool CMsgDialog::GetFirstEvent() { // This finds the first message to display, it works like shit m_hDbEventFirst = db_event_firstUnread(m_hContact); @@ -1339,6 +1335,7 @@ void CMsgDialog::FindFirstEvent() } break; } + return true; } void CMsgDialog::NotifyTyping(int mode) diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 0e9f38dead..8234296277 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -55,7 +55,6 @@ class CMsgDialog : public CSrmmBaseDialog friend class CTabbedWindow; typedef CSrmmBaseDialog CSuper; - void FindFirstEvent(); void Init(void); void NotifyTyping(int mode); void SetButtonsPos(void); @@ -141,8 +140,6 @@ public: return ((CLogWindow *)m_pLog); } - MEVENT m_hDbEventFirst, m_hDbEventLast; - int m_avatarWidth = 0, m_avatarHeight = 0; bool m_bIsAutoRTL = false; @@ -156,6 +153,7 @@ public: } void CloseTab() override; + bool GetFirstEvent() override; bool IsActive() const override; void LoadSettings() override; void SetStatusText(const wchar_t *, HICON) override; -- cgit v1.2.3