summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-09-24 20:48:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-09-24 20:50:01 +0300
commit87688568055a37961b1fa9cfe31cfaef064d3e1c (patch)
tree6bdef487722a687f84cc1d74de439fcabb240a9a
parent4c610be444c52c9734681d97f8368bd6eb693da7 (diff)
some common chat options exported directly from the core
-rw-r--r--include/m_chat_int.h26
-rw-r--r--libs/win32/mir_app.libbin225752 -> 230744 bytes
-rw-r--r--libs/win64/mir_app.libbin222010 -> 227002 bytes
-rw-r--r--plugins/Scriver/src/chat_main.cpp4
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp4
-rw-r--r--src/core/stdmsg/src/tabs.cpp4
-rw-r--r--src/mir_app/src/chat_opts.cpp24
-rw-r--r--src/mir_app/src/chat_svc.cpp23
-rw-r--r--src/mir_app/src/mir_app.def15
-rw-r--r--src/mir_app/src/mir_app64.def15
-rw-r--r--src/mir_app/src/srmm_base.cpp2
11 files changed, 94 insertions, 23 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index d6361eef5a..c449f3dd26 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -204,7 +204,6 @@ struct GlobalLogSettingsBase
bool bShowTime;
bool bShowTimeIfChanged;
bool bLoggingEnabled;
- bool bFlashWindow, bFlashWindowHighlight;
bool bHighlightEnabled;
bool bLogIndentEnabled;
bool bStripFormat;
@@ -215,7 +214,6 @@ struct GlobalLogSettingsBase
bool bTimeStampEventColour;
bool bShowContactStatus;
bool bContactStatusFirst;
- bool bDoubleClick4Privat; // send a private message on dblclick in a nick list
uint32_t dwIconFlags;
uint32_t dwTrayIconFlags;
uint32_t dwPopupFlags;
@@ -395,4 +393,28 @@ EXTERN_C MIR_APP_DLL(bool) Chat_GetDefaultEventDescr(const SESSION_INFO *si, con
// sets mute mode for a group chat
EXTERN_C MIR_APP_DLL(void) Chat_Mute(SESSION_INFO *si, int mode);
+/////////////////////////////////////////////////////////////////////////////////////////
+// common settings
+
+namespace Chat
+{
+ extern MIR_APP_EXPORT CMOption<bool>
+ bShowNicklist,
+ bFilterEnabled,
+ bTopicOnClist,
+ bPopupOnJoin,
+ bDoubleClick4Privat,
+ bShowContactStatus,
+ bContactStatusFirst,
+ bShowTime,
+ bShowTimeIfChanged,
+ bTimeStampEventColour,
+ bFlashWindow,
+ bFlashWindowHighlight,
+ bDoubleClick4Privat,
+ bLogIndentEnabled,
+ bLogLimitNames,
+ bStripFormat;
+};
+
#endif // M_CHAT_INT_H__
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index c533d3c89d..863f6f6705 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index eaa2e47d40..cd39df943f 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp
index 69b04f0207..4538572531 100644
--- a/plugins/Scriver/src/chat_main.cpp
+++ b/plugins/Scriver/src/chat_main.cpp
@@ -48,7 +48,7 @@ static void OnFlashHighlight(SESSION_INFO *si, int bInactive)
si->pDlg->FixTabIcons();
si->pDlg->UpdateTitle();
- if (g_Settings.bFlashWindowHighlight)
+ if (Chat::bFlashWindowHighlight)
si->pDlg->StartFlashing();
}
@@ -60,7 +60,7 @@ static void OnFlashWindow(SESSION_INFO *si, int bInactive)
si->pDlg->FixTabIcons();
si->pDlg->UpdateTitle();
- if (g_Settings.bFlashWindow)
+ if (Chat::bFlashWindow)
si->pDlg->StartFlashing();
}
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index 9fd934ded6..b72f53acd7 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -79,7 +79,7 @@ static void OnFlashHighlight(SESSION_INFO *si, int bInactive)
if (g_Settings.bTabsEnable)
g_pTabDialog->SetMessageHighlight(si->pDlg);
- else if (g_Settings.bFlashWindowHighlight)
+ else if (Chat::bFlashWindowHighlight)
si->pDlg->StartFlash();
}
@@ -90,7 +90,7 @@ static void OnFlashWindow(SESSION_INFO *si, int bInactive)
if (g_Settings.bTabsEnable)
g_pTabDialog->SetTabHighlight(si->pDlg);
- else if (g_Settings.bFlashWindow)
+ else if (Chat::bFlashWindow)
si->pDlg->StartFlash();
}
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 61c2426641..d60bec7634 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -371,7 +371,7 @@ void CTabbedWindow::SetMessageHighlight(CMsgDialog *pDlg)
pDlg->m_si->wState |= GC_EVENT_HIGHLIGHT;
FixTabIcons(pDlg);
- if (g_Settings.bFlashWindowHighlight && pDlg != m_tab.GetActivePage())
+ if (Chat::bFlashWindowHighlight && pDlg != m_tab.GetActivePage())
pDlg->StartFlash();
}
@@ -381,7 +381,7 @@ void CTabbedWindow::SetTabHighlight(CMsgDialog *pDlg)
return;
FixTabIcons(pDlg);
- if (g_Settings.bFlashWindow && pDlg != m_tab.GetActivePage())
+ if (Chat::bFlashWindow && pDlg != m_tab.GetActivePage())
pDlg->StartFlash();
}
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index 64a36af0bd..c6ef12ab41 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -205,32 +205,33 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau
void LoadGlobalSettings(void)
{
g_Settings->LogIconSize = 10;
- g_Settings->bLogLimitNames = db_get_b(0, CHAT_MODULE, "LogLimitNames", 1) != 0;
- g_Settings->bShowTime = db_get_b(0, CHAT_MODULE, "ShowTimeStamp", 1) != 0;
g_Settings->bSoundsFocus = db_get_b(0, CHAT_MODULE, "SoundsFocus", 0) != 0;
- g_Settings->bShowTimeIfChanged = db_get_b(0, CHAT_MODULE, "ShowTimeStampIfChanged", 0) != 0;
- g_Settings->bTimeStampEventColour = db_get_b(0, CHAT_MODULE, "TimeStampEventColour", 0) != 0;
g_Settings->iEventLimit = db_get_w(0, CHAT_MODULE, "LogLimit", 100);
g_Settings->dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000);
g_Settings->dwTrayIconFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", 0x1000);
g_Settings->dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", 0x0000);
g_Settings->LoggingLimit = db_get_w(0, CHAT_MODULE, "LoggingLimit", 100);
g_Settings->bLoggingEnabled = db_get_b(0, CHAT_MODULE, "LoggingEnabled", 0) != 0;
- g_Settings->bFlashWindow = db_get_b(0, CHAT_MODULE, "FlashWindow", 0) != 0;
- g_Settings->bFlashWindowHighlight = db_get_b(0, CHAT_MODULE, "FlashWindowHighlight", false) != 0;
g_Settings->bHighlightEnabled = db_get_b(0, CHAT_MODULE, "HighlightEnabled", 1) != 0;
g_Settings->crLogBackground = db_get_dw(0, CHAT_MODULE, "ColorLogBG", GetSysColor(COLOR_WINDOW));
g_Settings->crUserListColor = db_get_dw(0, CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0));
g_Settings->crUserListHeadingsColor = db_get_dw(0, CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170));
- g_Settings->bStripFormat = db_get_b(0, CHAT_MODULE, "StripFormatting", 0) != 0;
- g_Settings->bTrayIconInactiveOnly = g_bChatTrayInactive;
- g_Settings->bPopupInactiveOnly = g_bChatPopupInactive;
g_Settings->iPopupStyle = db_get_b(0, CHAT_MODULE, "PopupStyle", 1);
g_Settings->iPopupTimeout = db_get_w(0, CHAT_MODULE, "PopupTimeout", 3);
g_Settings->crPUBkgColour = db_get_dw(0, CHAT_MODULE, "PopupColorBG", GetSysColor(COLOR_WINDOW));
g_Settings->crPUTextColour = db_get_dw(0, CHAT_MODULE, "PopupColorText", 0);
- g_Settings->bShowContactStatus = db_get_b(0, CHAT_MODULE, "ShowContactStatus", 0) != 0;
- g_Settings->bContactStatusFirst = db_get_b(0, CHAT_MODULE, "ContactStatusFirst", 0) != 0;
+
+ g_Settings->bTrayIconInactiveOnly = g_bChatTrayInactive;
+ g_Settings->bPopupInactiveOnly = g_bChatPopupInactive;
+
+ g_Settings->bShowTime = Chat::bShowTime;
+ g_Settings->bStripFormat = Chat::bStripFormat;
+ g_Settings->bLogLimitNames = Chat::bLogLimitNames;
+ g_Settings->bLogIndentEnabled = Chat::bLogIndentEnabled;
+ g_Settings->bShowTimeIfChanged = Chat::bShowTimeIfChanged;
+ g_Settings->bShowContactStatus = Chat::bShowContactStatus;
+ g_Settings->bContactStatusFirst = Chat::bContactStatusFirst;
+ g_Settings->bTimeStampEventColour = Chat::bTimeStampEventColour;
LoadColors();
@@ -244,7 +245,6 @@ void LoadGlobalSettings(void)
InitSetting(&g_Settings->pszHighlightWords, "HighlightWords", L"%m");
InitSetting(&g_Settings->pszLogDir, "LogDirectory", L"%miranda_logpath%\\%proto%\\%userid%.log");
- g_Settings->bLogIndentEnabled = db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0;
LOGFONT lf;
if (g_Settings->UserListFont)
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 072fd6789a..e1c3ad4596 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -22,6 +22,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+CMOption<bool> Chat::bShowNicklist(CHAT_MODULE, "ShowNicklist", true);
+CMOption<bool> Chat::bFilterEnabled(CHAT_MODULE, "FilterEnabled", false);
+CMOption<bool> Chat::bTopicOnClist(CHAT_MODULE, "TopicOnClist", false);
+CMOption<bool> Chat::bPopupOnJoin(CHAT_MODULE, "PopupOnJoin", false);
+CMOption<bool> Chat::bDoubleClick4Privat(CHAT_MODULE, "DoubleClick4Privat", false);
+CMOption<bool> Chat::bShowContactStatus(CHAT_MODULE, "ShowContactStatus", true);
+CMOption<bool> Chat::bContactStatusFirst(CHAT_MODULE, "ContactStatusFirst", false);
+
+CMOption<bool> Chat::bFlashWindow(CHAT_MODULE, "FlashWindow", false);
+CMOption<bool> Chat::bFlashWindowHighlight(CHAT_MODULE, "FlashWindowHighlight", false);
+
+CMOption<bool> Chat::bShowTime(CHAT_MODULE, "ShowTimeStamp", true);
+CMOption<bool> Chat::bStripFormat(CHAT_MODULE, "StripFormatting", false);
+CMOption<bool> Chat::bLogLimitNames(CHAT_MODULE, "LogLimitNames", true);
+CMOption<bool> Chat::bLogIndentEnabled(CHAT_MODULE, "LogIndentEnabled", true);
+CMOption<bool> Chat::bShowTimeIfChanged(CHAT_MODULE, "ShowTimeStampIfChanged", false);
+CMOption<bool> Chat::bTimeStampEventColour(CHAT_MODULE, "TimeStampEventColour", false);
+
+
INT_PTR SvcGetChatManager(WPARAM, LPARAM);
#include "chat.h"
@@ -288,7 +307,7 @@ static INT_PTR __stdcall stubRoomControl(void *param)
return GC_EVENT_ERROR;
SetInitDone(si);
- if (p->command != SESSION_INITDONE || db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) == 0)
+ if (p->command != SESSION_INITDONE || !Chat::bPopupOnJoin)
g_chatApi.ShowRoom(si);
break;
@@ -461,7 +480,7 @@ static INT_PTR CALLBACK sttEventStub(void *_param)
if (g_chatApi.OnSetTopic)
g_chatApi.OnSetTopic(si);
- if (db_get_b(0, CHAT_MODULE, "TopicOnClist", 0)) {
+ if (Chat::bTopicOnClist) {
if (pwszNew != nullptr)
db_set_ws(si->hContact, "CList", "StatusMsg", si->ptszTopic);
else
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 9e7f962980..39e0e08b34 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -792,3 +792,18 @@ Srmm_CreateHotkey @886 NONAME
?SetContact@CUserInfoPageDlg@@QAEXI@Z @893 NONAME
?IsGroupChat@Contact@@YG_NIPBD@Z @894 NONAME
?IsEmpty@CUserInfoPageDlg@@UBE_NXZ @895 NONAME
+?bContactStatusFirst@Chat@@3V?$CMOption@_N@@A @896 NONAME
+?bDoubleClick4Privat@Chat@@3V?$CMOption@_N@@A @897 NONAME
+?bFilterEnabled@Chat@@3V?$CMOption@_N@@A @898 NONAME
+?bFlashWindow@Chat@@3V?$CMOption@_N@@A @899 NONAME
+?bFlashWindowHighlight@Chat@@3V?$CMOption@_N@@A @900 NONAME
+?bLogIndentEnabled@Chat@@3V?$CMOption@_N@@A @901 NONAME
+?bLogLimitNames@Chat@@3V?$CMOption@_N@@A @902 NONAME
+?bPopupOnJoin@Chat@@3V?$CMOption@_N@@A @903 NONAME
+?bShowContactStatus@Chat@@3V?$CMOption@_N@@A @904 NONAME
+?bShowNicklist@Chat@@3V?$CMOption@_N@@A @905 NONAME
+?bShowTime@Chat@@3V?$CMOption@_N@@A @906 NONAME
+?bShowTimeIfChanged@Chat@@3V?$CMOption@_N@@A @907 NONAME
+?bStripFormat@Chat@@3V?$CMOption@_N@@A @908 NONAME
+?bTimeStampEventColour@Chat@@3V?$CMOption@_N@@A @909 NONAME
+?bTopicOnClist@Chat@@3V?$CMOption@_N@@A @910 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 0f48f3e0f2..2a03307191 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -792,3 +792,18 @@ Srmm_CreateHotkey @886 NONAME
?SetContact@CUserInfoPageDlg@@QEAAXI@Z @893 NONAME
?IsGroupChat@Contact@@YA_NIPEBD@Z @894 NONAME
?IsEmpty@CUserInfoPageDlg@@UEBA_NXZ @895 NONAME
+?bContactStatusFirst@Chat@@3V?$CMOption@_N@@A @896 NONAME
+?bDoubleClick4Privat@Chat@@3V?$CMOption@_N@@A @897 NONAME
+?bFilterEnabled@Chat@@3V?$CMOption@_N@@A @898 NONAME
+?bFlashWindow@Chat@@3V?$CMOption@_N@@A @899 NONAME
+?bFlashWindowHighlight@Chat@@3V?$CMOption@_N@@A @900 NONAME
+?bLogIndentEnabled@Chat@@3V?$CMOption@_N@@A @901 NONAME
+?bLogLimitNames@Chat@@3V?$CMOption@_N@@A @902 NONAME
+?bPopupOnJoin@Chat@@3V?$CMOption@_N@@A @903 NONAME
+?bShowContactStatus@Chat@@3V?$CMOption@_N@@A @904 NONAME
+?bShowNicklist@Chat@@3V?$CMOption@_N@@A @905 NONAME
+?bShowTime@Chat@@3V?$CMOption@_N@@A @906 NONAME
+?bShowTimeIfChanged@Chat@@3V?$CMOption@_N@@A @907 NONAME
+?bStripFormat@Chat@@3V?$CMOption@_N@@A @908 NONAME
+?bTimeStampEventColour@Chat@@3V?$CMOption@_N@@A @909 NONAME
+?bTopicOnClist@Chat@@3V?$CMOption@_N@@A @910 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 730809af5f..85a9308301 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -733,7 +733,7 @@ void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList)
return;
bool bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
- if (g_Settings->bDoubleClick4Privat ? bShift : !bShift) {
+ if (Chat::bDoubleClick4Privat ? bShift : !bShift) {
int selStart = LOWORD(m_message.SendMsg(EM_GETSEL, 0, 0));
CMStringW tszName(ui->pszNick);
if (selStart == 0)