mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Update API scheme to layer 133.
This commit is contained in:
@@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
||||
[[nodiscard]] int32 CountDocumentVectorHash(
|
||||
[[nodiscard]] uint64 CountDocumentVectorHash(
|
||||
const QVector<DocumentData*> vector) {
|
||||
auto result = HashInit();
|
||||
for (const auto document : vector) {
|
||||
@@ -24,7 +24,7 @@ namespace {
|
||||
return HashFinalize(result);
|
||||
}
|
||||
|
||||
[[nodiscard]] int32 CountSpecialStickerSetHash(
|
||||
[[nodiscard]] uint64 CountSpecialStickerSetHash(
|
||||
not_null<Main::Session*> session,
|
||||
uint64 setId) {
|
||||
const auto &sets = session->data().stickers().sets();
|
||||
@@ -35,16 +35,14 @@ namespace {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int32 CountStickersHash(
|
||||
[[nodiscard]] uint64 CountStickersOrderHash(
|
||||
not_null<Main::Session*> session,
|
||||
const Data::StickersSetsOrder &order,
|
||||
bool checkOutdatedInfo) {
|
||||
using Flag = Data::StickersSetFlag;
|
||||
auto result = HashInit();
|
||||
bool foundOutdated = false;
|
||||
const auto &sets = session->data().stickers().sets();
|
||||
const auto &order = session->data().stickers().setsOrder();
|
||||
for (auto i = order.cbegin(), e = order.cend(); i != e; ++i) {
|
||||
auto it = sets.find(*i);
|
||||
if (it != sets.cend()) {
|
||||
@@ -62,7 +60,27 @@ int32 CountStickersHash(
|
||||
: 0;
|
||||
}
|
||||
|
||||
int32 CountRecentStickersHash(
|
||||
} // namespace
|
||||
|
||||
uint64 CountStickersHash(
|
||||
not_null<Main::Session*> session,
|
||||
bool checkOutdatedInfo) {
|
||||
return CountStickersOrderHash(
|
||||
session,
|
||||
session->data().stickers().setsOrder(),
|
||||
checkOutdatedInfo);
|
||||
}
|
||||
|
||||
uint64 CountMasksHash(
|
||||
not_null<Main::Session*> session,
|
||||
bool checkOutdatedInfo) {
|
||||
return CountStickersOrderHash(
|
||||
session,
|
||||
session->data().stickers().maskSetsOrder(),
|
||||
checkOutdatedInfo);
|
||||
}
|
||||
|
||||
uint64 CountRecentStickersHash(
|
||||
not_null<Main::Session*> session,
|
||||
bool attached) {
|
||||
return CountSpecialStickerSetHash(
|
||||
@@ -72,11 +90,11 @@ int32 CountRecentStickersHash(
|
||||
: Data::Stickers::CloudRecentSetId);
|
||||
}
|
||||
|
||||
int32 CountFavedStickersHash(not_null<Main::Session*> session) {
|
||||
uint64 CountFavedStickersHash(not_null<Main::Session*> session) {
|
||||
return CountSpecialStickerSetHash(session, Data::Stickers::FavedSetId);
|
||||
}
|
||||
|
||||
int32 CountFeaturedStickersHash(not_null<Main::Session*> session) {
|
||||
uint64 CountFeaturedStickersHash(not_null<Main::Session*> session) {
|
||||
auto result = HashInit();
|
||||
const auto &sets = session->data().stickers().sets();
|
||||
const auto &featured = session->data().stickers().featuredSetsOrder();
|
||||
@@ -92,7 +110,7 @@ int32 CountFeaturedStickersHash(not_null<Main::Session*> session) {
|
||||
return HashFinalize(result);
|
||||
}
|
||||
|
||||
int32 CountSavedGifsHash(not_null<Main::Session*> session) {
|
||||
uint64 CountSavedGifsHash(not_null<Main::Session*> session) {
|
||||
return CountDocumentVectorHash(session->data().stickers().savedGifs());
|
||||
}
|
||||
|
||||
|
@@ -13,40 +13,49 @@ class Session;
|
||||
|
||||
namespace Api {
|
||||
|
||||
[[nodiscard]] int32 CountStickersHash(
|
||||
[[nodiscard]] uint64 CountStickersHash(
|
||||
not_null<Main::Session*> session,
|
||||
bool checkOutdatedInfo = false);
|
||||
[[nodiscard]] int32 CountRecentStickersHash(
|
||||
[[nodiscard]] uint64 CountMasksHash(
|
||||
not_null<Main::Session*> session,
|
||||
bool checkOutdatedInfo = false);
|
||||
[[nodiscard]] uint64 CountRecentStickersHash(
|
||||
not_null<Main::Session*> session,
|
||||
bool attached = false);
|
||||
[[nodiscard]] int32 CountFavedStickersHash(not_null<Main::Session*> session);
|
||||
[[nodiscard]] int32 CountFeaturedStickersHash(
|
||||
[[nodiscard]] uint64 CountFavedStickersHash(not_null<Main::Session*> session);
|
||||
[[nodiscard]] uint64 CountFeaturedStickersHash(
|
||||
not_null<Main::Session*> session);
|
||||
[[nodiscard]] int32 CountSavedGifsHash(not_null<Main::Session*> session);
|
||||
[[nodiscard]] uint64 CountSavedGifsHash(not_null<Main::Session*> session);
|
||||
|
||||
[[nodiscard]] inline uint32 HashInit() {
|
||||
[[nodiscard]] inline uint64 HashInit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void HashUpdate(uint32 &already, uint32 value) {
|
||||
already = (already * 20261) + uint32(value);
|
||||
inline void HashUpdate(uint64 &already, uint64 value) {
|
||||
already ^= (already >> 21);
|
||||
already ^= (already << 35);
|
||||
already ^= (already >> 4);
|
||||
already += value;
|
||||
}
|
||||
|
||||
inline void HashUpdate(uint32 &already, int32 value) {
|
||||
HashUpdate(already, uint32(value));
|
||||
inline void HashUpdate(uint64 &already, int64 value) {
|
||||
HashUpdate(already, uint64(value));
|
||||
}
|
||||
|
||||
inline void HashUpdate(uint32 &already, uint64 value) {
|
||||
HashUpdate(already, uint32(value >> 32));
|
||||
HashUpdate(already, uint32(value & 0xFFFFFFFFULL));
|
||||
inline void HashUpdate(uint64 &already, uint32 value) {
|
||||
HashUpdate(already, uint64(value));
|
||||
}
|
||||
|
||||
[[nodiscard]] inline int32 HashFinalize(uint32 already) {
|
||||
return int32(already & 0x7FFFFFFF);
|
||||
inline void HashUpdate(uint64 &already, int32 value) {
|
||||
HashUpdate(already, int64(value));
|
||||
}
|
||||
|
||||
[[nodiscard]] inline uint64 HashFinalize(uint64 already) {
|
||||
return already;
|
||||
}
|
||||
|
||||
template <typename IntRange>
|
||||
[[nodiscard]] inline int32 CountHash(IntRange &&range) {
|
||||
[[nodiscard]] inline uint64 CountHash(IntRange &&range) {
|
||||
auto result = HashInit();
|
||||
for (const auto value : range) {
|
||||
HashUpdate(result, value);
|
||||
|
@@ -438,7 +438,7 @@ void SendConfirmedFile(
|
||||
peerToMTP(messageFromId),
|
||||
peerToMTP(file->to.peer),
|
||||
MTPMessageFwdHeader(),
|
||||
MTPint(),
|
||||
MTPlong(), // via_bot_id
|
||||
replyHeader,
|
||||
MTP_int(HistoryItem::NewMessageDate(file->to.options.scheduled)),
|
||||
MTP_string(caption.text),
|
||||
|
@@ -142,7 +142,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupById(
|
||||
_requestId = _session->api().request(MTPchannels_GetChannels(
|
||||
MTP_vector<MTPInputChannel>(
|
||||
1,
|
||||
MTP_inputChannel(MTP_int(channelId.bare), MTP_long(0))) // #TODO ids
|
||||
MTP_inputChannel(MTP_long(channelId.bare), MTP_long(0)))
|
||||
)).done([=](const MTPmessages_Chats &result) {
|
||||
result.match([&](const auto &data) {
|
||||
const auto peer = _session->data().processChats(data.vchats());
|
||||
|
@@ -116,7 +116,7 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
|
||||
if (session && fields.userId == session->userId().bare) {
|
||||
return MTP_inputUserSelf();
|
||||
} else if (fields.userId) {
|
||||
return MTP_inputUser(MTP_int(fields.userId), MTP_long(fields.accessHash));
|
||||
return MTP_inputUser(MTP_long(fields.userId), MTP_long(fields.accessHash));
|
||||
}
|
||||
return MTP_inputUserEmpty();
|
||||
}(entity.data());
|
||||
|
@@ -1041,7 +1041,7 @@ void Updates::applyUpdatesNoPtsCheck(const MTPUpdates &updates) {
|
||||
: MTP_peerUser(d.vuser_id())),
|
||||
MTP_peerUser(d.vuser_id()),
|
||||
d.vfwd_from() ? *d.vfwd_from() : MTPMessageFwdHeader(),
|
||||
MTP_int(d.vvia_bot_id().value_or_empty()),
|
||||
MTP_long(d.vvia_bot_id().value_or_empty()),
|
||||
d.vreply_to() ? *d.vreply_to() : MTPMessageReplyHeader(),
|
||||
d.vdate(),
|
||||
d.vmessage(),
|
||||
@@ -1072,7 +1072,7 @@ void Updates::applyUpdatesNoPtsCheck(const MTPUpdates &updates) {
|
||||
MTP_peerUser(d.vfrom_id()),
|
||||
MTP_peerChat(d.vchat_id()),
|
||||
d.vfwd_from() ? *d.vfwd_from() : MTPMessageFwdHeader(),
|
||||
MTP_int(d.vvia_bot_id().value_or_empty()),
|
||||
MTP_long(d.vvia_bot_id().value_or_empty()),
|
||||
d.vreply_to() ? *d.vreply_to() : MTPMessageReplyHeader(),
|
||||
d.vdate(),
|
||||
d.vmessage(),
|
||||
@@ -1933,7 +1933,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
|
||||
case mtpc_updatePrivacy: {
|
||||
auto &d = update.c_updatePrivacy();
|
||||
const auto allChatsLoaded = [&](const MTPVector<MTPint> &ids) {
|
||||
const auto allChatsLoaded = [&](const MTPVector<MTPlong> &ids) {
|
||||
for (const auto &chatId : ids.v) {
|
||||
if (!session().data().chatLoaded(chatId)
|
||||
&& !session().data().channelLoaded(chatId)) {
|
||||
|
@@ -36,7 +36,7 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
|
||||
return result;
|
||||
};
|
||||
const auto collectInputChats = [](const auto &peers) {
|
||||
auto result = QVector<MTPint>(); // #TODO ids
|
||||
auto result = QVector<MTPlong>();
|
||||
result.reserve(peers.size());
|
||||
for (const auto peer : peers) {
|
||||
if (!peer->isUser()) {
|
||||
@@ -59,7 +59,7 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
|
||||
if (!chats.empty()) {
|
||||
result.push_back(
|
||||
MTP_inputPrivacyValueAllowChatParticipants(
|
||||
MTP_vector<MTPint>(chats)));
|
||||
MTP_vector<MTPlong>(chats)));
|
||||
}
|
||||
}
|
||||
if (!rule.ignoreNever) {
|
||||
@@ -73,7 +73,7 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
|
||||
if (!chats.empty()) {
|
||||
result.push_back(
|
||||
MTP_inputPrivacyValueDisallowChatParticipants(
|
||||
MTP_vector<MTPint>(chats)));
|
||||
MTP_vector<MTPlong>(chats)));
|
||||
}
|
||||
}
|
||||
result.push_back([&] {
|
||||
|
Reference in New Issue
Block a user