diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 0d769bd14..d6361b5b2 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1593,8 +1593,8 @@ messageVoiceNote voice_note:voiceNote caption:formattedText is_listened:Bool = M //@description A message with a location @location The location description @live_period Time relative to the message send date, for which the location can be updated, in seconds //@expires_in Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes //@heading For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown -//@approaching_notification_distance For live locations, a maximum distance for notifications about approaching another chat member, in meters (0-100000). 0 if the notification is disabled. Available only for the message sender -messageLocation location:location live_period:int32 expires_in:int32 heading:int32 approaching_notification_distance:int32 = MessageContent; +//@proximity_alert_distance For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only for the message sender +messageLocation location:location live_period:int32 expires_in:int32 heading:int32 proximity_alert_distance:int32 = MessageContent; //@description A message with information about a venue @venue The venue description messageVenue venue:venue = MessageContent; @@ -1689,8 +1689,8 @@ messagePassportDataSent types:vector = MessageContent; //@description Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials messagePassportDataReceived elements:vector credentials:encryptedCredentials = MessageContent; -//@description A user in the chat approached another user @approacher The user or chat, which approached another user @observer The user which subscribed for the approaching notification @distance The distance between users -messageLiveLocationApproached approacher:MessageSender observer:MessageSender distance:int32 = MessageContent; +//@description A user in the chat came within proximity alert range @approacher The user or chat, which approached another user @observer The user or chat, which subscribed for the proximity alert @distance The distance between the users +messageProximityAlertTriggered approacher:MessageSender observer:MessageSender distance:int32 = MessageContent; //@description Message content that is not supported in the current TDLib version messageUnsupported = MessageContent; @@ -1814,8 +1814,8 @@ inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption //@description A message with a location @location Location to be sent @live_period Period for which the location can be updated, in seconds; should be between 60 and 86400 for a live location and 0 otherwise //@heading For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown -//@approaching_notification_distance For live locations, a maximum distance for notifications about approaching another chat member, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages, or for anonymous messages -inputMessageLocation location:location live_period:int32 heading:int32 approaching_notification_distance:int32 = InputMessageContent; +//@proximity_alert_distance For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages +inputMessageLocation location:location live_period:int32 heading:int32 proximity_alert_distance:int32 = InputMessageContent; //@description A message with information about a venue @venue Venue to send inputMessageVenue venue:venue = InputMessageContent; @@ -3849,8 +3849,8 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @location New location content of the message; may be null. Pass null to stop sharing the live location //@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown -//@approaching_notification_distance The new maximum distance for notifications about approaching another chat member, in meters (0-100000). Pass 0 if the notification is disabled -editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 approaching_notification_distance:int32 = Message; +//@proximity_alert_distance The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled +editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_distance:int32 = Message; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo @@ -3870,8 +3870,8 @@ editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_me //@description Edits the content of a live location in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup //@location New location content of the message; may be null. Pass null to stop sharing the live location //@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown -//@approaching_notification_distance The new maximum distance for notifications about approaching another chat member, in meters (0-100000). Pass 0 if the notification is disabled -editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 approaching_notification_distance:int32 = Ok; +//@proximity_alert_distance The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled +editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_distance:int32 = Ok; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier //@reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index 46096b414..267121cbf 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/telegram/DialogAction.cpp b/td/telegram/DialogAction.cpp index 761f5a452..cdc0512f1 100644 --- a/td/telegram/DialogAction.cpp +++ b/td/telegram/DialogAction.cpp @@ -305,7 +305,7 @@ bool DialogAction::is_cancelled_by_message_of_type(MessageContentType message_co case MessageContentType::PassportDataReceived: case MessageContentType::Poll: case MessageContentType::Dice: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return false; default: UNREACHABLE(); diff --git a/td/telegram/InlineQueriesManager.cpp b/td/telegram/InlineQueriesManager.cpp index 2cdda22c3..5a55a5ba5 100644 --- a/td/telegram/InlineQueriesManager.cpp +++ b/td/telegram/InlineQueriesManager.cpp @@ -266,7 +266,7 @@ Result> InlineQueriesManager: } return make_tl_object( flags, location.location.get_input_geo_point(), location.heading, location.live_period, - location.approaching_notification_distance, std::move(input_reply_markup)); + location.proximity_alert_distance, std::move(input_reply_markup)); } if (constructor_id == td_api::inputMessageVenue::ID) { TRY_RESULT(venue, process_input_message_venue(std::move(input_message_content))); diff --git a/td/telegram/Location.cpp b/td/telegram/Location.cpp index 5d4fd6f14..30a63e729 100644 --- a/td/telegram/Location.cpp +++ b/td/telegram/Location.cpp @@ -151,16 +151,17 @@ Result process_input_message_location( return Status::Error(400, "Wrong live location heading specified"); } - auto approaching_notification_distance = input_location->approaching_notification_distance_; - if (approaching_notification_distance < 0) { - return Status::Error(400, "Wrong live location approaching notification distance specified"); + constexpr int32 MAX_PROXIMITY_ALERT_DISTANCE = 100000; // meters, server side limit + auto proximity_alert_distance = input_location->proximity_alert_distance_; + if (proximity_alert_distance < 0 || proximity_alert_distance > MAX_PROXIMITY_ALERT_DISTANCE) { + return Status::Error(400, "Wrong live location proximity alert distance specified"); } InputMessageLocation result; result.location = std::move(location); result.live_period = period; result.heading = heading; - result.approaching_notification_distance = approaching_notification_distance; + result.proximity_alert_distance = proximity_alert_distance; return std::move(result); } diff --git a/td/telegram/Location.h b/td/telegram/Location.h index 2e624bcb0..6cd97aeca 100644 --- a/td/telegram/Location.h +++ b/td/telegram/Location.h @@ -126,7 +126,7 @@ struct InputMessageLocation { Location location; int32 live_period; int32 heading; - int32 approaching_notification_distance; + int32 proximity_alert_distance; }; Result process_input_message_location( td_api::object_ptr &&input_message_content) TD_WARN_UNUSED_RESULT; diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 84602dded..425638150 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -568,14 +568,14 @@ class MessageLiveLocation : public MessageContent { Location location; int32 period = 0; int32 heading = 0; - int32 approaching_notification_distance = 0; + int32 proximity_alert_distance = 0; MessageLiveLocation() = default; - MessageLiveLocation(Location &&location, int32 period, int32 heading, int32 approaching_notification_distance) + MessageLiveLocation(Location &&location, int32 period, int32 heading, int32 proximity_alert_distance) : location(std::move(location)) , period(period) , heading(heading) - , approaching_notification_distance(approaching_notification_distance) { + , proximity_alert_distance(proximity_alert_distance) { if (period < 0) { period = 0; } @@ -583,8 +583,8 @@ class MessageLiveLocation : public MessageContent { LOG(ERROR) << "Receive wrong heading " << heading; heading = 0; } - if (approaching_notification_distance < 0) { - approaching_notification_distance = 0; + if (proximity_alert_distance < 0) { + proximity_alert_distance = 0; } } @@ -688,19 +688,19 @@ class MessageDice : public MessageContent { } }; -class MessageLiveLocationApproached : public MessageContent { +class MessageProximityAlertTriggered : public MessageContent { public: DialogId approacher_dialog_id; DialogId observer_dialog_id; int32 distance = 0; - MessageLiveLocationApproached() = default; - MessageLiveLocationApproached(DialogId approacher_dialog_id, DialogId observer_dialog_id, int32 distance) + MessageProximityAlertTriggered() = default; + MessageProximityAlertTriggered(DialogId approacher_dialog_id, DialogId observer_dialog_id, int32 distance) : approacher_dialog_id(approacher_dialog_id), observer_dialog_id(observer_dialog_id), distance(distance) { } MessageContentType get_type() const override { - return MessageContentType::LiveLocationApproached; + return MessageContentType::ProximityAlertTriggered; } }; @@ -765,7 +765,7 @@ static void store(const MessageContent *content, StorerT &storer) { store(m->location, storer); store(m->period, storer); store(m->heading, storer); - store(m->approaching_notification_distance, storer); + store(m->proximity_alert_distance, storer); break; } case MessageContentType::Location: { @@ -971,8 +971,8 @@ static void store(const MessageContent *content, StorerT &storer) { store(m->dice_value, storer); break; } - case MessageContentType::LiveLocationApproached: { - auto m = static_cast(content); + case MessageContentType::ProximityAlertTriggered: { + auto m = static_cast(content); store(m->approacher_dialog_id, storer); store(m->observer_dialog_id, storer); store(m->distance, storer); @@ -1072,10 +1072,10 @@ static void parse(unique_ptr &content, ParserT &parser) { } else { m->heading = 0; } - if (parser.version() >= static_cast(Version::AddLiveLocationApproachingNotificationDistance)) { - parse(m->approaching_notification_distance, parser); + if (parser.version() >= static_cast(Version::AddLiveLocationProximityAlertDistance)) { + parse(m->proximity_alert_distance, parser); } else { - m->approaching_notification_distance = 0; + m->proximity_alert_distance = 0; } content = std::move(m); break; @@ -1344,8 +1344,8 @@ static void parse(unique_ptr &content, ParserT &parser) { content = std::move(m); break; } - case MessageContentType::LiveLocationApproached: { - auto m = make_unique(); + case MessageContentType::ProximityAlertTriggered: { + auto m = make_unique(); parse(m->approacher_dialog_id, parser); parse(m->observer_dialog_id, parser); parse(m->distance, parser); @@ -1687,7 +1687,7 @@ static Result create_input_message_content( content = make_unique(std::move(location.location)); } else { content = make_unique(std::move(location.location), location.live_period, location.heading, - location.approaching_notification_distance); + location.proximity_alert_distance); } break; } @@ -2046,7 +2046,7 @@ bool can_have_input_media(const Td *td, const MessageContent *content) { case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return false; case MessageContentType::Animation: case MessageContentType::Audio: @@ -2159,7 +2159,7 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td, case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: break; default: UNREACHABLE(); @@ -2289,7 +2289,7 @@ static tl_object_ptr get_input_media_impl( flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK; return make_tl_object(flags, false /*ignored*/, m->location.get_input_geo_point(), m->heading, m->period, - m->approaching_notification_distance); + m->proximity_alert_distance); } case MessageContentType::Location: { auto m = static_cast(content); @@ -2349,7 +2349,7 @@ static tl_object_ptr get_input_media_impl( case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: break; default: UNREACHABLE(); @@ -2472,7 +2472,7 @@ void delete_message_content_thumbnail(MessageContent *content, Td *td) { case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Poll: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: break; default: UNREACHABLE(); @@ -2596,7 +2596,7 @@ static int32 get_message_content_media_index_mask(const MessageContent *content, case MessageContentType::PassportDataReceived: case MessageContentType::Poll: case MessageContentType::Dice: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return 0; default: UNREACHABLE(); @@ -2872,7 +2872,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo need_update = true; } if (old_->period != new_->period || old_->heading != new_->heading || - old_->approaching_notification_distance != new_->approaching_notification_distance) { + old_->proximity_alert_distance != new_->proximity_alert_distance) { need_update = true; } if (old_->location.get_access_hash() != new_->location.get_access_hash()) { @@ -3209,9 +3209,9 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo } break; } - case MessageContentType::LiveLocationApproached: { - auto old_ = static_cast(old_content); - auto new_ = static_cast(new_content); + case MessageContentType::ProximityAlertTriggered: { + auto old_ = static_cast(old_content); + auto new_ = static_cast(new_content); if (old_->approacher_dialog_id != new_->approacher_dialog_id || old_->observer_dialog_id != new_->observer_dialog_id || old_->distance != new_->distance) { need_update = true; @@ -3350,7 +3350,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File case MessageContentType::PassportDataReceived: case MessageContentType::Poll: case MessageContentType::Dice: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: LOG(ERROR) << "Receive new file " << new_file_id << " in a sent message of the type " << content_type; break; default: @@ -4243,7 +4243,7 @@ unique_ptr dup_message_content(Td *td, DialogId dialog_id, const case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return nullptr; default: UNREACHABLE(); @@ -4436,7 +4436,7 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptr(approacher_id, observer_id, distance); + return make_unique(approacher_id, observer_id, distance); } default: UNREACHABLE(); @@ -4486,9 +4486,9 @@ tl_object_ptr get_message_content_object(const MessageCo auto passed = max(G()->unix_time_cached() - message_date, 0); auto expires_in = max(0, m->period - passed); auto heading = expires_in == 0 ? 0 : m->heading; - auto approaching_notification_distance = expires_in == 0 ? 0 : m->approaching_notification_distance; + auto proximity_alert_distance = expires_in == 0 ? 0 : m->proximity_alert_distance; return make_tl_object(m->location.get_location_object(), m->period, expires_in, heading, - approaching_notification_distance); + proximity_alert_distance); } case MessageContentType::Location: { const MessageLocation *m = static_cast(content); @@ -4641,9 +4641,9 @@ tl_object_ptr get_message_content_object(const MessageCo return make_tl_object(std::move(initial_state), std::move(final_state), m->emoji, m->dice_value, success_animation_frame_number); } - case MessageContentType::LiveLocationApproached: { - const MessageLiveLocationApproached *m = static_cast(content); - return make_tl_object( + case MessageContentType::ProximityAlertTriggered: { + const MessageProximityAlertTriggered *m = static_cast(content); + return make_tl_object( td->messages_manager_->get_message_sender_object(m->approacher_dialog_id), td->messages_manager_->get_message_sender_object(m->observer_dialog_id), m->distance); } @@ -4958,7 +4958,7 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Dice: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return string(); default: UNREACHABLE(); @@ -5152,8 +5152,8 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC break; case MessageContentType::Dice: break; - case MessageContentType::LiveLocationApproached: { - auto content = static_cast(message_content); + case MessageContentType::ProximityAlertTriggered: { + auto content = static_cast(message_content); add_message_sender_dependencies(dependencies, content->approacher_dialog_id); add_message_sender_dependencies(dependencies, content->observer_dialog_id); break; diff --git a/td/telegram/MessageContentType.cpp b/td/telegram/MessageContentType.cpp index 4b5c4b7d4..193e553eb 100644 --- a/td/telegram/MessageContentType.cpp +++ b/td/telegram/MessageContentType.cpp @@ -96,8 +96,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType cont return string_builder << "Poll"; case MessageContentType::Dice: return string_builder << "Dice"; - case MessageContentType::LiveLocationApproached: - return string_builder << "LiveLocationApproached"; + case MessageContentType::ProximityAlertTriggered: + return string_builder << "ProximityAlertTriggered"; default: UNREACHABLE(); return string_builder; @@ -149,7 +149,7 @@ bool is_allowed_media_group_content(MessageContentType content_type) { case MessageContentType::PassportDataReceived: case MessageContentType::Poll: case MessageContentType::Dice: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return false; default: UNREACHABLE(); @@ -209,7 +209,7 @@ bool is_secret_message_content(int32 ttl, MessageContentType content_type) { case MessageContentType::PassportDataReceived: case MessageContentType::Poll: case MessageContentType::Dice: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return false; default: UNREACHABLE(); @@ -262,7 +262,7 @@ bool is_service_message_content(MessageContentType content_type) { case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return true; default: UNREACHABLE(); @@ -315,7 +315,7 @@ bool can_have_message_content_caption(MessageContentType content_type) { case MessageContentType::PassportDataReceived: case MessageContentType::Poll: case MessageContentType::Dice: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return false; default: UNREACHABLE(); diff --git a/td/telegram/MessageContentType.h b/td/telegram/MessageContentType.h index 4b45608d9..954a5a67c 100644 --- a/td/telegram/MessageContentType.h +++ b/td/telegram/MessageContentType.h @@ -55,7 +55,7 @@ enum class MessageContentType : int32 { PassportDataReceived, Poll, Dice, - LiveLocationApproached + ProximityAlertTriggered }; StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 65ecb1350..9a768b43f 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -22431,7 +22431,7 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: UNREACHABLE(); } return Status::OK(); @@ -23992,7 +23992,7 @@ bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, boo case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::LiveLocationApproached: + case MessageContentType::ProximityAlertTriggered: return false; default: UNREACHABLE(); @@ -24135,7 +24135,7 @@ void MessagesManager::edit_message_text(FullMessageId full_message_id, void MessagesManager::edit_message_live_location(FullMessageId full_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_location, int32 heading, - int32 approaching_notification_distance, Promise &&promise) { + int32 proximity_alert_distance, Promise &&promise) { LOG(INFO) << "Begin to edit live location of " << full_message_id; auto dialog_id = full_message_id.get_dialog_id(); Dialog *d = get_dialog_force(dialog_id); @@ -24186,7 +24186,7 @@ void MessagesManager::edit_message_live_location(FullMessageId full_message_id, } flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK; auto input_media = telegram_api::make_object( - flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, approaching_notification_distance); + flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, proximity_alert_distance); send_closure(td_->create_net_actor(std::move(promise)), &EditMessageActor::send, 0, dialog_id, m->message_id, string(), vector>(), std::move(input_media), std::move(input_reply_markup), get_message_schedule_date(m), @@ -24500,8 +24500,7 @@ void MessagesManager::edit_inline_message_text(const string &inline_message_id, void MessagesManager::edit_inline_message_live_location(const string &inline_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_location, int32 heading, - int32 approaching_notification_distance, - Promise &&promise) { + int32 proximity_alert_distance, Promise &&promise) { if (!td_->auth_manager_->is_bot()) { return promise.set_error(Status::Error(3, "Method is available only for bots")); } @@ -24530,7 +24529,7 @@ void MessagesManager::edit_inline_message_live_location(const string &inline_mes } flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK; auto input_media = telegram_api::make_object( - flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, approaching_notification_distance); + flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, proximity_alert_distance); td_->create_handler(std::move(promise)) ->send(0, std::move(input_bot_inline_message_id), "", vector>(), std::move(input_media), get_input_reply_markup(r_new_reply_markup.ok())); diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 2f9d87563..66f47b3b8 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -440,7 +440,7 @@ class MessagesManager : public Actor { void edit_message_live_location(FullMessageId full_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_location, int32 heading, - int32 approaching_notification_distance, Promise &&promise); + int32 proximity_alert_distance, Promise &&promise); void edit_message_media(FullMessageId full_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_message_content, Promise &&promise); @@ -458,7 +458,7 @@ class MessagesManager : public Actor { void edit_inline_message_live_location(const string &inline_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_location, int32 heading, - int32 approaching_notification_distance, Promise &&promise); + int32 proximity_alert_distance, Promise &&promise); void edit_inline_message_media(const string &inline_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_message_content, diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 238a95546..d131fe31e 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -1225,11 +1225,11 @@ class EditMessageLiveLocationRequest : public RequestOnceActor { tl_object_ptr reply_markup_; tl_object_ptr location_; int32 heading_; - int32 approaching_notification_distance_; + int32 proximity_alert_distance_; void do_run(Promise &&promise) override { td->messages_manager_->edit_message_live_location(full_message_id_, std::move(reply_markup_), std::move(location_), - heading_, approaching_notification_distance_, std::move(promise)); + heading_, proximity_alert_distance_, std::move(promise)); } void do_send_result() override { @@ -1240,13 +1240,13 @@ class EditMessageLiveLocationRequest : public RequestOnceActor { EditMessageLiveLocationRequest(ActorShared td, uint64 request_id, int64 dialog_id, int64 message_id, tl_object_ptr reply_markup, tl_object_ptr location, int32 heading, - int32 approaching_notification_distance) + int32 proximity_alert_distance) : RequestOnceActor(std::move(td), request_id) , full_message_id_(DialogId(dialog_id), MessageId(message_id)) , reply_markup_(std::move(reply_markup)) , location_(std::move(location)) , heading_(heading) - , approaching_notification_distance_(approaching_notification_distance) { + , proximity_alert_distance_(proximity_alert_distance) { } }; @@ -5766,7 +5766,7 @@ void Td::on_request(uint64 id, td_api::editMessageText &request) { void Td::on_request(uint64 id, td_api::editMessageLiveLocation &request) { CREATE_REQUEST(EditMessageLiveLocationRequest, request.chat_id_, request.message_id_, std::move(request.reply_markup_), std::move(request.location_), request.heading_, - request.approaching_notification_distance_); + request.proximity_alert_distance_); } void Td::on_request(uint64 id, td_api::editMessageMedia &request) { @@ -5799,7 +5799,7 @@ void Td::on_request(uint64 id, td_api::editInlineMessageLiveLocation &request) { CREATE_OK_REQUEST_PROMISE(); messages_manager_->edit_inline_message_live_location( std::move(request.inline_message_id_), std::move(request.reply_markup_), std::move(request.location_), - request.heading_, request.approaching_notification_distance_, std::move(promise)); + request.heading_, request.proximity_alert_distance_, std::move(promise)); } void Td::on_request(uint64 id, td_api::editInlineMessageMedia &request) { diff --git a/td/telegram/Version.h b/td/telegram/Version.h index f5ac591f7..4a2097404 100644 --- a/td/telegram/Version.h +++ b/td/telegram/Version.h @@ -41,7 +41,7 @@ enum class Version : int32 { AddDialogPhotoHasAnimation, AddPhotoProgressiveSizes, AddLiveLocationHeading, - AddLiveLocationApproachingNotificationDistance, // 30 + AddLiveLocationProximityAlertDistance, // 30 Next }; diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index ce2af3ed8..8b5736113 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -3159,16 +3159,16 @@ class CliClient final : public Actor { string longitude; string accuracy; string heading; - string approaching_notification_distance; + string proximity_alert_distance; std::tie(chat_id, args) = split(args); std::tie(message_id, args) = split(args); std::tie(latitude, args) = split(args); std::tie(longitude, args) = split(args); std::tie(accuracy, args) = split(args); - std::tie(heading, approaching_notification_distance) = split(args); + std::tie(heading, proximity_alert_distance) = split(args); send_request(td_api::make_object( as_chat_id(chat_id), as_message_id(message_id), nullptr, as_location(latitude, longitude, accuracy), - to_integer(heading), to_integer(approaching_notification_distance))); + to_integer(heading), to_integer(proximity_alert_distance))); } else if (op == "emss") { string chat_id; string message_id; @@ -3432,17 +3432,17 @@ class CliClient final : public Actor { string longitude; string accuracy; string heading; - string approaching_notification_distance; + string proximity_alert_distance; std::tie(chat_id, args) = split(args); std::tie(period, args) = split(args); std::tie(latitude, args) = split(args); std::tie(longitude, args) = split(args); std::tie(accuracy, args) = split(args); - std::tie(heading, approaching_notification_distance) = split(args); + std::tie(heading, proximity_alert_distance) = split(args); send_message(chat_id, td_api::make_object( as_location(latitude, longitude, accuracy), to_integer(period), - to_integer(heading), to_integer(approaching_notification_distance))); + to_integer(heading), to_integer(proximity_alert_distance))); } else if (op == "spoll" || op == "spollm" || op == "spollp" || op == "squiz") { string chat_id; string question;