From b8ebaa0bdb6be17e014d7a382b86af8c028cf00d Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Tue, 26 Sep 2023 13:34:09 +0300
Subject: Group chat options are applied alongside the private window options
 update

---
 src/core/stdmsg/src/chat_window.cpp | 24 ------------------------
 src/core/stdmsg/src/msgdialog.cpp   | 25 +++++++++++++++++++++++--
 src/core/stdmsg/src/msgs.h          |  1 -
 3 files changed, 23 insertions(+), 27 deletions(-)

(limited to 'src/core/stdmsg')

diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 08762670c6..39ab7e2873 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -50,30 +50,6 @@ void CMsgDialog::UpdateFilterButton()
 	m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2, FALSE));
 }
 
-void CMsgDialog::UpdateOptions()
-{
-	HICON hIcon = ImageList_GetIcon(Clist_GetImageList(), GetImageId(), ILD_TRANSPARENT);
-	SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon);
-	DestroyIcon(hIcon);
-
-	Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), g_plugin.getIconHandle(IDI_CHANMGR));
-
-	// nicklist
-	int ih = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListFont, FALSE);
-	int ih2 = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListHeadingsFont, FALSE);
-	int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
-	int font = ih > ih2 ? ih : ih2;
-
-	// make sure we have space for icon!
-	if (g_Settings.bShowContactStatus)
-		font = font > 16 ? font : 16;
-
-	m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font);
-	InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE);
-
-	CSuper::UpdateOptions();
-}
-
 void CMsgDialog::UpdateStatusBar()
 {
 	wchar_t *ptszDispName = m_si->pMI->ptszModDispName;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 7794154a64..9de8fd65a1 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -140,7 +140,6 @@ bool CMsgDialog::OnInitDialog()
 
 	if (isChat()) {
 		OnActivate();
-		UpdateOptions();
 		UpdateStatusBar();
 		UpdateTitle();
 		UpdateChatLog();
@@ -1074,6 +1073,29 @@ void CMsgDialog::TabAutoComplete()
 
 void CMsgDialog::OnOptionsApplied()
 {
+	if (isChat()) {
+		HICON hIcon = ImageList_GetIcon(Clist_GetImageList(), GetImageId(), ILD_TRANSPARENT);
+		SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon);
+		DestroyIcon(hIcon);
+
+		Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), g_plugin.getIconHandle(IDI_CHANMGR));
+
+		// nicklist
+		int ih = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListFont, FALSE);
+		int ih2 = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListHeadingsFont, FALSE);
+		int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
+		int font = ih > ih2 ? ih : ih2;
+
+		// make sure we have space for icon!
+		if (g_Settings.bShowContactStatus)
+			font = font > 16 ? font : 16;
+
+		m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font);
+		InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE);
+
+		UpdateChatOptions();
+	}
+
 	CustomButtonData *cbd;
 	for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
 		HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID);
@@ -1103,7 +1125,6 @@ void CMsgDialog::OnOptionsApplied()
 	UpdateTitle();
 	Resize();
 
-	m_pLog->UpdateOptions();
 	m_message.SendMsg(EM_SETBKGNDCOLOR, 0, g_plugin.getDword(SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
 
 	// avatar stuff
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index 98670d6dee..3c82801813 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -144,7 +144,6 @@ public:
 	void SetStatusText(const wchar_t *, HICON) override;
 	void ShowFilterMenu() override;
 	void UpdateFilterButton() override;
-	void UpdateOptions() override;
 	void UpdateStatusBar() override;
 	void UpdateTitle() override;
 
-- 
cgit v1.2.3