From 0cc476783983509991502dbd0cddbfa1aa61a9f2 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 30 Oct 2020 21:27:38 +0300 Subject: [PATCH 01/29] Improve getSuitableDiscussionChats documentation. GitOrigin-RevId: 9d90fc5b5a702e01f6001a3c4ffe489152a274b7 --- td/generate/scheme/td_api.tl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 6ab21e84d..7c6f04dd3 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3664,7 +3664,7 @@ getCreatedPublicChats type:PublicChatType = Chats; //@description Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached @type Type of the public chats, for which to check the limit checkCreatedPublicChatsLimit type:PublicChatType = Ok; -//@description Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Basic group chats need to be first upgraded to supergroups before they can be set as a discussion group +//@description Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group. To set a returned supergroup as a discussion group, access to its old messages must be enabled using toggleSupergroupIsAllHistoryAvailable first getSuitableDiscussionChats = Chats; //@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error @@ -4109,7 +4109,7 @@ setChatClientData chat_id:int53 client_data:string = Ok; setChatDescription chat_id:int53 description:string = Ok; //@description Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified @chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) @discussion_chat_id Identifier of a new channel's discussion group. Use 0 to remove the discussion group. -//-Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats need to be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable needs to be used first to change that +//-Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats need to be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; //@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null From 0efc6ee6176e55a9ccd4c3626da5117010b74321 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 01:32:18 +0300 Subject: [PATCH 02/29] Reload all sticker sets once to drop legacy photo locations. GitOrigin-RevId: 2ab5e1ba035ea3946a733a06e44cc1f7b327cd36 --- td/telegram/StickersManager.cpp | 8 +++++--- td/telegram/StickersManager.h | 1 + td/telegram/StickersManager.hpp | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 09417afea..73ec2dd59 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -2175,6 +2175,7 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptrshort_name = std::move(set->short_name_); s->thumbnail = std::move(thumbnail); s->is_thumbnail_reloaded = true; + s->are_legacy_thumbnails_reloaded = true; s->sticker_count = set->count_; s->hash = set->hash_; s->is_official = is_official; @@ -2213,9 +2214,10 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptrthumbnail = std::move(thumbnail); s->is_changed = true; } - if (!s->is_thumbnail_reloaded) { - LOG(INFO) << "Thumbnail of " << set_id << " was reloaded"; + if (!s->is_thumbnail_reloaded || !s->are_legacy_thumbnails_reloaded) { + LOG(INFO) << "Sticker thumbnails and thumbnail of " << set_id << " was reloaded"; s->is_thumbnail_reloaded = true; + s->are_legacy_thumbnails_reloaded = true; s->need_save_to_database = true; } @@ -3397,7 +3399,7 @@ void StickersManager::on_load_sticker_set_from_database(StickerSetId sticker_set << format::as_hex_dump<4>(Slice(value)); } } - if (!sticker_set->is_thumbnail_reloaded) { + if (!sticker_set->is_thumbnail_reloaded || !sticker_set->are_legacy_thumbnails_reloaded) { do_reload_sticker_set(sticker_set_id, get_input_sticker_set(sticker_set), Auto()); } diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index fc985f6a4..dc018fca7 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -344,6 +344,7 @@ class StickersManager : public Actor { bool is_masks = false; bool is_viewed = true; bool is_thumbnail_reloaded = false; + bool are_legacy_thumbnails_reloaded = false; mutable bool was_update_sent = false; // does the sticker set is known to the client bool is_changed = true; // have new changes that need to be sent to the client and database bool need_save_to_database = true; // have new changes that need only to be saved to the database diff --git a/td/telegram/StickersManager.hpp b/td/telegram/StickersManager.hpp index 2be9801e3..a2bff4cc8 100644 --- a/td/telegram/StickersManager.hpp +++ b/td/telegram/StickersManager.hpp @@ -132,6 +132,7 @@ void StickersManager::store_sticker_set(const StickerSet *sticker_set, bool with STORE_FLAG(has_thumbnail); STORE_FLAG(sticker_set->is_thumbnail_reloaded); STORE_FLAG(sticker_set->is_animated); + STORE_FLAG(sticker_set->are_legacy_thumbnails_reloaded); END_STORE_FLAGS(); store(sticker_set->id.get(), storer); store(sticker_set->access_hash, storer); @@ -190,6 +191,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser PARSE_FLAG(has_thumbnail); PARSE_FLAG(sticker_set->is_thumbnail_reloaded); PARSE_FLAG(is_animated); + PARSE_FLAG(sticker_set->are_legacy_thumbnails_reloaded); END_PARSE_FLAGS(); int64 sticker_set_id; int64 access_hash; From 1fcd6b54ed74fbdccb93fc82e51ab95e591332c0 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 01:38:11 +0300 Subject: [PATCH 03/29] Improve messageProximityAlertTriggered field names. GitOrigin-RevId: b67708794a18ee954455871cce1084ca047f7f35 --- td/generate/scheme/td_api.tl | 4 ++-- td/generate/scheme/td_api.tlo | Bin 185264 -> 185260 bytes td/telegram/MessageContent.cpp | 36 ++++++++++++++++----------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 7c6f04dd3..c2f09da3b 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1691,8 +1691,8 @@ messagePassportDataSent types:vector = MessageContent; //@description Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials messagePassportDataReceived elements:vector credentials:encryptedCredentials = MessageContent; -//@description A user in the chat came within proximity alert range @approacher The user or chat, which approached another user @observer The user or chat, which subscribed for the proximity alert @distance The distance between the users -messageProximityAlertTriggered approacher:MessageSender observer:MessageSender distance:int32 = MessageContent; +//@description A user in the chat came within proximity alert range @traveler The user or chat, which triggered the proximity alert @watcher The user or chat, which subscribed for the proximity alert @distance The distance between the users +messageProximityAlertTriggered traveler:MessageSender watcher:MessageSender distance:int32 = MessageContent; //@description Message content that is not supported in the current TDLib version messageUnsupported = MessageContent; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index 5e6ae711ac1ed22a21c0e8c5684753d7274f8e84..bd9fdf227bd47a3e5a75053f6f40e485c68661d0 100644 GIT binary patch delta 1202 zcmaJ=PiT^18253mERD@So0{L|=lXQYKA3gMgCil?IxOa3haEg9OPb)ooS4uKUzZqU zF#2TgrQ3o*cu+dn!Gpyp2oDx@2!sZ!5!As$M6ext_5B`m#e7fi_xt^x-}AiB^L(XU zU2#`edSTNnCXT*8uiC!-8f@QG@}2rL3GAu0WPcd=4*NL75#9j)&IgGYKw!624uW!{ zsV5Bsh#hF#sDu!476OzrGi9!eKQY1*!+uiiTs!5b*T(q)Qof*`B#l`ZKIurdOdwcM zrlKc({fwxcdGNB0k-7;JwoKq-#)A2T@#P_E9G3nwu9^E8A5*rcy2T;&6yfiKhDbZW z%Y05lHb$@yPrJAJ2;^81H%76r-~#yM=of+1Mv)9ykc?We>H=bN^sDla9~R)4o8Af^ zyq)p1J3!CJ@$->vqIslSi?6T8ZpY_hYjJE6$mQx3i}TyiVcCX>@-`)TrDTI!z=T#i za6Qj`=cPT{*T5i2*kOT5s&-|_B;^26&S(6xbXCi^2!~vr!#p((JdFK|@neY1kD*SY z*y#hVQMOwc5CaEu%rr3GFKmOdOeejW-e#1BtDurx_vg z{Zb}*+y~z?wUrckP?mp>$L0hdVl5sgio;Iain^@&hU;^%uu!qiN z<`Nt*i6DS@djD31-u}stwkPG<6=iC5$}x}M0)*Ht=)xjWE=ZdH-MPb?@5`j+0^W|> zHbA%0e)!p|&7@=5cru<=smL`wTs(U>mRVVir%BiiLFQd>_xa;04L1~bI>L(d77A7t Nv-Jk}ivIv|tv{p9-f92< delta 1190 zcmaJ>KWGzS6wfbhB_R zcAwey==)0OesX31=w(?r{?*g4Oe8gJj*)sVdYhiDs7NFS!p#qoa6o2OCXX5IplT-v z4k%4%+X?AnL*mVJ44GJ@TQFJsM- zG>%Q5uLIV^>YeHz+fq80OWjV#QcG#x8E7xcml!WBaD@edCn^d?^3tAwTVR1cKMxH1 zQD9ivZ%mV@0VrB=C9D;$8YfMN+*cI2a7Dx@WB$XWevZxe^SA=V&L3lidRyHFafpa9 z(a1n2+8Xt;IQ6aB=wG#k#V5_i)cFjD_<2R%pf+X+->!J(j|9&`TO{r>j zIdyZ9z+?8?EXy}?>FjDcYci2(I|S`|(#W+r+~Ize^kMAo7(X0*K%n&KBUXIvz+?^i F`d?_!(PjVu diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 3427dbef8..63a1b20f4 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -690,13 +690,13 @@ class MessageDice : public MessageContent { class MessageProximityAlertTriggered : public MessageContent { public: - DialogId approacher_dialog_id; - DialogId observer_dialog_id; + DialogId traveler_dialog_id; + DialogId watcher_dialog_id; int32 distance = 0; MessageProximityAlertTriggered() = default; - MessageProximityAlertTriggered(DialogId approacher_dialog_id, DialogId observer_dialog_id, int32 distance) - : approacher_dialog_id(approacher_dialog_id), observer_dialog_id(observer_dialog_id), distance(distance) { + MessageProximityAlertTriggered(DialogId traveler_dialog_id, DialogId watcher_dialog_id, int32 distance) + : traveler_dialog_id(traveler_dialog_id), watcher_dialog_id(watcher_dialog_id), distance(distance) { } MessageContentType get_type() const override { @@ -973,8 +973,8 @@ static void store(const MessageContent *content, StorerT &storer) { } case MessageContentType::ProximityAlertTriggered: { auto m = static_cast(content); - store(m->approacher_dialog_id, storer); - store(m->observer_dialog_id, storer); + store(m->traveler_dialog_id, storer); + store(m->watcher_dialog_id, storer); store(m->distance, storer); break; } @@ -1346,8 +1346,8 @@ static void parse(unique_ptr &content, ParserT &parser) { } case MessageContentType::ProximityAlertTriggered: { auto m = make_unique(); - parse(m->approacher_dialog_id, parser); - parse(m->observer_dialog_id, parser); + parse(m->traveler_dialog_id, parser); + parse(m->watcher_dialog_id, parser); parse(m->distance, parser); content = std::move(m); break; @@ -3212,8 +3212,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo case MessageContentType::ProximityAlertTriggered: { auto old_ = static_cast(old_content); auto new_ = static_cast(new_content); - if (old_->approacher_dialog_id != new_->approacher_dialog_id || - old_->observer_dialog_id != new_->observer_dialog_id || old_->distance != new_->distance) { + if (old_->traveler_dialog_id != new_->traveler_dialog_id || old_->watcher_dialog_id != new_->watcher_dialog_id || + old_->distance != new_->distance) { need_update = true; } break; @@ -4428,15 +4428,15 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptr(action); - DialogId approacher_id(geo_proximity_reached->from_id_); - DialogId observer_id(geo_proximity_reached->to_id_); + DialogId traveler_id(geo_proximity_reached->from_id_); + DialogId watcher_id(geo_proximity_reached->to_id_); int32 distance = geo_proximity_reached->distance_; - if (!approacher_id.is_valid() || !observer_id.is_valid() || distance < 0) { + if (!traveler_id.is_valid() || !watcher_id.is_valid() || distance < 0) { LOG(ERROR) << "Receive invalid " << oneline(to_string(geo_proximity_reached)); break; } - return make_unique(approacher_id, observer_id, distance); + return make_unique(traveler_id, watcher_id, distance); } default: UNREACHABLE(); @@ -4644,8 +4644,8 @@ tl_object_ptr get_message_content_object(const MessageCo case MessageContentType::ProximityAlertTriggered: { const MessageProximityAlertTriggered *m = static_cast(content); return make_tl_object( - td->messages_manager_->get_message_sender_object(m->approacher_dialog_id), - td->messages_manager_->get_message_sender_object(m->observer_dialog_id), m->distance); + td->messages_manager_->get_message_sender_object(m->traveler_dialog_id), + td->messages_manager_->get_message_sender_object(m->watcher_dialog_id), m->distance); } default: UNREACHABLE(); @@ -5154,8 +5154,8 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC break; case MessageContentType::ProximityAlertTriggered: { auto content = static_cast(message_content); - add_message_sender_dependencies(dependencies, content->approacher_dialog_id); - add_message_sender_dependencies(dependencies, content->observer_dialog_id); + add_message_sender_dependencies(dependencies, content->traveler_dialog_id); + add_message_sender_dependencies(dependencies, content->watcher_dialog_id); break; } default: From a4a28c511ba272e5a90977bf87150554a120c2b6 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 11:58:06 +0300 Subject: [PATCH 04/29] Move logging from ERROR to WARNING. GitOrigin-RevId: f46e811f84315f014625ea532459fa714432a884 --- td/telegram/MessagesManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 5fcd5b41d..0717974ff 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -34735,9 +34735,9 @@ void MessagesManager::after_get_channel_difference(DialogId dialog_id, bool succ LOG(INFO) << "Can't apply postponed channel updates"; } else { // otherwise we protecting from getChannelDifference repeating calls by dropping pending updates - LOG(ERROR) << "Failed to apply postponed updates of type " << update_id << " in " << dialog_id - << " with pts " << d->pts << ", update pts is " << update_pts << ", update pts count is " - << update_pts_count; + LOG(WARNING) << "Failed to apply postponed updates of type " << update_id << " in " << dialog_id + << " with pts " << d->pts << ", update pts is " << update_pts << ", update pts count is " + << update_pts_count; d->postponed_channel_updates.clear(); } break; From 7010c7c6ea9b0aacf825163d2877edf26a4d1211 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 12:01:13 +0300 Subject: [PATCH 05/29] Fix dropping pending updates after receiving empty difference. GitOrigin-RevId: b8a7a2298191123b0e5be818ebae52c52998eab0 --- td/telegram/UpdatesManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index edd551888..84e6eff9f 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1072,10 +1072,12 @@ void UpdatesManager::on_get_difference(tl_object_ptrdate_, false, "on_get_difference_empty"); seq_ = difference->seq_; if (!pending_seq_updates_.empty()) { - LOG(ERROR) << "Drop " << pending_seq_updates_.size() << " pending seq updates after receive empty difference"; + LOG(WARNING) << "Drop " << pending_seq_updates_.size() << " pending seq updates after receive empty difference"; + pending_seq_updates_.clear(); } if (!pending_qts_updates_.empty()) { - LOG(ERROR) << "Drop " << pending_qts_updates_.size() << " pending qts updates after receive empty difference"; + LOG(WARNING) << "Drop " << pending_qts_updates_.size() << " pending qts updates after receive empty difference"; + pending_qts_updates_.clear(); } break; } From dd12a34656984f1546f9eed619708a1fdd136a04 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 13:13:31 +0300 Subject: [PATCH 06/29] Simplify set_dialog_last_pinned_message_id usage. GitOrigin-RevId: 62c3e3e8b5bd0260bc059ba92b6bc400bb9b3eda --- td/telegram/MessagesManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 0717974ff..37e31f471 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -28518,7 +28518,9 @@ void MessagesManager::on_update_dialog_last_pinned_message_id(DialogId dialog_id void MessagesManager::set_dialog_last_pinned_message_id(Dialog *d, MessageId pinned_message_id) { CHECK(d != nullptr); - CHECK(d->last_pinned_message_id != pinned_message_id); + if (d->last_pinned_message_id == pinned_message_id) { + return; + } d->last_pinned_message_id = pinned_message_id; d->is_last_pinned_message_id_inited = true; on_dialog_updated(d->dialog_id, "set_dialog_last_pinned_message_id"); @@ -29907,9 +29909,7 @@ void MessagesManager::unpin_all_dialog_messages(DialogId dialog_id, Promiselast_pinned_message_id != MessageId()) { - set_dialog_last_pinned_message_id(d, MessageId()); - } + set_dialog_last_pinned_message_id(d, MessageId()); if (d->message_count_by_index[message_search_filter_index(MessageSearchFilter::Pinned)] != 0) { d->message_count_by_index[message_search_filter_index(MessageSearchFilter::Pinned)] = 0; on_dialog_updated(dialog_id, "unpin_all_dialog_messages"); From ca3315ba06c6bd8ca4e4de45a2c150a1efe72fb7 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 13:55:53 +0300 Subject: [PATCH 07/29] Add MessagesManager::update_reply_count_by_message and update reply_count on message deletion. GitOrigin-RevId: 2746c056ae021053587c8b16b50a92ed126f89da --- td/telegram/MessageReplyInfo.cpp | 28 ++++++++++----- td/telegram/MessageReplyInfo.h | 2 +- td/telegram/MessagesManager.cpp | 60 ++++++++++++++++++++------------ td/telegram/MessagesManager.h | 5 +++ 4 files changed, 64 insertions(+), 31 deletions(-) diff --git a/td/telegram/MessageReplyInfo.cpp b/td/telegram/MessageReplyInfo.cpp index f262251e3..54dfb055a 100644 --- a/td/telegram/MessageReplyInfo.cpp +++ b/td/telegram/MessageReplyInfo.cpp @@ -108,22 +108,34 @@ bool MessageReplyInfo::update_max_message_ids(MessageId other_max_message_id, return result; } -void MessageReplyInfo::add_reply(DialogId replier_dialog_id, MessageId reply_message_id) { +bool MessageReplyInfo::add_reply(DialogId replier_dialog_id, MessageId reply_message_id, int diff) { CHECK(!is_empty()); + CHECK(diff == +1 || diff == -1); - reply_count++; - if (is_comment && replier_dialog_id.is_valid() && - (recent_replier_dialog_ids.empty() || recent_replier_dialog_ids[0] != replier_dialog_id)) { + if (diff == -1 && reply_count == 0) { + return false; + } + + reply_count += diff; + if (is_comment && replier_dialog_id.is_valid()) { td::remove(recent_replier_dialog_ids, replier_dialog_id); - recent_replier_dialog_ids.insert(recent_replier_dialog_ids.begin(), replier_dialog_id); - if (recent_replier_dialog_ids.size() > 3) { - recent_replier_dialog_ids.pop_back(); + if (diff > 0) { + recent_replier_dialog_ids.insert(recent_replier_dialog_ids.begin(), replier_dialog_id); + if (recent_replier_dialog_ids.size() > 3) { + recent_replier_dialog_ids.pop_back(); + } + } else { + auto max_repliers = static_cast(reply_count); + if (recent_replier_dialog_ids.size() > max_repliers) { + recent_replier_dialog_ids.resize(max_repliers); + } } } - if (reply_message_id > max_message_id) { + if (diff > 0 && reply_message_id > max_message_id) { max_message_id = reply_message_id; } + return true; } td_api::object_ptr MessageReplyInfo::get_message_reply_info_object( diff --git a/td/telegram/MessageReplyInfo.h b/td/telegram/MessageReplyInfo.h index 46a083396..1ecee6a0a 100644 --- a/td/telegram/MessageReplyInfo.h +++ b/td/telegram/MessageReplyInfo.h @@ -46,7 +46,7 @@ struct MessageReplyInfo { bool update_max_message_ids(const MessageReplyInfo &other); - void add_reply(DialogId replier_dialog_id, MessageId reply_message_id); + bool add_reply(DialogId replier_dialog_id, MessageId reply_message_id, int diff); td_api::object_ptr get_message_reply_info_object( ContactsManager *contacts_manager, const MessagesManager *messages_manager) const; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 37e31f471..957e76416 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -5793,6 +5793,40 @@ int32 MessagesManager::get_message_index_mask(DialogId dialog_id, const Message return index_mask; } +void MessagesManager::update_reply_count_by_message(Dialog *d, int diff, const Message *m) { + if (td_->auth_manager_->is_bot() || !m->top_thread_message_id.is_valid() || + m->top_thread_message_id == m->message_id || !m->message_id.is_server()) { + return; + } + + auto replier_dialog_id = + has_message_sender_user_id(d->dialog_id, m) ? DialogId(m->sender_user_id) : m->sender_dialog_id; + update_message_reply_count(d, m->top_thread_message_id, replier_dialog_id, m->message_id, diff); +} + +void MessagesManager::update_message_reply_count(Dialog *d, MessageId message_id, DialogId replier_dialog_id, + MessageId reply_message_id, int diff, bool is_recursive) { + if (d == nullptr) { + return; + } + + Message *m = get_message(d, message_id); + if (m == nullptr || !is_active_message_reply_info(d->dialog_id, m->reply_info)) { + return; + } + LOG(INFO) << "Update reply count to " << message_id << " in " << d->dialog_id << " by " << diff << " from " + << reply_message_id << " sent by " << replier_dialog_id; + if (m->reply_info.add_reply(replier_dialog_id, reply_message_id, diff)) { + on_message_reply_info_changed(d->dialog_id, m); + on_message_changed(d, m, true, "update_message_reply_count_by_message"); + } + + if (!is_recursive && is_discussion_message(d->dialog_id, m)) { + update_message_reply_count(get_dialog(m->forward_info->sender_dialog_id), m->forward_info->message_id, + replier_dialog_id, reply_message_id, diff, true); + } +} + vector MessagesManager::get_message_ids(const vector &input_message_ids) { vector message_ids; message_ids.reserve(input_message_ids.size()); @@ -13034,6 +13068,7 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f // add_message_to_dialog will not update counts, because need_update == false update_message_count_by_index(d, +1, new_message.get()); + update_reply_count_by_message(d, +1, new_message.get()); } if (!from_update) { @@ -14522,6 +14557,7 @@ unique_ptr MessagesManager::do_delete_message(Dialog * } update_message_count_by_index(d, -1, result.get()); + update_reply_count_by_message(d, -1, result.get()); } on_message_deleted(d, result.get(), is_permanently_deleted, source); @@ -28208,6 +28244,7 @@ void MessagesManager::fail_send_message(FullMessageId full_message_id, int error if (!m->message_id.is_scheduled()) { // add_message_to_dialog will not update counts, because need_update == false update_message_count_by_index(d, +1, m); + update_reply_count_by_message(d, +1, m); } register_new_local_message_id(d, m); @@ -31388,6 +31425,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq } if (*need_update) { update_message_count_by_index(d, +1, message.get()); + update_reply_count_by_message(d, +1, message.get()); } if (auto_attach && message_id > d->last_message_id && message_id >= d->last_new_message_id) { set_dialog_last_message_id(d, message_id, "add_message_to_dialog"); @@ -31510,28 +31548,6 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq UNREACHABLE(); } } - - if (!td_->auth_manager_->is_bot() && m->top_thread_message_id.is_valid() && - m->top_thread_message_id != message_id && message_id.is_server()) { - Message *top_m = get_message(d, m->top_thread_message_id); - if (top_m != nullptr && is_active_message_reply_info(dialog_id, top_m->reply_info)) { - auto replier_dialog_id = - has_message_sender_user_id(dialog_id, m) ? DialogId(m->sender_user_id) : m->sender_dialog_id; - top_m->reply_info.add_reply(replier_dialog_id, message_id); - on_message_reply_info_changed(dialog_id, top_m); - on_message_changed(d, top_m, true, "update_message_reply_count 1"); - - if (is_discussion_message(dialog_id, top_m)) { - auto channel_dialog_id = top_m->forward_info->sender_dialog_id; - Message *channel_m = get_message({channel_dialog_id, top_m->forward_info->message_id}); - if (channel_m != nullptr && is_active_message_reply_info(channel_dialog_id, channel_m->reply_info)) { - channel_m->reply_info.add_reply(replier_dialog_id, message_id); - on_message_reply_info_changed(channel_dialog_id, channel_m); - on_message_changed(get_dialog(channel_dialog_id), channel_m, true, "update_message_reply_count 2"); - } - } - } - } } Message *result_message = treap_insert_message(&d->messages, std::move(message)); diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 6f4c908ce..2efc4b0d3 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -2079,6 +2079,11 @@ class MessagesManager : public Actor { int32 get_message_index_mask(DialogId dialog_id, const Message *m) const; + void update_reply_count_by_message(Dialog *d, int diff, const Message *m); + + void update_message_reply_count(Dialog *d, MessageId message_id, DialogId replier_dialog_id, + MessageId reply_message_id, int diff, bool is_recursive = false); + Message *add_message_to_dialog(DialogId dialog_id, unique_ptr message, bool from_update, bool *need_update, bool *need_update_dialog_pos, const char *source); From 38d2fb8e9488465385d15fe31cdb6a024e6e7549 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 14:55:44 +0300 Subject: [PATCH 08/29] Improve updates order. GitOrigin-RevId: 5a88973c364be4630a7923190958cda47c697678 --- td/telegram/MessagesManager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 957e76416..0b4860093 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -12989,7 +12989,7 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f bool need_update_dialog_pos = false; MessageId old_message_id = find_old_message_id(dialog_id, message_id); - bool need_add_active_live_location = false; + bool is_sent_message = false; LOG(INFO) << "Found temporarily " << old_message_id << " for " << FullMessageId{dialog_id, message_id}; if (old_message_id.is_valid() || old_message_id.is_valid_scheduled()) { Dialog *d = get_dialog(dialog_id); @@ -13064,11 +13064,7 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f send_update_message_send_succeeded(d, old_message_id, new_message.get()); if (!message_id.is_scheduled()) { - need_add_active_live_location = true; - - // add_message_to_dialog will not update counts, because need_update == false - update_message_count_by_index(d, +1, new_message.get()); - update_reply_count_by_message(d, +1, new_message.get()); + is_sent_message = true; } if (!from_update) { @@ -13094,8 +13090,12 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f CHECK(d != nullptr); - if (need_add_active_live_location) { + if (is_sent_message) { try_add_active_live_location(dialog_id, m); + + // add_message_to_dialog will not update counts, because need_update == false + update_message_count_by_index(d, +1, m); + update_reply_count_by_message(d, +1, m); } auto pcc_it = pending_created_dialogs_.find(dialog_id); @@ -28244,7 +28244,7 @@ void MessagesManager::fail_send_message(FullMessageId full_message_id, int error if (!m->message_id.is_scheduled()) { // add_message_to_dialog will not update counts, because need_update == false update_message_count_by_index(d, +1, m); - update_reply_count_by_message(d, +1, m); + update_reply_count_by_message(d, +1, m); // no-op because the message isn't server } register_new_local_message_id(d, m); From e27385e9b8a7c4e65507446495c99509aeef0485 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 15:19:36 +0300 Subject: [PATCH 09/29] Fix discussion message usage. GitOrigin-RevId: 52f7c267b29589c751a2acfc5f74dce9950dc801 --- td/telegram/MessagesManager.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 0b4860093..d204e1e78 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -5822,7 +5822,7 @@ void MessagesManager::update_message_reply_count(Dialog *d, MessageId message_id } if (!is_recursive && is_discussion_message(d->dialog_id, m)) { - update_message_reply_count(get_dialog(m->forward_info->sender_dialog_id), m->forward_info->message_id, + update_message_reply_count(get_dialog(m->forward_info->from_dialog_id), m->forward_info->from_message_id, replier_dialog_id, reply_message_id, diff, true); } } @@ -16637,8 +16637,8 @@ Result> MessagesManager::get_message_link(FullMessageId if (for_comment) { auto *top_m = get_message_force(d, m->top_thread_message_id, "get_public_message_link"); if (is_discussion_message(dialog_id, top_m) && is_active_message_reply_info(dialog_id, top_m->reply_info)) { - auto linked_dialog_id = top_m->forward_info->sender_dialog_id; - auto linked_message_id = top_m->forward_info->message_id; + auto linked_dialog_id = top_m->forward_info->from_dialog_id; + auto linked_message_id = top_m->forward_info->from_message_id; auto linked_d = get_dialog(linked_dialog_id); CHECK(linked_d != nullptr); CHECK(linked_dialog_id.get_type() == DialogType::Channel); @@ -18770,11 +18770,11 @@ Status MessagesManager::view_messages(DialogId dialog_id, MessageId top_thread_m max_thread_message_id = top_m->reply_info.max_message_id; if (is_discussion_message(dialog_id, top_m)) { - auto linked_dialog_id = top_m->forward_info->sender_dialog_id; + auto linked_dialog_id = top_m->forward_info->from_dialog_id; auto linked_d = get_dialog(linked_dialog_id); CHECK(linked_d != nullptr); CHECK(linked_dialog_id.get_type() == DialogType::Channel); - auto *linked_m = get_message_force(linked_d, top_m->forward_info->message_id, "view_messages 4"); + auto *linked_m = get_message_force(linked_d, top_m->forward_info->from_message_id, "view_messages 4"); if (linked_m != nullptr && is_active_message_reply_info(linked_dialog_id, linked_m->reply_info)) { if (linked_m->reply_info.last_read_inbox_message_id < prev_last_read_inbox_message_id) { prev_last_read_inbox_message_id = linked_m->reply_info.last_read_inbox_message_id; @@ -24742,16 +24742,16 @@ bool MessagesManager::is_discussion_message(DialogId dialog_id, const Message *m return false; } } - if (!m->forward_info->sender_dialog_id.is_valid() || !m->forward_info->message_id.is_valid()) { + if (!m->forward_info->from_dialog_id.is_valid() || !m->forward_info->from_message_id.is_valid()) { return false; } if (dialog_id.get_type() != DialogType::Channel || is_broadcast_channel(dialog_id)) { return false; } - if (m->forward_info->sender_dialog_id == dialog_id) { + if (m->forward_info->from_dialog_id == dialog_id) { return false; } - if (m->forward_info->sender_dialog_id.get_type() != DialogType::Channel) { + if (m->forward_info->from_dialog_id.get_type() != DialogType::Channel) { return false; } return true; @@ -30911,7 +30911,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq message->sender_dialog_id = dialog_id; } else { if (is_discussion_message(dialog_id, message.get())) { - message->sender_dialog_id = message->forward_info->sender_dialog_id; + message->sender_dialog_id = message->forward_info->from_dialog_id; } else { LOG(ERROR) << "Failed to repair sender chat in " << message_id << " in " << dialog_id; } @@ -31193,10 +31193,10 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq Message *top_m = get_message(d, message->top_thread_message_id); CHECK(top_m != nullptr); if (is_active_message_reply_info(dialog_id, top_m->reply_info) && is_discussion_message(dialog_id, top_m) && - have_message_force({top_m->forward_info->sender_dialog_id, top_m->forward_info->message_id}, + have_message_force({top_m->forward_info->from_dialog_id, top_m->forward_info->from_message_id}, "preload discussed message")) { LOG(INFO) << "Preloaded discussed " - << FullMessageId{top_m->forward_info->sender_dialog_id, top_m->forward_info->message_id} + << FullMessageId{top_m->forward_info->from_dialog_id, top_m->forward_info->from_message_id} << " from database"; } } @@ -31610,7 +31610,8 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq } if (!td_->auth_manager_->is_bot() && from_update && m->forward_info != nullptr && m->forward_info->sender_dialog_id.is_valid() && m->forward_info->message_id.is_valid() && - !is_discussion_message(dialog_id, m)) { + (!is_discussion_message(dialog_id, m) || m->forward_info->sender_dialog_id != m->forward_info->from_dialog_id || + m->forward_info->message_id != m->forward_info->from_message_id)) { update_forward_count(m->forward_info->sender_dialog_id, m->forward_info->message_id); } From d28a7245ea1c4be455f500919055ffc5d5172e57 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 15:28:55 +0300 Subject: [PATCH 10/29] Make can_get_channel_message_statistics const to prevent unneeded getChannelFull requests. GitOrigin-RevId: 90121f149dfa5ec6e586b8932b8507dd25614921 --- td/telegram/ContactsManager.cpp | 15 ++++++++++----- td/telegram/ContactsManager.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 9efddc65f..d8eb6df98 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -5974,7 +5974,7 @@ void ContactsManager::send_get_channel_stats_query(DcId dc_id, ChannelId channel } } -bool ContactsManager::can_get_channel_message_statistics(DialogId dialog_id) { +bool ContactsManager::can_get_channel_message_statistics(DialogId dialog_id) const { if (dialog_id.get_type() != DialogType::Channel) { return false; } @@ -5985,11 +5985,16 @@ bool ContactsManager::can_get_channel_message_statistics(DialogId dialog_id) { return false; } - auto channel_full = get_channel_full_force(channel_id, "can_get_channel_message_statistics"); - if (channel_full == nullptr) { - return c->status.is_administrator(); + if (td_->auth_manager_->is_bot()) { + return false; } - return channel_full->stats_dc_id.is_exact(); + + auto channel_full = get_channel_full(channel_id); + if (channel_full != nullptr) { + return channel_full->stats_dc_id.is_exact(); + } + + return c->status.is_administrator(); } void ContactsManager::get_channel_message_statistics(FullMessageId full_message_id, bool is_dark, diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 61de2ce32..57d546546 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -371,7 +371,7 @@ class ContactsManager : public Actor { void get_channel_statistics(DialogId dialog_id, bool is_dark, Promise> &&promise); - bool can_get_channel_message_statistics(DialogId dialog_id); + bool can_get_channel_message_statistics(DialogId dialog_id) const; void get_channel_message_statistics(FullMessageId full_message_id, bool is_dark, Promise> &&promise); From 98ff412f7aaecc002e743969356a87353c94c148 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 15:47:40 +0300 Subject: [PATCH 11/29] Use get_channel_full_const in get methods to avoid unneeded getChannelFull requests. GitOrigin-RevId: 1959c781b6c85667065e38af125a87186746a233 --- td/telegram/ContactsManager.cpp | 20 +++++++++++++++----- td/telegram/ContactsManager.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index d8eb6df98..9d4f52b09 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -12986,17 +12986,23 @@ bool ContactsManager::get_channel_has_linked_channel(const Channel *c) { } ChannelId ContactsManager::get_channel_linked_channel_id(ChannelId channel_id) { - auto channel_full = get_channel_full_force(channel_id, "get_channel_linked_channel_id"); + auto channel_full = get_channel_full_const(channel_id); if (channel_full == nullptr) { - return ChannelId(); + channel_full = get_channel_full_force(channel_id, "get_channel_linked_channel_id"); + if (channel_full == nullptr) { + return ChannelId(); + } } return channel_full->linked_channel_id; } int32 ContactsManager::get_channel_slow_mode_delay(ChannelId channel_id) { - auto channel_full = get_channel_full_force(channel_id, "get_channel_slow_mode_delay"); + auto channel_full = get_channel_full_const(channel_id); if (channel_full == nullptr) { - return 0; + channel_full = get_channel_full_force(channel_id, "get_channel_slow_mode_delay"); + if (channel_full == nullptr) { + return 0; + } } return channel_full->slow_mode_delay; } @@ -13078,7 +13084,7 @@ void ContactsManager::reload_channel(ChannelId channel_id, Promise &&promi td_->create_handler(std::move(promise))->send(std::move(input_channel)); } -const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id) const { +const ContactsManager::ChannelFull *ContactsManager::get_channel_full_const(ChannelId channel_id) const { auto p = channels_full_.find(channel_id); if (p == channels_full_.end()) { return nullptr; @@ -13087,6 +13093,10 @@ const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId } } +const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id) const { + return get_channel_full_const(channel_id); +} + ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id, const char *source) { auto p = channels_full_.find(channel_id); if (p == channels_full_.end()) { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 57d546546..85a9a250e 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1105,6 +1105,7 @@ class ContactsManager : public Actor { Channel *add_channel(ChannelId channel_id, const char *source); const ChannelFull *get_channel_full(ChannelId channel_id) const; + const ChannelFull *get_channel_full_const(ChannelId channel_id) const; ChannelFull *get_channel_full(ChannelId channel_id, const char *source); ChannelFull *get_channel_full_force(ChannelId channel_id, const char *source); From 778adce53dcf8d721763c6d31c21c55d591a8d04 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 16:33:06 +0300 Subject: [PATCH 12/29] Add debug logging. GitOrigin-RevId: 08ae2a25ae086a2211658239a532e1e19d996a4f --- td/telegram/UpdatesManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 84e6eff9f..c86f2d789 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1520,6 +1520,9 @@ void UpdatesManager::process_qts_update(tl_object_ptr &&up } void UpdatesManager::process_pending_seq_updates() { + if (!pending_seq_updates_.empty()) { + LOG(DEBUG) << "Trying to process " << pending_seq_updates_.size() << " pending seq updates"; + } while (!pending_seq_updates_.empty() && !running_get_difference_) { auto update_it = pending_seq_updates_.begin(); auto seq_begin = update_it->second.seq_begin; From ed0bf2c1b388a768c7aabc01fb2ba5916dac7b12 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 16:43:26 +0300 Subject: [PATCH 13/29] Ignore failed to load chats in getChatFilter. GitOrigin-RevId: 5c1871080e56576f402917e1ecfbf0c99da0deba --- td/telegram/MessagesManager.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index d204e1e78..51f130022 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -14805,13 +14805,9 @@ void MessagesManager::load_dialog_filter(const DialogFilter *filter, bool force, if (!input_dialog_ids.empty() && !force) { const size_t MAX_SLICE_SIZE = 100; - if (input_dialog_ids.size() <= MAX_SLICE_SIZE) { - td_->create_handler(std::move(promise))->send(std::move(input_dialog_ids)); - return; - } - MultiPromiseActorSafe mpas{"GetFilterDialogsFromServerMultiPromiseActor"}; mpas.add_promise(std::move(promise)); + mpas.set_ignore_errors(true); auto lock = mpas.get_promise(); for (size_t i = 0; i < input_dialog_ids.size(); i += MAX_SLICE_SIZE) { From c8949e264df89e63f34f378dd35e3c1dfd7f6ee2 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 19:40:08 +0300 Subject: [PATCH 14/29] Allow access to channel if it has linked channel, but we can't check access to it. GitOrigin-RevId: 897e86d18ad2b3c829c4ac544320fa4ee4ebd31b --- td/telegram/ContactsManager.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 9d4f52b09..f199b3332 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4074,10 +4074,13 @@ bool ContactsManager::have_input_peer_channel(const Channel *c, ChannelId channe if (is_public) { return true; } - if (!from_linked) { + if (!from_linked && c->has_linked_channel) { auto linked_channel_id = get_linked_channel_id(channel_id); - if (linked_channel_id.is_valid() && - have_input_peer_channel(get_channel(linked_channel_id), linked_channel_id, access_rights, true)) { + if (linked_channel_id.is_valid() && have_channel(linked_channel_id)) { + if (have_input_peer_channel(get_channel(linked_channel_id), linked_channel_id, access_rights, true)) { + return true; + } + } else { return true; } } @@ -4085,11 +4088,13 @@ bool ContactsManager::have_input_peer_channel(const Channel *c, ChannelId channe return true; } } else { - if (!from_linked && c->is_megagroup && !td_->auth_manager_->is_bot()) { + if (!from_linked && c->is_megagroup && !td_->auth_manager_->is_bot() && c->has_linked_channel) { auto linked_channel_id = get_linked_channel_id(channel_id); - if (linked_channel_id.is_valid()) { + if (linked_channel_id.is_valid() && (is_public || have_channel(linked_channel_id))) { return is_public || have_input_peer_channel(get_channel(linked_channel_id), linked_channel_id, AccessRights::Read, true); + } else { + return true; } } } From f9a527b2d0165269705cafc503fd68984a668c83 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 21:24:59 +0300 Subject: [PATCH 15/29] Update documentation. GitOrigin-RevId: 6f36ec26b37604e21b4de35a2be864ab9e7fd251 --- td/generate/scheme/td_api.tl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index c2f09da3b..a434f2faa 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3750,7 +3750,7 @@ getChatMessageCount chat_id:int53 filter:SearchMessagesFilter return_local:Bool //@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; -//@description Returns forwarded copies of a channel message to another public channels. For optimal performance the number of returned messages is chosen by the library. The method is under development and may or may not work +//@description Returns forwarded copies of a channel message to another public channels. For optimal performance the number of returned messages is chosen by the library //@chat_id Chat identifier of the message //@message_id Message identifier //@offset Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results @@ -4637,7 +4637,7 @@ getChatStatisticsUrl chat_id:int53 parameters:string is_dark:Bool = HttpUrl; //@description Returns detailed statistics about a chat. Currently this method can be used only for supergroups and channels. Can be used only if SupergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; -//@description Returns detailed statistics about a message. Can be used only if Message.can_get_statistics == true. The method is under development and may or may not work @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application +//@description Returns detailed statistics about a message. Can be used only if Message.can_get_statistics == true @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; //@description Loads asynchronous or zoomed in chat or message statistics graph @chat_id Chat identifier @token The token for graph loading @x X-value for zoomed in graph or 0 otherwise From fd2fcc3eb0e825731a6458baf9f4803da79326a8 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 31 Oct 2020 21:27:21 +0300 Subject: [PATCH 16/29] Improve documentation. GitOrigin-RevId: f0e6047beb07322b285807462d381e8fdafe35a3 --- td/generate/scheme/td_api.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index a434f2faa..c2ad0f854 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3750,7 +3750,7 @@ getChatMessageCount chat_id:int53 filter:SearchMessagesFilter return_local:Bool //@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; -//@description Returns forwarded copies of a channel message to another public channels. For optimal performance the number of returned messages is chosen by the library +//@description Returns forwarded copies of a channel message to different public channels. For optimal performance the number of returned messages is chosen by the library //@chat_id Chat identifier of the message //@message_id Message identifier //@offset Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results From 36763888d4771f7f04e153e32d57f14c1e47ddeb Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Nov 2020 01:28:58 +0300 Subject: [PATCH 17/29] Improve Usage output in OptionParser. GitOrigin-RevId: 8955f6ce0643fbf871b3f3781bd36568d490eb6c --- tdutils/td/utils/OptionParser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tdutils/td/utils/OptionParser.cpp b/tdutils/td/utils/OptionParser.cpp index cab601116..d39def7da 100644 --- a/tdutils/td/utils/OptionParser.cpp +++ b/tdutils/td/utils/OptionParser.cpp @@ -219,7 +219,7 @@ StringBuilder &operator<<(StringBuilder &sb, const OptionParser &o) { length += 4 + opt.long_key.size(); } if (opt.type != OptionParser::Option::Type::NoArg) { - length += 5; + length += 6; } if (length > max_length) { max_length = length; @@ -247,8 +247,8 @@ StringBuilder &operator<<(StringBuilder &sb, const OptionParser &o) { length -= 4 + opt.long_key.size(); } if (opt.type != OptionParser::Option::Type::NoArg) { - sb << ""; - length -= 5; + sb << "="; + length -= 6; } sb << string(length, ' ') << opt.description; sb << '\n'; From d90f271c486beb09601970fd41cb5cbcac55bce9 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Nov 2020 11:55:51 +0300 Subject: [PATCH 18/29] Add TD_ENABLE_MULTI_PROCESSOR_COMPILATION option for MSVC. GitOrigin-RevId: f5500b79eb83a20d7ffc1c73963fa3f29fc90012 --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 733b77694..c46fd8699 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,14 @@ endif() include(TdSetUpCompiler) td_set_up_compiler() +if (MSVC) + option(TD_ENABLE_MULTI_PROCESSOR_COMPILATION "Use \"ON\" to enable multi-processor compilation.") + + if (TD_ENABLE_MULTI_PROCESSOR_COMPILATION) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + endif() +endif() + if (CLANG OR GCC) if (MEMPROF) include(CheckCXXCompilerFlag) From 107d86f6d4150d4d7d652203653b716817d2c5b8 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Nov 2020 11:58:01 +0300 Subject: [PATCH 19/29] Improve formatting. GitOrigin-RevId: 0038725a5dd9e4773f4c7e8f1b8e4a0372087261 --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c46fd8699..73c68f048 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,9 +82,9 @@ if (EMSCRIPTEN) set(ZLIB_INCLUDE_DIR) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s USE_ZLIB=1 -s MODULARIZE=1 \ - -s EXPORT_NAME=\"'createTdwebModule'\" -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\" -lidbfs.js -lworkerfs.js") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s USE_ZLIB=1 -s \ - MODULARIZE=1 -s EXPORT_NAME=\"'createTdwebModule'\" -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\" -lidbfs.js -lworkerfs.js") + -s EXPORT_NAME=\"'createTdwebModule'\" -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\" -lidbfs.js -lworkerfs.js") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s USE_ZLIB=1 -s MODULARIZE=1 \ + -s EXPORT_NAME=\"'createTdwebModule'\" -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\" -lidbfs.js -lworkerfs.js") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1") From 3a8931cff09c05ed03e02dacf5cf574e05f0288b Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Nov 2020 21:36:42 +0300 Subject: [PATCH 20/29] Ping server only if authorized. GitOrigin-RevId: 02e272e5dd2892fde8df74b968091d14fb96ed54 --- td/telegram/Td.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 68f2008ce..1abb73610 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -3113,7 +3113,7 @@ void Td::on_alarm_timeout(int64 alarm_id) { return; } if (alarm_id == PING_SERVER_ALARM_ID) { - if (!close_flag_ && updates_manager_ != nullptr) { + if (!close_flag_ && updates_manager_ != nullptr && auth_manager_->is_authorized()) { updates_manager_->ping_server(); alarm_timeout_.set_timeout_in(PING_SERVER_ALARM_ID, PING_SERVER_TIMEOUT + Random::fast(0, PING_SERVER_TIMEOUT / 5)); @@ -3632,7 +3632,7 @@ void Td::on_result(NetQueryPtr query) { updates_manager_->schedule_get_difference("failed to fetch update"); } else { updates_manager_->on_get_updates(std::move(ptr)); - if (auth_manager_->is_bot()) { + if (auth_manager_->is_bot() && auth_manager_->is_authorized()) { alarm_timeout_.set_timeout_in(PING_SERVER_ALARM_ID, PING_SERVER_TIMEOUT + Random::fast(0, PING_SERVER_TIMEOUT / 5)); } From 69ae1d4f0cc8983d610e44162cb06aaf66c3ef72 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Nov 2020 21:42:48 +0300 Subject: [PATCH 21/29] Allow auth.bindTempAuthKey before authorization to check auth_key validness. GitOrigin-RevId: 7a80d84aef6a9f097c6567ed72bccd9b62f87c2c --- td/telegram/net/NetQueryCreator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/td/telegram/net/NetQueryCreator.cpp b/td/telegram/net/NetQueryCreator.cpp index dd399a340..02cf40ad1 100644 --- a/td/telegram/net/NetQueryCreator.cpp +++ b/td/telegram/net/NetQueryCreator.cpp @@ -63,7 +63,8 @@ NetQueryPtr NetQueryCreator::create(uint64 id, const telegram_api::Function &fun total_timeout_limit = 8; } if ((auth_manager == nullptr || !auth_manager->was_authorized()) && auth_flag == NetQuery::AuthFlag::On && - tl_constructor != telegram_api::auth_exportAuthorization::ID) { + tl_constructor != telegram_api::auth_exportAuthorization::ID && + tl_constructor != telegram_api::auth_bindTempAuthKey::ID) { LOG(ERROR) << "Send query before authorization: " << to_string(function); } } From ab5484fd7863ea2ce39512d5748cb32eb5fba0ae Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Nov 2020 23:22:42 +0300 Subject: [PATCH 22/29] Improve logging. GitOrigin-RevId: 2d3e19395b48d4c6c330a852d559b537ff363b4e --- td/telegram/MessagesManager.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 51f130022..bb2d2b343 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -22536,7 +22536,7 @@ void MessagesManager::fix_server_reply_to_message_id(DialogId dialog_id, Message } if (!message_id.is_scheduled() && !reply_in_dialog_id.is_valid() && reply_to_message_id >= message_id) { - if (reply_to_message_id.get() - message_id.get() <= MessageId(ServerMessageId(2000000000)).get() || + if (reply_to_message_id.get() - message_id.get() <= MessageId(ServerMessageId(1000000)).get() || dialog_id.get_type() == DialogType::Channel) { LOG(ERROR) << "Receive reply to wrong " << reply_to_message_id << " in " << message_id << " in " << dialog_id; } @@ -32207,9 +32207,9 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr if (new_message->forward_info != nullptr) { if (!replace_legacy) { LOG(ERROR) << message_id << " in " << dialog_id << " has received forward info " << *new_message->forward_info - << ", really forwarded from " << old_message->real_forward_from_dialog_id - << ", message content type is " << old_message->content->get_type() << '/' - << new_message->content->get_type(); + << ", really forwarded from " << old_message->real_forward_from_message_id << " in " + << old_message->real_forward_from_dialog_id << ", message content type is " + << old_message->content->get_type() << '/' << new_message->content->get_type(); } old_message->forward_info = std::move(new_message->forward_info); need_send_update = true; @@ -32225,8 +32225,9 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr if (!is_forward_info_sender_hidden(new_message->forward_info.get()) && !replace_legacy) { LOG(ERROR) << message_id << " in " << dialog_id << " has changed forward info from " << *old_message->forward_info << " to " << *new_message->forward_info << ", really forwarded from " - << old_message->real_forward_from_dialog_id << ", message content type is " - << old_message->content->get_type() << '/' << new_message->content->get_type(); + << old_message->real_forward_from_message_id << " in " << old_message->real_forward_from_dialog_id + << ", message content type is " << old_message->content->get_type() << '/' + << new_message->content->get_type(); } old_message->forward_info = std::move(new_message->forward_info); need_send_update = true; @@ -32234,9 +32235,9 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr } else if (is_new_available) { LOG(ERROR) << message_id << " in " << dialog_id << " sent by " << old_message->sender_user_id << "/" << old_message->sender_dialog_id << " has lost forward info " << *old_message->forward_info - << ", really forwarded from " << old_message->real_forward_from_dialog_id - << ", message content type is " << old_message->content->get_type() << '/' - << new_message->content->get_type(); + << ", really forwarded from " << old_message->real_forward_from_message_id << " in " + << old_message->real_forward_from_dialog_id << ", message content type is " + << old_message->content->get_type() << '/' << new_message->content->get_type(); old_message->forward_info = nullptr; need_send_update = true; } From 301c8b167fec6788c9362389d7aec73294e1e4cf Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Nov 2020 23:24:29 +0300 Subject: [PATCH 23/29] Allow passing outdated yet unsent message identifier to getRepliedMessage. GitOrigin-RevId: b24c47456a3716022de52fe030245e048ff5d053 --- td/telegram/MessagesManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index bb2d2b343..c54f6841b 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -16152,6 +16152,7 @@ FullMessageId MessagesManager::get_replied_message(DialogId dialog_id, MessageId return FullMessageId(); } + message_id = get_persistent_message_id(d, message_id); auto m = get_message_force(d, message_id, "get_replied_message"); if (m == nullptr) { if (force) { From c1de6a7d8da619893c140c379a5476a08a7abcee Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 2 Nov 2020 00:43:57 +0300 Subject: [PATCH 24/29] Minor improvements. GitOrigin-RevId: eb8b201d80405feb6972b2eabc7de30d40aa8b81 --- td/telegram/InlineQueriesManager.cpp | 7 ++----- td/telegram/MessageContent.cpp | 2 +- td/telegram/MessagesManager.cpp | 2 +- td/telegram/NotificationType.cpp | 1 - tdutils/td/utils/port/SocketFd.cpp | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/td/telegram/InlineQueriesManager.cpp b/td/telegram/InlineQueriesManager.cpp index ca2f421dc..989ce5356 100644 --- a/td/telegram/InlineQueriesManager.cpp +++ b/td/telegram/InlineQueriesManager.cpp @@ -1388,11 +1388,8 @@ void InlineQueriesManager::on_get_inline_query_results(UserId bot_user_id, uint6 Location l(inline_message_geo->geo_); location->location_ = l.get_location_object(); } else { - Slice latitude; - Slice longitude; - Slice horizontal_accuracy; - std::tie(latitude, longitude) = split(Slice(result->description_)); - Location l(to_double(latitude), to_double(longitude), 0.0, 0); + auto latitude_longitude = split(Slice(result->description_)); + Location l(to_double(latitude_longitude.first), to_double(latitude_longitude.second), 0.0, 0); location->location_ = l.get_location_object(); } location->thumbnail_ = register_thumbnail(std::move(result->thumb_)); diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 63a1b20f4..c0a86779d 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -33,8 +33,8 @@ #include "td/telegram/MessageEntity.h" #include "td/telegram/MessageEntity.hpp" #include "td/telegram/MessageId.h" -#include "td/telegram/MessagesManager.h" #include "td/telegram/MessageSearchFilter.h" +#include "td/telegram/MessagesManager.h" #include "td/telegram/misc.h" #include "td/telegram/net/DcId.h" #include "td/telegram/Payments.h" diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index c54f6841b..f2a6aaf85 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6971,7 +6971,7 @@ void MessagesManager::on_user_dialog_action(DialogId dialog_id, MessageId top_th if (td_->auth_manager_->is_bot() || !user_id.is_valid() || is_broadcast_channel(dialog_id)) { return; } - if (!td_->messages_manager_->have_dialog(dialog_id)) { + if (!have_dialog(dialog_id)) { LOG(DEBUG) << "Ignore typing in unknown " << dialog_id; return; } diff --git a/td/telegram/NotificationType.cpp b/td/telegram/NotificationType.cpp index b1f2eddc1..c43bd3afc 100644 --- a/td/telegram/NotificationType.cpp +++ b/td/telegram/NotificationType.cpp @@ -8,7 +8,6 @@ #include "td/telegram/AnimationsManager.h" #include "td/telegram/AudiosManager.h" -#include "td/telegram/ContactsManager.h" #include "td/telegram/DocumentsManager.h" #include "td/telegram/Global.h" #include "td/telegram/MessagesManager.h" diff --git a/tdutils/td/utils/port/SocketFd.cpp b/tdutils/td/utils/port/SocketFd.cpp index feab6676d..a0b06bb14 100644 --- a/tdutils/td/utils/port/SocketFd.cpp +++ b/tdutils/td/utils/port/SocketFd.cpp @@ -391,7 +391,7 @@ class SocketFdImpl { auto write_res = detail::skip_eintr([&] { #ifdef MSG_NOSIGNAL msghdr msg; - memset(&msg, 0, sizeof(msg)); + std::memset(&msg, 0, sizeof(msg)); msg.msg_iov = const_cast(slices.begin()); msg.msg_iovlen = slices_size; return sendmsg(native_fd, &msg, MSG_NOSIGNAL); From 1f484446fc6b42a3fcd1a690cf6450bdb41dcb21 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 2 Nov 2020 19:34:21 +0300 Subject: [PATCH 25/29] Fix pkgconfig install path. GitOrigin-RevId: 2a8a4160d82ee15f02ee9996a7a964bd8fe37c6e --- CMake/GeneratePkgConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/GeneratePkgConfig.cmake b/CMake/GeneratePkgConfig.cmake index bbba7a27f..b9154de13 100644 --- a/CMake/GeneratePkgConfig.cmake +++ b/CMake/GeneratePkgConfig.cmake @@ -76,5 +76,5 @@ CFlags: -I\"\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}\" Libs: -L\"\${prefix}/${CMAKE_INSTALL_LIBDIR}\" -l${TARGET} ${REQUIRES}${LIBRARIES}") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/${TARGET}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/${TARGET}.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endfunction() From b3736ba09840a0fb4a5e513ddc4e7fe1f07aad08 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 2 Nov 2020 20:23:10 +0300 Subject: [PATCH 26/29] Improve wording in build instructions generator. GitOrigin-RevId: a84f204148b06b9859373617829badfca477d5fc --- build.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build.html b/build.html index b97a77958..ed042e4e3 100644 --- a/build.html +++ b/build.html @@ -73,7 +73,7 @@ select.large { font-size: large; }
- +
@@ -486,7 +486,7 @@ function onOptionsChanged() { if (os_windows) { let win10_sdk = (target === 'C++/CX' ? ' and Windows 10 SDK' : ''); if (target !== 'C++/CLI' && target !== 'C++/CX') { - pre_text.push('Note that Windows Subsystem for Linux (WSL) and Cygwin are not Windows environments, so you need to use instructions for Linux instead for them.'); + pre_text.push('Note that Windows Subsystem for Linux (WSL) and Cygwin are not Windows environments, so you need to use instructions for Linux for them instead.'); } pre_text.push('Download and install Microsoft Visual Studio. Enable C++' + win10_sdk + ' support while installing.'); pre_text.push('Download and install CMake; choose "Add CMake to the system PATH" option while installing.'); @@ -523,15 +523,15 @@ function onOptionsChanged() { pre_text.push('Note that for Node.js ≤ 9.11.2 you must build TDLib with OpenSSL 1.0.* and for Node.js ≥ 10 with OpenSSL 1.1.* instead, so you may need to modify the following commands to install a proper OpenSSL version.'); } if (os_freebsd) { - pre_text.push('Note that following instruction is for FreeBSD 11.'); - pre_text.push('Note that following calls to pkg needs to be run as root.'); + pre_text.push('Note that the following instruction is for FreeBSD 11.'); + pre_text.push('Note that the following calls to pkg needs to be run as root.'); } if (os_openbsd) { - pre_text.push('Note that following instruction is for OpenBSD 6.7 and default KSH shell.'); + pre_text.push('Note that the following instruction is for OpenBSD 6.7 and default KSH shell.'); pre_text.push('Note that building requires a lot of memory, so you may need to increase allowed per-process memory usage in /etc/login.conf or build from root.'); } if (os_netbsd) { - pre_text.push('Note that following instruction is for NetBSD 8.0 and default SH shell.'); + pre_text.push('Note that the following instruction is for NetBSD 8.0 and default SH shell.'); } var terminal_name = (function () { @@ -553,7 +553,7 @@ function onOptionsChanged() { return 'Bash'; })(); if (os_windows) { - pre_text.push('Close and re-open ' + terminal_name + ' if PATH environment variable was changed.'); + pre_text.push('Close and re-open ' + terminal_name + ' if the PATH environment variable was changed.'); } pre_text.push('Run these commands in ' + terminal_name + ' to build TDLib and to install it to ' + install_dir + ':'); document.getElementById('buildPre').innerHTML = '
  • ' + pre_text.join('
  • ') + '
'; From 925e590917e92a0fe60ac463aca52f76b3ee0984 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 3 Nov 2020 12:34:34 +0300 Subject: [PATCH 27/29] Enable CMake policy CMP0060 by default. GitOrigin-RevId: 9d2073bbf54af70c44614153f05eed3d324c0fe6 --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73c68f048..ed6e4d5fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,10 @@ if (POLICY CMP0054) # do not expand quoted arguments cmake_policy(SET CMP0054 NEW) endif() +if (POLICY CMP0060) + # link libraries by full path + cmake_policy(SET CMP0060 NEW) +endif() include(PreventInSourceBuild) prevent_in_source_build() From c9a70fcd49757084a0c3124e610e92bf0586894b Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 3 Nov 2020 17:35:12 +0300 Subject: [PATCH 28/29] Minor build.html fixes. GitOrigin-RevId: 4ecacd9a9d10a96e857d348a6a886d74ed613321 --- build.html | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/build.html b/build.html index ed042e4e3..985b8f04c 100644 --- a/build.html +++ b/build.html @@ -10,13 +10,12 @@ select.large { font-size: large; } - - +
-
+

Choose a programming language, from which you want to use TDLib:

- @@ -42,7 +41,7 @@ select.large { font-size: large; }
-
+

Choose an operating system, on which you want to use TDLib:

@@ -67,7 +66,7 @@ select.large { font-size: large; }

-
+
@@ -129,12 +128,12 @@ select.large { font-size: large; }

-
+

Hidden text

-
-

Here is complete instruction for TDLib binaries building:

+
+

Here is complete instruction for TDLib binaries building:

Hidden text

Empty commands
@@ -904,4 +903,3 @@ function onOptionsChanged() { - From 821398fa211b6a3c53733ccf271ee7a783d9bc75 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 4 Nov 2020 03:53:13 +0300 Subject: [PATCH 29/29] Add vcpkg folder to gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4b29dd985..2572f2230 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ auto/ db_backup *.pyc docs/ +vcpkg/