From b5ce6f26e8b5389f2be2360509d336b539b65f56 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 14 Sep 2020 12:42:58 +0300 Subject: g_chatApi.LogToFile completely moved into the core --- src/mir_app/src/chat.h | 18 ++++++++++-------- src/mir_app/src/chat_manager.cpp | 1 - src/mir_app/src/chat_opts.cpp | 3 +++ src/mir_app/src/chat_svc.cpp | 4 ++-- src/mir_app/src/chat_tools.cpp | 7 +++++++ 5 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index 1fe2bff454..edefe3af39 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -34,17 +34,19 @@ void Srmm_ProcessToolbarHotkey(MCONTACT hContact, INT_PTR iButtonFrom, HWND hwnd class CLogWindow : public CSrmmLogWindow {}; -extern HPLUGIN g_pChatPlugin; -extern GlobalLogSettingsBase *g_Settings; -extern int g_cbSession, g_cbModuleInfo, g_iFontMode; +extern HPLUGIN g_pChatPlugin; +extern int g_cbSession, g_cbModuleInfo, g_iFontMode; extern wchar_t *g_szFontGroup; -extern mir_cs csChat; +extern mir_cs csChat; + +extern DWORD g_dwDiskLogFlags; +extern HCURSOR g_hCurHyperlinkHand; +extern char* pLogIconBmpBits[14]; +extern HANDLE hevSendEvent, hevBuildMenuEvent; -extern HCURSOR g_hCurHyperlinkHand; -extern char* pLogIconBmpBits[14]; -extern LIST g_arSessions; extern MWindowList g_hWindowList; -extern HANDLE hevSendEvent, hevBuildMenuEvent; +extern LIST g_arSessions; +extern GlobalLogSettingsBase *g_Settings; extern CMOption g_bChatTrayInactive, g_bChatPopupInactive; diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 5479e45d45..74b56fed8c 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -909,7 +909,6 @@ static void ResetApi() g_chatApi.DoTrayIcon = ::DoTrayIcon; g_chatApi.DoPopup = ::DoPopup; g_chatApi.ShowPopup = ::ShowPopup; - g_chatApi.LogToFile = ::LogToFile; g_chatApi.GetChatLogsFilename = ::GetChatLogsFilename; g_chatApi.Log_SetStyle = ::Log_SetStyle; diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index 229f7da5a7..c05953a187 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern SESSION_INFO g_TabSession; +DWORD g_dwDiskLogFlags; HPLUGIN g_pChatPlugin; GlobalLogSettingsBase *g_Settings; int g_cbSession, g_cbModuleInfo, g_iFontMode; @@ -257,6 +258,8 @@ void LoadGlobalSettings(void) g_Settings->UserListHeadingsFont = CreateFontIndirect(&lf); SetIndentSize(); + + g_dwDiskLogFlags = db_get_dw(0, CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL); } static void FreeGlobalSettings(void) diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 1e1653f3ae..583c5e678e 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -412,7 +412,7 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce) bManyFix++; if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled) - g_chatApi.LogToFile(si, gce); + LogToFile(si, gce); } return 0; @@ -556,7 +556,7 @@ static INT_PTR CALLBACK sttEventStub(void *_param) g_chatApi.DoSoundsFlashPopupTrayStuff(si, &gce, bIsHighlighted, 0); if ((gce.dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled) - g_chatApi.LogToFile(si, &gce); + LogToFile(si, &gce); } if (!bRemoveFlag) diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index bf31f299c5..424ead734e 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -483,6 +483,13 @@ bool IsHighlighted(SESSION_INFO *si, GCEVENT *gce) BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) { + if (si == nullptr || gce == nullptr) + return FALSE; + + // check whether we have to log this event + if (!(gce->iType & g_dwDiskLogFlags)) + return FALSE; + wchar_t p = '\0'; GetChatLogsFilename(si, gce->time); -- cgit v1.2.3