Strong typing for MessageContent type.
GitOrigin-RevId: b89a431f6252ec47ebf2c3653eafbf71abbd7678
This commit is contained in:
parent
3c8e8f106f
commit
946b46ad8c
File diff suppressed because it is too large
Load Diff
@ -69,6 +69,55 @@ class Td;
|
|||||||
|
|
||||||
class MultiSequenceDispatcher;
|
class MultiSequenceDispatcher;
|
||||||
|
|
||||||
|
enum class MessageContentType : int32 {
|
||||||
|
None = -1,
|
||||||
|
Text,
|
||||||
|
Animation,
|
||||||
|
Audio,
|
||||||
|
Document,
|
||||||
|
Photo,
|
||||||
|
Sticker,
|
||||||
|
Video,
|
||||||
|
VoiceNote,
|
||||||
|
Contact,
|
||||||
|
Location,
|
||||||
|
Venue,
|
||||||
|
ChatCreate,
|
||||||
|
ChatChangeTitle,
|
||||||
|
ChatChangePhoto,
|
||||||
|
ChatDeletePhoto,
|
||||||
|
ChatDeleteHistory,
|
||||||
|
ChatAddUsers,
|
||||||
|
ChatJoinedByLink,
|
||||||
|
ChatDeleteUser,
|
||||||
|
ChatMigrateTo,
|
||||||
|
ChannelCreate,
|
||||||
|
ChannelMigrateFrom,
|
||||||
|
PinMessage,
|
||||||
|
Game,
|
||||||
|
GameScore,
|
||||||
|
ScreenshotTaken,
|
||||||
|
ChatSetTtl,
|
||||||
|
Unsupported,
|
||||||
|
Call,
|
||||||
|
Invoice,
|
||||||
|
PaymentSuccessful,
|
||||||
|
VideoNote,
|
||||||
|
ContactRegistered,
|
||||||
|
ExpiredPhoto,
|
||||||
|
ExpiredVideo,
|
||||||
|
LiveLocation,
|
||||||
|
CustomServiceAction,
|
||||||
|
WebsiteConnected,
|
||||||
|
PassportDataSent,
|
||||||
|
PassportDataReceived
|
||||||
|
};
|
||||||
|
|
||||||
|
inline StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type) {
|
||||||
|
// TODO
|
||||||
|
return string_builder << static_cast<int32>(content_type);
|
||||||
|
}
|
||||||
|
|
||||||
// Do not forget to update MessagesManager::update_message_content when one of the inheritors of this class changes
|
// Do not forget to update MessagesManager::update_message_content when one of the inheritors of this class changes
|
||||||
class MessageContent {
|
class MessageContent {
|
||||||
public:
|
public:
|
||||||
@ -78,7 +127,7 @@ class MessageContent {
|
|||||||
MessageContent(MessageContent &&) = default;
|
MessageContent(MessageContent &&) = default;
|
||||||
MessageContent &operator=(MessageContent &&) = default;
|
MessageContent &operator=(MessageContent &&) = default;
|
||||||
|
|
||||||
virtual int32 get_id() const = 0;
|
virtual MessageContentType get_id() const = 0;
|
||||||
virtual ~MessageContent() = default;
|
virtual ~MessageContent() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,9 +140,8 @@ class MessageText : public MessageContent {
|
|||||||
MessageText(FormattedText text, WebPageId web_page_id) : text(std::move(text)), web_page_id(web_page_id) {
|
MessageText(FormattedText text, WebPageId web_page_id) : text(std::move(text)), web_page_id(web_page_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 0;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Text;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,9 +155,8 @@ class MessageAnimation : public MessageContent {
|
|||||||
MessageAnimation(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
MessageAnimation(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 1;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Animation;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,9 +170,8 @@ class MessageAudio : public MessageContent {
|
|||||||
MessageAudio(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
MessageAudio(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 2;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Audio;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,9 +185,8 @@ class MessageDocument : public MessageContent {
|
|||||||
MessageDocument(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
MessageDocument(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 3;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Document;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,9 +200,8 @@ class MessagePhoto : public MessageContent {
|
|||||||
MessagePhoto(Photo &&photo, FormattedText &&caption) : photo(std::move(photo)), caption(std::move(caption)) {
|
MessagePhoto(Photo &&photo, FormattedText &&caption) : photo(std::move(photo)), caption(std::move(caption)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 4;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Photo;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -169,9 +213,8 @@ class MessageSticker : public MessageContent {
|
|||||||
explicit MessageSticker(FileId file_id) : file_id(file_id) {
|
explicit MessageSticker(FileId file_id) : file_id(file_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 5;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Sticker;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -185,9 +228,8 @@ class MessageVideo : public MessageContent {
|
|||||||
MessageVideo(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
MessageVideo(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 6;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Video;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -203,9 +245,8 @@ class MessageVoiceNote : public MessageContent {
|
|||||||
: file_id(file_id), caption(std::move(caption)), is_listened(is_listened) {
|
: file_id(file_id), caption(std::move(caption)), is_listened(is_listened) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 7;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::VoiceNote;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -217,9 +258,8 @@ class MessageContact : public MessageContent {
|
|||||||
explicit MessageContact(Contact &&contact) : contact(std::move(contact)) {
|
explicit MessageContact(Contact &&contact) : contact(std::move(contact)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 8;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Contact;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -231,9 +271,8 @@ class MessageLocation : public MessageContent {
|
|||||||
explicit MessageLocation(Location &&location) : location(std::move(location)) {
|
explicit MessageLocation(Location &&location) : location(std::move(location)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 9;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Location;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -245,9 +284,8 @@ class MessageVenue : public MessageContent {
|
|||||||
explicit MessageVenue(Venue &&venue) : venue(std::move(venue)) {
|
explicit MessageVenue(Venue &&venue) : venue(std::move(venue)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 10;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Venue;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -261,9 +299,8 @@ class MessageChatCreate : public MessageContent {
|
|||||||
: title(std::move(title)), participant_user_ids(std::move(participant_user_ids)) {
|
: title(std::move(title)), participant_user_ids(std::move(participant_user_ids)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 11;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatCreate;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -275,9 +312,8 @@ class MessageChatChangeTitle : public MessageContent {
|
|||||||
explicit MessageChatChangeTitle(string &&title) : title(std::move(title)) {
|
explicit MessageChatChangeTitle(string &&title) : title(std::move(title)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 12;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatChangeTitle;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -289,25 +325,22 @@ class MessageChatChangePhoto : public MessageContent {
|
|||||||
explicit MessageChatChangePhoto(Photo &&photo) : photo(std::move(photo)) {
|
explicit MessageChatChangePhoto(Photo &&photo) : photo(std::move(photo)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 13;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatChangePhoto;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageChatDeletePhoto : public MessageContent {
|
class MessageChatDeletePhoto : public MessageContent {
|
||||||
public:
|
public:
|
||||||
static const int32 ID = 14;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatDeletePhoto;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageChatDeleteHistory : public MessageContent {
|
class MessageChatDeleteHistory : public MessageContent {
|
||||||
public:
|
public:
|
||||||
static const int32 ID = 15;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatDeleteHistory;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -319,17 +352,15 @@ class MessageChatAddUsers : public MessageContent {
|
|||||||
explicit MessageChatAddUsers(vector<UserId> &&user_ids) : user_ids(std::move(user_ids)) {
|
explicit MessageChatAddUsers(vector<UserId> &&user_ids) : user_ids(std::move(user_ids)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 16;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatAddUsers;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageChatJoinedByLink : public MessageContent {
|
class MessageChatJoinedByLink : public MessageContent {
|
||||||
public:
|
public:
|
||||||
static const int32 ID = 17;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatJoinedByLink;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -341,9 +372,8 @@ class MessageChatDeleteUser : public MessageContent {
|
|||||||
explicit MessageChatDeleteUser(UserId user_id) : user_id(user_id) {
|
explicit MessageChatDeleteUser(UserId user_id) : user_id(user_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 18;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatDeleteUser;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -355,9 +385,8 @@ class MessageChatMigrateTo : public MessageContent {
|
|||||||
explicit MessageChatMigrateTo(ChannelId migrated_to_channel_id) : migrated_to_channel_id(migrated_to_channel_id) {
|
explicit MessageChatMigrateTo(ChannelId migrated_to_channel_id) : migrated_to_channel_id(migrated_to_channel_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 19;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatMigrateTo;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -369,9 +398,8 @@ class MessageChannelCreate : public MessageContent {
|
|||||||
explicit MessageChannelCreate(string &&title) : title(std::move(title)) {
|
explicit MessageChannelCreate(string &&title) : title(std::move(title)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 20;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChannelCreate;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -385,9 +413,8 @@ class MessageChannelMigrateFrom : public MessageContent {
|
|||||||
: title(std::move(title)), migrated_from_chat_id(migrated_from_chat_id) {
|
: title(std::move(title)), migrated_from_chat_id(migrated_from_chat_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 21;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChannelMigrateFrom;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -399,9 +426,8 @@ class MessagePinMessage : public MessageContent {
|
|||||||
explicit MessagePinMessage(MessageId message_id) : message_id(message_id) {
|
explicit MessagePinMessage(MessageId message_id) : message_id(message_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 22;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::PinMessage;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -413,9 +439,8 @@ class MessageGame : public MessageContent {
|
|||||||
explicit MessageGame(Game &&game) : game(std::move(game)) {
|
explicit MessageGame(Game &&game) : game(std::move(game)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 23;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Game;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -430,17 +455,15 @@ class MessageGameScore : public MessageContent {
|
|||||||
: game_message_id(game_message_id), game_id(game_id), score(score) {
|
: game_message_id(game_message_id), game_id(game_id), score(score) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 24;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::GameScore;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageScreenshotTaken : public MessageContent {
|
class MessageScreenshotTaken : public MessageContent {
|
||||||
public:
|
public:
|
||||||
static const int32 ID = 25;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ScreenshotTaken;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -452,9 +475,8 @@ class MessageChatSetTtl : public MessageContent {
|
|||||||
explicit MessageChatSetTtl(int32 ttl) : ttl(ttl) {
|
explicit MessageChatSetTtl(int32 ttl) : ttl(ttl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 26;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ChatSetTtl;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -462,9 +484,8 @@ class MessageUnsupported
|
|||||||
: public MessageContent { // TODO save a layer in which the message was received to
|
: public MessageContent { // TODO save a layer in which the message was received to
|
||||||
// automatically reget it if the layer changes
|
// automatically reget it if the layer changes
|
||||||
public:
|
public:
|
||||||
static const int32 ID = 27;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Unsupported;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -479,9 +500,8 @@ class MessageCall : public MessageContent {
|
|||||||
: call_id(call_id), duration(duration), discard_reason(discard_reason) {
|
: call_id(call_id), duration(duration), discard_reason(discard_reason) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 28;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Call;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -517,9 +537,8 @@ class MessageInvoice : public MessageContent {
|
|||||||
, receipt_message_id(receipt_message_id) {
|
, receipt_message_id(receipt_message_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 29;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::Invoice;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -541,9 +560,8 @@ class MessagePaymentSuccessful : public MessageContent {
|
|||||||
: invoice_message_id(invoice_message_id), currency(std::move(currency)), total_amount(total_amount) {
|
: invoice_message_id(invoice_message_id), currency(std::move(currency)), total_amount(total_amount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 30;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::PaymentSuccessful;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -557,17 +575,15 @@ class MessageVideoNote : public MessageContent {
|
|||||||
MessageVideoNote(FileId file_id, bool is_viewed) : file_id(file_id), is_viewed(is_viewed) {
|
MessageVideoNote(FileId file_id, bool is_viewed) : file_id(file_id), is_viewed(is_viewed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 31;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::VideoNote;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageContactRegistered : public MessageContent {
|
class MessageContactRegistered : public MessageContent {
|
||||||
public:
|
public:
|
||||||
static const int32 ID = 32;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ContactRegistered;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -575,9 +591,8 @@ class MessageExpiredPhoto : public MessageContent {
|
|||||||
public:
|
public:
|
||||||
MessageExpiredPhoto() = default;
|
MessageExpiredPhoto() = default;
|
||||||
|
|
||||||
static const int32 ID = 33;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ExpiredPhoto;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -585,9 +600,8 @@ class MessageExpiredVideo : public MessageContent {
|
|||||||
public:
|
public:
|
||||||
MessageExpiredVideo() = default;
|
MessageExpiredVideo() = default;
|
||||||
|
|
||||||
static const int32 ID = 34;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::ExpiredVideo;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -600,9 +614,8 @@ class MessageLiveLocation : public MessageContent {
|
|||||||
MessageLiveLocation(Location &&location, int32 period) : location(std::move(location)), period(period) {
|
MessageLiveLocation(Location &&location, int32 period) : location(std::move(location)), period(period) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 35;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::LiveLocation;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -614,9 +627,8 @@ class MessageCustomServiceAction : public MessageContent {
|
|||||||
explicit MessageCustomServiceAction(string &&message) : message(std::move(message)) {
|
explicit MessageCustomServiceAction(string &&message) : message(std::move(message)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 36;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::CustomServiceAction;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -628,9 +640,8 @@ class MessageWebsiteConnected : public MessageContent {
|
|||||||
explicit MessageWebsiteConnected(string &&domain_name) : domain_name(std::move(domain_name)) {
|
explicit MessageWebsiteConnected(string &&domain_name) : domain_name(std::move(domain_name)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 37;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::WebsiteConnected;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -642,9 +653,8 @@ class MessagePassportDataSent : public MessageContent {
|
|||||||
explicit MessagePassportDataSent(vector<SecureValueType> &&types) : types(std::move(types)) {
|
explicit MessagePassportDataSent(vector<SecureValueType> &&types) : types(std::move(types)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 38;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::PassportDataSent;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -658,9 +668,8 @@ class MessagePassportDataReceived : public MessageContent {
|
|||||||
: values(std::move(values)), credentials(std::move(credentials)) {
|
: values(std::move(values)), credentials(std::move(credentials)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 ID = 39;
|
MessageContentType get_id() const override {
|
||||||
int32 get_id() const override {
|
return MessageContentType::PassportDataReceived;
|
||||||
return ID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1036,7 +1045,7 @@ class MessagesManager : public Actor {
|
|||||||
void on_update_channel_max_unavailable_message_id(ChannelId channel_id, MessageId max_unavailable_message_id);
|
void on_update_channel_max_unavailable_message_id(ChannelId channel_id, MessageId max_unavailable_message_id);
|
||||||
|
|
||||||
void on_user_dialog_action(DialogId dialog_id, UserId user_id, tl_object_ptr<td_api::ChatAction> &&action,
|
void on_user_dialog_action(DialogId dialog_id, UserId user_id, tl_object_ptr<td_api::ChatAction> &&action,
|
||||||
int32 message_content_id = -1);
|
MessageContentType message_content_type = MessageContentType::None);
|
||||||
|
|
||||||
void delete_messages(DialogId dialog_id, const vector<MessageId> &message_ids, bool revoke, Promise<Unit> &&promise);
|
void delete_messages(DialogId dialog_id, const vector<MessageId> &message_ids, bool revoke, Promise<Unit> &&promise);
|
||||||
|
|
||||||
@ -1694,16 +1703,17 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
struct MessageOp {
|
struct MessageOp {
|
||||||
enum : int8 { Add, SetPts, Delete, DeleteAll } type;
|
enum : int8 { Add, SetPts, Delete, DeleteAll } type;
|
||||||
bool from_update;
|
bool from_update = false;
|
||||||
bool have_previous;
|
bool have_previous = false;
|
||||||
bool have_next;
|
bool have_next = false;
|
||||||
int32 content_type;
|
MessageContentType content_type = MessageContentType::None;
|
||||||
|
int32 pts = 0;
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
const char *source;
|
const char *source = nullptr;
|
||||||
double date;
|
double date = 0;
|
||||||
|
|
||||||
MessageOp(decltype(type) type, MessageId message_id, int32 content_type, bool from_update, bool have_previous,
|
MessageOp(decltype(type) type, MessageId message_id, MessageContentType content_type, bool from_update,
|
||||||
bool have_next, const char *source)
|
bool have_previous, bool have_next, const char *source)
|
||||||
: type(type)
|
: type(type)
|
||||||
, from_update(from_update)
|
, from_update(from_update)
|
||||||
, have_previous(have_previous)
|
, have_previous(have_previous)
|
||||||
@ -1713,6 +1723,10 @@ class MessagesManager : public Actor {
|
|||||||
, source(source)
|
, source(source)
|
||||||
, date(G()->server_time()) {
|
, date(G()->server_time()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageOp(decltype(type) type, int32 pts, const char *source)
|
||||||
|
: type(type), pts(pts), source(source), date(G()->server_time()) {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *debug_set_dialog_last_database_message_id = "Unknown"; // to be removed soon
|
const char *debug_set_dialog_last_database_message_id = "Unknown"; // to be removed soon
|
||||||
@ -2087,15 +2101,15 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
bool is_message_unload_enabled() const;
|
bool is_message_unload_enabled() const;
|
||||||
|
|
||||||
static bool is_allowed_media_group_content(int32 content_type);
|
static bool is_allowed_media_group_content(MessageContentType content_type);
|
||||||
|
|
||||||
static bool can_forward_message(DialogId from_dialog_id, const Message *m);
|
static bool can_forward_message(DialogId from_dialog_id, const Message *m);
|
||||||
|
|
||||||
static bool is_secret_message_content(int32 ttl, int32 content_type);
|
static bool is_secret_message_content(int32 ttl, MessageContentType content_type);
|
||||||
|
|
||||||
static bool is_service_message_content(int32 content_type);
|
static bool is_service_message_content(MessageContentType content_type);
|
||||||
|
|
||||||
static bool can_have_message_content_caption(int32 content_type);
|
static bool can_have_message_content_caption(MessageContentType content_type);
|
||||||
|
|
||||||
static bool can_delete_channel_message(DialogParticipantStatus status, const Message *m, bool is_bot);
|
static bool can_delete_channel_message(DialogParticipantStatus status, const Message *m, bool is_bot);
|
||||||
|
|
||||||
@ -2369,7 +2383,7 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
void on_active_dialog_action_timeout(DialogId dialog_id);
|
void on_active_dialog_action_timeout(DialogId dialog_id);
|
||||||
|
|
||||||
static bool need_cancel_user_dialog_action(int32 action_id, int32 message_content_id);
|
static bool need_cancel_user_dialog_action(int32 action_id, MessageContentType message_content_type);
|
||||||
|
|
||||||
void cancel_user_dialog_action(DialogId dialog_id, const Message *m);
|
void cancel_user_dialog_action(DialogId dialog_id, const Message *m);
|
||||||
|
|
||||||
@ -2687,7 +2701,7 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
void set_sponsored_dialog_id(DialogId dialog_id);
|
void set_sponsored_dialog_id(DialogId dialog_id);
|
||||||
|
|
||||||
static uint64 get_sequence_dispatcher_id(DialogId dialog_id, int32 message_content_type);
|
static uint64 get_sequence_dispatcher_id(DialogId dialog_id, MessageContentType message_content_type);
|
||||||
|
|
||||||
Dialog *get_service_notifications_dialog();
|
Dialog *get_service_notifications_dialog();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user