Fix TTL not set
This commit is contained in:
parent
07fed579c2
commit
52e41fbb76
@ -20,9 +20,12 @@ class ChatId {
|
|||||||
int64 time_ = INT64_MAX;
|
int64 time_ = INT64_MAX;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatId() = default;
|
explicit ChatId() {
|
||||||
|
set_time();
|
||||||
|
};
|
||||||
|
|
||||||
explicit ChatId(int32 chat_id) : id(chat_id) {
|
explicit ChatId(int32 chat_id) : id(chat_id) {
|
||||||
|
set_time();
|
||||||
}
|
}
|
||||||
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
|
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
|
||||||
ChatId(T chat_id) = delete;
|
ChatId(T chat_id) = delete;
|
||||||
|
@ -12387,6 +12387,7 @@ bool ContactsManager::get_user(UserId user_id, int left_tries, Promise<Unit> &&p
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user_id.set_time();
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -12397,6 +12398,7 @@ ContactsManager::User *ContactsManager::add_user(UserId user_id, const char *sou
|
|||||||
if (user_ptr == nullptr) {
|
if (user_ptr == nullptr) {
|
||||||
user_ptr = make_unique<User>();
|
user_ptr = make_unique<User>();
|
||||||
}
|
}
|
||||||
|
user_id.set_time();
|
||||||
return user_ptr.get();
|
return user_ptr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12405,6 +12407,7 @@ const ContactsManager::UserFull *ContactsManager::get_user_full(UserId user_id)
|
|||||||
if (p == users_full_.end()) {
|
if (p == users_full_.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
|
user_id.set_time();
|
||||||
return p->second.get();
|
return p->second.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12414,6 +12417,7 @@ ContactsManager::UserFull *ContactsManager::get_user_full(UserId user_id) {
|
|||||||
if (p == users_full_.end()) {
|
if (p == users_full_.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
|
user_id.set_time();
|
||||||
return p->second.get();
|
return p->second.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12425,6 +12429,7 @@ ContactsManager::UserFull *ContactsManager::add_user_full(UserId user_id) {
|
|||||||
user_full_ptr = make_unique<UserFull>();
|
user_full_ptr = make_unique<UserFull>();
|
||||||
user_full_ptr->can_pin_messages = (user_id == get_my_id());
|
user_full_ptr->can_pin_messages = (user_id == get_my_id());
|
||||||
}
|
}
|
||||||
|
user_id.set_time();
|
||||||
return user_full_ptr.get();
|
return user_full_ptr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12438,6 +12443,7 @@ void ContactsManager::reload_user(UserId user_id, Promise<Unit> &&promise) {
|
|||||||
if (input_user == nullptr) {
|
if (input_user == nullptr) {
|
||||||
return promise.set_error(Status::Error(6, "User info not found"));
|
return promise.set_error(Status::Error(6, "User info not found"));
|
||||||
}
|
}
|
||||||
|
user_id.set_time();
|
||||||
|
|
||||||
// there is no much reason to combine different requests into one request
|
// there is no much reason to combine different requests into one request
|
||||||
vector<tl_object_ptr<telegram_api::InputUser>> users;
|
vector<tl_object_ptr<telegram_api::InputUser>> users;
|
||||||
@ -12474,6 +12480,7 @@ bool ContactsManager::load_user_full(UserId user_id, bool force, Promise<Unit> &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user_id.set_time();
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -12481,6 +12488,7 @@ bool ContactsManager::load_user_full(UserId user_id, bool force, Promise<Unit> &
|
|||||||
void ContactsManager::reload_user_full(UserId user_id) {
|
void ContactsManager::reload_user_full(UserId user_id) {
|
||||||
auto input_user = get_input_user(user_id);
|
auto input_user = get_input_user(user_id);
|
||||||
if (input_user != nullptr) {
|
if (input_user != nullptr) {
|
||||||
|
user_id.set_time();
|
||||||
send_get_user_full_query(user_id, std::move(input_user), Auto(), "reload_user_full");
|
send_get_user_full_query(user_id, std::move(input_user), Auto(), "reload_user_full");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12502,6 +12510,7 @@ const ContactsManager::BotInfo *ContactsManager::get_bot_info(UserId user_id) co
|
|||||||
if (p == bot_infos_.end()) {
|
if (p == bot_infos_.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
|
user_id.set_time();
|
||||||
return p->second.get();
|
return p->second.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12511,6 +12520,7 @@ ContactsManager::BotInfo *ContactsManager::get_bot_info(UserId user_id) {
|
|||||||
if (p == bot_infos_.end()) {
|
if (p == bot_infos_.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
|
user_id.set_time();
|
||||||
return p->second.get();
|
return p->second.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12521,6 +12531,7 @@ ContactsManager::BotInfo *ContactsManager::add_bot_info(UserId user_id) {
|
|||||||
if (bot_info_ptr == nullptr) {
|
if (bot_info_ptr == nullptr) {
|
||||||
bot_info_ptr = make_unique<BotInfo>();
|
bot_info_ptr = make_unique<BotInfo>();
|
||||||
}
|
}
|
||||||
|
user_id.set_time();
|
||||||
return bot_info_ptr.get();
|
return bot_info_ptr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,12 @@ class UserId {
|
|||||||
int64 time_ = INT64_MAX;
|
int64 time_ = INT64_MAX;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UserId() = default;
|
explicit UserId() {
|
||||||
|
set_time();
|
||||||
|
}
|
||||||
|
|
||||||
explicit UserId(int32 user_id) : id(user_id) {
|
explicit UserId(int32 user_id) : id(user_id) {
|
||||||
|
set_time();
|
||||||
}
|
}
|
||||||
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
|
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
|
||||||
UserId(T user_id) = delete;
|
UserId(T user_id) = delete;
|
||||||
|
@ -21,9 +21,12 @@ class FileId {
|
|||||||
int64 time_ = INT64_MAX;
|
int64 time_ = INT64_MAX;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FileId() = default;
|
FileId() {
|
||||||
|
set_time();
|
||||||
|
}
|
||||||
|
|
||||||
FileId(int32 file_id, int32 remote_id) : id(file_id), remote_id(remote_id) {
|
FileId(int32 file_id, int32 remote_id) : id(file_id), remote_id(remote_id) {
|
||||||
|
set_time();
|
||||||
}
|
}
|
||||||
template <class T1, class T2, typename = std::enable_if_t<std::is_convertible<T1, int32>::value>,
|
template <class T1, class T2, typename = std::enable_if_t<std::is_convertible<T1, int32>::value>,
|
||||||
typename = std::enable_if_t<std::is_convertible<T2, int32>::value>>
|
typename = std::enable_if_t<std::is_convertible<T2, int32>::value>>
|
||||||
|
Loading…
Reference in New Issue
Block a user