summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-05-08 11:55:59 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-05-08 11:56:10 +0300
commit751e36b8878a2aec02c439c8c009cdb6db35d8d0 (patch)
treef0e39671218bc5316cdf578a81a1ecad2a0d085d /src/mir_app
parenta28c6f1d7c6cd725576aad87e298e2082da6c82b (diff)
NetLib: logging options aren't saved after Miranda's restart
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/netlib_log.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mir_app/src/netlib_log.cpp b/src/mir_app/src/netlib_log.cpp
index 8574a4f9b3..22bd9c5866 100644
--- a/src/mir_app/src/netlib_log.cpp
+++ b/src/mir_app/src/netlib_log.cpp
@@ -166,12 +166,12 @@ public:
for (auto &it : netlibUser) {
tvis.item.pszText = it->user.szDescriptiveName.w;
- tvis.item.lParam = netlibUser.indexOf(&it);
+ tvis.item.lParam = (LPARAM)it;
tvis.item.state = INDEXTOSTATEIMAGEMASK(it->toLog ? 2 : 1);
treeFilter.InsertItem(&tvis);
}
- tvis.item.lParam = -1;
+ tvis.item.lParam = 0;
tvis.item.pszText = TranslateT("(Miranda core logging)");
tvis.item.state = INDEXTOSTATEIMAGEMASK((logOptions.toLog) ? 2 : 1);
treeFilter.InsertItem(&tvis);
@@ -214,16 +214,14 @@ public:
treeFilter.GetItem(&tvi);
bool checked = ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2);
- if (tvi.lParam == -1) {
+ auto *pNetUser = (HNETLIBUSER)tvi.lParam;
+ if (pNetUser == nullptr) {
logOptions.toLog = checked;
db_set_dw(0, "Netlib", "NLlog", checked);
}
- else if (tvi.lParam < netlibUser.getCount()) {
- netlibUser[tvi.lParam]->toLog = checked;
- if (checked)
- db_set_dw(0, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
- else
- db_unset(0, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog");
+ else {
+ pNetUser->toLog = checked;
+ db_set_dw(0, pNetUser->user.szSettingsModule, "NLlog", checked);
}
tvi.hItem = treeFilter.GetNextSibling(tvi.hItem);