Update layer to 90.

GitOrigin-RevId: d105e3fe4c4c16764a8062915ad20bb9b8e3f815
This commit is contained in:
levlam 2019-02-13 19:05:34 +03:00
parent f37d86d109
commit e7fc6f4d58
9 changed files with 19 additions and 67 deletions

View File

@ -160,6 +160,7 @@ messageActionCustomAction#fae69f56 message:string = MessageAction;
messageActionBotAllowed#abe9affe domain:string = MessageAction;
messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;
messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType> = MessageAction;
messageActionContactSignUp#70ef8294 flags:# silent:flags.0?true = MessageAction;
dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
@ -264,7 +265,6 @@ updateChatParticipants#7761198 participants:ChatParticipants = Update;
updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update;
updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update;
updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update;
updateContactRegistered#2575bbb9 user_id:int date:int = Update;
updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update;
updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;
updateEncryptedChatTyping#1710f156 chat_id:int = Update;
@ -1037,6 +1037,9 @@ account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool;
account.confirmPasswordEmail#8fdf1920 code:string = Bool;
account.resendPasswordEmail#7a7f2a15 = Bool;
account.cancelPasswordEmail#c1cbd5b6 = Bool;
account.getContactSignUpNotification#9f07c728 = Bool;
account.setContactSignUpNotification#cff43f61 silent:Bool = Bool;
account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
users.getFullUser#ca30a5b1 id:InputUser = UserFull;

Binary file not shown.

View File

