summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/mir_app.vcxproj1
-rw-r--r--src/mir_app/mir_app.vcxproj.filters3
-rw-r--r--src/mir_app/res/resource.rc7
-rw-r--r--src/mir_app/src/netlib_log.cpp78
-rw-r--r--src/mir_app/src/resource.h5
5 files changed, 58 insertions, 36 deletions
diff --git a/src/mir_app/mir_app.vcxproj b/src/mir_app/mir_app.vcxproj
index c054553f42..224fc3f656 100644
--- a/src/mir_app/mir_app.vcxproj
+++ b/src/mir_app/mir_app.vcxproj
@@ -287,6 +287,7 @@
<Image Include="res\never_visible.ico" />
<Image Include="res\Off.ico" />
<Image Include="res\On.ico" />
+ <Image Include="res\sound.ico" />
<Image Include="res\status_away.ico" />
<Image Include="res\status_DND.ico" />
<Image Include="res\status_free4chat.ico" />
diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters
index 0d94a10dcc..e47a9bfbae 100644
--- a/src/mir_app/mir_app.vcxproj.filters
+++ b/src/mir_app/mir_app.vcxproj.filters
@@ -723,5 +723,8 @@
<Image Include="res\icon_password.ico">
<Filter>Resource Files</Filter>
</Image>
+ <Image Include="res\sound.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index abf6aa3657..95dc5df7be 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -251,6 +251,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,226,294,10
DEFPUSHBUTTON "OK",IDOK,194,241,54,14
PUSHBUTTON "Cancel",IDCANCEL,254,241,54,14
+ CONTROL "Rotate logs",IDC_LOGROTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,146,153,10
END
IDD_OPT_SOUND DIALOGEX 0, 0, 316, 252
@@ -1321,6 +1322,7 @@ IDI_PASSWORD ICON "icon_password.ico"
IDI_SOUND ICON "sound.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
@@ -1490,6 +1492,11 @@ BEGIN
0
END
+IDD_NETLIBLOGOPTS AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/netlib_log.cpp b/src/mir_app/src/netlib_log.cpp
index 52c93406a0..5640c34c66 100644
--- a/src/mir_app/src/netlib_log.cpp
+++ b/src/mir_app/src/netlib_log.cpp
@@ -35,13 +35,11 @@ extern HANDLE hConnectionHeaderMutex;
#define TIMEFORMAT_MICROSECONDS 3
struct {
HWND hwndOpts;
- int toOutputDebugString;
- int toFile;
- int toLog;
- int timeFormat;
- int showUser;
- int dumpSent, dumpRecv, dumpProxy, dumpSsl;
- int textDumps, autoDetectText;
+ bool toOutputDebugString, toFile, toLog;
+ bool showUser;
+ bool dumpSent, dumpRecv, dumpProxy, dumpSsl;
+ bool textDumps, autoDetectText;
+ int timeFormat;
CMStringW tszFile, tszUserFile;
}
static logOptions = {};
@@ -59,6 +57,18 @@ static HANDLE hLogger = nullptr;
static void InitLog()
{
+ logOptions.dumpRecv = db_get_b(0, "Netlib", "DumpRecv", true) != 0;
+ logOptions.dumpSent = db_get_b(0, "Netlib", "DumpSent", true) != 0;
+ logOptions.dumpProxy = db_get_b(0, "Netlib", "DumpProxy", true) != 0;
+ logOptions.dumpSsl = db_get_b(0, "Netlib", "DumpSsl", false) != 0;
+ logOptions.textDumps = db_get_b(0, "Netlib", "TextDumps", true) != 0;
+ logOptions.autoDetectText = db_get_b(0, "Netlib", "AutoDetectText", true) != 0;
+ logOptions.timeFormat = db_get_b(0, "Netlib", "TimeFormat", TIMEFORMAT_HHMMSS);
+ logOptions.showUser = db_get_b(0, "Netlib", "ShowUser", true) != 0;
+ logOptions.toOutputDebugString = db_get_b(0, "Netlib", "ToOutputDebugString", false) != 0;
+ logOptions.toFile = db_get_b(0, "Netlib", "ToFile", false) != 0;
+ logOptions.toLog = db_get_dw(0, "Netlib", "NLlog", true) != 0;
+
if (hLogger) {
mir_closeLog(hLogger);
hLogger = nullptr;
@@ -77,8 +87,16 @@ static void InitLog()
logOptions.tszFile = VARSW(logOptions.tszUserFile);
}
- if (logOptions.toFile)
- hLogger = mir_createLog("Netlib", LPGENW("Standard Netlib log"), logOptions.tszFile, 0);
+ if (logOptions.toFile) {
+ CMStringW wszFileName = logOptions.tszFile;
+ if (db_get_b(0, "Netlib", "RotateLogs", false)) {
+ int iLogNumber = db_get_dw(0, "Netlib", "RotateId");
+ wszFileName.AppendFormat(L".%d", iLogNumber);
+ db_set_dw(0, "Netlib", "RotateId", (iLogNumber + 1) % 10);
+ }
+
+ hLogger = mir_createLog("Netlib", LPGENW("Standard Netlib log"), wszFileName, 0);
+ }
}
static const wchar_t *szTimeFormats[] =
@@ -92,6 +110,7 @@ static const wchar_t *szTimeFormats[] =
class CLogOptionsDlg : public CDlgBase
{
CCtrlEdit edtFileName;
+ CCtrlCombo cmbTimeFormat;
CCtrlButton btnRunNow, btnFileName, btnRunAtStart;
CCtrlTreeView treeFilter;
@@ -100,6 +119,7 @@ public:
CDlgBase(g_plugin, IDD_NETLIBLOGOPTS),
treeFilter(this, IDC_FILTER),
edtFileName(this, IDC_FILENAME),
+ cmbTimeFormat(this, IDC_TIMEFORMAT),
btnRunNow(this, IDC_RUNNOW),
btnFileName(this, IDC_FILENAMEBROWSE),
btnRunAtStart(this, IDC_RUNATSTARTBROWSE)
@@ -120,9 +140,9 @@ public:
CheckDlgButton(m_hwnd, IDC_AUTODETECTTEXT, logOptions.autoDetectText ? BST_CHECKED : BST_UNCHECKED);
for (auto &it : szTimeFormats)
- SendDlgItemMessage(m_hwnd, IDC_TIMEFORMAT, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
+ cmbTimeFormat.AddString(TranslateW(it));
+ cmbTimeFormat.SetCurSel(logOptions.timeFormat);
- SendDlgItemMessage(m_hwnd, IDC_TIMEFORMAT, CB_SETCURSEL, logOptions.timeFormat, 0);
CheckDlgButton(m_hwnd, IDC_SHOWNAMES, logOptions.showUser ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_TOOUTPUTDEBUGSTRING, logOptions.toOutputDebugString ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_TOFILE, logOptions.toFile ? BST_CHECKED : BST_UNCHECKED);
@@ -160,7 +180,6 @@ public:
wchar_t str[MAX_PATH];
GetDlgItemText(m_hwnd, IDC_RUNATSTART, str, _countof(str));
db_set_ws(0, "Netlib", "RunAtStart", str);
- db_set_b(0, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWTHISDLGATSTART));
edtFileName.GetText(str, _countof(str));
logOptions.tszUserFile = rtrimw(str);
@@ -169,16 +188,19 @@ public:
GetDlgItemText(m_hwnd, IDC_PATH, str, _countof(str));
logOptions.tszFile = rtrimw(str);
- db_set_b(0, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(m_hwnd, IDC_DUMPRECV));
- db_set_b(0, "Netlib", "DumpSent", logOptions.dumpSent = IsDlgButtonChecked(m_hwnd, IDC_DUMPSENT));
- db_set_b(0, "Netlib", "DumpProxy", logOptions.dumpProxy = IsDlgButtonChecked(m_hwnd, IDC_DUMPPROXY));
- db_set_b(0, "Netlib", "DumpSsl", logOptions.dumpSsl = IsDlgButtonChecked(m_hwnd, IDC_DUMPSSL));
- db_set_b(0, "Netlib", "TextDumps", logOptions.textDumps = IsDlgButtonChecked(m_hwnd, IDC_TEXTDUMPS));
- db_set_b(0, "Netlib", "AutoDetectText", logOptions.autoDetectText = IsDlgButtonChecked(m_hwnd, IDC_AUTODETECTTEXT));
- db_set_b(0, "Netlib", "TimeFormat", logOptions.timeFormat = SendDlgItemMessage(m_hwnd, IDC_TIMEFORMAT, CB_GETCURSEL, 0, 0));
- db_set_b(0, "Netlib", "ShowUser", logOptions.showUser = IsDlgButtonChecked(m_hwnd, IDC_SHOWNAMES));
- db_set_b(0, "Netlib", "ToOutputDebugString", logOptions.toOutputDebugString = IsDlgButtonChecked(m_hwnd, IDC_TOOUTPUTDEBUGSTRING));
- db_set_b(0, "Netlib", "ToFile", logOptions.toFile = IsDlgButtonChecked(m_hwnd, IDC_TOFILE));
+ db_set_b(0, "Netlib", "DumpRecv", IsDlgButtonChecked(m_hwnd, IDC_DUMPRECV));
+ db_set_b(0, "Netlib", "DumpSent", IsDlgButtonChecked(m_hwnd, IDC_DUMPSENT));
+ db_set_b(0, "Netlib", "DumpProxy", IsDlgButtonChecked(m_hwnd, IDC_DUMPPROXY));
+ db_set_b(0, "Netlib", "DumpSsl", IsDlgButtonChecked(m_hwnd, IDC_DUMPSSL));
+ db_set_b(0, "Netlib", "TextDumps", IsDlgButtonChecked(m_hwnd, IDC_TEXTDUMPS));
+ db_set_b(0, "Netlib", "AutoDetectText", IsDlgButtonChecked(m_hwnd, IDC_AUTODETECTTEXT));
+ db_set_b(0, "Netlib", "ShowUser", IsDlgButtonChecked(m_hwnd, IDC_SHOWNAMES));
+ db_set_b(0, "Netlib", "ToOutputDebugString", IsDlgButtonChecked(m_hwnd, IDC_TOOUTPUTDEBUGSTRING));
+ db_set_b(0, "Netlib", "ShowLogOptsAtStart", IsDlgButtonChecked(m_hwnd, IDC_SHOWTHISDLGATSTART));
+ db_set_b(0, "Netlib", "ToFile", IsDlgButtonChecked(m_hwnd, IDC_TOFILE));
+ db_set_b(0, "Netlib", "RotateLogs", IsDlgButtonChecked(m_hwnd, IDC_LOGROTATE));
+
+ db_set_b(0, "Netlib", "TimeFormat", cmbTimeFormat.GetCurSel());
TVITEMEX tvi = {};
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT;
@@ -523,18 +545,6 @@ void NetlibLogInit(void)
CreateServiceFunction(MS_NETLIB_LOGWIN, ShowOptions);
hLogEvent = CreateHookableEvent(ME_NETLIB_FASTDUMP);
- logOptions.dumpRecv = db_get_b(0, "Netlib", "DumpRecv", 1);
- logOptions.dumpSent = db_get_b(0, "Netlib", "DumpSent", 1);
- logOptions.dumpProxy = db_get_b(0, "Netlib", "DumpProxy", 1);
- logOptions.dumpSsl = db_get_b(0, "Netlib", "DumpSsl", 0);
- logOptions.textDumps = db_get_b(0, "Netlib", "TextDumps", 1);
- logOptions.autoDetectText = db_get_b(0, "Netlib", "AutoDetectText", 1);
- logOptions.timeFormat = db_get_b(0, "Netlib", "TimeFormat", TIMEFORMAT_HHMMSS);
- logOptions.showUser = db_get_b(0, "Netlib", "ShowUser", 1);
- logOptions.toOutputDebugString = db_get_b(0, "Netlib", "ToOutputDebugString", 0);
- logOptions.toFile = db_get_b(0, "Netlib", "ToFile", 0);
- logOptions.toLog = db_get_dw(0, "Netlib", "NLlog", 1);
-
InitLog();
if (db_get_b(0, "Netlib", "ShowLogOptsAtStart", 0))
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index 64a57eaa82..f30af17e39 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -563,6 +563,7 @@
#define IDC_SM_ENABLED 1746
#define IDC_LANGUAGES 1747
#define IDC_GENMENU_MODULE 1748
+#define IDC_LOGROTATE 1749
#define IDC_EFFECT_COLOUR_TEXT1 1853
#define IDC_EFFECT_COLOUR_SPIN1 1854
#define IDC_EXTRAORDER 1889
@@ -669,9 +670,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 332
+#define _APS_NEXT_RESOURCE_VALUE 333
#define _APS_NEXT_COMMAND_VALUE 40018
-#define _APS_NEXT_CONTROL_VALUE 1749
+#define _APS_NEXT_CONTROL_VALUE 1751
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif