1 // 2 // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 // 7 #pragma once 8 9 #include "td/utils/common.h" 10 #include "td/utils/StringBuilder.h" 11 12 #include <functional> 13 14 namespace td { 15 16 // increase MessageUnsupported::CURRENT_VERSION each time a new message content type is added 17 enum class MessageContentType : int32 { 18 None = -1, 19 Text, 20 Animation, 21 Audio, 22 Document, 23 Photo, 24 Sticker, 25 Video, 26 VoiceNote, 27 Contact, 28 Location, 29 Venue, 30 ChatCreate, 31 ChatChangeTitle, 32 ChatChangePhoto, 33 ChatDeletePhoto, 34 ChatDeleteHistory, 35 ChatAddUsers, 36 ChatJoinedByLink, 37 ChatDeleteUser, 38 ChatMigrateTo, 39 ChannelCreate, 40 ChannelMigrateFrom, 41 PinMessage, 42 Game, 43 GameScore, 44 ScreenshotTaken, 45 ChatSetTtl, 46 Unsupported, 47 Call, 48 Invoice, 49 PaymentSuccessful, 50 VideoNote, 51 ContactRegistered, 52 ExpiredPhoto, 53 ExpiredVideo, 54 LiveLocation, 55 CustomServiceAction, 56 WebsiteConnected, 57 PassportDataSent, 58 PassportDataReceived, 59 Poll, 60 Dice, 61 ProximityAlertTriggered, 62 GroupCall, 63 InviteToGroupCall, 64 ChatSetTheme 65 }; 66 67 StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type); 68 69 bool is_allowed_media_group_content(MessageContentType content_type); 70 71 bool is_homogenous_media_group_content(MessageContentType content_type); 72 73 bool is_secret_message_content(int32 ttl, MessageContentType content_type); 74 75 bool is_service_message_content(MessageContentType content_type); 76 77 bool can_have_message_content_caption(MessageContentType content_type); 78 79 struct MessageContentTypeHash { operatorMessageContentTypeHash80 std::size_t operator()(MessageContentType content_type) const { 81 return std::hash<int32>()(static_cast<int32>(content_type)); 82 } 83 }; 84 85 } // namespace td 86