/* 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 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, HasTimeToLive, }; [[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(MessageFlags flags); [[nodiscard]] bool CopyMarkupToForward(not_null item); [[nodiscard]] TextWithEntities EnsureNonEmpty( const TextWithEntities &text = TextWithEntities()); [[nodiscard]] TextWithEntities UnsupportedMessageText(); void RequestDependentMessageData( not_null item, PeerId peerId, MsgId msgId); [[nodiscard]] MessageFlags NewMessageFlags(not_null peer); [[nodiscard]] bool ShouldSendSilent( not_null peer, const Api::SendOptions &options); [[nodiscard]] HistoryItem *LookupReplyTo( not_null history, MsgId replyToId); [[nodiscard]] MsgId LookupReplyToTop(HistoryItem *replyTo); [[nodiscard]] bool LookupReplyIsTopicPost(HistoryItem *replyTo); struct SendingErrorRequest { MsgId topicRootId = 0; const HistoryItemsList *forward = 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 DropCustomEmoji(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()); [[nodiscard]] ClickHandlerPtr JumpToMessageClickHandler( not_null item, FullMsgId returnToId = FullMsgId()); [[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);