summaryrefslogtreecommitdiff
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
parentb37a9860232c8f9bc8d0503783c53eb6abbae26e (diff)
g_chatApi.LogToFile completely moved into the core
-rw-r--r--include/m_chat_int.h1
-rw-r--r--plugins/TabSRMM/src/chat.h3
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp1
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp20
-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
9 files changed, 23 insertions, 35 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 746ab483fc..d0dfff4bce 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -324,7 +324,6 @@ struct CHAT_MANAGER
BOOL (*DoTrayIcon)(SESSION_INFO *si, GCEVENT *gce);
BOOL (*DoPopup)(SESSION_INFO *si, GCEVENT *gce);
int (*ShowPopup)(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, wchar_t* pszRoomName, COLORREF crBkg, const wchar_t* fmt, ...);
- BOOL (*LogToFile)(SESSION_INFO *si, GCEVENT *gce);
wchar_t* (*GetChatLogsFilename)(SESSION_INFO *si, time_t tTime);
char* (*Log_SetStyle)(int style);
diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h
index 17e7dab2f1..eef0e184aa 100644
--- a/plugins/TabSRMM/src/chat.h
+++ b/plugins/TabSRMM/src/chat.h
@@ -52,7 +52,7 @@ struct MODULEINFO : public GCModuleInfoBase
struct SESSION_INFO : public GCSessionInfoBase
{
- int iLogTrayFlags, iLogPopupFlags, iDiskLogFlags;
+ int iLogTrayFlags, iLogPopupFlags;
};
struct LOGSTREAMDATA : public GCLogStreamDataBase
@@ -130,7 +130,6 @@ void Chat_SetFilters(SESSION_INFO *si);
void DoFlashAndSoundWorker(FLASH_PARAMS* p);
BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce);
int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, wchar_t* pszRoomName, COLORREF crBkg, const wchar_t* fmt, ...);
-BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
#include "chat_resource.h"
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index ce201a4f91..55777bec1c 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -372,7 +372,6 @@ int Chat_Load()
// this operation is unsafe, that's why we restore the old pci state on exit
g_chatApi.DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff;
g_chatApi.IsHighlighted = IsHighlighted;
- oldLogToFile = g_chatApi.LogToFile; g_chatApi.LogToFile = LogToFile;
oldDoPopup = g_chatApi.DoPopup; g_chatApi.DoPopup = DoPopup;
oldDoTrayIcon = g_chatApi.DoTrayIcon; g_chatApi.ShowPopup = ShowPopup;
g_chatApi.Log_CreateRTF = Log_CreateRTF;
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index cc43998dd8..ad2b476e04 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -472,24 +472,6 @@ wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2)
}
/*
-* log the event to the log file
-* allows selective logging of wanted events
-*/
-BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
-{
- if (!si || !gce)
- return FALSE;
-
- /*
- * check whether we have to log this event
- */
- if (!(gce->iType & si->iDiskLogFlags))
- return FALSE;
-
- return oldLogToFile(si, gce); // call kernel method
-}
-
-/*
* set all filters and notification config for a session
* uses per channel mask + filterbits, default config as backup
*/
@@ -524,8 +506,6 @@ void Chat_SetFilters(SESSION_INFO *si)
dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
dwMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0);
- si->iDiskLogFlags = db_get_dw(0, CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
-
si->iLogTrayFlags = dwFlags_default;
for (int i = 0; i < 32; i++) {
DWORD dwBit = 1 << i;
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);