summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-09-14 12:42:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-09-14 12:42:58 +0300
commitb5ce6f26e8b5389f2be2360509d336b539b65f56 (patch)
tree3267151830df6f376d56c46da361b35a241da550 /src
parentb37a9860232c8f9bc8d0503783c53eb6abbae26e (diff)
g_chatApi.LogToFile completely moved into the core
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/chat.h18
-rw-r--r--src/mir_app/src/chat_manager.cpp1
-rw-r--r--src/mir_app/src/chat_opts.cpp3
-rw-r--r--src/mir_app/src/chat_svc.cpp4
-rw-r--r--src/mir_app/src/chat_tools.cpp7
5 files changed, 22 insertions, 11 deletions
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<SESSION_INFO> g_arSessions;
extern MWindowList g_hWindowList;
-extern HANDLE hevSendEvent, hevBuildMenuEvent;
+extern LIST<SESSION_INFO> g_arSessions;
+extern GlobalLogSettingsBase *g_Settings;
extern CMOption<bool> 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);