Skip to content

Commit 41c391f

Browse files
committed
Update layer to 133.
1 parent 0b6d40b commit 41c391f

54 files changed

Lines changed: 635 additions & 577 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎benchmark/bench_tddb.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class MessagesDbBench final : public Benchmark {
5050
void run(int n) final {
5151
auto guard = scheduler_->get_main_guard();
5252
for (int i = 0; i < n; i += 20) {
53-
auto dialog_id = DialogId{UserId{Random::fast(1, 100)}};
53+
auto dialog_id = DialogId(UserId(static_cast<int64>(Random::fast(1, 100))));
5454
auto message_id_raw = Random::fast(1, 100000);
5555
for (int j = 0; j < 20; j++) {
5656
auto message_id = MessageId{ServerMessageId{message_id_raw + j}};
5757
auto unique_message_id = ServerMessageId{i + 1};
58-
auto sender_user_id = UserId{Random::fast(1, 1000)};
58+
auto sender_user_id = UserId(static_cast<int64>(Random::fast(1, 1000)));
5959
auto random_id = i + 1;
6060
auto ttl_expires_at = 0;
6161
auto data = BufferSlice(Random::fast(100, 299));

‎example/cpp/td_example.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class TdExample {
142142

143143
std::map<std::uint64_t, std::function<void(Object)>> handlers_;
144144

145-
std::map<std::int32_t, td_api::object_ptr<td_api::user>> users_;
145+
std::map<std::int64_t, td_api::object_ptr<td_api::user>> users_;
146146

147147
std::map<std::int64_t, std::string> chat_title_;
148148

@@ -174,7 +174,7 @@ class TdExample {
174174
}
175175
}
176176

177-
std::string get_user_name(std::int32_t user_id) const {
177+
std::string get_user_name(std::int64_t user_id) const {
178178
auto it = users_.find(user_id);
179179
if (it == users_.end()) {
180180
return "unknown user";

‎example/java/org/drinkless/tdlib/example/Example.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ public final class Example {
3737
private static final Lock authorizationLock = new ReentrantLock();
3838
private static final Condition gotAuthorization = authorizationLock.newCondition();
3939

40-
private static final ConcurrentMap<Integer, TdApi.User> users = new ConcurrentHashMap<Integer, TdApi.User>();
41-
private static final ConcurrentMap<Integer, TdApi.BasicGroup> basicGroups = new ConcurrentHashMap<Integer, TdApi.BasicGroup>();
42-
private static final ConcurrentMap<Integer, TdApi.Supergroup> supergroups = new ConcurrentHashMap<Integer, TdApi.Supergroup>();
40+
private static final ConcurrentMap<Long, TdApi.User> users = new ConcurrentHashMap<Long, TdApi.User>();
41+
private static final ConcurrentMap<Long, TdApi.BasicGroup> basicGroups = new ConcurrentHashMap<Long, TdApi.BasicGroup>();
42+
private static final ConcurrentMap<Long, TdApi.Supergroup> supergroups = new ConcurrentHashMap<Long, TdApi.Supergroup>();
4343
private static final ConcurrentMap<Integer, TdApi.SecretChat> secretChats = new ConcurrentHashMap<Integer, TdApi.SecretChat>();
4444

4545
private static final ConcurrentMap<Long, TdApi.Chat> chats = new ConcurrentHashMap<Long, TdApi.Chat>();
4646
private static final NavigableSet<OrderedChat> mainChatList = new TreeSet<OrderedChat>();
4747
private static boolean haveFullMainChatList = false;
4848

49-
private static final ConcurrentMap<Integer, TdApi.UserFullInfo> usersFullInfo = new ConcurrentHashMap<Integer, TdApi.UserFullInfo>();
50-
private static final ConcurrentMap<Integer, TdApi.BasicGroupFullInfo> basicGroupsFullInfo = new ConcurrentHashMap<Integer, TdApi.BasicGroupFullInfo>();
51-
private static final ConcurrentMap<Integer, TdApi.SupergroupFullInfo> supergroupsFullInfo = new ConcurrentHashMap<Integer, TdApi.SupergroupFullInfo>();
49+
private static final ConcurrentMap<Long, TdApi.UserFullInfo> usersFullInfo = new ConcurrentHashMap<Long, TdApi.UserFullInfo>();
50+
private static final ConcurrentMap<Long, TdApi.BasicGroupFullInfo> basicGroupsFullInfo = new ConcurrentHashMap<Long, TdApi.BasicGroupFullInfo>();
51+
private static final ConcurrentMap<Long, TdApi.SupergroupFullInfo> supergroupsFullInfo = new ConcurrentHashMap<Long, TdApi.SupergroupFullInfo>();
5252

5353
private static final String newLine = System.getProperty("line.separator");
5454
private static final String commandsLine = "Enter command (gcs - GetChats, gc <chatId> - GetChat, me - GetMe, sm <chatId> <message> - SendMessage, lo - LogOut, q - Quit): ";

‎td/generate/scheme/td_api.tl‎

Lines changed: 111 additions & 114 deletions
Large diffs are not rendered by default.

‎td/generate/scheme/telegram_api.tl‎

Lines changed: 170 additions & 166 deletions
Large diffs are not rendered by default.

‎td/telegram/AnimationsManager.cpp‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class GetSavedGifsQuery final : public Td::ResultHandler {
4242
bool is_repair_ = false;
4343

4444
public:
45-
void send(bool is_repair, int32 hash) {
45+
void send(bool is_repair, int64 hash) {
4646
is_repair_ = is_repair;
4747
LOG(INFO) << "Send get saved animations request with hash = " << hash;
4848
send_query(G()->net_query_creator().create(telegram_api::messages_getSavedGifs(hash)));
@@ -664,9 +664,9 @@ void AnimationsManager::on_get_saved_animations_failed(bool is_repair, Status er
664664
}
665665
}
666666

667-
int32 AnimationsManager::get_saved_animations_hash(const char *source) const {
668-
vector<uint32> numbers;
669-
numbers.reserve(saved_animation_ids_.size() * 2);
667+
int64 AnimationsManager::get_saved_animations_hash(const char *source) const {
668+
vector<uint64> numbers;
669+
numbers.reserve(saved_animation_ids_.size());
670670
for (auto animation_id : saved_animation_ids_) {
671671
auto animation = get_animation(animation_id);
672672
CHECK(animation != nullptr);
@@ -676,9 +676,7 @@ int32 AnimationsManager::get_saved_animations_hash(const char *source) const {
676676
LOG(ERROR) << "Saved animation remote location is not document: " << source << " " << file_view.remote_location();
677677
continue;
678678
}
679-
auto id = static_cast<uint64>(file_view.remote_location().get_id());
680-
numbers.push_back(static_cast<uint32>(id >> 32));
681-
numbers.push_back(static_cast<uint32>(id & 0xFFFFFFFF));
679+
numbers.push_back(file_view.remote_location().get_id());
682680
}
683681
return get_vector_hash(numbers);
684682
}

‎td/telegram/AnimationsManager.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class AnimationsManager final : public Actor {
116116

117117
FileId on_get_animation(unique_ptr<Animation> new_animation, bool replace);
118118

119-
int32 get_saved_animations_hash(const char *source) const;
119+
int64 get_saved_animations_hash(const char *source) const;
120120

121121
void add_saved_animation_impl(FileId animation_id, bool add_on_server, Promise<Unit> &&promise);
122122

‎td/telegram/CallbackQueriesManager.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void CallbackQueriesManager::on_new_query(int32 flags, int64 callback_query_id,
202202

203203
void CallbackQueriesManager::on_new_inline_query(
204204
int32 flags, int64 callback_query_id, UserId sender_user_id,
205-
tl_object_ptr<telegram_api::inputBotInlineMessageID> &&inline_message_id, BufferSlice &&data, int64 chat_instance,
205+
tl_object_ptr<telegram_api::InputBotInlineMessageID> &&inline_message_id, BufferSlice &&data, int64 chat_instance,
206206
string &&game_short_name) {
207207
if (!sender_user_id.is_valid()) {
208208
LOG(ERROR) << "Receive new callback query from invalid " << sender_user_id;

‎td/telegram/CallbackQueriesManager.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CallbackQueriesManager {
3636
MessageId message_id, BufferSlice &&data, int64 chat_instance, string &&game_short_name);
3737

3838
void on_new_inline_query(int32 flags, int64 callback_query_id, UserId sender_user_id,
39-
tl_object_ptr<telegram_api::inputBotInlineMessageID> &&inline_message_id, BufferSlice &&data,
39+
tl_object_ptr<telegram_api::InputBotInlineMessageID> &&inline_message_id, BufferSlice &&data,
4040
int64 chat_instance, string &&game_short_name);
4141

4242
int64 send_callback_query(FullMessageId full_message_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,

‎td/telegram/ChannelId.h‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
namespace td {
1616

1717
class ChannelId {
18-
int32 id = 0;
18+
int64 id = 0;
1919

2020
public:
2121
ChannelId() = default;
2222

23-
explicit ChannelId(int32 channel_id) : id(channel_id) {
23+
explicit ChannelId(int64 channel_id) : id(channel_id) {
2424
}
25-
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
25+
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
2626
ChannelId(T channel_id) = delete;
2727

2828
bool is_valid() const {
2929
return id > 0; // TODO better is_valid
3030
}
3131

32-
int32 get() const {
32+
int64 get() const {
3333
return id;
3434
}
3535

@@ -43,18 +43,22 @@ class ChannelId {
4343

4444
template <class StorerT>
4545
void store(StorerT &storer) const {
46-
storer.store_int(id);
46+
storer.store_long(id);
4747
}
4848

4949
template <class ParserT>
5050
void parse(ParserT &parser) {
51-
id = parser.fetch_int();
51+
if (parser.version() >= static_cast<int32>(Version::Support64BitIds)) {
52+
id = parser.fetch_long();
53+
} else {
54+
id = parser.fetch_int();
55+
}
5256
}
5357
};
5458

5559
struct ChannelIdHash {
5660
std::size_t operator()(ChannelId channel_id) const {
57-
return std::hash<int32>()(channel_id.get());
61+
return std::hash<int64>()(channel_id.get());
5862
}
5963
};
6064

0 commit comments

Comments
 (0)