Add and use ScopeNotificationSettings::get_input_peer_notify_settings.
This commit is contained in:
parent
d51ad4f4e9
commit
bd4004e0be
@ -395,15 +395,8 @@ class UpdateScopeNotifySettingsQuery final : public Td::ResultHandler {
|
|||||||
void send(NotificationSettingsScope scope, const ScopeNotificationSettings &new_settings) {
|
void send(NotificationSettingsScope scope, const ScopeNotificationSettings &new_settings) {
|
||||||
auto input_notify_peer = get_input_notify_peer(scope);
|
auto input_notify_peer = get_input_notify_peer(scope);
|
||||||
CHECK(input_notify_peer != nullptr);
|
CHECK(input_notify_peer != nullptr);
|
||||||
int32 flags = telegram_api::inputPeerNotifySettings::MUTE_UNTIL_MASK |
|
|
||||||
telegram_api::inputPeerNotifySettings::SHOW_PREVIEWS_MASK;
|
|
||||||
if (new_settings.sound != nullptr) {
|
|
||||||
flags |= telegram_api::inputPeerNotifySettings::SOUND_MASK;
|
|
||||||
}
|
|
||||||
send_query(G()->net_query_creator().create(telegram_api::account_updateNotifySettings(
|
send_query(G()->net_query_creator().create(telegram_api::account_updateNotifySettings(
|
||||||
std::move(input_notify_peer), make_tl_object<telegram_api::inputPeerNotifySettings>(
|
std::move(input_notify_peer), new_settings.get_input_peer_notify_settings())));
|
||||||
flags, new_settings.show_preview, false, new_settings.mute_until,
|
|
||||||
get_input_notification_sound(new_settings.sound), false, false, nullptr))));
|
|
||||||
scope_ = scope;
|
scope_ = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,17 @@
|
|||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
|
telegram_api::object_ptr<telegram_api::inputPeerNotifySettings>
|
||||||
|
ScopeNotificationSettings::get_input_peer_notify_settings() const {
|
||||||
|
int32 flags = telegram_api::inputPeerNotifySettings::MUTE_UNTIL_MASK |
|
||||||
|
telegram_api::inputPeerNotifySettings::SHOW_PREVIEWS_MASK;
|
||||||
|
if (sound != nullptr) {
|
||||||
|
flags |= telegram_api::inputPeerNotifySettings::SOUND_MASK;
|
||||||
|
}
|
||||||
|
return telegram_api::make_object<telegram_api::inputPeerNotifySettings>(
|
||||||
|
flags, show_preview, false, mute_until, get_input_notification_sound(sound), false, false, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings) {
|
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings) {
|
||||||
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
||||||
<< notification_settings.show_preview << ", " << notification_settings.is_synchronized << ", "
|
<< notification_settings.show_preview << ", " << notification_settings.is_synchronized << ", "
|
||||||
|
@ -38,6 +38,8 @@ class ScopeNotificationSettings {
|
|||||||
, disable_pinned_message_notifications(disable_pinned_message_notifications)
|
, disable_pinned_message_notifications(disable_pinned_message_notifications)
|
||||||
, disable_mention_notifications(disable_mention_notifications) {
|
, disable_mention_notifications(disable_mention_notifications) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
telegram_api::object_ptr<telegram_api::inputPeerNotifySettings> get_input_peer_notify_settings() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings);
|
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user