/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once class History; namespace Api { struct SendOptions; struct SendAction; } // namespace Api namespace Data { class Story; class Thread; } // namespace Data namespace Main { class Session; } // namespace Main struct PreparedServiceText { TextWithEntities text; std::vector links; }; [[nodiscard]] MessageFlags FlagsFromMTP( MsgId id, MTPDmessage::Flags flags, MessageFlags localFlags); [[nodiscard]] MessageFlags FlagsFromMTP( MsgId id, MTPDmessageService::Flags flags, MessageFlags localFlags); [[nodiscard]] MTPMessageReplyHeader NewMessageReplyHeader( const Api::SendAction &action); enum class MediaCheckResult { Good, Unsupported, Empty, HasExpiredMediaTimeToLive, HasUnsupportedTimeToLive, HasStoryMention, }; [[nodiscard]] MediaCheckResult CheckMessageMedia( const MTPMessageMedia &media); [[nodiscard]] CallId CallIdFromInput(const MTPInputGroupCall &data); [[nodiscard]] std::vector> ParseInvitedToCallUsers( not_null item, const QVector &users); inline constexpr auto kMaxUnreadReactions = 5; // Now 3, but just in case. using OnStackUsers = std::array; [[nodiscard]] OnStackUsers LookupRecentUnreadReactedUsers( not_null item); void CheckReactionNotificationSchedule( not_null item, const OnStackUsers &wasUsers); [[nodiscard]] MessageFlags NewForwardedFlags( not_null peer, PeerId from, not_null fwd); [[nodiscard]] MessageFlags FinalizeMessageFlags( not_null history, MessageFlags flags); [[nodiscard]] bool CopyMarkupToForward(not_null item); [[nodiscard]] TextWithEntities EnsureNonEmpty( const TextWithEntities &text = TextWithEntities()); [[nodiscard]] TextWithEntities UnsupportedMessageText(); void RequestDependentMessageItem( not_null item, PeerId peerId, MsgId msgId); void RequestDependentMessageStory( not_null item, PeerId peerId, StoryId storyId); [[nodiscard]] MessageFlags NewMessageFlags(not_null peer); [[nodiscard]] bool ShouldSendSilent( not_null peer, const Api::SendOptions &options); [[nodiscard]] HistoryItem *LookupReplyTo( not_null history, FullMsgId replyToId); [[nodiscard]] MsgId LookupReplyToTop( not_null history, HistoryItem *replyTo); [[nodiscard]] MsgId LookupReplyToTop( not_null history, FullReplyTo replyTo); [[nodiscard]] bool LookupReplyIsTopicPost(HistoryItem *replyTo); struct SendingErrorRequest { MsgId topicRootId = 0; const HistoryItemsList *forward = nullptr; const Data::Story *story = nullptr; const TextWithTags *text = nullptr; bool ignoreSlowmodeCountdown = false; }; [[nodiscard]] QString GetErrorTextForSending( not_null peer, SendingErrorRequest request); [[nodiscard]] QString GetErrorTextForSending( not_null thread, SendingErrorRequest request); [[nodiscard]] TextWithEntities DropDisallowedCustomEmoji( not_null to, TextWithEntities text); [[nodiscard]] Main::Session *SessionByUniqueId(uint64 sessionUniqueId); [[nodiscard]] HistoryItem *MessageByGlobalId(GlobalMsgId globalId); [[nodiscard]] QDateTime ItemDateTime(not_null item); [[nodiscard]] QString ItemDateText( not_null item, bool isUntilOnline); [[nodiscard]] bool IsItemScheduledUntilOnline( not_null item); [[nodiscard]] ClickHandlerPtr JumpToMessageClickHandler( not_null peer, MsgId msgId, FullMsgId returnToId = FullMsgId(), TextWithEntities highlightPart = {}, int highlightPartOffsetHint = 0); [[nodiscard]] ClickHandlerPtr JumpToMessageClickHandler( not_null item, FullMsgId returnToId = FullMsgId(), TextWithEntities highlightPart = {}, int highlightPartOffsetHint = 0); [[nodiscard]] ClickHandlerPtr JumpToStoryClickHandler( not_null story); ClickHandlerPtr JumpToStoryClickHandler( not_null peer, StoryId storyId); [[nodiscard]] ClickHandlerPtr HideSponsoredClickHandler(); [[nodiscard]] not_null GenerateJoinedMessage( not_null history, TimeId inviteDate, not_null inviter, bool viaRequest); [[nodiscard]] std::optional PeerHasThisCall( not_null peer, CallId id); [[nodiscard]] rpl::producer PeerHasThisCallValue( not_null peer, CallId id); [[nodiscard]] ClickHandlerPtr GroupCallClickHandler( not_null peer, CallId callId); void ShowTrialTranscribesToast(int left, TimeId until); void ClearMediaAsExpired(not_null item); [[nodiscard]] int ItemsForwardSendersCount(const HistoryItemsList &list); [[nodiscard]] int ItemsForwardCaptionsCount(const HistoryItemsList &list);