2016-09-27 17:20:49 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-09-27 17:20:49 +03:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-04-06 17:38:10 +03:00
|
|
|
#include "base/runtime_composer.h"
|
2017-08-31 19:28:58 +03:00
|
|
|
#include "base/flags.h"
|
2017-12-13 22:10:48 +04:00
|
|
|
#include "base/value_ordering.h"
|
2019-03-29 17:17:46 +03:00
|
|
|
#include "data/data_media_types.h"
|
2016-09-29 14:37:16 +03:00
|
|
|
|
2018-01-13 15:45:11 +03:00
|
|
|
enum class UnreadMentionType;
|
2017-12-18 19:44:50 +04:00
|
|
|
struct HistoryMessageReplyMarkup;
|
|
|
|
class ReplyKeyboard;
|
|
|
|
class HistoryMessage;
|
|
|
|
|
2017-09-04 14:40:02 +03:00
|
|
|
namespace base {
|
|
|
|
template <typename Enum>
|
|
|
|
class enum_mask;
|
|
|
|
} // namespace base
|
|
|
|
|
|
|
|
namespace Storage {
|
2018-03-09 21:48:47 +01:00
|
|
|
enum class SharedMediaType : signed char;
|
2017-09-04 14:40:02 +03:00
|
|
|
using SharedMediaTypesMask = base::enum_mask<SharedMediaType>;
|
|
|
|
} // namespace Storage
|
|
|
|
|
2016-11-16 19:04:25 +03:00
|
|
|
namespace Ui {
|
|
|
|
class RippleAnimation;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2016-11-16 13:44:06 +03:00
|
|
|
namespace style {
|
|
|
|
struct BotKeyboardButton;
|
2016-11-16 19:04:25 +03:00
|
|
|
struct RippleAnimation;
|
2016-11-16 13:44:06 +03:00
|
|
|
} // namespace style
|
|
|
|
|
2018-01-09 20:08:31 +03:00
|
|
|
namespace Data {
|
|
|
|
struct MessagePosition;
|
2018-01-14 19:02:25 +03:00
|
|
|
class Media;
|
2018-01-09 20:08:31 +03:00
|
|
|
} // namespace Data
|
|
|
|
|
2018-01-11 22:33:26 +03:00
|
|
|
namespace Window {
|
2019-06-06 13:21:40 +03:00
|
|
|
class SessionController;
|
2018-01-11 22:33:26 +03:00
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
namespace HistoryView {
|
2018-01-27 16:59:24 +03:00
|
|
|
struct TextState;
|
|
|
|
struct StateRequest;
|
|
|
|
enum class CursorState : char;
|
|
|
|
enum class PointState : char;
|
2018-01-11 22:33:26 +03:00
|
|
|
enum class Context : char;
|
2018-01-17 19:21:01 +03:00
|
|
|
class ElementDelegate;
|
2018-01-11 22:33:26 +03:00
|
|
|
} // namespace HistoryView
|
|
|
|
|
2019-03-15 19:15:56 +04:00
|
|
|
struct HiddenSenderInfo;
|
2019-09-13 09:06:02 +03:00
|
|
|
class History;
|
2019-03-15 19:15:56 +04:00
|
|
|
|
2018-01-14 19:02:25 +03:00
|
|
|
class HistoryItem : public RuntimeComposer<HistoryItem> {
|
2016-09-27 17:20:49 +03:00
|
|
|
public:
|
2018-01-14 19:02:25 +03:00
|
|
|
static not_null<HistoryItem*> Create(
|
|
|
|
not_null<History*> history,
|
2019-08-09 20:19:23 +01:00
|
|
|
const MTPMessage &message,
|
|
|
|
MTPDmessage_ClientFlags clientFlags);
|
2018-01-14 19:02:25 +03:00
|
|
|
|
2018-02-05 23:19:51 +03:00
|
|
|
struct Destroyer {
|
|
|
|
void operator()(HistoryItem *value);
|
|
|
|
};
|
|
|
|
|
2016-09-27 17:20:49 +03:00
|
|
|
virtual void dependencyItemRemoved(HistoryItem *dependency) {
|
|
|
|
}
|
|
|
|
virtual bool updateDependencyItem() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual MsgId dependencyMsgId() const {
|
|
|
|
return 0;
|
|
|
|
}
|
2019-08-28 17:24:12 +03:00
|
|
|
[[nodiscard]] virtual bool notificationReady() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return true;
|
|
|
|
}
|
2019-08-28 17:24:12 +03:00
|
|
|
[[nodiscard]] PeerData *specialNotificationPeer() const;
|
2017-12-01 22:38:44 +04:00
|
|
|
virtual void applyGroupAdminChanges(
|
2019-07-19 15:34:09 +02:00
|
|
|
const base::flat_set<UserId> &changes) {
|
2017-12-01 22:38:44 +04:00
|
|
|
}
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-28 17:24:12 +03:00
|
|
|
[[nodiscard]] UserData *viaBot() const;
|
|
|
|
[[nodiscard]] UserData *getMessageBot() const;
|
|
|
|
[[nodiscard]] bool isHistoryEntry() const;
|
2019-09-06 12:20:12 +03:00
|
|
|
[[nodiscard]] bool isAdminLogEntry() const;
|
2019-08-28 17:24:12 +03:00
|
|
|
[[nodiscard]] bool isFromScheduled() const;
|
|
|
|
[[nodiscard]] bool isScheduled() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2017-12-18 19:44:50 +04:00
|
|
|
void addLogEntryOriginal(
|
|
|
|
WebPageId localId,
|
|
|
|
const QString &label,
|
|
|
|
const TextWithEntities &content);
|
2017-06-18 16:08:49 +03:00
|
|
|
|
2017-08-25 18:17:46 +03:00
|
|
|
not_null<History*> history() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return _history;
|
|
|
|
}
|
2018-01-13 15:45:11 +03:00
|
|
|
not_null<PeerData*> from() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return _from;
|
|
|
|
}
|
2018-01-11 22:33:26 +03:00
|
|
|
HistoryView::Element *mainView() const {
|
2018-01-10 16:13:33 +03:00
|
|
|
return _mainView;
|
|
|
|
}
|
2018-03-10 15:47:19 +03:00
|
|
|
void setMainView(not_null<HistoryView::Element*> view) {
|
2018-01-11 16:07:29 +03:00
|
|
|
_mainView = view;
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2018-01-18 16:59:22 +03:00
|
|
|
void refreshMainView();
|
2018-01-11 16:07:29 +03:00
|
|
|
void clearMainView();
|
|
|
|
void removeMainView();
|
2017-05-12 17:05:06 +03:00
|
|
|
|
2018-01-11 16:07:29 +03:00
|
|
|
void destroy();
|
2019-04-30 13:48:48 +04:00
|
|
|
[[nodiscard]] bool out() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return _flags & MTPDmessage::Flag::f_out;
|
|
|
|
}
|
2019-04-30 13:48:48 +04:00
|
|
|
[[nodiscard]] bool unread() const;
|
2019-08-28 17:24:12 +03:00
|
|
|
[[nodiscard]] bool showNotification() const;
|
2019-04-30 13:48:48 +04:00
|
|
|
void markClientSideAsRead();
|
2019-05-28 16:53:36 +02:00
|
|
|
[[nodiscard]] bool mentionsMe() const;
|
2019-04-30 13:48:48 +04:00
|
|
|
[[nodiscard]] bool isUnreadMention() const;
|
|
|
|
[[nodiscard]] bool isUnreadMedia() const;
|
|
|
|
[[nodiscard]] bool hasUnreadMediaFlag() const;
|
2017-08-25 15:48:10 +03:00
|
|
|
void markMediaRead();
|
2017-07-17 23:09:55 +03:00
|
|
|
|
2019-03-29 17:17:46 +03:00
|
|
|
// For edit media in history_message.
|
|
|
|
virtual void returnSavedMedia() {};
|
2019-03-31 23:45:55 +03:00
|
|
|
void savePreviousMedia() {
|
|
|
|
_savedMedia = _media->clone(this);
|
|
|
|
}
|
2019-04-30 13:48:48 +04:00
|
|
|
[[nodiscard]] bool isEditingMedia() const {
|
2019-04-04 13:22:59 +03:00
|
|
|
return _savedMedia != nullptr;
|
|
|
|
}
|
2019-03-30 11:13:16 +03:00
|
|
|
void clearSavedMedia() {
|
|
|
|
_savedMedia = nullptr;
|
|
|
|
}
|
2019-03-29 17:17:46 +03:00
|
|
|
|
2017-07-17 23:09:55 +03:00
|
|
|
// Zero result means this message is not self-destructing right now.
|
2019-02-19 10:57:53 +04:00
|
|
|
virtual crl::time getSelfDestructIn(crl::time now) {
|
2017-07-17 23:09:55 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool definesReplyKeyboard() const;
|
|
|
|
[[nodiscard]] MTPDreplyKeyboardMarkup::Flags replyKeyboardFlags() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool hasSwitchInlineButton() const {
|
2019-08-09 20:19:23 +01:00
|
|
|
return _clientFlags & MTPDmessage_ClientFlag::f_has_switch_inline_button;
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool hasTextLinks() const {
|
2019-08-09 20:19:23 +01:00
|
|
|
return _clientFlags & MTPDmessage_ClientFlag::f_has_text_links;
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool isGroupEssential() const {
|
2019-08-09 20:19:23 +01:00
|
|
|
return _clientFlags & MTPDmessage_ClientFlag::f_is_group_essential;
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool isLocalUpdateMedia() const {
|
2019-08-09 20:19:23 +01:00
|
|
|
return _clientFlags & MTPDmessage_ClientFlag::f_is_local_update_media;
|
2019-04-04 13:22:59 +03:00
|
|
|
}
|
|
|
|
void setIsLocalUpdateMedia(bool flag) {
|
|
|
|
if (flag) {
|
2019-08-09 20:19:23 +01:00
|
|
|
_clientFlags |= MTPDmessage_ClientFlag::f_is_local_update_media;
|
2019-04-04 13:22:59 +03:00
|
|
|
} else {
|
2019-08-09 20:19:23 +01:00
|
|
|
_clientFlags &= ~MTPDmessage_ClientFlag::f_is_local_update_media;
|
2019-04-04 13:22:59 +03:00
|
|
|
}
|
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool isGroupMigrate() const {
|
2019-01-22 11:50:21 +04:00
|
|
|
return isGroupEssential() && isEmpty();
|
|
|
|
}
|
2019-08-02 19:19:14 +01:00
|
|
|
[[nodiscard]] bool isIsolatedEmoji() const {
|
2019-08-09 20:19:23 +01:00
|
|
|
return _clientFlags & MTPDmessage_ClientFlag::f_isolated_emoji;
|
2019-08-01 22:14:19 +01:00
|
|
|
}
|
|
|
|
[[nodiscard]] bool hasViews() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return _flags & MTPDmessage::Flag::f_views;
|
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool isPost() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return _flags & MTPDmessage::Flag::f_post;
|
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool isSilent() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return _flags & MTPDmessage::Flag::f_silent;
|
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool isSending() const {
|
2019-08-09 20:19:23 +01:00
|
|
|
return _clientFlags & MTPDmessage_ClientFlag::f_sending;
|
2019-07-17 16:34:39 +02:00
|
|
|
}
|
2019-08-01 22:14:19 +01:00
|
|
|
[[nodiscard]] bool hasFailed() const {
|
2019-08-09 20:19:23 +01:00
|
|
|
return _clientFlags & MTPDmessage_ClientFlag::f_failed;
|
2019-07-17 16:34:39 +02:00
|
|
|
}
|
|
|
|
void sendFailed();
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual int viewsCount() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return hasViews() ? 1 : -1;
|
|
|
|
}
|
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual bool needCheck() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual bool serviceMsg() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
virtual void applyEdition(const MTPDmessage &message) {
|
|
|
|
}
|
|
|
|
virtual void applyEdition(const MTPDmessageService &message) {
|
|
|
|
}
|
2019-04-08 13:16:45 +04:00
|
|
|
void applyEditionToHistoryCleared();
|
2019-08-07 15:38:26 +01:00
|
|
|
virtual void updateSentContent(
|
|
|
|
const TextWithEntities &textWithEntities,
|
|
|
|
const MTPMessageMedia *media) {
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2016-10-20 18:26:55 +03:00
|
|
|
virtual void updateReplyMarkup(const MTPReplyMarkup *markup) {
|
|
|
|
}
|
2019-03-15 19:15:56 +04:00
|
|
|
virtual void updateForwardedInfo(const MTPMessageFwdHeader *fwd) {
|
|
|
|
}
|
2019-08-20 12:42:13 +03:00
|
|
|
virtual void contributeToSlowmode(TimeId realDate = 0) {
|
|
|
|
}
|
2017-09-04 14:40:02 +03:00
|
|
|
|
2018-01-13 15:45:11 +03:00
|
|
|
virtual void addToUnreadMentions(UnreadMentionType type);
|
2017-12-08 22:27:28 +04:00
|
|
|
virtual void eraseFromUnreadMentions() {
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual Storage::SharedMediaTypesMask sharedMediaTypes() const = 0;
|
2016-11-18 19:27:47 +03:00
|
|
|
|
2018-01-14 19:02:25 +03:00
|
|
|
void indexAsNewItem();
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual QString notificationHeader() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return QString();
|
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual QString notificationText() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2017-09-05 20:21:56 +03:00
|
|
|
enum class DrawInDialog {
|
|
|
|
Normal,
|
|
|
|
WithoutSender,
|
|
|
|
};
|
|
|
|
|
2016-09-27 17:20:49 +03:00
|
|
|
// Returns text with link-start and link-end commands for service-color highlighting.
|
|
|
|
// Example: "[link1-start]You:[link1-end] [link1-start]Photo,[link1-end] caption text"
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual QString inDialogsText(DrawInDialog way) const;
|
|
|
|
[[nodiscard]] virtual QString inReplyText() const {
|
2018-05-31 14:13:11 +03:00
|
|
|
return inDialogsText(DrawInDialog::WithoutSender);
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual Ui::Text::IsolatedEmoji isolatedEmoji() const;
|
|
|
|
[[nodiscard]] virtual TextWithEntities originalText() const {
|
2019-04-08 19:10:06 +04:00
|
|
|
return TextWithEntities();
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual TextForMimeData clipboardText() const {
|
2019-04-08 19:10:06 +04:00
|
|
|
return TextForMimeData();
|
2018-01-26 18:40:11 +03:00
|
|
|
}
|
2016-09-27 17:20:49 +03:00
|
|
|
|
|
|
|
virtual void setViewsCount(int32 count) {
|
|
|
|
}
|
2018-01-13 15:45:11 +03:00
|
|
|
virtual void setRealId(MsgId newId);
|
2017-09-05 20:21:56 +03:00
|
|
|
|
|
|
|
void drawInDialog(
|
|
|
|
Painter &p,
|
|
|
|
const QRect &r,
|
|
|
|
bool active,
|
|
|
|
bool selected,
|
|
|
|
DrawInDialog way,
|
|
|
|
const HistoryItem *&cacheFor,
|
2019-06-12 15:26:04 +02:00
|
|
|
Ui::Text::String &cache) const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] bool emptyText() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return _text.isEmpty();
|
|
|
|
}
|
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] bool isPinned() const;
|
|
|
|
[[nodiscard]] bool canPin() const;
|
|
|
|
[[nodiscard]] bool canStopPoll() const;
|
|
|
|
[[nodiscard]] virtual bool allowsSendNow() const;
|
|
|
|
[[nodiscard]] virtual bool allowsForward() const;
|
|
|
|
[[nodiscard]] virtual bool allowsEdit(TimeId now) const;
|
|
|
|
[[nodiscard]] bool canDelete() const;
|
|
|
|
[[nodiscard]] bool canDeleteForEveryone(TimeId now) const;
|
|
|
|
[[nodiscard]] bool suggestReport() const;
|
|
|
|
[[nodiscard]] bool suggestBanReport() const;
|
|
|
|
[[nodiscard]] bool suggestDeleteAllReport() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] bool hasDirectLink() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] ChannelId channelId() const;
|
|
|
|
[[nodiscard]] FullMsgId fullId() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return FullMsgId(channelId(), id);
|
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] Data::MessagePosition position() const;
|
|
|
|
[[nodiscard]] TimeId date() const;
|
|
|
|
|
|
|
|
[[nodiscard]] static TimeId NewMessageDate(TimeId scheduled);
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] Data::Media *media() const {
|
2017-03-05 16:39:10 +03:00
|
|
|
return _media.get();
|
2016-09-27 17:20:49 +03:00
|
|
|
}
|
|
|
|
virtual void setText(const TextWithEntities &textWithEntities) {
|
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual bool textHasLinks() const {
|
2016-09-27 17:20:49 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual HistoryMessage *toHistoryMessage() { // dynamic_cast optimize
|
2016-09-27 17:20:49 +03:00
|
|
|
return nullptr;
|
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual const HistoryMessage *toHistoryMessage() const { // dynamic_cast optimize
|
2016-09-27 17:20:49 +03:00
|
|
|
return nullptr;
|
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] MsgId replyToId() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] not_null<PeerData*> author() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] TimeId dateOriginal() const;
|
|
|
|
[[nodiscard]] PeerData *senderOriginal() const;
|
|
|
|
[[nodiscard]] const HiddenSenderInfo *hiddenForwardedInfo() const;
|
|
|
|
[[nodiscard]] not_null<PeerData*> fromOriginal() const;
|
|
|
|
[[nodiscard]] QString authorOriginal() const;
|
|
|
|
[[nodiscard]] MsgId idOriginal() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] bool isEmpty() const;
|
2017-12-13 22:10:48 +04:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] MessageGroupId groupId() const;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] const HistoryMessageReplyMarkup *inlineReplyMarkup() const {
|
2019-05-25 16:42:01 +02:00
|
|
|
return const_cast<HistoryItem*>(this)->inlineReplyMarkup();
|
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] const ReplyKeyboard *inlineReplyKeyboard() const {
|
2019-05-25 16:42:01 +02:00
|
|
|
return const_cast<HistoryItem*>(this)->inlineReplyKeyboard();
|
|
|
|
}
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] HistoryMessageReplyMarkup *inlineReplyMarkup();
|
|
|
|
[[nodiscard]] ReplyKeyboard *inlineReplyKeyboard();
|
2019-05-25 16:42:01 +02:00
|
|
|
|
2019-05-25 17:05:57 +02:00
|
|
|
[[nodiscard]] ChannelData *discussionPostOriginalSender() const;
|
|
|
|
[[nodiscard]] bool isDiscussionPost() const;
|
|
|
|
[[nodiscard]] PeerData *displayFrom() const;
|
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
[[nodiscard]] virtual std::unique_ptr<HistoryView::Element> createView(
|
2018-01-17 19:21:01 +03:00
|
|
|
not_null<HistoryView::ElementDelegate*> delegate) = 0;
|
2018-01-11 22:33:26 +03:00
|
|
|
|
2018-01-13 15:45:11 +03:00
|
|
|
virtual ~HistoryItem();
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-08-12 17:33:36 +01:00
|
|
|
MsgId id;
|
|
|
|
|
2016-09-27 17:20:49 +03:00
|
|
|
protected:
|
2017-08-25 18:17:46 +03:00
|
|
|
HistoryItem(
|
|
|
|
not_null<History*> history,
|
|
|
|
MsgId id,
|
|
|
|
MTPDmessage::Flags flags,
|
2019-08-09 20:19:23 +01:00
|
|
|
MTPDmessage_ClientFlags clientFlags,
|
2018-02-03 22:52:35 +03:00
|
|
|
TimeId date,
|
2017-08-25 18:17:46 +03:00
|
|
|
UserId from);
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2017-07-17 23:09:55 +03:00
|
|
|
virtual void markMediaAsReadHook() {
|
|
|
|
}
|
|
|
|
|
2016-09-27 17:20:49 +03:00
|
|
|
void finishEdition(int oldKeyboardTop);
|
|
|
|
void finishEditionToEmpty();
|
|
|
|
|
2017-08-25 18:17:46 +03:00
|
|
|
const not_null<History*> _history;
|
2017-08-17 11:31:24 +03:00
|
|
|
not_null<PeerData*> _from;
|
2017-06-21 11:53:14 +03:00
|
|
|
MTPDmessage::Flags _flags = 0;
|
2019-08-09 20:19:23 +01:00
|
|
|
MTPDmessage_ClientFlags _clientFlags = 0;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-01-15 15:57:45 +04:00
|
|
|
void invalidateChatListEntry();
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2018-01-14 19:02:25 +03:00
|
|
|
void setGroupId(MessageGroupId groupId);
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2019-06-12 15:26:04 +02:00
|
|
|
Ui::Text::String _text = { st::msgMinWidth };
|
2016-09-27 17:20:49 +03:00
|
|
|
int _textWidth = -1;
|
|
|
|
int _textHeight = 0;
|
|
|
|
|
2019-03-29 17:17:46 +03:00
|
|
|
std::unique_ptr<Data::Media> _savedMedia;
|
2018-01-14 19:02:25 +03:00
|
|
|
std::unique_ptr<Data::Media> _media;
|
2016-09-27 17:20:49 +03:00
|
|
|
|
2017-05-12 16:53:08 +03:00
|
|
|
private:
|
2018-02-03 22:52:35 +03:00
|
|
|
TimeId _date = 0;
|
|
|
|
|
2018-01-11 22:33:26 +03:00
|
|
|
HistoryView::Element *_mainView = nullptr;
|
2018-01-13 15:45:11 +03:00
|
|
|
friend class HistoryView::Element;
|
2017-05-12 16:53:08 +03:00
|
|
|
|
2019-06-01 00:51:57 +03:00
|
|
|
MessageGroupId _groupId = MessageGroupId();
|
2018-01-14 19:02:25 +03:00
|
|
|
|
2016-09-27 17:20:49 +03:00
|
|
|
};
|
|
|
|
|
2018-02-03 22:52:35 +03:00
|
|
|
QDateTime ItemDateTime(not_null<const HistoryItem*> item);
|
|
|
|
|
2018-01-13 15:45:11 +03:00
|
|
|
ClickHandlerPtr goToMessageClickHandler(
|
|
|
|
not_null<PeerData*> peer,
|
2018-01-26 18:40:11 +03:00
|
|
|
MsgId msgId,
|
|
|
|
FullMsgId returnToId = FullMsgId());
|
|
|
|
ClickHandlerPtr goToMessageClickHandler(
|
|
|
|
not_null<HistoryItem*> item,
|
|
|
|
FullMsgId returnToId = FullMsgId());
|