Move NotificationSettings to separate header.
GitOrigin-RevId: cb0c2e33a0a075dfea2b70ff671de8db0db36ca0
This commit is contained in:
parent
b6a8624c60
commit
79a613cf45
@ -399,6 +399,7 @@ set(TDLIB_SOURCE
|
|||||||
td/telegram/net/Session.cpp
|
td/telegram/net/Session.cpp
|
||||||
td/telegram/net/SessionProxy.cpp
|
td/telegram/net/SessionProxy.cpp
|
||||||
td/telegram/net/SessionMultiProxy.cpp
|
td/telegram/net/SessionMultiProxy.cpp
|
||||||
|
td/telegram/NotificationSettings.cpp
|
||||||
td/telegram/Payments.cpp
|
td/telegram/Payments.cpp
|
||||||
td/telegram/PasswordManager.cpp
|
td/telegram/PasswordManager.cpp
|
||||||
td/telegram/PrivacyManager.cpp
|
td/telegram/PrivacyManager.cpp
|
||||||
@ -525,6 +526,7 @@ set(TDLIB_SOURCE
|
|||||||
td/telegram/net/SessionProxy.h
|
td/telegram/net/SessionProxy.h
|
||||||
td/telegram/net/SessionMultiProxy.h
|
td/telegram/net/SessionMultiProxy.h
|
||||||
td/telegram/net/TempAuthKeyWatchdog.h
|
td/telegram/net/TempAuthKeyWatchdog.h
|
||||||
|
td/telegram/NotificationSettings.h
|
||||||
td/telegram/PasswordManager.h
|
td/telegram/PasswordManager.h
|
||||||
td/telegram/Payments.h
|
td/telegram/Payments.h
|
||||||
td/telegram/Photo.h
|
td/telegram/Photo.h
|
||||||
@ -569,6 +571,7 @@ set(TDLIB_SOURCE
|
|||||||
td/telegram/Game.hpp
|
td/telegram/Game.hpp
|
||||||
td/telegram/InputMessageText.hpp
|
td/telegram/InputMessageText.hpp
|
||||||
td/telegram/MessageEntity.hpp
|
td/telegram/MessageEntity.hpp
|
||||||
|
td/telegram/NotificationSettings.hpp
|
||||||
td/telegram/Payments.hpp
|
td/telegram/Payments.hpp
|
||||||
td/telegram/Photo.hpp
|
td/telegram/Photo.hpp
|
||||||
td/telegram/ReplyMarkup.hpp
|
td/telegram/ReplyMarkup.hpp
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "td/telegram/InputMessageText.h"
|
#include "td/telegram/InputMessageText.h"
|
||||||
#include "td/telegram/MessageId.h"
|
#include "td/telegram/MessageId.h"
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
|
#include "td/telegram/telegram_api.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "td/telegram/net/DcId.h"
|
#include "td/telegram/net/DcId.h"
|
||||||
#include "td/telegram/net/NetActor.h"
|
#include "td/telegram/net/NetActor.h"
|
||||||
#include "td/telegram/net/NetQuery.h"
|
#include "td/telegram/net/NetQuery.h"
|
||||||
|
#include "td/telegram/NotificationSettings.hpp"
|
||||||
#include "td/telegram/Payments.h"
|
#include "td/telegram/Payments.h"
|
||||||
#include "td/telegram/ReplyMarkup.h"
|
#include "td/telegram/ReplyMarkup.h"
|
||||||
#include "td/telegram/ReplyMarkup.hpp"
|
#include "td/telegram/ReplyMarkup.hpp"
|
||||||
@ -3068,7 +3069,7 @@ class GetScopeNotifySettingsQuery : public Td::ResultHandler {
|
|||||||
|
|
||||||
void send(NotificationSettingsScope scope) {
|
void send(NotificationSettingsScope scope) {
|
||||||
scope_ = scope;
|
scope_ = scope;
|
||||||
auto input_notify_peer = td->messages_manager_->get_input_notify_peer(scope);
|
auto input_notify_peer = get_input_notify_peer(scope);
|
||||||
CHECK(input_notify_peer != nullptr);
|
CHECK(input_notify_peer != nullptr);
|
||||||
send_query(G()->net_query_creator().create(
|
send_query(G()->net_query_creator().create(
|
||||||
create_storer(telegram_api::account_getNotifySettings(std::move(input_notify_peer)))));
|
create_storer(telegram_api::account_getNotifySettings(std::move(input_notify_peer)))));
|
||||||
@ -3161,7 +3162,7 @@ class UpdateScopeNotifySettingsQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void send(NotificationSettingsScope scope, const ScopeNotificationSettings &new_settings) {
|
void send(NotificationSettingsScope scope, const ScopeNotificationSettings &new_settings) {
|
||||||
auto input_notify_peer = td->messages_manager_->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 |
|
int32 flags = telegram_api::inputPeerNotifySettings::MUTE_UNTIL_MASK |
|
||||||
telegram_api::inputPeerNotifySettings::SOUND_MASK |
|
telegram_api::inputPeerNotifySettings::SOUND_MASK |
|
||||||
@ -3815,93 +3816,6 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
is_secret_message_content(ttl, content->get_type()); // repair is_content_secret for old messages
|
is_secret_message_content(ttl, content->get_type()); // repair is_content_secret for old messages
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class StorerT>
|
|
||||||
static void store(const DialogNotificationSettings ¬ification_settings, StorerT &storer) {
|
|
||||||
bool is_muted = !notification_settings.use_default_mute_until && notification_settings.mute_until != 0 &&
|
|
||||||
notification_settings.mute_until > G()->unix_time();
|
|
||||||
bool has_sound = !notification_settings.use_default_sound && notification_settings.sound != "default";
|
|
||||||
BEGIN_STORE_FLAGS();
|
|
||||||
STORE_FLAG(is_muted);
|
|
||||||
STORE_FLAG(has_sound);
|
|
||||||
STORE_FLAG(notification_settings.show_preview);
|
|
||||||
STORE_FLAG(notification_settings.silent_send_message);
|
|
||||||
STORE_FLAG(notification_settings.is_synchronized);
|
|
||||||
STORE_FLAG(notification_settings.use_default_mute_until);
|
|
||||||
STORE_FLAG(notification_settings.use_default_sound);
|
|
||||||
STORE_FLAG(notification_settings.use_default_show_preview);
|
|
||||||
STORE_FLAG(notification_settings.is_use_default_fixed);
|
|
||||||
END_STORE_FLAGS();
|
|
||||||
if (is_muted) {
|
|
||||||
store(notification_settings.mute_until, storer);
|
|
||||||
}
|
|
||||||
if (has_sound) {
|
|
||||||
store(notification_settings.sound, storer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class ParserT>
|
|
||||||
static void parse(DialogNotificationSettings ¬ification_settings, ParserT &parser) {
|
|
||||||
bool is_muted;
|
|
||||||
bool has_sound;
|
|
||||||
BEGIN_PARSE_FLAGS();
|
|
||||||
PARSE_FLAG(is_muted);
|
|
||||||
PARSE_FLAG(has_sound);
|
|
||||||
PARSE_FLAG(notification_settings.show_preview);
|
|
||||||
PARSE_FLAG(notification_settings.silent_send_message);
|
|
||||||
PARSE_FLAG(notification_settings.is_synchronized);
|
|
||||||
PARSE_FLAG(notification_settings.use_default_mute_until);
|
|
||||||
PARSE_FLAG(notification_settings.use_default_sound);
|
|
||||||
PARSE_FLAG(notification_settings.use_default_show_preview);
|
|
||||||
PARSE_FLAG(notification_settings.is_use_default_fixed);
|
|
||||||
END_PARSE_FLAGS();
|
|
||||||
if (is_muted) {
|
|
||||||
parse(notification_settings.mute_until, parser);
|
|
||||||
}
|
|
||||||
if (has_sound) {
|
|
||||||
parse(notification_settings.sound, parser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class StorerT>
|
|
||||||
static void store(const ScopeNotificationSettings ¬ification_settings, StorerT &storer) {
|
|
||||||
bool is_muted = notification_settings.mute_until != 0 && notification_settings.mute_until > G()->unix_time();
|
|
||||||
bool has_sound = notification_settings.sound != "default";
|
|
||||||
BEGIN_STORE_FLAGS();
|
|
||||||
STORE_FLAG(is_muted);
|
|
||||||
STORE_FLAG(has_sound);
|
|
||||||
STORE_FLAG(notification_settings.show_preview);
|
|
||||||
STORE_FLAG(false);
|
|
||||||
STORE_FLAG(notification_settings.is_synchronized);
|
|
||||||
END_STORE_FLAGS();
|
|
||||||
if (is_muted) {
|
|
||||||
store(notification_settings.mute_until, storer);
|
|
||||||
}
|
|
||||||
if (has_sound) {
|
|
||||||
store(notification_settings.sound, storer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class ParserT>
|
|
||||||
static void parse(ScopeNotificationSettings ¬ification_settings, ParserT &parser) {
|
|
||||||
bool is_muted;
|
|
||||||
bool has_sound;
|
|
||||||
bool silent_send_message_ignored;
|
|
||||||
BEGIN_PARSE_FLAGS();
|
|
||||||
PARSE_FLAG(is_muted);
|
|
||||||
PARSE_FLAG(has_sound);
|
|
||||||
PARSE_FLAG(notification_settings.show_preview);
|
|
||||||
PARSE_FLAG(silent_send_message_ignored);
|
|
||||||
PARSE_FLAG(notification_settings.is_synchronized);
|
|
||||||
END_PARSE_FLAGS();
|
|
||||||
(void)silent_send_message_ignored;
|
|
||||||
if (is_muted) {
|
|
||||||
parse(notification_settings.mute_until, parser);
|
|
||||||
}
|
|
||||||
if (has_sound) {
|
|
||||||
parse(notification_settings.sound, parser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void MessagesManager::Dialog::store(StorerT &storer) const {
|
void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||||
using td::store;
|
using td::store;
|
||||||
@ -5673,20 +5587,6 @@ void MessagesManager::drop_pending_updates() {
|
|||||||
pending_updates_.clear();
|
pending_updates_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationSettingsScope MessagesManager::get_notification_settings_scope(
|
|
||||||
const tl_object_ptr<td_api::NotificationSettingsScope> &scope) {
|
|
||||||
CHECK(scope != nullptr);
|
|
||||||
switch (scope->get_id()) {
|
|
||||||
case td_api::notificationSettingsScopePrivateChats::ID:
|
|
||||||
return NotificationSettingsScope::Private;
|
|
||||||
case td_api::notificationSettingsScopeGroupChats::ID:
|
|
||||||
return NotificationSettingsScope::Group;
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return NotificationSettingsScope::Private;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string MessagesManager::get_notification_settings_scope_database_key(NotificationSettingsScope scope) {
|
string MessagesManager::get_notification_settings_scope_database_key(NotificationSettingsScope scope) {
|
||||||
switch (scope) {
|
switch (scope) {
|
||||||
case NotificationSettingsScope::Private:
|
case NotificationSettingsScope::Private:
|
||||||
@ -5926,7 +5826,7 @@ void MessagesManager::on_update_dialog_notify_settings(
|
|||||||
LOG(INFO) << "Receive notification settings for " << dialog_id << ": " << to_string(peer_notify_settings);
|
LOG(INFO) << "Receive notification settings for " << dialog_id << ": " << to_string(peer_notify_settings);
|
||||||
|
|
||||||
const DialogNotificationSettings notification_settings =
|
const DialogNotificationSettings notification_settings =
|
||||||
get_dialog_notification_settings(std::move(peer_notify_settings));
|
td::get_dialog_notification_settings(std::move(peer_notify_settings));
|
||||||
if (!notification_settings.is_synchronized) {
|
if (!notification_settings.is_synchronized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5945,7 +5845,7 @@ void MessagesManager::on_update_scope_notify_settings(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ScopeNotificationSettings notification_settings =
|
const ScopeNotificationSettings notification_settings =
|
||||||
get_scope_notification_settings(std::move(peer_notify_settings));
|
td::get_scope_notification_settings(std::move(peer_notify_settings));
|
||||||
if (!notification_settings.is_synchronized) {
|
if (!notification_settings.is_synchronized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -12395,34 +12295,6 @@ tl_object_ptr<td_api::chats> MessagesManager::get_chats_object(const vector<Dial
|
|||||||
return td_api::make_object<td_api::chats>(transform(dialogs, [](DialogId dialog_id) { return dialog_id.get(); }));
|
return td_api::make_object<td_api::chats>(transform(dialogs, [](DialogId dialog_id) { return dialog_id.get(); }));
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<td_api::NotificationSettingsScope> MessagesManager::get_notification_settings_scope_object(
|
|
||||||
NotificationSettingsScope scope) {
|
|
||||||
switch (scope) {
|
|
||||||
case NotificationSettingsScope::Private:
|
|
||||||
return make_tl_object<td_api::notificationSettingsScopePrivateChats>();
|
|
||||||
case NotificationSettingsScope::Group:
|
|
||||||
return make_tl_object<td_api::notificationSettingsScopeGroupChats>();
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tl_object_ptr<td_api::chatNotificationSettings> MessagesManager::get_chat_notification_settings_object(
|
|
||||||
const DialogNotificationSettings *notification_settings) {
|
|
||||||
return make_tl_object<td_api::chatNotificationSettings>(
|
|
||||||
notification_settings->use_default_mute_until, max(0, notification_settings->mute_until - G()->unix_time()),
|
|
||||||
notification_settings->use_default_sound, notification_settings->sound,
|
|
||||||
notification_settings->use_default_show_preview, notification_settings->show_preview);
|
|
||||||
}
|
|
||||||
|
|
||||||
tl_object_ptr<td_api::scopeNotificationSettings> MessagesManager::get_scope_notification_settings_object(
|
|
||||||
const ScopeNotificationSettings *notification_settings) {
|
|
||||||
return make_tl_object<td_api::scopeNotificationSettings>(max(0, notification_settings->mute_until - G()->unix_time()),
|
|
||||||
notification_settings->sound,
|
|
||||||
notification_settings->show_preview);
|
|
||||||
}
|
|
||||||
|
|
||||||
td_api::object_ptr<td_api::updateScopeNotificationSettings>
|
td_api::object_ptr<td_api::updateScopeNotificationSettings>
|
||||||
MessagesManager::get_update_scope_notification_settings_object(NotificationSettingsScope scope) const {
|
MessagesManager::get_update_scope_notification_settings_object(NotificationSettingsScope scope) const {
|
||||||
auto notification_settings = get_scope_notification_settings(scope);
|
auto notification_settings = get_scope_notification_settings(scope);
|
||||||
@ -12529,17 +12401,6 @@ tl_object_ptr<telegram_api::InputNotifyPeer> MessagesManager::get_input_notify_p
|
|||||||
return make_tl_object<telegram_api::inputNotifyPeer>(std::move(input_peer));
|
return make_tl_object<telegram_api::inputNotifyPeer>(std::move(input_peer));
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<telegram_api::InputNotifyPeer> MessagesManager::get_input_notify_peer(NotificationSettingsScope scope) {
|
|
||||||
switch (scope) {
|
|
||||||
case NotificationSettingsScope::Private:
|
|
||||||
return make_tl_object<telegram_api::inputNotifyUsers>();
|
|
||||||
case NotificationSettingsScope::Group:
|
|
||||||
return make_tl_object<telegram_api::inputNotifyChats>();
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Status MessagesManager::set_dialog_notification_settings(
|
Status MessagesManager::set_dialog_notification_settings(
|
||||||
DialogId dialog_id, tl_object_ptr<td_api::chatNotificationSettings> &¬ification_settings) {
|
DialogId dialog_id, tl_object_ptr<td_api::chatNotificationSettings> &¬ification_settings) {
|
||||||
if (notification_settings == nullptr) {
|
if (notification_settings == nullptr) {
|
||||||
@ -19739,33 +19600,6 @@ MessagesManager::Message *MessagesManager::on_get_message_from_database(DialogId
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogNotificationSettings MessagesManager::get_dialog_notification_settings(
|
|
||||||
tl_object_ptr<telegram_api::peerNotifySettings> &&settings) {
|
|
||||||
bool use_default_mute_until = (settings->flags_ & telegram_api::peerNotifySettings::MUTE_UNTIL_MASK) == 0;
|
|
||||||
bool use_default_sound = (settings->flags_ & telegram_api::peerNotifySettings::SOUND_MASK) == 0;
|
|
||||||
bool use_default_show_preview = (settings->flags_ & telegram_api::peerNotifySettings::SHOW_PREVIEWS_MASK) == 0;
|
|
||||||
auto mute_until = use_default_mute_until || settings->mute_until_ <= G()->unix_time() ? 0 : settings->mute_until_;
|
|
||||||
bool silent_send_message =
|
|
||||||
(settings->flags_ & telegram_api::peerNotifySettings::SILENT_MASK) == 0 ? false : settings->silent_;
|
|
||||||
return {use_default_mute_until, mute_until,
|
|
||||||
use_default_sound, std::move(settings->sound_),
|
|
||||||
use_default_show_preview, settings->show_previews_,
|
|
||||||
silent_send_message};
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopeNotificationSettings MessagesManager::get_scope_notification_settings(
|
|
||||||
tl_object_ptr<telegram_api::peerNotifySettings> &&settings) {
|
|
||||||
auto mute_until = (settings->flags_ & telegram_api::peerNotifySettings::MUTE_UNTIL_MASK) == 0 ||
|
|
||||||
settings->mute_until_ <= G()->unix_time()
|
|
||||||
? 0
|
|
||||||
: settings->mute_until_;
|
|
||||||
auto sound =
|
|
||||||
(settings->flags_ & telegram_api::peerNotifySettings::SOUND_MASK) == 0 ? "default" : std::move(settings->sound_);
|
|
||||||
auto show_preview =
|
|
||||||
(settings->flags_ & telegram_api::peerNotifySettings::SHOW_PREVIEWS_MASK) == 0 ? false : settings->show_previews_;
|
|
||||||
return {mute_until, std::move(sound), show_preview};
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 MessagesManager::get_random_y(MessageId message_id) {
|
int32 MessagesManager::get_random_y(MessageId message_id) {
|
||||||
return static_cast<int32>(static_cast<uint32>(message_id.get() * 2101234567u));
|
return static_cast<int32>(static_cast<uint32>(message_id.get() * 2101234567u));
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "td/telegram/MessageId.h"
|
#include "td/telegram/MessageId.h"
|
||||||
#include "td/telegram/MessagesDb.h"
|
#include "td/telegram/MessagesDb.h"
|
||||||
#include "td/telegram/net/NetQuery.h"
|
#include "td/telegram/net/NetQuery.h"
|
||||||
|
#include "td/telegram/NotificationSettings.h"
|
||||||
#include "td/telegram/ReplyMarkup.h"
|
#include "td/telegram/ReplyMarkup.h"
|
||||||
#include "td/telegram/SecretChatId.h"
|
#include "td/telegram/SecretChatId.h"
|
||||||
#include "td/telegram/SecretInputMedia.h"
|
#include "td/telegram/SecretInputMedia.h"
|
||||||
@ -64,75 +65,6 @@ class MultiSequenceDispatcher;
|
|||||||
|
|
||||||
class DraftMessage;
|
class DraftMessage;
|
||||||
|
|
||||||
class DialogNotificationSettings {
|
|
||||||
public:
|
|
||||||
int32 mute_until = 0;
|
|
||||||
string sound = "default";
|
|
||||||
bool show_preview = true;
|
|
||||||
bool silent_send_message = false;
|
|
||||||
bool use_default_mute_until = true;
|
|
||||||
bool use_default_sound = true;
|
|
||||||
bool use_default_show_preview = true;
|
|
||||||
bool is_use_default_fixed = true;
|
|
||||||
bool is_synchronized = false;
|
|
||||||
|
|
||||||
DialogNotificationSettings() = default;
|
|
||||||
|
|
||||||
DialogNotificationSettings(bool use_default_mute_until, int32 mute_until, bool use_default_sound, string sound,
|
|
||||||
bool use_default_show_preview, bool show_preview, bool silent_send_message)
|
|
||||||
: mute_until(mute_until)
|
|
||||||
, sound(std::move(sound))
|
|
||||||
, show_preview(show_preview)
|
|
||||||
, silent_send_message(silent_send_message)
|
|
||||||
, use_default_mute_until(use_default_mute_until)
|
|
||||||
, use_default_sound(use_default_sound)
|
|
||||||
, use_default_show_preview(use_default_show_preview)
|
|
||||||
, is_synchronized(true) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class NotificationSettingsScope : int32 { Private, Group };
|
|
||||||
|
|
||||||
class ScopeNotificationSettings {
|
|
||||||
public:
|
|
||||||
int32 mute_until = 0;
|
|
||||||
string sound = "default";
|
|
||||||
bool show_preview = true;
|
|
||||||
bool is_synchronized = false;
|
|
||||||
|
|
||||||
ScopeNotificationSettings() = default;
|
|
||||||
|
|
||||||
ScopeNotificationSettings(int32 mute_until, string sound, bool show_preview)
|
|
||||||
: mute_until(mute_until), sound(std::move(sound)), show_preview(show_preview), is_synchronized(true) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline StringBuilder &operator<<(StringBuilder &string_builder, DialogNotificationSettings notification_settings) {
|
|
||||||
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
|
||||||
<< notification_settings.show_preview << ", " << notification_settings.silent_send_message
|
|
||||||
<< ", " << notification_settings.use_default_mute_until << ", "
|
|
||||||
<< notification_settings.use_default_sound << ", "
|
|
||||||
<< notification_settings.use_default_show_preview << ", "
|
|
||||||
<< notification_settings.is_synchronized << "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
inline StringBuilder &operator<<(StringBuilder &string_builder, NotificationSettingsScope scope) {
|
|
||||||
switch (scope) {
|
|
||||||
case NotificationSettingsScope::Private:
|
|
||||||
return string_builder << "notification settings for private chats";
|
|
||||||
case NotificationSettingsScope::Group:
|
|
||||||
return string_builder << "notification settings for group chats";
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return string_builder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline StringBuilder &operator<<(StringBuilder &string_builder, ScopeNotificationSettings notification_settings) {
|
|
||||||
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
|
||||||
<< notification_settings.show_preview << ", " << notification_settings.is_synchronized << "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
class DialogDate {
|
class DialogDate {
|
||||||
int64 order;
|
int64 order;
|
||||||
DialogId dialog_id;
|
DialogId dialog_id;
|
||||||
@ -600,15 +532,6 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
Status open_message_content(FullMessageId full_message_id) TD_WARN_UNUSED_RESULT;
|
Status open_message_content(FullMessageId full_message_id) TD_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
static tl_object_ptr<td_api::NotificationSettingsScope> get_notification_settings_scope_object(
|
|
||||||
NotificationSettingsScope scope);
|
|
||||||
|
|
||||||
static tl_object_ptr<td_api::chatNotificationSettings> get_chat_notification_settings_object(
|
|
||||||
const DialogNotificationSettings *notification_settings);
|
|
||||||
|
|
||||||
static tl_object_ptr<td_api::scopeNotificationSettings> get_scope_notification_settings_object(
|
|
||||||
const ScopeNotificationSettings *notification_settings);
|
|
||||||
|
|
||||||
td_api::object_ptr<td_api::updateScopeNotificationSettings> get_update_scope_notification_settings_object(
|
td_api::object_ptr<td_api::updateScopeNotificationSettings> get_update_scope_notification_settings_object(
|
||||||
NotificationSettingsScope scope) const;
|
NotificationSettingsScope scope) const;
|
||||||
|
|
||||||
@ -697,11 +620,6 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
tl_object_ptr<telegram_api::InputNotifyPeer> get_input_notify_peer(DialogId dialogId) const;
|
tl_object_ptr<telegram_api::InputNotifyPeer> get_input_notify_peer(DialogId dialogId) const;
|
||||||
|
|
||||||
static tl_object_ptr<telegram_api::InputNotifyPeer> get_input_notify_peer(NotificationSettingsScope scope);
|
|
||||||
|
|
||||||
static NotificationSettingsScope get_notification_settings_scope(
|
|
||||||
const tl_object_ptr<td_api::NotificationSettingsScope> &scope);
|
|
||||||
|
|
||||||
void on_update_dialog_notify_settings(DialogId dialog_id,
|
void on_update_dialog_notify_settings(DialogId dialog_id,
|
||||||
tl_object_ptr<telegram_api::peerNotifySettings> &&peer_notify_settings);
|
tl_object_ptr<telegram_api::peerNotifySettings> &&peer_notify_settings);
|
||||||
|
|
||||||
@ -1722,12 +1640,6 @@ class MessagesManager : public Actor {
|
|||||||
void on_get_dialog_message_by_date_from_database(DialogId dialog_id, int32 date, int64 random_id,
|
void on_get_dialog_message_by_date_from_database(DialogId dialog_id, int32 date, int64 random_id,
|
||||||
Result<BufferSlice> result, Promise<Unit> promise);
|
Result<BufferSlice> result, Promise<Unit> promise);
|
||||||
|
|
||||||
static DialogNotificationSettings get_dialog_notification_settings(
|
|
||||||
tl_object_ptr<telegram_api::peerNotifySettings> &&settings);
|
|
||||||
|
|
||||||
static ScopeNotificationSettings get_scope_notification_settings(
|
|
||||||
tl_object_ptr<telegram_api::peerNotifySettings> &&settings);
|
|
||||||
|
|
||||||
std::pair<bool, int32> get_dialog_mute_until(DialogId dialog_id, const Dialog *d) const;
|
std::pair<bool, int32> get_dialog_mute_until(DialogId dialog_id, const Dialog *d) const;
|
||||||
|
|
||||||
static NotificationSettingsScope get_dialog_notification_setting_scope(DialogId dialog_id);
|
static NotificationSettingsScope get_dialog_notification_setting_scope(DialogId dialog_id);
|
||||||
|
120
td/telegram/NotificationSettings.cpp
Normal file
120
td/telegram/NotificationSettings.cpp
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
//
|
||||||
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
#include "td/telegram/NotificationSettings.h"
|
||||||
|
|
||||||
|
#include "td/telegram/Global.h"
|
||||||
|
|
||||||
|
#include "td/utils/logging.h"
|
||||||
|
|
||||||
|
namespace td {
|
||||||
|
|
||||||
|
StringBuilder &operator<<(StringBuilder &string_builder, const DialogNotificationSettings ¬ification_settings) {
|
||||||
|
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
||||||
|
<< notification_settings.show_preview << ", " << notification_settings.silent_send_message
|
||||||
|
<< ", " << notification_settings.use_default_mute_until << ", "
|
||||||
|
<< notification_settings.use_default_sound << ", "
|
||||||
|
<< notification_settings.use_default_show_preview << ", "
|
||||||
|
<< notification_settings.is_synchronized << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder &operator<<(StringBuilder &string_builder, NotificationSettingsScope scope) {
|
||||||
|
switch (scope) {
|
||||||
|
case NotificationSettingsScope::Private:
|
||||||
|
return string_builder << "notification settings for private chats";
|
||||||
|
case NotificationSettingsScope::Group:
|
||||||
|
return string_builder << "notification settings for group chats";
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
return string_builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings) {
|
||||||
|
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
||||||
|
<< notification_settings.show_preview << ", " << notification_settings.is_synchronized << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::NotificationSettingsScope> get_notification_settings_scope_object(
|
||||||
|
NotificationSettingsScope scope) {
|
||||||
|
switch (scope) {
|
||||||
|
case NotificationSettingsScope::Private:
|
||||||
|
return td_api::make_object<td_api::notificationSettingsScopePrivateChats>();
|
||||||
|
case NotificationSettingsScope::Group:
|
||||||
|
return td_api::make_object<td_api::notificationSettingsScopeGroupChats>();
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::chatNotificationSettings> get_chat_notification_settings_object(
|
||||||
|
const DialogNotificationSettings *notification_settings) {
|
||||||
|
return td_api::make_object<td_api::chatNotificationSettings>(
|
||||||
|
notification_settings->use_default_mute_until, max(0, notification_settings->mute_until - G()->unix_time()),
|
||||||
|
notification_settings->use_default_sound, notification_settings->sound,
|
||||||
|
notification_settings->use_default_show_preview, notification_settings->show_preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::scopeNotificationSettings> get_scope_notification_settings_object(
|
||||||
|
const ScopeNotificationSettings *notification_settings) {
|
||||||
|
return td_api::make_object<td_api::scopeNotificationSettings>(
|
||||||
|
max(0, notification_settings->mute_until - G()->unix_time()), notification_settings->sound,
|
||||||
|
notification_settings->show_preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
telegram_api::object_ptr<telegram_api::InputNotifyPeer> get_input_notify_peer(NotificationSettingsScope scope) {
|
||||||
|
switch (scope) {
|
||||||
|
case NotificationSettingsScope::Private:
|
||||||
|
return telegram_api::make_object<telegram_api::inputNotifyUsers>();
|
||||||
|
case NotificationSettingsScope::Group:
|
||||||
|
return telegram_api::make_object<telegram_api::inputNotifyChats>();
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NotificationSettingsScope get_notification_settings_scope(
|
||||||
|
const td_api::object_ptr<td_api::NotificationSettingsScope> &scope) {
|
||||||
|
CHECK(scope != nullptr);
|
||||||
|
switch (scope->get_id()) {
|
||||||
|
case td_api::notificationSettingsScopePrivateChats::ID:
|
||||||
|
return NotificationSettingsScope::Private;
|
||||||
|
case td_api::notificationSettingsScopeGroupChats::ID:
|
||||||
|
return NotificationSettingsScope::Group;
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
return NotificationSettingsScope::Private;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogNotificationSettings get_dialog_notification_settings(
|
||||||
|
tl_object_ptr<telegram_api::peerNotifySettings> &&settings) {
|
||||||
|
bool use_default_mute_until = (settings->flags_ & telegram_api::peerNotifySettings::MUTE_UNTIL_MASK) == 0;
|
||||||
|
bool use_default_sound = (settings->flags_ & telegram_api::peerNotifySettings::SOUND_MASK) == 0;
|
||||||
|
bool use_default_show_preview = (settings->flags_ & telegram_api::peerNotifySettings::SHOW_PREVIEWS_MASK) == 0;
|
||||||
|
auto mute_until = use_default_mute_until || settings->mute_until_ <= G()->unix_time() ? 0 : settings->mute_until_;
|
||||||
|
bool silent_send_message =
|
||||||
|
(settings->flags_ & telegram_api::peerNotifySettings::SILENT_MASK) == 0 ? false : settings->silent_;
|
||||||
|
return {use_default_mute_until, mute_until,
|
||||||
|
use_default_sound, std::move(settings->sound_),
|
||||||
|
use_default_show_preview, settings->show_previews_,
|
||||||
|
silent_send_message};
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopeNotificationSettings get_scope_notification_settings(tl_object_ptr<telegram_api::peerNotifySettings> &&settings) {
|
||||||
|
auto mute_until = (settings->flags_ & telegram_api::peerNotifySettings::MUTE_UNTIL_MASK) == 0 ||
|
||||||
|
settings->mute_until_ <= G()->unix_time()
|
||||||
|
? 0
|
||||||
|
: settings->mute_until_;
|
||||||
|
auto sound =
|
||||||
|
(settings->flags_ & telegram_api::peerNotifySettings::SOUND_MASK) == 0 ? "default" : std::move(settings->sound_);
|
||||||
|
auto show_preview =
|
||||||
|
(settings->flags_ & telegram_api::peerNotifySettings::SHOW_PREVIEWS_MASK) == 0 ? false : settings->show_previews_;
|
||||||
|
return {mute_until, std::move(sound), show_preview};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace td
|
84
td/telegram/NotificationSettings.h
Normal file
84
td/telegram/NotificationSettings.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
//
|
||||||
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "td/telegram/td_api.h"
|
||||||
|
#include "td/telegram/telegram_api.h"
|
||||||
|
|
||||||
|
#include "td/utils/common.h"
|
||||||
|
#include "td/utils/StringBuilder.h"
|
||||||
|
|
||||||
|
namespace td {
|
||||||
|
|
||||||
|
class DialogNotificationSettings {
|
||||||
|
public:
|
||||||
|
int32 mute_until = 0;
|
||||||
|
string sound = "default";
|
||||||
|
bool show_preview = true;
|
||||||
|
bool silent_send_message = false;
|
||||||
|
bool use_default_mute_until = true;
|
||||||
|
bool use_default_sound = true;
|
||||||
|
bool use_default_show_preview = true;
|
||||||
|
bool is_use_default_fixed = true;
|
||||||
|
bool is_synchronized = false;
|
||||||
|
|
||||||
|
DialogNotificationSettings() = default;
|
||||||
|
|
||||||
|
DialogNotificationSettings(bool use_default_mute_until, int32 mute_until, bool use_default_sound, string sound,
|
||||||
|
bool use_default_show_preview, bool show_preview, bool silent_send_message)
|
||||||
|
: mute_until(mute_until)
|
||||||
|
, sound(std::move(sound))
|
||||||
|
, show_preview(show_preview)
|
||||||
|
, silent_send_message(silent_send_message)
|
||||||
|
, use_default_mute_until(use_default_mute_until)
|
||||||
|
, use_default_sound(use_default_sound)
|
||||||
|
, use_default_show_preview(use_default_show_preview)
|
||||||
|
, is_synchronized(true) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class NotificationSettingsScope : int32 { Private, Group };
|
||||||
|
|
||||||
|
class ScopeNotificationSettings {
|
||||||
|
public:
|
||||||
|
int32 mute_until = 0;
|
||||||
|
string sound = "default";
|
||||||
|
bool show_preview = true;
|
||||||
|
bool is_synchronized = false;
|
||||||
|
|
||||||
|
ScopeNotificationSettings() = default;
|
||||||
|
|
||||||
|
ScopeNotificationSettings(int32 mute_until, string sound, bool show_preview)
|
||||||
|
: mute_until(mute_until), sound(std::move(sound)), show_preview(show_preview), is_synchronized(true) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
StringBuilder &operator<<(StringBuilder &string_builder, const DialogNotificationSettings ¬ification_settings);
|
||||||
|
|
||||||
|
StringBuilder &operator<<(StringBuilder &string_builder, NotificationSettingsScope scope);
|
||||||
|
|
||||||
|
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings);
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::NotificationSettingsScope> get_notification_settings_scope_object(
|
||||||
|
NotificationSettingsScope scope);
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::chatNotificationSettings> get_chat_notification_settings_object(
|
||||||
|
const DialogNotificationSettings *notification_settings);
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::scopeNotificationSettings> get_scope_notification_settings_object(
|
||||||
|
const ScopeNotificationSettings *notification_settings);
|
||||||
|
|
||||||
|
telegram_api::object_ptr<telegram_api::InputNotifyPeer> get_input_notify_peer(NotificationSettingsScope scope);
|
||||||
|
|
||||||
|
NotificationSettingsScope get_notification_settings_scope(
|
||||||
|
const td_api::object_ptr<td_api::NotificationSettingsScope> &scope);
|
||||||
|
|
||||||
|
DialogNotificationSettings get_dialog_notification_settings(tl_object_ptr<telegram_api::peerNotifySettings> &&settings);
|
||||||
|
|
||||||
|
ScopeNotificationSettings get_scope_notification_settings(tl_object_ptr<telegram_api::peerNotifySettings> &&settings);
|
||||||
|
|
||||||
|
} // namespace td
|
102
td/telegram/NotificationSettings.hpp
Normal file
102
td/telegram/NotificationSettings.hpp
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
//
|
||||||
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "td/telegram/NotificationSettings.h"
|
||||||
|
|
||||||
|
#include "td/utils/tl_helpers.h"
|
||||||
|
|
||||||
|
namespace td {
|
||||||
|
|
||||||
|
template <class StorerT>
|
||||||
|
void store(const DialogNotificationSettings ¬ification_settings, StorerT &storer) {
|
||||||
|
bool is_muted = !notification_settings.use_default_mute_until && notification_settings.mute_until != 0 &&
|
||||||
|
notification_settings.mute_until > G()->unix_time();
|
||||||
|
bool has_sound = !notification_settings.use_default_sound && notification_settings.sound != "default";
|
||||||
|
BEGIN_STORE_FLAGS();
|
||||||
|
STORE_FLAG(is_muted);
|
||||||
|
STORE_FLAG(has_sound);
|
||||||
|
STORE_FLAG(notification_settings.show_preview);
|
||||||
|
STORE_FLAG(notification_settings.silent_send_message);
|
||||||
|
STORE_FLAG(notification_settings.is_synchronized);
|
||||||
|
STORE_FLAG(notification_settings.use_default_mute_until);
|
||||||
|
STORE_FLAG(notification_settings.use_default_sound);
|
||||||
|
STORE_FLAG(notification_settings.use_default_show_preview);
|
||||||
|
STORE_FLAG(notification_settings.is_use_default_fixed);
|
||||||
|
END_STORE_FLAGS();
|
||||||
|
if (is_muted) {
|
||||||
|
store(notification_settings.mute_until, storer);
|
||||||
|
}
|
||||||
|
if (has_sound) {
|
||||||
|
store(notification_settings.sound, storer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ParserT>
|
||||||
|
void parse(DialogNotificationSettings ¬ification_settings, ParserT &parser) {
|
||||||
|
bool is_muted;
|
||||||
|
bool has_sound;
|
||||||
|
BEGIN_PARSE_FLAGS();
|
||||||
|
PARSE_FLAG(is_muted);
|
||||||
|
PARSE_FLAG(has_sound);
|
||||||
|
PARSE_FLAG(notification_settings.show_preview);
|
||||||
|
PARSE_FLAG(notification_settings.silent_send_message);
|
||||||
|
PARSE_FLAG(notification_settings.is_synchronized);
|
||||||
|
PARSE_FLAG(notification_settings.use_default_mute_until);
|
||||||
|
PARSE_FLAG(notification_settings.use_default_sound);
|
||||||
|
PARSE_FLAG(notification_settings.use_default_show_preview);
|
||||||
|
PARSE_FLAG(notification_settings.is_use_default_fixed);
|
||||||
|
END_PARSE_FLAGS();
|
||||||
|
if (is_muted) {
|
||||||
|
parse(notification_settings.mute_until, parser);
|
||||||
|
}
|
||||||
|
if (has_sound) {
|
||||||
|
parse(notification_settings.sound, parser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class StorerT>
|
||||||
|
void store(const ScopeNotificationSettings ¬ification_settings, StorerT &storer) {
|
||||||
|
bool is_muted = notification_settings.mute_until != 0 && notification_settings.mute_until > G()->unix_time();
|
||||||
|
bool has_sound = notification_settings.sound != "default";
|
||||||
|
BEGIN_STORE_FLAGS();
|
||||||
|
STORE_FLAG(is_muted);
|
||||||
|
STORE_FLAG(has_sound);
|
||||||
|
STORE_FLAG(notification_settings.show_preview);
|
||||||
|
STORE_FLAG(false);
|
||||||
|
STORE_FLAG(notification_settings.is_synchronized);
|
||||||
|
END_STORE_FLAGS();
|
||||||
|
if (is_muted) {
|
||||||
|
store(notification_settings.mute_until, storer);
|
||||||
|
}
|
||||||
|
if (has_sound) {
|
||||||
|
store(notification_settings.sound, storer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ParserT>
|
||||||
|
void parse(ScopeNotificationSettings ¬ification_settings, ParserT &parser) {
|
||||||
|
bool is_muted;
|
||||||
|
bool has_sound;
|
||||||
|
bool silent_send_message_ignored;
|
||||||
|
BEGIN_PARSE_FLAGS();
|
||||||
|
PARSE_FLAG(is_muted);
|
||||||
|
PARSE_FLAG(has_sound);
|
||||||
|
PARSE_FLAG(notification_settings.show_preview);
|
||||||
|
PARSE_FLAG(silent_send_message_ignored);
|
||||||
|
PARSE_FLAG(notification_settings.is_synchronized);
|
||||||
|
END_PARSE_FLAGS();
|
||||||
|
(void)silent_send_message_ignored;
|
||||||
|
if (is_muted) {
|
||||||
|
parse(notification_settings.mute_until, parser);
|
||||||
|
}
|
||||||
|
if (has_sound) {
|
||||||
|
parse(notification_settings.sound, parser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace td
|
@ -43,6 +43,7 @@
|
|||||||
#include "td/telegram/MessageId.h"
|
#include "td/telegram/MessageId.h"
|
||||||
#include "td/telegram/MessagesManager.h"
|
#include "td/telegram/MessagesManager.h"
|
||||||
#include "td/telegram/misc.h"
|
#include "td/telegram/misc.h"
|
||||||
|
#include "td/telegram/NotificationSettings.h"
|
||||||
#include "td/telegram/PasswordManager.h"
|
#include "td/telegram/PasswordManager.h"
|
||||||
#include "td/telegram/Payments.h"
|
#include "td/telegram/Payments.h"
|
||||||
#include "td/telegram/Photo.h"
|
#include "td/telegram/Photo.h"
|
||||||
@ -2233,7 +2234,7 @@ class GetScopeNotificationSettingsRequest : public RequestActor<> {
|
|||||||
|
|
||||||
void do_send_result() override {
|
void do_send_result() override {
|
||||||
CHECK(notification_settings_ != nullptr);
|
CHECK(notification_settings_ != nullptr);
|
||||||
send_result(td->messages_manager_->get_scope_notification_settings_object(notification_settings_));
|
send_result(get_scope_notification_settings_object(notification_settings_));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -6074,7 +6075,7 @@ void Td::on_request(uint64 id, const td_api::getScopeNotificationSettings &reque
|
|||||||
if (request.scope_ == nullptr) {
|
if (request.scope_ == nullptr) {
|
||||||
return send_error_raw(id, 400, "Scope must not be empty");
|
return send_error_raw(id, 400, "Scope must not be empty");
|
||||||
}
|
}
|
||||||
CREATE_REQUEST(GetScopeNotificationSettingsRequest, MessagesManager::get_notification_settings_scope(request.scope_));
|
CREATE_REQUEST(GetScopeNotificationSettingsRequest, get_notification_settings_scope(request.scope_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::getChatReportSpamState &request) {
|
void Td::on_request(uint64 id, const td_api::getChatReportSpamState &request) {
|
||||||
@ -6108,8 +6109,7 @@ void Td::on_request(uint64 id, td_api::setScopeNotificationSettings &request) {
|
|||||||
return send_error_raw(id, 400, "Scope must not be empty");
|
return send_error_raw(id, 400, "Scope must not be empty");
|
||||||
}
|
}
|
||||||
answer_ok_query(id, messages_manager_->set_scope_notification_settings(
|
answer_ok_query(id, messages_manager_->set_scope_notification_settings(
|
||||||
MessagesManager::get_notification_settings_scope(request.scope_),
|
get_notification_settings_scope(request.scope_), std::move(request.notification_settings_)));
|
||||||
std::move(request.notification_settings_)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::resetAllNotificationSettings &request) {
|
void Td::on_request(uint64 id, const td_api::resetAllNotificationSettings &request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user