diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-27 18:05:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-27 18:05:39 +0300 |
commit | fc312c6da15bea2a8a819da59e68262bbced3f39 (patch) | |
tree | 33e4fc02d5fe0bb51b32c5b5c726e0c36efdae17 | |
parent | c8f805032d674e6d3f002e47fe38d8df40748205 (diff) |
SRMM/DisableCustomLogsForProto STRING - list of account names (comma/space/semicolon separated) that use built-in groupchat viewer only
-rw-r--r-- | src/mir_app/src/srmm_log.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/mir_app/src/srmm_log.cpp b/src/mir_app/src/srmm_log.cpp index f1cef0dd62..d8a3760bad 100644 --- a/src/mir_app/src/srmm_log.cpp +++ b/src/mir_app/src/srmm_log.cpp @@ -46,12 +46,41 @@ static CMOption<BYTE> g_bEnableCustomLogs("SRMM", "EnableCustomLogs", 0); ///////////////////////////////////////////////////////////////////////////////////////// +static bool sttEnableCustomLogs(CMsgDialog *pDlg) +{ + // always enable custom log viewers for private chats + if (!pDlg->isChat()) + return true; + + // if custom log viewers are disable, use build-in one + if (!g_bEnableCustomLogs) + return false; + + // check if custom viewers are forbidden for this particular account + auto *szProto = Proto_GetBaseAccountName(pDlg->m_hContact); + if (szProto) { + // hidden setting !!!!!!!! + CMStringA szProtoList(db_get_sm(0, "SRMM", "DisableCustomLogsForProto")); + + int iStart = 0; + while (true) { + auto forbiddenProto = szProtoList.Tokenize(",; ", iStart); + if (forbiddenProto.IsEmpty()) + break; + + if (forbiddenProto == szProto) + return false; + } + } + + // ok-ok, use that custom viewer + return true; +} + CSrmmLogWindow* Srmm_GetLogWindow(CMsgDialog *pDlg) { - if (!pDlg->isChat() || g_bEnableCustomLogs) { - ptrA szCurr(db_get_sa(pDlg->m_hContact, "SRMsg", "Logger")); - if (!szCurr) - szCurr = db_get_sa(0, "SRMM", "Logger", "built-in"); + if (sttEnableCustomLogs(pDlg)) { + ptrA szCurr(db_get_sa(pDlg->m_hContact, "SRMsg", "Logger", "")); for (auto &it : g_arLogClasses) if (!mir_strcmp(szCurr, it->szShortName)) |