Add DialogNotificationSettings::get_input_peer_notify_settings.
This commit is contained in:
parent
96fef663bb
commit
9a8262f146
|
@ -12,6 +12,25 @@
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
|
telegram_api::object_ptr<telegram_api::inputPeerNotifySettings>
|
||||||
|
DialogNotificationSettings::get_input_peer_notify_settings() const {
|
||||||
|
int32 flags = 0;
|
||||||
|
if (!use_default_mute_until) {
|
||||||
|
flags |= telegram_api::inputPeerNotifySettings::MUTE_UNTIL_MASK;
|
||||||
|
}
|
||||||
|
if (sound != nullptr) {
|
||||||
|
flags |= telegram_api::inputPeerNotifySettings::SOUND_MASK;
|
||||||
|
}
|
||||||
|
if (!use_default_show_preview) {
|
||||||
|
flags |= telegram_api::inputPeerNotifySettings::SHOW_PREVIEWS_MASK;
|
||||||
|
}
|
||||||
|
if (silent_send_message) {
|
||||||
|
flags |= telegram_api::inputPeerNotifySettings::SILENT_MASK;
|
||||||
|
}
|
||||||
|
return telegram_api::make_object<telegram_api::inputPeerNotifySettings>(
|
||||||
|
flags, show_preview, silent_send_message, mute_until, get_input_notification_sound(sound), false, false, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder &operator<<(StringBuilder &string_builder, const DialogNotificationSettings ¬ification_settings) {
|
StringBuilder &operator<<(StringBuilder &string_builder, const DialogNotificationSettings ¬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.silent_send_message
|
<< notification_settings.show_preview << ", " << notification_settings.silent_send_message
|
||||||
|
|
|
@ -53,6 +53,8 @@ class DialogNotificationSettings {
|
||||||
, use_default_disable_mention_notifications(use_default_disable_mention_notifications)
|
, use_default_disable_mention_notifications(use_default_disable_mention_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 DialogNotificationSettings ¬ification_settings);
|
StringBuilder &operator<<(StringBuilder &string_builder, const DialogNotificationSettings ¬ification_settings);
|
||||||
|
|
|
@ -334,24 +334,8 @@ class UpdateDialogNotifySettingsQuery final : public Td::ResultHandler {
|
||||||
return on_error(Status::Error(500, "Can't update chat notification settings"));
|
return on_error(Status::Error(500, "Can't update chat notification settings"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 flags = 0;
|
|
||||||
if (!new_settings.use_default_mute_until) {
|
|
||||||
flags |= telegram_api::inputPeerNotifySettings::MUTE_UNTIL_MASK;
|
|
||||||
}
|
|
||||||
if (new_settings.sound != nullptr) {
|
|
||||||
flags |= telegram_api::inputPeerNotifySettings::SOUND_MASK;
|
|
||||||
}
|
|
||||||
if (!new_settings.use_default_show_preview) {
|
|
||||||
flags |= telegram_api::inputPeerNotifySettings::SHOW_PREVIEWS_MASK;
|
|
||||||
}
|
|
||||||
if (new_settings.silent_send_message) {
|
|
||||||
flags |= telegram_api::inputPeerNotifySettings::SILENT_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),
|
std::move(input_notify_peer), new_settings.get_input_peer_notify_settings())));
|
||||||
make_tl_object<telegram_api::inputPeerNotifySettings>(
|
|
||||||
flags, new_settings.show_preview, new_settings.silent_send_message, new_settings.mute_until,
|
|
||||||
get_input_notification_sound(new_settings.sound), false, false, nullptr))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_result(BufferSlice packet) final {
|
void on_result(BufferSlice packet) final {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user