Minor improvements.

This commit is contained in:
levlam 2021-02-25 15:56:26 +03:00
parent 4e8732a197
commit c733f8ed34
8 changed files with 18 additions and 10 deletions

View File

@ -57,6 +57,7 @@
#include "td/utils/tl_parsers.h"
#include "td/utils/UInt.h"
#include <functional>
#include <memory>
#include <unordered_map>
#include <utility>
@ -997,7 +998,8 @@ void ConfigManager::get_external_link(string &&link, Promise<string> &&promise)
auto url = r_url.move_as_ok();
url.protocol_ = HttpUrl::Protocol::Https;
Slice path = Slice(url.query_).truncate(url.query_.find_first_of("?#"));
Slice path = url.query_;
path.truncate(url.query_.find_first_of("?#"));
Slice parameters_hash = Slice(url.query_).substr(path.size());
Slice parameters = parameters_hash;
parameters.truncate(parameters.find('#'));

View File

@ -34,7 +34,6 @@
#include "td/telegram/PasswordManager.h"
#include "td/telegram/Photo.h"
#include "td/telegram/Photo.hpp"
#include "td/telegram/RestrictionReason.h"
#include "td/telegram/SecretChatActor.h"
#include "td/telegram/SecretChatsManager.h"
#include "td/telegram/ServerMessageId.h"
@ -60,6 +59,7 @@
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Random.h"
#include "td/utils/Slice.h"
#include "td/utils/StringBuilder.h"
#include "td/utils/Time.h"
#include "td/utils/tl_helpers.h"
@ -1778,7 +1778,7 @@ class GetExportedChatInviteQuery : public Td::ResultHandler {
}
if (result_ptr.ok()->get_id() != telegram_api::messages_exportedChatInvite::ID) {
LOG(ERROR) << "Receive result for GetExportedChatInviteQuery: " << to_string(result_ptr.ok());
LOG(ERROR) << "Receive wrong result for GetExportedChatInviteQuery: " << to_string(result_ptr.ok());
return on_error(id, Status::Error(500, "Receive unexpected response"));
}
@ -10048,7 +10048,7 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
register_user_photo(u, user_id, user_full->photo);
}
if (user->bot_info_ != nullptr && on_update_bot_info(std::move(user->bot_info_), false)) {
if (on_update_bot_info(std::move(user->bot_info_), false)) {
user_full->need_send_update = true;
}
update_user_full(user_full, user_id);
@ -10143,7 +10143,10 @@ void ContactsManager::on_get_user_photos(UserId user_id, int32 offset, int32 lim
}
bool ContactsManager::on_update_bot_info(tl_object_ptr<telegram_api::botInfo> &&new_bot_info, bool send_update) {
CHECK(new_bot_info != nullptr);
if (new_bot_info == nullptr) {
return false;
}
UserId user_id(new_bot_info->user_id_);
if (!user_id.is_valid()) {
LOG(ERROR) << "Receive invalid " << user_id;

View File

@ -43,6 +43,7 @@
#include "td/utils/Hints.h"
#include "td/utils/Status.h"
#include "td/utils/StringBuilder.h"
#include "td/utils/Time.h"
#include <functional>
#include <memory>

View File

@ -7,7 +7,6 @@
#include "td/telegram/DialogInviteLink.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Global.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"

View File

@ -4629,7 +4629,7 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
case telegram_api::messageActionSetMessagesTTL::ID: {
auto set_messages_ttl = move_tl_object_as<telegram_api::messageActionSetMessagesTTL>(action);
if (set_messages_ttl->period_ < 0) {
LOG(ERROR) << "Receive wrong ttl = " << set_messages_ttl->period_;
LOG(ERROR) << "Receive wrong TTL = " << set_messages_ttl->period_;
break;
}
return td::make_unique<MessageChatSetTtl>(set_messages_ttl->period_);

View File

@ -6,13 +6,12 @@
//
#pragma once
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/common.h"
#include "td/utils/StringBuilder.h"
#include "td/utils/tl_helpers.h"
#include <type_traits>
namespace td {
class MessageTtlSetting {

View File

@ -10,6 +10,8 @@
#include "td/telegram/Global.h"
#include "td/telegram/Td.h"
#include "td/actor/actor.h"
#include "td/utils/algorithm.h"
#include <algorithm>

View File

@ -20,6 +20,7 @@
#include "td/telegram/ContactsManager.h"
#include "td/telegram/DialogAction.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/DialogInviteLink.h"
#include "td/telegram/FolderId.h"
#include "td/telegram/Global.h"
#include "td/telegram/GroupCallManager.h"
@ -57,6 +58,7 @@
#include "td/utils/Slice.h"
#include "td/utils/Status.h"
#include "td/utils/StringBuilder.h"
#include "td/utils/Time.h"
#include <iterator>
#include <limits>