Allow to search for messages from inaccessible chats.
This commit is contained in:
parent
0c6922a0bf
commit
ab153e306a
@ -2280,7 +2280,7 @@ class SearchMessagesQuery final : public Td::ResultHandler {
|
|||||||
tl_object_ptr<telegram_api::InputPeer> sender_input_peer;
|
tl_object_ptr<telegram_api::InputPeer> sender_input_peer;
|
||||||
if (sender_dialog_id.is_valid()) {
|
if (sender_dialog_id.is_valid()) {
|
||||||
flags |= telegram_api::messages_search::FROM_ID_MASK;
|
flags |= telegram_api::messages_search::FROM_ID_MASK;
|
||||||
sender_input_peer = td_->messages_manager_->get_input_peer(sender_dialog_id, AccessRights::Read);
|
sender_input_peer = td_->messages_manager_->get_input_peer(sender_dialog_id, AccessRights::Know);
|
||||||
CHECK(sender_input_peer != nullptr);
|
CHECK(sender_input_peer != nullptr);
|
||||||
}
|
}
|
||||||
if (top_thread_message_id.is_valid()) {
|
if (top_thread_message_id.is_valid()) {
|
||||||
@ -6221,14 +6221,14 @@ int32 MessagesManager::get_message_index_mask(DialogId dialog_id, const Message
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::update_reply_count_by_message(Dialog *d, int diff, const Message *m) {
|
void MessagesManager::update_reply_count_by_message(Dialog *d, int diff, const Message *m) {
|
||||||
|
CHECK(d != nullptr);
|
||||||
|
CHECK(m != nullptr);
|
||||||
if (td_->auth_manager_->is_bot() || !m->top_thread_message_id.is_valid() ||
|
if (td_->auth_manager_->is_bot() || !m->top_thread_message_id.is_valid() ||
|
||||||
m->top_thread_message_id == m->message_id || !m->message_id.is_valid() || !m->message_id.is_server()) {
|
m->top_thread_message_id == m->message_id || !m->message_id.is_valid() || !m->message_id.is_server()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto replier_dialog_id =
|
update_message_reply_count(d, m->top_thread_message_id, get_message_sender(m), m->message_id,
|
||||||
has_message_sender_user_id(d->dialog_id, m) ? DialogId(m->sender_user_id) : m->sender_dialog_id;
|
|
||||||
update_message_reply_count(d, m->top_thread_message_id, replier_dialog_id, m->message_id,
|
|
||||||
diff < 0 ? G()->unix_time() : m->date, diff);
|
diff < 0 ? G()->unix_time() : m->date, diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21523,7 +21523,7 @@ std::pair<int32, vector<MessageId>> MessagesManager::search_dialog_messages(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
auto sender_dialog_id = r_sender_dialog_id.move_as_ok();
|
auto sender_dialog_id = r_sender_dialog_id.move_as_ok();
|
||||||
if (sender_dialog_id != DialogId() && !have_input_peer(sender_dialog_id, AccessRights::Read)) {
|
if (sender_dialog_id != DialogId() && !have_input_peer(sender_dialog_id, AccessRights::Know)) {
|
||||||
promise.set_error(Status::Error(400, "Invalid message sender specified"));
|
promise.set_error(Status::Error(400, "Invalid message sender specified"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -26483,8 +26483,7 @@ tl_object_ptr<telegram_api::InputPeer> MessagesManager::get_send_message_as_inpu
|
|||||||
if (!m->has_explicit_sender) {
|
if (!m->has_explicit_sender) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto sender_dialog_id = get_message_sender(m);
|
return get_input_peer(get_message_sender(m), AccessRights::Write);
|
||||||
return get_input_peer(sender_dialog_id, AccessRights::Write);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessagesManager::can_set_game_score(FullMessageId full_message_id) const {
|
bool MessagesManager::can_set_game_score(FullMessageId full_message_id) const {
|
||||||
|
@ -2087,10 +2087,12 @@ class CliClient final : public Actor {
|
|||||||
} else if (op == "SMU" || op == "SMC") {
|
} else if (op == "SMU" || op == "SMC") {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
string sender_id;
|
string sender_id;
|
||||||
|
string from_message_id;
|
||||||
string limit;
|
string limit;
|
||||||
get_args(args, chat_id, sender_id, limit);
|
get_args(args, chat_id, sender_id, from_message_id, limit);
|
||||||
send_request(td_api::make_object<td_api::searchChatMessages>(
|
send_request(td_api::make_object<td_api::searchChatMessages>(
|
||||||
as_chat_id(chat_id), "", as_message_sender(sender_id), 0, 0, as_limit(limit), nullptr, 0));
|
as_chat_id(chat_id), "", as_message_sender(sender_id), as_message_id(from_message_id), 0, as_limit(limit),
|
||||||
|
nullptr, 0));
|
||||||
} else if (op == "SM") {
|
} else if (op == "SM") {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
string filter;
|
string filter;
|
||||||
|
Loading…
Reference in New Issue
Block a user