Improve field names.

GitOrigin-RevId: 3c30190dc75bd5dc812078f33bbf9dcaaeba1a1a
This commit is contained in:
levlam 2020-10-29 22:25:58 +03:00
parent 2875272cdc
commit 86c80e652e
14 changed files with 85 additions and 85 deletions

View File

@ -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 //@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 //@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 //@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 //@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 approaching_notification_distance:int32 = MessageContent; 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 //@description A message with information about a venue @venue The venue description
messageVenue venue:venue = MessageContent; messageVenue venue:venue = MessageContent;
@ -1689,8 +1689,8 @@ messagePassportDataSent types:vector<PassportElementType> = MessageContent;
//@description Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials //@description Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials
messagePassportDataReceived elements:vector<encryptedPassportElement> credentials:encryptedCredentials = MessageContent; messagePassportDataReceived elements:vector<encryptedPassportElement> 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 //@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
messageLiveLocationApproached approacher:MessageSender observer:MessageSender distance:int32 = MessageContent; messageProximityAlertTriggered approacher:MessageSender observer:MessageSender distance:int32 = MessageContent;
//@description Message content that is not supported in the current TDLib version //@description Message content that is not supported in the current TDLib version
messageUnsupported = MessageContent; 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 //@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 //@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 //@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 approaching_notification_distance:int32 = InputMessageContent; 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 //@description A message with information about a venue @venue Venue to send
inputMessageVenue venue:venue = InputMessageContent; 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 //@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 //@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 //@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 //@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 approaching_notification_distance:int32 = Message; 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 //@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 //@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 //@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 //@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 //@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 //@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 approaching_notification_distance:int32 = Ok; 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 //@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 //@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

Binary file not shown.

View File

@ -305,7 +305,7 @@ bool DialogAction::is_cancelled_by_message_of_type(MessageContentType message_co
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Poll: case MessageContentType::Poll:
case MessageContentType::Dice: case MessageContentType::Dice:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return false; return false;
default: default:
UNREACHABLE(); UNREACHABLE();

View File

@ -266,7 +266,7 @@ Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> InlineQueriesManager:
} }
return make_tl_object<telegram_api::inputBotInlineMessageMediaGeo>( return make_tl_object<telegram_api::inputBotInlineMessageMediaGeo>(
flags, location.location.get_input_geo_point(), location.heading, location.live_period, 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) { if (constructor_id == td_api::inputMessageVenue::ID) {
TRY_RESULT(venue, process_input_message_venue(std::move(input_message_content))); TRY_RESULT(venue, process_input_message_venue(std::move(input_message_content)));

View File

@ -151,16 +151,17 @@ Result<InputMessageLocation> process_input_message_location(
return Status::Error(400, "Wrong live location heading specified"); return Status::Error(400, "Wrong live location heading specified");
} }
auto approaching_notification_distance = input_location->approaching_notification_distance_; constexpr int32 MAX_PROXIMITY_ALERT_DISTANCE = 100000; // meters, server side limit
if (approaching_notification_distance < 0) { auto proximity_alert_distance = input_location->proximity_alert_distance_;
return Status::Error(400, "Wrong live location approaching notification distance specified"); 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; InputMessageLocation result;
result.location = std::move(location); result.location = std::move(location);
result.live_period = period; result.live_period = period;
result.heading = heading; result.heading = heading;
result.approaching_notification_distance = approaching_notification_distance; result.proximity_alert_distance = proximity_alert_distance;
return std::move(result); return std::move(result);
} }

View File

@ -126,7 +126,7 @@ struct InputMessageLocation {
Location location; Location location;
int32 live_period; int32 live_period;
int32 heading; int32 heading;
int32 approaching_notification_distance; int32 proximity_alert_distance;
}; };
Result<InputMessageLocation> process_input_message_location( Result<InputMessageLocation> process_input_message_location(
td_api::object_ptr<td_api::InputMessageContent> &&input_message_content) TD_WARN_UNUSED_RESULT; td_api::object_ptr<td_api::InputMessageContent> &&input_message_content) TD_WARN_UNUSED_RESULT;

View File

