From bcbbf5616d887449254a53a26531990bc55f020c Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 25 Jan 2021 20:52:40 +0100 Subject: [PATCH] Fix two bugs in user privacy settings --- src/tdlibwrapper.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 15cf157..0300c47 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -1717,15 +1717,16 @@ void TDLibWrapper::handleMessageIsPinnedUpdated(qlonglong chatId, qlonglong mess void TDLibWrapper::handleUserPrivacySettingRules(const QVariantMap &rules) { QVariantList newGivenRules = rules.value("rules").toList(); - UserPrivacySettingRule newAppliedRule = UserPrivacySettingRule::RuleAllowAll; + // If nothing (or something unsupported is sent out) it is considered to be restricted completely + UserPrivacySettingRule newAppliedRule = UserPrivacySettingRule::RuleRestrictAll; QListIterator givenRulesIterator(newGivenRules); while (givenRulesIterator.hasNext()) { QString givenRule = givenRulesIterator.next().toMap().value(_TYPE).toString(); if (givenRule == "userPrivacySettingRuleAllowContacts") { newAppliedRule = UserPrivacySettingRule::RuleAllowContacts; } - if (givenRule == "userPrivacySettingRuleRestrictAll") { - newAppliedRule = UserPrivacySettingRule::RuleRestrictAll; + if (givenRule == "userPrivacySettingRuleAllowAll") { + newAppliedRule = UserPrivacySettingRule::RuleAllowAll; } } UserPrivacySetting usedSetting = static_cast(rules.value(_EXTRA).toInt()); @@ -1757,7 +1758,7 @@ void TDLibWrapper::handleUpdatedUserPrivacySettingRules(const QVariantMap &updat } if (usedSetting != UserPrivacySetting::SettingUnknown) { QVariantMap rawRules = updatedRules.value("rules").toMap(); - rawRules.insert(_TYPE, usedSetting); + rawRules.insert(_EXTRA, usedSetting); this->handleUserPrivacySettingRules(rawRules); } }