Fix updateShortMessage handling.
GitOrigin-RevId: 35c667af5646654ed9f8495774043adb10b12faf
This commit is contained in:
parent
cd3bf3618b
commit
7df0c5084a
@ -12048,8 +12048,10 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
||||
auto message = move_tl_object_as<telegram_api::message>(message_ptr);
|
||||
|
||||
message_info.dialog_id = DialogId(message->peer_id_);
|
||||
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
||||
if (message->from_id_ != nullptr) {
|
||||
message_info.sender_dialog_id = DialogId(message->from_id_);
|
||||
} else {
|
||||
message_info.sender_dialog_id = message_info.dialog_id;
|
||||
}
|
||||
message_info.date = message->date_;
|
||||
message_info.forward_header = std::move(message->fwd_from_);
|
||||
@ -12101,8 +12103,10 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
||||
auto message = move_tl_object_as<telegram_api::messageService>(message_ptr);
|
||||
|
||||
message_info.dialog_id = DialogId(message->peer_id_);
|
||||
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
||||
if (message->from_id_ != nullptr) {
|
||||
message_info.sender_dialog_id = DialogId(message->from_id_);
|
||||
} else {
|
||||
message_info.sender_dialog_id = message_info.dialog_id;
|
||||
}
|
||||
message_info.date = message->date_;
|
||||
message_info.flags = message->flags_;
|
||||
@ -23193,7 +23197,7 @@ unique_ptr<MessagesManager::MessageForwardInfo> MessagesManager::get_message_for
|
||||
DialogId from_dialog_id;
|
||||
MessageId from_message_id;
|
||||
string sender_name;
|
||||
if ((flags & telegram_api::messageFwdHeader::FROM_ID_MASK) != 0) {
|
||||
if (forward_header->from_id_ != nullptr) {
|
||||
sender_dialog_id = DialogId(forward_header->from_id_);
|
||||
if (!sender_dialog_id.is_valid()) {
|
||||
LOG(ERROR) << "Receive invalid sender id in message forward header: " << oneline(to_string(forward_header));
|
||||
|
@ -3778,7 +3778,9 @@ void Td::inc_actor_refcnt() {
|
||||
|
||||
void Td::dec_actor_refcnt() {
|
||||
actor_refcnt_--;
|
||||
LOG(DEBUG) << "Decrease reference count to " << actor_refcnt_;
|
||||
if (actor_refcnt_ < 3) {
|
||||
LOG(DEBUG) << "Decrease reference count to " << actor_refcnt_;
|
||||
}
|
||||
if (actor_refcnt_ == 0) {
|
||||
if (close_flag_ == 2) {
|
||||
create_reference();
|
||||
|
@ -414,17 +414,11 @@ bool UpdatesManager::is_acceptable_message_forward_header(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (header->from_id_ != nullptr) {
|
||||
DialogId dialog_id(header->from_id_);
|
||||
if (!is_acceptable_dialog(dialog_id)) {
|
||||
return false;
|
||||
}
|
||||
if (header->from_id_ != nullptr && !is_acceptable_dialog(DialogId(header->from_id_))) {
|
||||
return false;
|
||||
}
|
||||
if (header->saved_from_peer_ != nullptr) {
|
||||
DialogId dialog_id(header->saved_from_peer_);
|
||||
if (!is_acceptable_dialog(dialog_id)) {
|
||||
return false;
|
||||
}
|
||||
if (header->saved_from_peer_ != nullptr && !is_acceptable_dialog(DialogId(header->saved_from_peer_))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -534,10 +528,8 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_
|
||||
if (!is_acceptable_dialog(DialogId(message->peer_id_))) {
|
||||
return false;
|
||||
}
|
||||
if (message->flags_ & MessagesManager::MESSAGE_FLAG_HAS_FROM_ID) {
|
||||
if (!is_acceptable_dialog(DialogId(message->from_id_))) {
|
||||
return false;
|
||||
}
|
||||
if (message->from_id_ != nullptr && !is_acceptable_dialog(DialogId(message->from_id_))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const telegram_api::MessageAction *action = message->action_.get();
|
||||
@ -707,16 +699,13 @@ void UpdatesManager::on_get_updates(tl_object_ptr<telegram_api::Updates> &&updat
|
||||
|
||||
auto from_id = update->flags_ & MessagesManager::MESSAGE_FLAG_IS_OUT ? td_->contacts_manager_->get_my_id().get()
|
||||
: update->user_id_;
|
||||
auto peer_id = update->flags_ & MessagesManager::MESSAGE_FLAG_IS_OUT ? update->user_id_
|
||||
: td_->contacts_manager_->get_my_id().get();
|
||||
|
||||
update->flags_ |= MessagesManager::MESSAGE_FLAG_HAS_FROM_ID;
|
||||
on_pending_update(make_tl_object<telegram_api::updateNewMessage>(
|
||||
make_tl_object<telegram_api::message>(
|
||||
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, update->id_, make_tl_object<telegram_api::peerUser>(from_id),
|
||||
make_tl_object<telegram_api::peerUser>(peer_id), std::move(update->fwd_from_),
|
||||
make_tl_object<telegram_api::peerUser>(update->user_id_), std::move(update->fwd_from_),
|
||||
update->via_bot_id_, std::move(update->reply_to_), update->date_, update->message_,
|
||||
nullptr, nullptr, std::move(update->entities_), 0, 0, nullptr, 0, string(), 0, Auto()),
|
||||
update->pts_, update->pts_count_),
|
||||
|
@ -505,6 +505,10 @@ class CliClient final : public Actor {
|
||||
return transform(full_split(trim(message_ids), get_delimiter(message_ids)), as_message_id);
|
||||
}
|
||||
|
||||
static int64 as_message_thread_id(Slice str) {
|
||||
return as_message_id(str);
|
||||
}
|
||||
|
||||
static int32 as_button_id(Slice str) {
|
||||
return to_integer<int32>(trim(str));
|
||||
}
|
||||
@ -1860,6 +1864,12 @@ class CliClient final : public Actor {
|
||||
|
||||
send_request(td_api::make_object<td_api::getChatHistory>(get_history_chat_id_, std::numeric_limits<int64>::max(),
|
||||
0, 100, false));
|
||||
} else if (op == "replies") {
|
||||
string chat_id;
|
||||
string message_thread_id;
|
||||
|
||||
send_request(td_api::make_object<td_api::searchChatMessages>(as_chat_id(chat_id), "", 0, 0, 0, 100, nullptr,
|
||||
as_message_thread_id(message_thread_id)));
|
||||
} else if (op == "spvf") {
|
||||
search_chat_id_ = as_chat_id(args);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user