2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Support edit / save of greeting message settings.

This commit is contained in:
John Preston
2024-02-23 13:56:18 +04:00
parent e6b9ac2267
commit dd7ccada2f
5 changed files with 266 additions and 11 deletions

View File

@@ -112,6 +112,20 @@ Data::BusinessRecipients RecipientsFromMTP(
return result;
}
[[nodiscard]] Data::GreetingSettings FromMTP(
not_null<Data::Session*> owner,
const tl::conditional<MTPBusinessGreetingMessage> &message) {
if (!message) {
return Data::GreetingSettings();
}
const auto &data = message->data();
return Data::GreetingSettings{
.recipients = RecipientsFromMTP(owner, data),
.noActivityDays = data.vno_activity_days().v,
.shortcutId = data.vshortcut_id().v,
};
}
} // namespace
BotInfo::BotInfo() = default;
@@ -678,6 +692,8 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
if (user->isSelf()) {
user->owner().businessInfo().applyAwaySettings(
FromMTP(&user->owner(), update.vbusiness_away_message()));
user->owner().businessInfo().applyGreetingSettings(
FromMTP(&user->owner(), update.vbusiness_greeting_message()));
}
user->owner().stories().apply(user, update.vstories());