summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-10-30 18:57:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-10-30 18:57:07 +0300
commit5f96afab8b8eadd97cd36519adc3cfc67809d51f (patch)
tree345842a480855bd9199cb601021bb3d0aad4b316 /src/mir_app
parentcd7bd07a41a73ce520005d2317cb1a0ea5cdba52 (diff)
fixes #2108 (Old message log is listed in settings until reopen)
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/srmm_log.cpp54
1 files changed, 37 insertions, 17 deletions
diff --git a/src/mir_app/src/srmm_log.cpp b/src/mir_app/src/srmm_log.cpp
index f0ac1b2401..88612df889 100644
--- a/src/mir_app/src/srmm_log.cpp
+++ b/src/mir_app/src/srmm_log.cpp
@@ -46,23 +46,6 @@ static CMOption<BYTE> g_bEnableCustomLogs("SRMM", "EnableCustomLogs", 0);
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(HANDLE) RegisterSrmmLog(const char *pszShortName, const wchar_t *pwszScreenName, pfnSrmmLogCreator fnBuilder)
-{
- if (!pszShortName || !pwszScreenName || !fnBuilder)
- return nullptr;
-
- auto *p = new LoggerClass(pszShortName, pwszScreenName, fnBuilder);
- g_arLogClasses.insert(p);
- return p;
-}
-
-MIR_APP_DLL(void) UnregisterSrmmLog(HANDLE pLogger)
-{
- g_arLogClasses.remove((LoggerClass *)pLogger);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
CSrmmLogWindow* Srmm_GetLogWindow(CMsgDialog *pDlg)
{
if (!pDlg->isChat() || g_bEnableCustomLogs) {
@@ -85,6 +68,8 @@ CSrmmLogWindow* Srmm_GetLogWindow(CMsgDialog *pDlg)
/////////////////////////////////////////////////////////////////////////////////////////
// options dialog
+static class CSrmmLogOptionsDlg *pDialog = nullptr;
+
class CSrmmLogOptionsDlg : public CDlgBase
{
CCtrlListBox m_list;
@@ -103,6 +88,7 @@ public:
bool OnInitDialog() override
{
+ pDialog = this;
ptrA szCurr(db_get_sa(0, "SRMM", "Logger", "built-in"));
for (auto &it : g_arLogClasses) {
@@ -125,6 +111,17 @@ public:
return true;
}
+ void OnDestroy() override
+ {
+ pDialog = nullptr;
+ }
+
+ void Rebuild()
+ {
+ m_list.ResetContent();
+ OnInitDialog();
+ }
+
void onChange_List(CCtrlListBox *)
{
NotifyChange();
@@ -141,3 +138,26 @@ void SrmmLogOptionsInit(WPARAM wParam)
odp.pDialog = new CSrmmLogOptionsDlg();
g_plugin.addOptions(wParam, &odp);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(HANDLE) RegisterSrmmLog(const char *pszShortName, const wchar_t *pwszScreenName, pfnSrmmLogCreator fnBuilder)
+{
+ if (!pszShortName || !pwszScreenName || !fnBuilder)
+ return nullptr;
+
+ auto *p = new LoggerClass(pszShortName, pwszScreenName, fnBuilder);
+ g_arLogClasses.insert(p);
+
+ if (pDialog)
+ pDialog->Rebuild();
+ return p;
+}
+
+MIR_APP_DLL(void) UnregisterSrmmLog(HANDLE pLogger)
+{
+ g_arLogClasses.remove((LoggerClass *)pLogger);
+
+ if (pDialog)
+ pDialog->Rebuild();
+}