@ -568,14 +568,14 @@ class MessageLiveLocation : public MessageContent {
Location location; Location location;
int32 period = 0; int32 period = 0;
int32 heading = 0; int32 heading = 0;
int32 approaching_notification_distance = 0; int32 proximity_alert_distance = 0;
MessageLiveLocation() = default; 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)) : location(std::move(location))
, period(period) , period(period)
, heading(heading) , heading(heading)
, approaching_notification_distance(approaching_notification_distance) { , proximity_alert_distance(proximity_alert_distance) {
if (period < 0) { if (period < 0) {
period = 0; period = 0;
} }
@ -583,8 +583,8 @@ class MessageLiveLocation : public MessageContent {
LOG(ERROR) << "Receive wrong heading " << heading; LOG(ERROR) << "Receive wrong heading " << heading;
heading = 0; heading = 0;
} }
if (approaching_notification_distance < 0) { if (proximity_alert_distance < 0) {
approaching_notification_distance = 0; proximity_alert_distance = 0;
} }
} }
@ -688,19 +688,19 @@ class MessageDice : public MessageContent {
} }
}; };
class MessageLiveLocationApproached : public MessageContent { class MessageProximityAlertTriggered : public MessageContent {
public: public:
DialogId approacher_dialog_id; DialogId approacher_dialog_id;
DialogId observer_dialog_id; DialogId observer_dialog_id;
int32 distance = 0; int32 distance = 0;
MessageLiveLocationApproached() = default; MessageProximityAlertTriggered() = default;
MessageLiveLocationApproached(DialogId approacher_dialog_id, DialogId observer_dialog_id, int32 distance) 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) { : approacher_dialog_id(approacher_dialog_id), observer_dialog_id(observer_dialog_id), distance(distance) {
} }
MessageContentType get_type() const override { 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->location, storer);
store(m->period, storer); store(m->period, storer);
store(m->heading, storer); store(m->heading, storer);
store(m->approaching_notification_distance, storer); store(m->proximity_alert_distance, storer);
break; break;
} }
case MessageContentType::Location: { case MessageContentType::Location: {
@ -971,8 +971,8 @@ static void store(const MessageContent *content, StorerT &storer) {
store(m->dice_value, storer); store(m->dice_value, storer);
break; break;
} }
case MessageContentType::LiveLocationApproached: { case MessageContentType::ProximityAlertTriggered: {
auto m = static_cast<const MessageLiveLocationApproached *>(content); auto m = static_cast<const MessageProximityAlertTriggered *>(content);
store(m->approacher_dialog_id, storer); store(m->approacher_dialog_id, storer);
store(m->observer_dialog_id, storer); store(m->observer_dialog_id, storer);
store(m->distance, storer); store(m->distance, storer);
@ -1072,10 +1072,10 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
} else { } else {
m->heading = 0; m->heading = 0;
} }
if (parser.version() >= static_cast<int32>(Version::AddLiveLocationApproachingNotificationDistance)) { if (parser.version() >= static_cast<int32>(Version::AddLiveLocationProximityAlertDistance)) {
parse(m->approaching_notification_distance, parser); parse(m->proximity_alert_distance, parser);
} else { } else {
m->approaching_notification_distance = 0; m->proximity_alert_distance = 0;
} }
content = std::move(m); content = std::move(m);
break; break;
@ -1344,8 +1344,8 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
content = std::move(m); content = std::move(m);
break; break;
} }
case MessageContentType::LiveLocationApproached: { case MessageContentType::ProximityAlertTriggered: {
auto m = make_unique<MessageLiveLocationApproached>(); auto m = make_unique<MessageProximityAlertTriggered>();
parse(m->approacher_dialog_id, parser); parse(m->approacher_dialog_id, parser);
parse(m->observer_dialog_id, parser); parse(m->observer_dialog_id, parser);
parse(m->distance, parser); parse(m->distance, parser);
@ -1687,7 +1687,7 @@ static Result<InputMessageContent> create_input_message_content(
content = make_unique<MessageLocation>(std::move(location.location)); content = make_unique<MessageLocation>(std::move(location.location));
} else { } else {
content = make_unique<MessageLiveLocation>(std::move(location.location), location.live_period, location.heading, content = make_unique<MessageLiveLocation>(std::move(location.location), location.live_period, location.heading,
location.approaching_notification_distance); location.proximity_alert_distance);
} }
break; break;
} }
@ -2046,7 +2046,7 @@ bool can_have_input_media(const Td *td, const MessageContent *content) {
case MessageContentType::WebsiteConnected: case MessageContentType::WebsiteConnected:
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return false; return false;
case MessageContentType::Animation: case MessageContentType::Animation:
case MessageContentType::Audio: case MessageContentType::Audio:
@ -2159,7 +2159,7 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td,
case MessageContentType::WebsiteConnected: case MessageContentType::WebsiteConnected:
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -2289,7 +2289,7 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK; flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK;
return make_tl_object<telegram_api::inputMediaGeoLive>(flags, false /*ignored*/, return make_tl_object<telegram_api::inputMediaGeoLive>(flags, false /*ignored*/,
m->location.get_input_geo_point(), m->heading, m->period, m->location.get_input_geo_point(), m->heading, m->period,
m->approaching_notification_distance); m->proximity_alert_distance);
} }
case MessageContentType::Location: { case MessageContentType::Location: {
auto m = static_cast<const MessageLocation *>(content); auto m = static_cast<const MessageLocation *>(content);
@ -2349,7 +2349,7 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
case MessageContentType::WebsiteConnected: case MessageContentType::WebsiteConnected:
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -2472,7 +2472,7 @@ void delete_message_content_thumbnail(MessageContent *content, Td *td) {
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Poll: case MessageContentType::Poll:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -2596,7 +2596,7 @@ static int32 get_message_content_media_index_mask(const MessageContent *content,
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Poll: case MessageContentType::Poll:
case MessageContentType::Dice: case MessageContentType::Dice:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return 0; return 0;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -2872,7 +2872,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
need_update = true; need_update = true;
} }
if (old_->period != new_->period || old_->heading != new_->heading || 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; need_update = true;
} }
if (old_->location.get_access_hash() != new_->location.get_access_hash()) { 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; break;
} }
case MessageContentType::LiveLocationApproached: { case MessageContentType::ProximityAlertTriggered: {
auto old_ = static_cast<const MessageLiveLocationApproached *>(old_content); auto old_ = static_cast<const MessageProximityAlertTriggered *>(old_content);
auto new_ = static_cast<const MessageLiveLocationApproached *>(new_content); auto new_ = static_cast<const MessageProximityAlertTriggered *>(new_content);
if (old_->approacher_dialog_id != new_->approacher_dialog_id || if (old_->approacher_dialog_id != new_->approacher_dialog_id ||
old_->observer_dialog_id != new_->observer_dialog_id || old_->distance != new_->distance) { old_->observer_dialog_id != new_->observer_dialog_id || old_->distance != new_->distance) {
need_update = true; need_update = true;
@ -3350,7 +3350,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Poll: case MessageContentType::Poll:
case MessageContentType::Dice: 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; LOG(ERROR) << "Receive new file " << new_file_id << " in a sent message of the type " << content_type;
break; break;
default: default:
@ -4243,7 +4243,7 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
case MessageContentType::WebsiteConnected: case MessageContentType::WebsiteConnected:
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return nullptr; return nullptr;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -4436,7 +4436,7 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
break; break;
} }
return make_unique<MessageLiveLocationApproached>(approacher_id, observer_id, distance); return make_unique<MessageProximityAlertTriggered>(approacher_id, observer_id, distance);
} }
default: default:
UNREACHABLE(); UNREACHABLE();
@ -4486,9 +4486,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
auto passed = max(G()->unix_time_cached() - message_date, 0); auto passed = max(G()->unix_time_cached() - message_date, 0);
auto expires_in = max(0, m->period - passed); auto expires_in = max(0, m->period - passed);
auto heading = expires_in == 0 ? 0 : m->heading; 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<td_api::messageLocation>(m->location.get_location_object(), m->period, expires_in, heading, return make_tl_object<td_api::messageLocation>(m->location.get_location_object(), m->period, expires_in, heading,
approaching_notification_distance); proximity_alert_distance);
} }
case MessageContentType::Location: { case MessageContentType::Location: {
const MessageLocation *m = static_cast<const MessageLocation *>(content); const MessageLocation *m = static_cast<const MessageLocation *>(content);
@ -4641,9 +4641,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
return make_tl_object<td_api::messageDice>(std::move(initial_state), std::move(final_state), m->emoji, return make_tl_object<td_api::messageDice>(std::move(initial_state), std::move(final_state), m->emoji,
m->dice_value, success_animation_frame_number); m->dice_value, success_animation_frame_number);
} }
case MessageContentType::LiveLocationApproached: { case MessageContentType::ProximityAlertTriggered: {
const MessageLiveLocationApproached *m = static_cast<const MessageLiveLocationApproached *>(content); const MessageProximityAlertTriggered *m = static_cast<const MessageProximityAlertTriggered *>(content);
return make_tl_object<td_api::messageLiveLocationApproached>( return make_tl_object<td_api::messageProximityAlertTriggered>(
td->messages_manager_->get_message_sender_object(m->approacher_dialog_id), td->messages_manager_->get_message_sender_object(m->approacher_dialog_id),
td->messages_manager_->get_message_sender_object(m->observer_dialog_id), m->distance); 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::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Dice: case MessageContentType::Dice:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return string(); return string();
default: default:
UNREACHABLE(); UNREACHABLE();
@ -5152,8 +5152,8 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC
break; break;
case MessageContentType::Dice: case MessageContentType::Dice:
break; break;
case MessageContentType::LiveLocationApproached: { case MessageContentType::ProximityAlertTriggered: {
auto content = static_cast<const MessageLiveLocationApproached *>(message_content); auto content = static_cast<const MessageProximityAlertTriggered *>(message_content);
add_message_sender_dependencies(dependencies, content->approacher_dialog_id); add_message_sender_dependencies(dependencies, content->approacher_dialog_id);
add_message_sender_dependencies(dependencies, content->observer_dialog_id); add_message_sender_dependencies(dependencies, content->observer_dialog_id);
break; break;

View File

@ -96,8 +96,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType cont
return string_builder << "Poll"; return string_builder << "Poll";
case MessageContentType::Dice: case MessageContentType::Dice:
return string_builder << "Dice"; return string_builder << "Dice";
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return string_builder << "LiveLocationApproached"; return string_builder << "ProximityAlertTriggered";
default: default:
UNREACHABLE(); UNREACHABLE();
return string_builder; return string_builder;
@ -149,7 +149,7 @@ bool is_allowed_media_group_content(MessageContentType content_type) {
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Poll: case MessageContentType::Poll:
case MessageContentType::Dice: case MessageContentType::Dice:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return false; return false;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -209,7 +209,7 @@ bool is_secret_message_content(int32 ttl, MessageContentType content_type) {
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Poll: case MessageContentType::Poll:
case MessageContentType::Dice: case MessageContentType::Dice:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return false; return false;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -262,7 +262,7 @@ bool is_service_message_content(MessageContentType content_type) {
case MessageContentType::WebsiteConnected: case MessageContentType::WebsiteConnected:
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return true; return true;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -315,7 +315,7 @@ bool can_have_message_content_caption(MessageContentType content_type) {
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::Poll: case MessageContentType::Poll:
case MessageContentType::Dice: case MessageContentType::Dice:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return false; return false;
default: default:
UNREACHABLE(); UNREACHABLE();

View File

@ -55,7 +55,7 @@ enum class MessageContentType : int32 {
PassportDataReceived, PassportDataReceived,
Poll, Poll,
Dice, Dice,
LiveLocationApproached ProximityAlertTriggered
}; };
StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type); StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type);

View File

@ -22431,7 +22431,7 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa
case MessageContentType::WebsiteConnected: case MessageContentType::WebsiteConnected:
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
UNREACHABLE(); UNREACHABLE();
} }
return Status::OK(); return Status::OK();
@ -23992,7 +23992,7 @@ bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, boo
case MessageContentType::WebsiteConnected: case MessageContentType::WebsiteConnected:
case MessageContentType::PassportDataSent: case MessageContentType::PassportDataSent:
case MessageContentType::PassportDataReceived: case MessageContentType::PassportDataReceived:
case MessageContentType::LiveLocationApproached: case MessageContentType::ProximityAlertTriggered:
return false; return false;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -24135,7 +24135,7 @@ void MessagesManager::edit_message_text(FullMessageId full_message_id,
void MessagesManager::edit_message_live_location(FullMessageId full_message_id, void MessagesManager::edit_message_live_location(FullMessageId full_message_id,
tl_object_ptr<td_api::ReplyMarkup> &&reply_markup, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading, tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 approaching_notification_distance, Promise<Unit> &&promise) { int32 proximity_alert_distance, Promise<Unit> &&promise) {
LOG(INFO) << "Begin to edit live location of " << full_message_id; LOG(INFO) << "Begin to edit live location of " << full_message_id;
auto dialog_id = full_message_id.get_dialog_id(); auto dialog_id = full_message_id.get_dialog_id();
Dialog *d = get_dialog_force(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; flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK;
auto input_media = telegram_api::make_object<telegram_api::inputMediaGeoLive>( auto input_media = telegram_api::make_object<telegram_api::inputMediaGeoLive>(
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<EditMessageActor>(std::move(promise)), &EditMessageActor::send, 0, dialog_id, send_closure(td_->create_net_actor<EditMessageActor>(std::move(promise)), &EditMessageActor::send, 0, dialog_id,
m->message_id, string(), vector<tl_object_ptr<telegram_api::MessageEntity>>(), std::move(input_media), m->message_id, string(), vector<tl_object_ptr<telegram_api::MessageEntity>>(), std::move(input_media),
std::move(input_reply_markup), get_message_schedule_date(m), 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, void MessagesManager::edit_inline_message_live_location(const string &inline_message_id,
tl_object_ptr<td_api::ReplyMarkup> &&reply_markup, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading, tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 approaching_notification_distance, int32 proximity_alert_distance, Promise<Unit> &&promise) {
Promise<Unit> &&promise) {
if (!td_->auth_manager_->is_bot()) { if (!td_->auth_manager_->is_bot()) {
return promise.set_error(Status::Error(3, "Method is available only for bots")); 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; flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK;
auto input_media = telegram_api::make_object<telegram_api::inputMediaGeoLive>( auto input_media = telegram_api::make_object<telegram_api::inputMediaGeoLive>(
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<EditInlineMessageQuery>(std::move(promise)) td_->create_handler<EditInlineMessageQuery>(std::move(promise))
->send(0, std::move(input_bot_inline_message_id), "", vector<tl_object_ptr<telegram_api::MessageEntity>>(), ->send(0, std::move(input_bot_inline_message_id), "", vector<tl_object_ptr<telegram_api::MessageEntity>>(),
std::move(input_media), get_input_reply_markup(r_new_reply_markup.ok())); std::move(input_media), get_input_reply_markup(r_new_reply_markup.ok()));

View File

@ -440,7 +440,7 @@ class MessagesManager : public Actor {
void edit_message_live_location(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup, void edit_message_live_location(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading, tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 approaching_notification_distance, Promise<Unit> &&promise); int32 proximity_alert_distance, Promise<Unit> &&promise);
void edit_message_media(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup, void edit_message_media(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Promise<Unit> &&promise); tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Promise<Unit> &&promise);
@ -458,7 +458,7 @@ class MessagesManager : public Actor {
void edit_inline_message_live_location(const string &inline_message_id, void edit_inline_message_live_location(const string &inline_message_id,
tl_object_ptr<td_api::ReplyMarkup> &&reply_markup, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading, tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 approaching_notification_distance, Promise<Unit> &&promise); int32 proximity_alert_distance, Promise<Unit> &&promise);
void edit_inline_message_media(const string &inline_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup, void edit_inline_message_media(const string &inline_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::InputMessageContent> &&input_message_content, tl_object_ptr<td_api::InputMessageContent> &&input_message_content,

View File

@ -1225,11 +1225,11 @@ class EditMessageLiveLocationRequest : public RequestOnceActor {
tl_object_ptr<td_api::ReplyMarkup> reply_markup_; tl_object_ptr<td_api::ReplyMarkup> reply_markup_;
tl_object_ptr<td_api::location> location_; tl_object_ptr<td_api::location> location_;
int32 heading_; int32 heading_;
int32 approaching_notification_distance_; int32 proximity_alert_distance_;
void do_run(Promise<Unit> &&promise) override { void do_run(Promise<Unit> &&promise) override {
td->messages_manager_->edit_message_live_location(full_message_id_, std::move(reply_markup_), std::move(location_), 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 { void do_send_result() override {
@ -1240,13 +1240,13 @@ class EditMessageLiveLocationRequest : public RequestOnceActor {
EditMessageLiveLocationRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int64 message_id, EditMessageLiveLocationRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int64 message_id,
tl_object_ptr<td_api::ReplyMarkup> reply_markup, tl_object_ptr<td_api::ReplyMarkup> reply_markup,
tl_object_ptr<td_api::location> location, int32 heading, tl_object_ptr<td_api::location> location, int32 heading,
int32 approaching_notification_distance) int32 proximity_alert_distance)
: RequestOnceActor(std::move(td), request_id) : RequestOnceActor(std::move(td), request_id)
, full_message_id_(DialogId(dialog_id), MessageId(message_id)) , full_message_id_(DialogId(dialog_id), MessageId(message_id))
, reply_markup_(std::move(reply_markup)) , reply_markup_(std::move(reply_markup))
, location_(std::move(location)) , location_(std::move(location))
, heading_(heading) , 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) { void Td::on_request(uint64 id, td_api::editMessageLiveLocation &request) {
CREATE_REQUEST(EditMessageLiveLocationRequest, request.chat_id_, request.message_id_, CREATE_REQUEST(EditMessageLiveLocationRequest, request.chat_id_, request.message_id_,
std::move(request.reply_markup_), std::move(request.location_), request.heading_, 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) { 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(); CREATE_OK_REQUEST_PROMISE();
messages_manager_->edit_inline_message_live_location( messages_manager_->edit_inline_message_live_location(
std::move(request.inline_message_id_), std::move(request.reply_markup_), std::move(request.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) { void Td::on_request(uint64 id, td_api::editInlineMessageMedia &request) {

View File

@ -41,7 +41,7 @@ enum class Version : int32 {
AddDialogPhotoHasAnimation, AddDialogPhotoHasAnimation,
AddPhotoProgressiveSizes, AddPhotoProgressiveSizes,
AddLiveLocationHeading, AddLiveLocationHeading,
AddLiveLocationApproachingNotificationDistance, // 30 AddLiveLocationProximityAlertDistance, // 30
Next Next
}; };

View File

@ -3159,16 +3159,16 @@ class CliClient final : public Actor {
string longitude; string longitude;
string accuracy; string accuracy;
string heading; string heading;
string approaching_notification_distance; string proximity_alert_distance;
std::tie(chat_id, args) = split(args); std::tie(chat_id, args) = split(args);
std::tie(message_id, args) = split(args); std::tie(message_id, args) = split(args);
std::tie(latitude, args) = split(args); std::tie(latitude, args) = split(args);
std::tie(longitude, args) = split(args); std::tie(longitude, args) = split(args);
std::tie(accuracy, 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<td_api::editMessageLiveLocation>( send_request(td_api::make_object<td_api::editMessageLiveLocation>(
as_chat_id(chat_id), as_message_id(message_id), nullptr, as_location(latitude, longitude, accuracy), as_chat_id(chat_id), as_message_id(message_id), nullptr, as_location(latitude, longitude, accuracy),
to_integer<int32>(heading), to_integer<int32>(approaching_notification_distance))); to_integer<int32>(heading), to_integer<int32>(proximity_alert_distance)));
} else if (op == "emss") { } else if (op == "emss") {
string chat_id; string chat_id;
string message_id; string message_id;
@ -3432,17 +3432,17 @@ class CliClient final : public Actor {
string longitude; string longitude;
string accuracy; string accuracy;
string heading; string heading;
string approaching_notification_distance; string proximity_alert_distance;
std::tie(chat_id, args) = split(args); std::tie(chat_id, args) = split(args);
std::tie(period, args) = split(args); std::tie(period, args) = split(args);
std::tie(latitude, args) = split(args); std::tie(latitude, args) = split(args);
std::tie(longitude, args) = split(args); std::tie(longitude, args) = split(args);
std::tie(accuracy, 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<td_api::inputMessageLocation>( send_message(chat_id, td_api::make_object<td_api::inputMessageLocation>(
as_location(latitude, longitude, accuracy), to_integer<int32>(period), as_location(latitude, longitude, accuracy), to_integer<int32>(period),
to_integer<int32>(heading), to_integer<int32>(approaching_notification_distance))); to_integer<int32>(heading), to_integer<int32>(proximity_alert_distance)));
} else if (op == "spoll" || op == "spollm" || op == "spollp" || op == "squiz") { } else if (op == "spoll" || op == "spollm" || op == "spollp" || op == "squiz") {
string chat_id; string chat_id;
string question; string question;