Merge commit '6d9953aea5e431cc80162f11127a7198453639e9'
This commit is contained in:
commit
62c10c2d37
@ -441,7 +441,7 @@ chatPermissions can_send_messages:Bool can_send_media_messages:Bool can_send_pol
|
|||||||
|
|
||||||
//@description The user is the owner of a chat and has all the administrator privileges
|
//@description The user is the owner of a chat and has all the administrator privileges
|
||||||
//@custom_title A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only
|
//@custom_title A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only
|
||||||
//@is_anonymous True, if the creator isn't shown in the chat member list and sends messages anonymously
|
//@is_anonymous True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only
|
||||||
//@is_member True, if the user is a member of the chat
|
//@is_member True, if the user is a member of the chat
|
||||||
chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = ChatMemberStatus;
|
chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = ChatMemberStatus;
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = C
|
|||||||
//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members
|
//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members
|
||||||
//@can_pin_messages True, if the administrator can pin messages; applicable to groups only
|
//@can_pin_messages True, if the administrator can pin messages; applicable to groups only
|
||||||
//@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them
|
//@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them
|
||||||
//@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously
|
//@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only
|
||||||
chatMemberStatusAdministrator custom_title:string can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool is_anonymous:Bool = ChatMemberStatus;
|
chatMemberStatusAdministrator custom_title:string can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool is_anonymous:Bool = ChatMemberStatus;
|
||||||
|
|
||||||
//@description The user is a member of a chat, without any additional privileges or restrictions
|
//@description The user is a member of a chat, without any additional privileges or restrictions
|
||||||
|
@ -4418,6 +4418,18 @@ UserId ContactsManager::get_replies_bot_user_id() {
|
|||||||
return UserId(G()->is_test_dc() ? 708513 : 1271266957);
|
return UserId(G()->is_test_dc() ? 708513 : 1271266957);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserId ContactsManager::get_anonymous_bot_user_id() {
|
||||||
|
return UserId(G()->is_test_dc() ? 552888 : 1087968824);
|
||||||
|
}
|
||||||
|
|
||||||
|
UserId ContactsManager::add_anonymous_bot_user() {
|
||||||
|
auto user_id = get_anonymous_bot_user_id();
|
||||||
|
if (!have_user_force(user_id)) {
|
||||||
|
LOG(FATAL) << "Failed to load anonymous bot user";
|
||||||
|
}
|
||||||
|
return user_id;
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::check_dialog_username(DialogId dialog_id, const string &username,
|
void ContactsManager::check_dialog_username(DialogId dialog_id, const string &username,
|
||||||
Promise<CheckDialogUsernameResult> &&promise) {
|
Promise<CheckDialogUsernameResult> &&promise) {
|
||||||
if (dialog_id != DialogId() && !dialog_id.is_valid()) {
|
if (dialog_id != DialogId() && !dialog_id.is_valid()) {
|
||||||
@ -7530,38 +7542,60 @@ bool ContactsManager::have_user_force(UserId user_id) {
|
|||||||
|
|
||||||
ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
|
ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
|
||||||
auto u = get_user_force_impl(user_id);
|
auto u = get_user_force_impl(user_id);
|
||||||
if (user_id == get_service_notifications_user_id() && (u == nullptr || !u->is_received)) {
|
if ((u == nullptr || !u->is_received) &&
|
||||||
|
(user_id == get_service_notifications_user_id() || user_id == get_replies_bot_user_id() ||
|
||||||
|
user_id == get_anonymous_bot_user_id())) {
|
||||||
int32 flags = telegram_api::user::ACCESS_HASH_MASK | telegram_api::user::FIRST_NAME_MASK |
|
int32 flags = telegram_api::user::ACCESS_HASH_MASK | telegram_api::user::FIRST_NAME_MASK |
|
||||||
telegram_api::user::PHONE_MASK | telegram_api::user::PHOTO_MASK | telegram_api::user::VERIFIED_MASK |
|
telegram_api::user::APPLY_MIN_PHOTO_MASK;
|
||||||
telegram_api::user::SUPPORT_MASK | telegram_api::user::APPLY_MIN_PHOTO_MASK;
|
int64 profile_photo_id = 0;
|
||||||
auto profile_photo = telegram_api::make_object<telegram_api::userProfilePhoto>(
|
int64 profile_photo_volume_id = 0;
|
||||||
0, false /*ignored*/, 3337190045231023,
|
int32 profile_photo_local_id = 0;
|
||||||
telegram_api::make_object<telegram_api::fileLocationToBeDeprecated>(107738948, 13226),
|
int32 profile_photo_dc_id = 1;
|
||||||
telegram_api::make_object<telegram_api::fileLocationToBeDeprecated>(107738948, 13228), 1);
|
string first_name;
|
||||||
if (G()->is_test_dc()) {
|
string username;
|
||||||
profile_photo = nullptr;
|
string phone_number;
|
||||||
flags -= telegram_api::user::PHOTO_MASK;
|
int32 bot_info_version = 0;
|
||||||
|
|
||||||
|
if (user_id == get_service_notifications_user_id()) {
|
||||||
|
flags |= telegram_api::user::PHONE_MASK | telegram_api::user::VERIFIED_MASK | telegram_api::user::SUPPORT_MASK;
|
||||||
|
first_name = "Telegram";
|
||||||
|
phone_number = "42777";
|
||||||
|
profile_photo_id = 3337190045231023;
|
||||||
|
profile_photo_volume_id = 107738948;
|
||||||
|
profile_photo_local_id = 13226;
|
||||||
|
} else if (user_id == get_replies_bot_user_id()) {
|
||||||
|
flags |= telegram_api::user::USERNAME_MASK | telegram_api::user::BOT_MASK;
|
||||||
|
first_name = "Replies";
|
||||||
|
username = "replies";
|
||||||
|
bot_info_version = G()->is_test_dc() ? 1 : 3;
|
||||||
|
} else if (user_id == get_anonymous_bot_user_id()) {
|
||||||
|
flags |= telegram_api::user::USERNAME_MASK | telegram_api::user::BOT_MASK;
|
||||||
|
first_name = "Group";
|
||||||
|
username = G()->is_test_dc() ? "izgroupbot" : "GroupAnonymousBot";
|
||||||
|
bot_info_version = G()->is_test_dc() ? 1 : 3;
|
||||||
|
profile_photo_id = 5159307831025969322;
|
||||||
|
profile_photo_volume_id = 806529792;
|
||||||
|
profile_photo_local_id = 188482;
|
||||||
|
}
|
||||||
|
|
||||||
|
telegram_api::object_ptr<telegram_api::userProfilePhoto> profile_photo;
|
||||||
|
if (!G()->is_test_dc() && profile_photo_id != 0) {
|
||||||
|
flags |= telegram_api::user::PHOTO_MASK;
|
||||||
|
profile_photo = telegram_api::make_object<telegram_api::userProfilePhoto>(
|
||||||
|
0, false /*ignored*/, profile_photo_id,
|
||||||
|
telegram_api::make_object<telegram_api::fileLocationToBeDeprecated>(profile_photo_volume_id,
|
||||||
|
profile_photo_local_id),
|
||||||
|
telegram_api::make_object<telegram_api::fileLocationToBeDeprecated>(profile_photo_volume_id,
|
||||||
|
profile_photo_local_id + 2),
|
||||||
|
profile_photo_dc_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto user = telegram_api::make_object<telegram_api::user>(
|
auto user = telegram_api::make_object<telegram_api::user>(
|
||||||
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, user_id.get(), 1, "Telegram",
|
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, user_id.get(), 1, first_name,
|
||||||
string(), string(), "42777", std::move(profile_photo), nullptr, 0, Auto(), string(), string());
|
string(), username, phone_number, std::move(profile_photo), nullptr, bot_info_version, Auto(), string(),
|
||||||
on_get_user(std::move(user), "get_user_force");
|
string());
|
||||||
u = get_user(user_id);
|
|
||||||
CHECK(u != nullptr && u->is_received);
|
|
||||||
}
|
|
||||||
if (user_id == get_replies_bot_user_id() && (u == nullptr || !u->is_received)) {
|
|
||||||
int32 flags = telegram_api::user::ACCESS_HASH_MASK | telegram_api::user::FIRST_NAME_MASK |
|
|
||||||
telegram_api::user::USERNAME_MASK |
|
|
||||||
/*telegram_api::user::PHOTO_MASK | telegram_api::user::VERIFIED_MASK |*/
|
|
||||||
telegram_api::user::BOT_MASK | telegram_api::user::APPLY_MIN_PHOTO_MASK;
|
|
||||||
auto user = telegram_api::make_object<telegram_api::user>(
|
|
||||||
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, user_id.get(), 1, "Replies",
|
|
||||||
string(), "replies", "", nullptr, nullptr, 1, Auto(), string(), string());
|
|
||||||
on_get_user(std::move(user), "get_user_force");
|
on_get_user(std::move(user), "get_user_force");
|
||||||
u = get_user(user_id);
|
u = get_user(user_id);
|
||||||
CHECK(u != nullptr && u->is_received);
|
CHECK(u != nullptr && u->is_received);
|
||||||
|
@ -268,6 +268,10 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
static UserId get_replies_bot_user_id();
|
static UserId get_replies_bot_user_id();
|
||||||
|
|
||||||
|
static UserId get_anonymous_bot_user_id();
|
||||||
|
|
||||||
|
UserId add_anonymous_bot_user();
|
||||||
|
|
||||||
void on_update_online_status_privacy();
|
void on_update_online_status_privacy();
|
||||||
|
|
||||||
void on_update_phone_number_privacy();
|
void on_update_phone_number_privacy();
|
||||||
|
@ -1357,6 +1357,9 @@ void UpdatesManager::on_pending_updates(vector<tl_object_ptr<telegram_api::Updat
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (seq_begin <= seq_) {
|
if (seq_begin <= seq_) {
|
||||||
|
if (seq_ >= 1000000000 && seq_begin < seq_ - 1000000000) {
|
||||||
|
set_seq_gap_timeout(0.001);
|
||||||
|
}
|
||||||
if (seq_end > seq_) {
|
if (seq_end > seq_) {
|
||||||
LOG(ERROR) << "Strange updates from " << source << " coming with seq_begin = " << seq_begin
|
LOG(ERROR) << "Strange updates from " << source << " coming with seq_begin = " << seq_begin
|
||||||
<< ", seq_end = " << seq_end << ", but seq = " << seq_;
|
<< ", seq_end = " << seq_end << ", but seq = " << seq_;
|
||||||
|
@ -859,6 +859,13 @@ class CliClient final : public Actor {
|
|||||||
options.net_query_stats = net_query_stats_;
|
options.net_query_stats = net_query_stats_;
|
||||||
|
|
||||||
td_client_ = create_actor<ClientActor>(name, make_unique<TdCallbackImpl>(this, ++generation_), std::move(options));
|
td_client_ = create_actor<ClientActor>(name, make_unique<TdCallbackImpl>(this, ++generation_), std::move(options));
|
||||||
|
|
||||||
|
if (get_chat_list_) {
|
||||||
|
send_request(td_api::make_object<td_api::getChats>(nullptr, std::numeric_limits<int64>::max(), 0, 100));
|
||||||
|
}
|
||||||
|
if (disable_network_) {
|
||||||
|
send_request(td_api::make_object<td_api::setNetworkType>(td_api::make_object<td_api::networkTypeNone>()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_td() {
|
void init_td() {
|
||||||
@ -928,13 +935,6 @@ class CliClient final : public Actor {
|
|||||||
reactivate_readline();
|
reactivate_readline();
|
||||||
#endif
|
#endif
|
||||||
Scheduler::subscribe(stdin_.get_poll_info().extract_pollable_fd(this), PollFlags::Read());
|
Scheduler::subscribe(stdin_.get_poll_info().extract_pollable_fd(this), PollFlags::Read());
|
||||||
|
|
||||||
if (get_chat_list_) {
|
|
||||||
send_request(td_api::make_object<td_api::getChats>(nullptr, std::numeric_limits<int64>::max(), 0, 100));
|
|
||||||
}
|
|
||||||
if (disable_network_) {
|
|
||||||
send_request(td_api::make_object<td_api::setNetworkType>(td_api::make_object<td_api::networkTypeNone>()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifndef USE_READLINE
|
#ifndef USE_READLINE
|
||||||
size_t buffer_pos_ = 0;
|
size_t buffer_pos_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user