2017-08-12 07:17:33 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-08-12 07:17:33 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "scheme.h"
|
2017-08-31 16:28:58 +00:00
|
|
|
#include "base/flags.h"
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
inline MTPbool MTP_bool(bool v) {
|
|
|
|
return v ? MTP_boolTrue() : MTP_boolFalse();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool mtpIsTrue(const MTPBool &v) {
|
|
|
|
return v.type() == mtpc_boolTrue;
|
|
|
|
}
|
|
|
|
inline bool mtpIsFalse(const MTPBool &v) {
|
|
|
|
return !mtpIsTrue(v);
|
|
|
|
}
|
|
|
|
|
|
|
|
// we must validate that MTProto scheme flags don't intersect with client side flags
|
|
|
|
// and define common bit operators which allow use Type_ClientFlag together with Type::Flag
|
|
|
|
#define DEFINE_MTP_CLIENT_FLAGS(Type) \
|
2017-08-31 16:28:58 +00:00
|
|
|
static_assert(Type::Flags(Type::Flag::MAX_FIELD) < static_cast<Type::Flag>(Type##_ClientFlag::MIN_FIELD), \
|
2017-08-12 07:17:33 +00:00
|
|
|
"MTProto flags conflict with client side flags!"); \
|
2017-08-31 16:28:58 +00:00
|
|
|
namespace base {\
|
|
|
|
template<>\
|
|
|
|
struct extended_flags<Type##_ClientFlag> {\
|
|
|
|
using type = Type::Flag;\
|
|
|
|
};\
|
|
|
|
}
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// we use the same flags field for some additional client side flags
|
2017-09-26 11:49:16 +00:00
|
|
|
enum class MTPDmessage_ClientFlag : uint32 {
|
2017-08-12 07:17:33 +00:00
|
|
|
// message has links for "shared links" indexing
|
2017-09-26 11:49:16 +00:00
|
|
|
f_has_text_links = (1U << 30),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2019-01-15 11:57:45 +00:00
|
|
|
// message is a group / channel create or migrate service message
|
|
|
|
f_is_group_essential = (1U << 29),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2018-01-13 12:45:11 +00:00
|
|
|
//// message needs initDimensions() + resize() + paint()
|
|
|
|
//f_pending_init_dimensions = (1U << 28),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2018-01-13 12:45:11 +00:00
|
|
|
//// message needs resize() + paint()
|
|
|
|
//f_pending_resize = (1U << 27),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2018-01-13 12:45:11 +00:00
|
|
|
//// message needs paint()
|
|
|
|
//f_pending_paint = (1U << 26),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2018-01-13 12:45:11 +00:00
|
|
|
//// message is attached to previous one when displaying the history
|
|
|
|
//f_attach_to_previous = (1U << 25),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2019-04-04 10:22:59 +00:00
|
|
|
// message's edited media is generated on the client
|
|
|
|
// and should not update media from server
|
|
|
|
f_is_local_update_media = (1U << 24),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// message was sent from inline bot, need to re-set media when sent
|
2017-09-26 11:49:16 +00:00
|
|
|
f_from_inline_bot = (1U << 23),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// message has a switch inline keyboard button, need to return to inline
|
2017-09-26 11:49:16 +00:00
|
|
|
f_has_switch_inline_button = (1U << 22),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// message is generated on the client side and should be unread
|
2017-09-26 11:49:16 +00:00
|
|
|
f_clientside_unread = (1U << 21),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
2017-12-01 18:38:44 +00:00
|
|
|
// message has an admin badge in supergroup
|
|
|
|
f_has_admin_badge = (1U << 20),
|
|
|
|
|
2017-08-12 07:17:33 +00:00
|
|
|
// update this when adding new client side flags
|
2019-05-20 14:57:25 +00:00
|
|
|
MIN_FIELD = (1U << 20),
|
2017-08-12 07:17:33 +00:00
|
|
|
};
|
|
|
|
DEFINE_MTP_CLIENT_FLAGS(MTPDmessage)
|
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
enum class MTPDreplyKeyboardMarkup_ClientFlag : uint32 {
|
2017-08-12 07:17:33 +00:00
|
|
|
// none (zero) markup
|
2017-09-26 11:49:16 +00:00
|
|
|
f_zero = (1U << 30),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// markup just wants a text reply
|
2017-09-26 11:49:16 +00:00
|
|
|
f_force_reply = (1U << 29),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// markup keyboard is inline
|
2017-09-26 11:49:16 +00:00
|
|
|
f_inline = (1U << 28),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// markup has a switch inline keyboard button
|
2017-09-26 11:49:16 +00:00
|
|
|
f_has_switch_inline_button = (1U << 27),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// update this when adding new client side flags
|
2017-09-26 11:49:16 +00:00
|
|
|
MIN_FIELD = (1U << 27),
|
2017-08-12 07:17:33 +00:00
|
|
|
};
|
|
|
|
DEFINE_MTP_CLIENT_FLAGS(MTPDreplyKeyboardMarkup)
|
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
enum class MTPDstickerSet_ClientFlag : uint32 {
|
2017-08-12 07:17:33 +00:00
|
|
|
// sticker set is not yet loaded
|
2017-09-26 11:49:16 +00:00
|
|
|
f_not_loaded = (1U << 30),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// sticker set is one of featured (should be saved locally)
|
2017-09-26 11:49:16 +00:00
|
|
|
f_featured = (1U << 29),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// sticker set is an unread featured set
|
2017-09-26 11:49:16 +00:00
|
|
|
f_unread = (1U << 28),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// special set like recent or custom stickers
|
2017-09-26 11:49:16 +00:00
|
|
|
f_special = (1U << 27),
|
2017-08-12 07:17:33 +00:00
|
|
|
|
|
|
|
// update this when adding new client side flags
|
2017-09-26 11:49:16 +00:00
|
|
|
MIN_FIELD = (1U << 27),
|
2017-08-12 07:17:33 +00:00
|
|
|
};
|
|
|
|
DEFINE_MTP_CLIENT_FLAGS(MTPDstickerSet)
|
|
|
|
|
2017-09-26 13:53:51 +00:00
|
|
|
//enum class MTPDuser_ClientFlag : uint32 {
|
|
|
|
// // forbidden constructor received
|
|
|
|
// f_inaccessible = (1U << 31),
|
|
|
|
//
|
|
|
|
// // update this when adding new client side flags
|
|
|
|
// MIN_FIELD = (1U << 31),
|
|
|
|
//};
|
|
|
|
//DEFINE_MTP_CLIENT_FLAGS(MTPDuser)
|
2017-09-26 11:49:16 +00:00
|
|
|
|
|
|
|
enum class MTPDchat_ClientFlag : uint32 {
|
|
|
|
// forbidden constructor received
|
|
|
|
f_forbidden = (1U << 31),
|
|
|
|
|
|
|
|
// update this when adding new client side flags
|
|
|
|
MIN_FIELD = (1U << 31),
|
|
|
|
};
|
|
|
|
DEFINE_MTP_CLIENT_FLAGS(MTPDchat)
|
|
|
|
|
|
|
|
enum class MTPDchannel_ClientFlag : uint32 {
|
|
|
|
// forbidden constructor received
|
|
|
|
f_forbidden = (1U << 31),
|
|
|
|
|
|
|
|
// update this when adding new client side flags
|
|
|
|
MIN_FIELD = (1U << 31),
|
|
|
|
};
|
|
|
|
DEFINE_MTP_CLIENT_FLAGS(MTPDchannel)
|