diff --git a/Telegram/SourceFiles/api/api_statistics.cpp b/Telegram/SourceFiles/api/api_statistics.cpp index e889c3cdb..a26f73502 100644 --- a/Telegram/SourceFiles/api/api_statistics.cpp +++ b/Telegram/SourceFiles/api/api_statistics.cpp @@ -383,11 +383,12 @@ void PublicForwards::requestMessage( _requestId = makeRequest(MTPstats_GetMessagePublicForwards( channel()->inputChannel, MTP_int(_fullId.messageId.msg), - MTP_int(token.rate), - tlOffsetPeer, - MTP_int(token.fullId.msg), + //MTP_int(token.rate), + //tlOffsetPeer, + //MTP_int(token.fullId.msg), + MTP_string(), // offset kLimit - )).done([=, channel = channel()](const MTPmessages_Messages &result) { + )).done([=, channel = channel()](const MTPstats_PublicForwards &result) { using Messages = QVector; _requestId = 0; @@ -414,6 +415,8 @@ void PublicForwards::requestMessage( auto allLoaded = false; auto fullCount = 0; + auto messages = Messages(); +#if 0 // todo auto messages = result.match([&](const MTPDmessages_messages &data) { channel->owner().processUsers(data.vusers()); channel->owner().processChats(data.vchats()); @@ -447,7 +450,7 @@ void PublicForwards::requestMessage( allLoaded = true; return Messages(); }); - +#endif _lastTotal = std::max(_lastTotal, fullCount); done({ .list = std::move(messages), diff --git a/Telegram/SourceFiles/data/data_story.cpp b/Telegram/SourceFiles/data/data_story.cpp index 309b3b204..d1af2b73f 100644 --- a/Telegram/SourceFiles/data/data_story.cpp +++ b/Telegram/SourceFiles/data/data_story.cpp @@ -81,8 +81,11 @@ using UpdateFlag = StoryUpdate::Flag; }, [](const MTPDgeoPointEmpty &) { }); }, [&](const MTPDmediaAreaSuggestedReaction &data) { + }, [&](const MTPDmediaAreaChannelPost &data) { + }, [&](const MTPDinputMediaAreaChannelPost &data) { + LOG(("API Error: Unexpected inputMediaAreaChannelPost from API.")); }, [&](const MTPDinputMediaAreaVenue &data) { - LOG(("API Error: Unexpected inputMediaAreaVenue in API data.")); + LOG(("API Error: Unexpected inputMediaAreaVenue from API.")); }); return result; } @@ -99,8 +102,32 @@ using UpdateFlag = StoryUpdate::Flag; .flipped = data.is_flipped(), .dark = data.is_dark(), }); + }, [&](const MTPDmediaAreaChannelPost &data) { + }, [&](const MTPDinputMediaAreaChannelPost &data) { + LOG(("API Error: Unexpected inputMediaAreaChannelPost from API.")); }, [&](const MTPDinputMediaAreaVenue &data) { - LOG(("API Error: Unexpected inputMediaAreaVenue in API data.")); + LOG(("API Error: Unexpected inputMediaAreaVenue from API.")); + }); + return result; +} + +[[nodiscard]] auto ParseChannelPost(const MTPMediaArea &area) +-> std::optional { + auto result = std::optional(); + area.match([&](const MTPDmediaAreaVenue &data) { + }, [&](const MTPDmediaAreaGeoPoint &data) { + }, [&](const MTPDmediaAreaSuggestedReaction &data) { + }, [&](const MTPDmediaAreaChannelPost &data) { + result.emplace(ChannelPost{ + .area = ParseArea(data.vcoordinates()), + .itemId = FullMsgId( + peerFromChannel(data.vchannel_id()), + data.vmsg_id().v), + }); + }, [&](const MTPDinputMediaAreaChannelPost &data) { + LOG(("API Error: Unexpected inputMediaAreaChannelPost from API.")); + }, [&](const MTPDinputMediaAreaVenue &data) { + LOG(("API Error: Unexpected inputMediaAreaVenue from API.")); }); return result; } diff --git a/Telegram/SourceFiles/data/data_story.h b/Telegram/SourceFiles/data/data_story.h index b97e12379..ee48c2d10 100644 --- a/Telegram/SourceFiles/data/data_story.h +++ b/Telegram/SourceFiles/data/data_story.h @@ -109,6 +109,15 @@ struct SuggestedReaction { const SuggestedReaction &) = default; }; +struct ChannelPost { + StoryArea area; + FullMsgId itemId; + + friend inline bool operator==( + const ChannelPost &, + const ChannelPost &) = default; +}; + class Story final { public: Story( diff --git a/Telegram/SourceFiles/mtproto/scheme/api.tl b/Telegram/SourceFiles/mtproto/scheme/api.tl index e085eaf91..9977b8e8b 100644 --- a/Telegram/SourceFiles/mtproto/scheme/api.tl +++ b/Telegram/SourceFiles/mtproto/scheme/api.tl @@ -1575,6 +1575,8 @@ mediaAreaVenue#be82db9c coordinates:MediaAreaCoordinates geo:GeoPoint title:stri inputMediaAreaVenue#b282217f coordinates:MediaAreaCoordinates query_id:long result_id:string = MediaArea; mediaAreaGeoPoint#df8b3b22 coordinates:MediaAreaCoordinates geo:GeoPoint = MediaArea; mediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea; +mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea; +inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea; peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector = PeerStories; @@ -2164,7 +2166,7 @@ folders.editPeerFolders#6847d0ab folder_peers:Vector = Updates; stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards; stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards;