diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index 09381d698..d0b47b8b8 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -52,7 +52,6 @@ inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:strin inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; -inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; @@ -344,6 +343,7 @@ updateMessagePollVote#42f88f2c poll_id:long user_id:int options:Vector = updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update; updateDialogFilterOrder#a5d72105 order:Vector = Update; updateDialogFilters#3504914f = Update; +updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -408,7 +408,7 @@ inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument; documentEmpty#36f8c871 id:long = Document; -document#9ba29cc1 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector dc_id:int attributes:Vector = Document; +document#1e87342b flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector video_thumbs:flags.1?Vector dc_id:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; @@ -605,11 +605,6 @@ channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector min_age_confirm:flags.1?int = help.TermsOfService; -foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; -foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; - -messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; - messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; @@ -1127,6 +1122,8 @@ stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueA help.promoDataEmpty#98f6ac75 expires:int = help.PromoData; help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector users:Vector psa_type:flags.1?string psa_message:flags.2?string = help.PromoData; +videoSize#435bb987 type:string location:FileLocation w:int h:int size:int = VideoSize; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1296,7 +1293,6 @@ messages.migrateChat#15a3b8e3 chat_id:int = Updates; messages.searchGlobal#bf7225a4 flags:# folder_id:flags.0?int q:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; -messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; @@ -1472,6 +1468,7 @@ phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; +phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool; langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector = Vector; diff --git a/td/generate/scheme/telegram_api.tlo b/td/generate/scheme/telegram_api.tlo index d6fdd39b2..a15fad90f 100644 Binary files a/td/generate/scheme/telegram_api.tlo and b/td/generate/scheme/telegram_api.tlo differ diff --git a/td/telegram/CallActor.cpp b/td/telegram/CallActor.cpp index 1d82b4490..5bdeb520e 100644 --- a/td/telegram/CallActor.cpp +++ b/td/telegram/CallActor.cpp @@ -138,6 +138,10 @@ void CallActor::create_call(UserId user_id, tl_object_ptr promise) { promise.set_value(Unit()); @@ -726,7 +730,7 @@ void CallActor::on_get_call_config_result(NetQueryPtr net_query) { } void CallActor::loop() { - LOG(DEBUG) << "Enter loop for call " << call_id_ << " in state " << static_cast(state_) << '/' + LOG(DEBUG) << "Enter loop for " << call_id_ << " in state " << static_cast(state_) << '/' << static_cast(call_state_.type); flush_call_state(); switch (state_) { @@ -747,7 +751,7 @@ void CallActor::loop() { (call_state_.need_rating || call_state_.need_debug_information)) { break; } - LOG(INFO) << "Close call " << local_call_id_; + LOG(INFO) << "Close " << local_call_id_; stop(); break; } diff --git a/td/telegram/CallActor.h b/td/telegram/CallActor.h index 6adc9b987..fe57d9926 100644 --- a/td/telegram/CallActor.h +++ b/td/telegram/CallActor.h @@ -80,6 +80,7 @@ class CallActor : public NetQueryCallback { void create_call(UserId user_id, tl_object_ptr &&input_user, CallProtocol &&protocol, bool is_video, Promise &&promise); + void update_call_signaling_data(string data); void discard_call(bool is_disconnected, int32 duration, bool is_video, int64 connection_id, Promise<> promise); void accept_call(CallProtocol &&protocol, Promise<> promise); void rate_call(int32 rating, string comment, vector> &&problems, diff --git a/td/telegram/CallId.h b/td/telegram/CallId.h index 9a81d0ac8..21c27a2b9 100644 --- a/td/telegram/CallId.h +++ b/td/telegram/CallId.h @@ -53,7 +53,7 @@ struct CallIdHash { }; inline StringBuilder &operator<<(StringBuilder &sb, const CallId call_id) { - return sb << "CallId(" << call_id.get() << ")"; + return sb << "call " << call_id.get(); } } // namespace td diff --git a/td/telegram/CallManager.cpp b/td/telegram/CallManager.cpp index c09ee2d31..8e0dafe42 100644 --- a/td/telegram/CallManager.cpp +++ b/td/telegram/CallManager.cpp @@ -23,7 +23,7 @@ CallManager::CallManager(ActorShared<> parent) : parent_(std::move(parent)) { void CallManager::update_call(Update call) { int64 call_id = 0; downcast_call(*call->phone_call_, [&](auto &update) { call_id = update.id_; }); - LOG(DEBUG) << "Receive UpdateCall for call " << call_id; + LOG(DEBUG) << "Receive UpdateCall for " << call_id; auto &info = call_info_[call_id]; @@ -32,7 +32,7 @@ void CallManager::update_call(Update call) { } if (!info.call_id.is_valid()) { - LOG(INFO) << "Call_id is not valid for call " << call_id << ", postpone update " << to_string(call); + LOG(INFO) << "Call_id is not valid for " << call_id << ", postpone update " << to_string(call); info.updates.push_back(std::move(call)); return; } @@ -44,6 +44,20 @@ void CallManager::update_call(Update call) { send_closure(actor, &CallActor::update_call, std::move(call->phone_call_)); } +void CallManager::update_call_signaling_data(int64 call_id, string data) { + auto info_it = call_info_.find(call_id); + if (info_it == call_info_.end() || !info_it->second.call_id.is_valid()) { + LOG(INFO) << "Ignore signaling data for " << call_id; + } + + auto actor = get_call_actor(info_it->second.call_id); + if (actor.empty()) { + LOG(INFO) << "Ignore signaling data for " << info_it->second.call_id; + return; + } + send_closure(actor, &CallActor::update_call_signaling_data, std::move(data)); +} + void CallManager::create_call(UserId user_id, tl_object_ptr &&input_user, CallProtocol &&protocol, bool is_video, Promise promise) { LOG(INFO) << "Create call with " << user_id; diff --git a/td/telegram/CallManager.h b/td/telegram/CallManager.h index 367984d07..3a261967b 100644 --- a/td/telegram/CallManager.h +++ b/td/telegram/CallManager.h @@ -27,6 +27,7 @@ class CallManager : public Actor { using Update = telegram_api::object_ptr; explicit CallManager(ActorShared<> parent); void update_call(Update call); + void update_call_signaling_data(int64 call_id, string data); void create_call(UserId user_id, tl_object_ptr &&input_user, CallProtocol &&protocol, bool is_video, Promise promise); diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 53b73eea7..c3cbd3968 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -3507,7 +3507,7 @@ static auto secret_to_telegram_document(secret_api::decryptedMessageMediaExterna thumbnails.push_back(secret_to_telegram(*from.thumb_)); return make_tl_object( telegram_api::document::THUMBS_MASK, from.id_, from.access_hash_, BufferSlice(), from.date_, from.mime_type_, - from.size_, std::move(thumbnails), from.dc_id_, secret_to_telegram(from.attributes_)); + from.size_, std::move(thumbnails), Auto(), from.dc_id_, secret_to_telegram(from.attributes_)); } template diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index b8337daa6..a64d2becc 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1982,6 +1982,11 @@ void UpdatesManager::on_update(tl_object_ptr upda send_closure(G()->call_manager(), &CallManager::update_call, std::move(update)); } +void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/) { + send_closure(G()->call_manager(), &CallManager::update_call_signaling_data, update->phone_call_id_, + update->data_.as_slice().str()); +} + void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/) { td_->contacts_manager_->on_update_contacts_reset(); } diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h index 28036f151..84679580b 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -272,6 +272,7 @@ class UpdatesManager : public Actor { void on_update(tl_object_ptr update, bool /*force_apply*/); void on_update(tl_object_ptr update, bool /*force_apply*/); + void on_update(tl_object_ptr update, bool /*force_apply*/); void on_update(tl_object_ptr update, bool /*force_apply*/); diff --git a/td/telegram/Version.h b/td/telegram/Version.h index 7a1c98ea0..79621b02a 100644 --- a/td/telegram/Version.h +++ b/td/telegram/Version.h @@ -8,7 +8,7 @@ namespace td { -constexpr int32 MTPROTO_LAYER = 113; +constexpr int32 MTPROTO_LAYER = 114; enum class Version : int32 { Initial,