summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-06 18:01:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-06 18:01:27 +0300
commit581533039372c7022c81cc87a6926df7ff368d1d (patch)
tree3628d7952df685b6c212f063b2cb1eb06478e5c7
parent44fc5738c808a028ecd74df2d92529f66c1ceca8 (diff)
fixes #3391 (WhatsApp: после удаления учётки остаётся ключ в базе)
-rw-r--r--src/mir_app/src/netlib.cpp7
-rw-r--r--src/mir_app/src/netlib_log.cpp5
2 files changed, 8 insertions, 4 deletions
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp
index 2914620911..6591b6f68b 100644
--- a/src/mir_app/src/netlib.cpp
+++ b/src/mir_app/src/netlib.cpp
@@ -115,8 +115,9 @@ void NetlibLeaveNestedCS(NetlibNestedCriticalSection *nlncs)
static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szSetting, int defValue)
{
DBVARIANT dbv;
- if (db_get(0, szUserModule, szSetting, &dbv) && db_get(0, "Netlib", szSetting, &dbv))
- return defValue;
+ if (db_get(0, szUserModule, szSetting, &dbv))
+ if (db_get(0, "Netlib", szSetting, &dbv))
+ return defValue;
if (dbv.type == DBVT_BYTE) return dbv.bVal;
if (dbv.type == DBVT_WORD) return dbv.wVal;
@@ -190,7 +191,7 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu)
thisUser->settings.enableUPnP = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLEnableUPnP", 1); //default to on
thisUser->settings.validateSSL = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLValidateSSL", 0);
- thisUser->toLog = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLlog", 1);
+ thisUser->toLog = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLlog", 0);
mir_cslock lck(csNetlibUser);
netlibUser.insert(thisUser);
diff --git a/src/mir_app/src/netlib_log.cpp b/src/mir_app/src/netlib_log.cpp
index 1ddbb63f6f..8574a4f9b3 100644
--- a/src/mir_app/src/netlib_log.cpp
+++ b/src/mir_app/src/netlib_log.cpp
@@ -220,7 +220,10 @@ public:
}
else if (tvi.lParam < netlibUser.getCount()) {
netlibUser[tvi.lParam]->toLog = checked;
- db_set_dw(0, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
+ if (checked)
+ db_set_dw(0, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
+ else
+ db_unset(0, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog");
}
tvi.hItem = treeFilter.GetNextSibling(tvi.hItem);