@ -8870,7 +8870,7 @@ ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channe
}
auto channel_full = &p->second;
if (channel_full->is_expired()) {
if (channel_full->is_expired() && !td_->auth_manager_->is_bot()) {
auto input_channel = get_input_channel(channel_id);
CHECK(input_channel != nullptr);
send_get_channel_full_query(channel_id, std::move(input_channel), Auto());

View File

@ -422,7 +422,7 @@ class MessageChatSetTtl : public MessageContent {
class MessageUnsupported : public MessageContent {
public:
static constexpr int32 CURRENT_VERSION = 1;
static constexpr int32 CURRENT_VERSION = 2;
int32 version = CURRENT_VERSION;
MessageUnsupported() = default;
@ -4119,6 +4119,10 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
get_encrypted_secure_values(td->file_manager_.get(), std::move(secure_values->values_)),
get_encrypted_secure_credentials(std::move(secure_values->credentials_)));
}
case telegram_api::messageActionContactSignUp::ID: {
LOG_IF(ERROR, td->auth_manager_->is_bot()) << "Receive ContactRegistered in " << owner_dialog_id;
return td::make_unique<MessageContactRegistered>();
}
default:
UNREACHABLE();
}

View File

@ -4758,61 +4758,6 @@ void MessagesManager::on_update_service_notification(tl_object_ptr<telegram_api:
}
}
void MessagesManager::on_update_contact_registered(tl_object_ptr<telegram_api::updateContactRegistered> &&update) {
if (update->date_ <= 0) {
LOG(ERROR) << "Receive wrong date " << update->date_ << " in updateContactRegistered";
return;
}
UserId user_id(update->user_id_);
if (!user_id.is_valid()) {
LOG(ERROR) << "Receive invalid " << user_id << " in updateContactRegistered";
return;
}
if (!td_->auth_manager_->is_bot() &&
!G()->shared_config().get_option_boolean("disable_contact_registered_notifications")) {
DialogId dialog_id(user_id);
force_create_dialog(dialog_id, "on_update_contact_registered");
Dialog *d = get_dialog(dialog_id);
CHECK(d != nullptr);
if (d->has_contact_registered_message) {
LOG(INFO) << "Ignore duplicate updateContactRegistered about " << user_id;
return;
}
if (d->last_message_id.is_valid()) {
auto m = get_message(d, d->last_message_id);
CHECK(m != nullptr);
if (m->content->get_type() == MessageContentType::ContactRegistered) {
LOG(INFO) << "Ignore duplicate updateContactRegistered about " << user_id;
return;
}
}
auto new_message = make_unique<Message>();
new_message->message_id = get_next_local_message_id(d);
new_message->random_y = get_random_y(new_message->message_id);
new_message->sender_user_id = user_id;
new_message->date = update->date_;
new_message->content = create_contact_registered_message_content();
new_message->have_previous = true;
new_message->have_next = true;
bool need_update = true;
bool need_update_dialog_pos = false;
const Message *m = add_message_to_dialog(d, std::move(new_message), true, &need_update, &need_update_dialog_pos,
"on_update_contact_registered");
if (m != nullptr && need_update) {
send_update_new_message(d, m);
}
if (need_update_dialog_pos) {
send_update_chat_last_message(d, "on_update_contact_registered");
}
}
}
void MessagesManager::on_update_new_channel_message(tl_object_ptr<telegram_api::updateNewChannelMessage> &&update) {
int new_pts = update->pts_;
int pts_count = update->pts_count_;
@ -8050,6 +7995,10 @@ int32 MessagesManager::calc_new_unread_count(Dialog *d, MessageId max_message_id
}
void MessagesManager::repair_server_unread_count(DialogId dialog_id, int32 unread_count) {
if (td_->auth_manager_->is_bot()) {
return;
}
LOG(INFO) << "Repair server unread count in " << dialog_id << " from " << unread_count;
create_actor<SleepActor>("RepairServerUnreadCountSleepActor", 0.2,
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id](Result<Unit> result) {
@ -8063,6 +8012,9 @@ void MessagesManager::repair_channel_server_unread_count(Dialog *d) {
CHECK(d != nullptr);
CHECK(d->dialog_id.get_type() == DialogType::Channel);
if (td_->auth_manager_->is_bot()) {
return;
}
if (d->last_read_inbox_message_id.get() >= d->last_new_message_id.get()) {
// all messages are already read
return;

View File

@ -280,8 +280,6 @@ class MessagesManager : public Actor {
void on_update_service_notification(tl_object_ptr<telegram_api::updateServiceNotification> &&update);
void on_update_contact_registered(tl_object_ptr<telegram_api::updateContactRegistered> &&update);
void on_update_new_channel_message(tl_object_ptr<telegram_api::updateNewChannelMessage> &&update);
void on_update_edit_channel_message(tl_object_ptr<telegram_api::updateEditChannelMessage> &&update);

View File

@ -499,6 +499,7 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_
case telegram_api::messageActionScreenshotTaken::ID:
case telegram_api::messageActionSecureValuesSent::ID:
case telegram_api::messageActionSecureValuesSentMe::ID:
case telegram_api::messageActionContactSignUp::ID:
break;
case telegram_api::messageActionChatCreate::ID: {
auto chat_create = static_cast<const telegram_api::messageActionChatCreate *>(action);
@ -1437,11 +1438,6 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateServiceNotifica
td_->messages_manager_->on_update_service_notification(std::move(update));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateContactRegistered> update, bool /*force_apply*/) {
CHECK(update != nullptr);
td_->messages_manager_->on_update_contact_registered(std::move(update));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateReadChannelInbox> update, bool /*force_apply*/) {
CHECK(update != nullptr);
td_->messages_manager_->on_update_read_channel_inbox(std::move(update));

View File

@ -212,7 +212,6 @@ class UpdatesManager : public Actor {
void on_update(tl_object_ptr<telegram_api::updateChatAdmins> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateServiceNotification> update, bool force_apply);
void on_update(tl_object_ptr<telegram_api::updateContactRegistered> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateDcOptions> update, bool /*force_apply*/);

View File

@ -21,7 +21,7 @@ class HeaderStorer {
}
template <class StorerT>
void store(StorerT &storer) const {
constexpr int32 LAYER = 89;
constexpr int32 LAYER = 90;
using td::store;
// invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;