Remove support for nearby chat

Disable reportChat
This commit is contained in:
Giuseppe Marino 2024-12-18 20:52:58 +01:00
parent bdd7594dd4
commit 5a032f0af8
No known key found for this signature in database
GPG Key ID: C26F7A532ADEC25E
3 changed files with 10 additions and 143 deletions

View File

@ -854,90 +854,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
/getNearbyChats:
post:
tags:
- added
- user-only
description: |-
*ONLY FOR USERS*
Returns a list of chats nearby the specified location. Telegram may send old results if you change your location too quick.
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
latitude:
description: Latitude of the location
type: number
longitude:
description: Longitude of the location
type: number
horizontal_accuracy:
description: 'The radius of uncertainty for the location, measured in meters; 0-1500'
type: number
required:
- latitude
- longitude
multipart/form-data:
schema:
type: object
properties:
latitude:
description: Latitude of the location
type: number
longitude:
description: Longitude of the location
type: number
horizontal_accuracy:
description: 'The radius of uncertainty for the location, measured in meters; 0-1500'
type: number
required:
- latitude
- longitude
application/json:
schema:
type: object
properties:
latitude:
description: Latitude of the location
type: number
longitude:
description: Longitude of the location
type: number
horizontal_accuracy:
description: 'The radius of uncertainty for the location, measured in meters; 0-1500'
type: number
required:
- latitude
- longitude
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
ok:
default: true
type: boolean
result:
type: array
items:
$ref: '#/components/schemas/Chat'
required:
- ok
- result
default:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/searchPublicChats:
post:
tags:

View File

@ -374,7 +374,6 @@ bool Client::init_methods() {
methods_.emplace("getchats", &Client::process_get_chats_query);
methods_.emplace("getcommonchats", &Client::process_get_common_chats_query);
methods_.emplace("getinactivechats", &Client::process_get_inactive_chats_query);
methods_.emplace("getnearbychats", &Client::process_get_nearby_chats_query);
methods_.emplace("searchpublicchats", &Client::process_search_public_chats_query);
methods_.emplace("votepoll", &Client::process_set_poll_answer_query);
methods_.emplace("joinchat", &Client::process_join_chat_query);
@ -4760,26 +4759,6 @@ class Client::JsonChats : public td::Jsonable {
const Client *client_;
};
class Client::JsonChatsNearby : public td::Jsonable {
public:
JsonChatsNearby(const object_ptr<td_api::chatsNearby> &chats_nearby, const Client *client)
: chats_nearby_(chats_nearby), client_(client) {
}
void store(td::JsonValueScope *scope) const {
auto array = scope->enter_array();
for (auto &chat : chats_nearby_->users_nearby_) {
array << JsonChat(chat->chat_id_, client_, false, -1, chat->distance_);
}
for (auto &chat : chats_nearby_->supergroups_nearby_) {
array << JsonChat(chat->chat_id_, client_, false, -1, chat->distance_);
}
}
private:
const object_ptr<td_api::chatsNearby> &chats_nearby_;
const Client *client_;
};
class Client::JsonMessagesArray : public td::Jsonable {
public:
explicit JsonMessagesArray(td::vector<object_ptr<td_api::message>> &messages, Client *client) : messages_(messages), client_(client) {
@ -6648,27 +6627,6 @@ class Client::TdOnGetChatsCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
class Client::TdOnGetChatsNearbyCallback : public TdQueryCallback {
public:
explicit TdOnGetChatsNearbyCallback(Client *client, PromisedQueryPtr query)
: client_(client), query_(std::move(query)) {
}
void on_result(object_ptr<td_api::Object> result) override {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as<td_api::error>(result));
}
CHECK(result->get_id() == td_api::chatsNearby::ID);
auto chats_nearby = move_object_as<td_api::chatsNearby>(result);
answer_query(JsonChatsNearby(chats_nearby, client_), std::move(query_));
}
private:
const Client *client_;
PromisedQueryPtr query_;
};
class Client::TdOnJoinChatCallback : public TdQueryCallback {
public:
explicit TdOnJoinChatCallback(Client *client, PromisedQueryPtr query, int64 chat_id)
@ -13792,15 +13750,6 @@ td::Status Client::process_get_inactive_chats_query(PromisedQueryPtr &query) {
return td::Status::OK();
}
td::Status Client::process_get_nearby_chats_query(PromisedQueryPtr &query) {
CHECK_IS_USER();
TRY_RESULT(location, get_location(query.get()));
send_request(make_object<td_api::searchChatsNearby>(std::move(location)),
td::make_unique<TdOnGetChatsNearbyCallback>(this, std::move(query)));
return td::Status::OK();
}
td::Status Client::process_search_public_chats_query(PromisedQueryPtr &query) {
CHECK_IS_USER();
auto query_ = query->arg("query");
@ -13867,17 +13816,22 @@ td::Status Client::process_add_chat_member_query(PromisedQueryPtr &query) {
td::Status Client::process_report_chat_query(PromisedQueryPtr &query) {
CHECK_IS_USER();
// to be rewritten
/*
auto chat_id = query->arg("chat_id");
TRY_RESULT(reason, get_report_reason(query.get()));
TRY_RESULT(message_ids, get_int_array_arg<td::int64>(query.get(), "message_ids", true));
check_chat(chat_id, AccessRights::Read, std::move(query),
[this, reason = std::move(reason), message_ids = std::move(message_ids)](int64 chat_id,
PromisedQueryPtr query) mutable {
send_request(make_object<td_api::reportChat>(chat_id, std::move(message_ids), std::move(reason), reason->get_id() == td_api::reportReasonCustom::ID ? query->arg("reason").str() : td::string()),
[this, reason = std::move(reason), message_ids = std::move(message_ids), option_id = std::move(option_id)](
int64 chat_id, PromisedQueryPtr query) mutable {
send_request(
make_object<td_api::reportChat>(
chat_id, option_id, std::move(message_ids), std::move(reason),
reason->get_id() == td_api::reportReasonCustom::ID ? query->arg("reason").str() : td::string()),
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
});
*/
return td::Status::OK();
}

View File

@ -232,7 +232,6 @@ class Client final : public WebhookActor::Callback {
class JsonAuthorizationState;
class JsonCallbackQueryAnswer;
class JsonChats;
class JsonChatsNearby;
class JsonMessagesArray;
class JsonFoundMessages;
class JsonProxy;
@ -296,7 +295,6 @@ class Client final : public WebhookActor::Callback {
class TdOnPingCallback;
class TdOnGetMemoryStatisticsCallback;
class TdOnGetChatsCallback;
class TdOnGetChatsNearbyCallback;
class TdOnJoinChatCallback;
class TdOnReturnChatCallback;
class TdOnReturnMessagesCallback;
@ -848,7 +846,6 @@ class Client final : public WebhookActor::Callback {
td::Status process_get_chats_query(PromisedQueryPtr &query);
td::Status process_get_common_chats_query(PromisedQueryPtr &query);
td::Status process_get_inactive_chats_query(PromisedQueryPtr &query);
td::Status process_get_nearby_chats_query(PromisedQueryPtr &query);
td::Status process_search_public_chats_query(PromisedQueryPtr &query);
td::Status process_set_poll_answer_query(PromisedQueryPtr &query);
td::Status process_join_chat_query(PromisedQueryPtr &query);