From fb4475e83dedaed2f451864093d256e44a795802 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 8 Apr 2019 19:15:39 +0300 Subject: [PATCH] Move file_reference and notifications logging from WARNING to INFO. GitOrigin-RevId: e03ee30dac7fbec2930a3cd1c625b43136d3739f --- td/generate/scheme/td_api.tl | 2 +- td/telegram/FileReferenceManager.cpp | 2 +- td/telegram/MessagesManager.cpp | 15 ++++++++++++--- td/telegram/NotificationManager.cpp | 2 +- td/telegram/cli.cpp | 3 +++ td/telegram/files/FileManager.cpp | 2 +- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 556860fbb..3b1c832c3 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1415,7 +1415,7 @@ inputMessageGame bot_user_id:int32 game_short_name:string = InputMessageContent; //@payload The invoice payload @provider_token Payment provider token @provider_data JSON-encoded data about the invoice, which will be shared with the payment provider @start_parameter Unique invoice bot start_parameter for the generation of this invoice inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string = InputMessageContent; -//@description A message with a poll @question Poll question, 1-255 characters @options List of poll answer options, 1-10 strings 1-100 characters each +//@description A message with a poll. Polls can't be sent to private or secret chats @question Poll question, 1-255 characters @options List of poll answer options, 1-10 strings 1-100 characters each inputMessagePoll question:string options:vector = InputMessageContent; //@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward @in_game_share True, if a game message should be shared within a launched game; applies only to game messages diff --git a/td/telegram/FileReferenceManager.cpp b/td/telegram/FileReferenceManager.cpp index 0e868e1f9..6f929f07c 100644 --- a/td/telegram/FileReferenceManager.cpp +++ b/td/telegram/FileReferenceManager.cpp @@ -22,7 +22,7 @@ namespace td { -int VERBOSITY_NAME(file_references) = VERBOSITY_NAME(WARNING); +int VERBOSITY_NAME(file_references) = VERBOSITY_NAME(INFO); bool FileReferenceManager::is_file_reference_error(const Status &error) { return error.is_error() && error.code() == 400 && begins_with(error.message(), "FILE_REFERENCE_"); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 33ca3b282..89985371c 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -15315,8 +15315,13 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa bool can_send_games = true; bool can_send_polls = true; + auto content_type = content->get_type(); switch (dialog_type) { case DialogType::User: + if (content_type == MessageContentType::Poll && !is_forward) { + return Status::Error(400, "Polls can't be sent to private chats"); + } + break; case DialogType::Chat: // ok break; @@ -15331,15 +15336,19 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa break; } case DialogType::SecretChat: - can_send_games = false; - can_send_polls = false; + if (content_type == MessageContentType::Game) { + return Status::Error(400, "Games can't be sent to secret chats"); + } + if (content_type == MessageContentType::Poll) { + return Status::Error(400, "Polls can't be sent to secret chats"); + } break; case DialogType::None: default: UNREACHABLE(); } - switch (content->get_type()) { + switch (content_type) { case MessageContentType::Animation: if (!can_send_animations) { return Status::Error(400, "Not enough rights to send animations to the chat"); diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index ea654d9b2..a2914f3e8 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -48,7 +48,7 @@ namespace td { -int VERBOSITY_NAME(notifications) = VERBOSITY_NAME(WARNING); +int VERBOSITY_NAME(notifications) = VERBOSITY_NAME(INFO); class SetContactSignUpNotificationQuery : public Td::ResultHandler { Promise promise_; diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index d46c1abaa..b8e341934 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -3893,6 +3893,9 @@ void main(int argc, char **argv) { } SET_VERBOSITY_LEVEL(new_verbosity_level); + ClientActor::execute(td_api::make_object("update_file", 2)); + ClientActor::execute(td_api::make_object("notifications", 2)); + ClientActor::execute(td_api::make_object("file_reference", 2)); { ConcurrentScheduler scheduler; diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 4784455e7..38ab14c97 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -86,7 +86,7 @@ RemoteFileLocation NewRemoteFileLocation::partial_or_empty() const { return {}; } -int VERBOSITY_NAME(update_file) = VERBOSITY_NAME(WARNING); +int VERBOSITY_NAME(update_file) = VERBOSITY_NAME(INFO); FileNode *FileNodePtr::operator->() const { return get();