Update layer 120. New live location approaching API.
GitOrigin-RevId: 98e984a3c84deee3552eb01b53963a6a998c7eda
This commit is contained in:
parent
bc2de6e5c0
commit
38fe050dba
@ -1592,8 +1592,9 @@ 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; 0-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
|
||||||
messageLocation location:location live_period:int32 expires_in:int32 heading:int32 = MessageContent;
|
//@approaching_notification_distance For live locations, a maximum distance for notifications about approaching another chat member, in meters. 0 if 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;
|
||||||
|
|
||||||
//@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;
|
||||||
@ -1812,8 +1813,9 @@ inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int
|
|||||||
inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent;
|
inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent;
|
||||||
|
|
||||||
//@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; 0-360. Pass 0 if unknown
|
//@heading For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
|
||||||
inputMessageLocation location:location live_period:int32 heading:int32 = InputMessageContent;
|
//@approaching_notification_distance For live locations, a maximum distance for notifications about approaching another chat member, in meters. Pass 0 if 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;
|
||||||
|
|
||||||
//@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;
|
||||||
@ -3734,17 +3736,6 @@ searchChatRecentLocationMessages chat_id:int53 limit:int32 = Messages;
|
|||||||
//@description Returns all active live locations that should be updated by the application. The list is persistent across application restarts only if the message database is used
|
//@description Returns all active live locations that should be updated by the application. The list is persistent across application restarts only if the message database is used
|
||||||
getActiveLiveLocationMessages = Messages;
|
getActiveLiveLocationMessages = Messages;
|
||||||
|
|
||||||
//@description Enables sending a notification when some other user in the chat approaches the current user. Both users need to send live location messages to the chat
|
|
||||||
//@chat_id Chat identifier
|
|
||||||
//@message_id Identifier of an outgoing successfully sent non-anonymous active live location message
|
|
||||||
//@distance The maximum target distance for the notification, in meters; must be positive
|
|
||||||
enableLiveLocationApproachingNotification chat_id:int53 message_id:int53 distance:int32 = Ok;
|
|
||||||
|
|
||||||
//@description Disables sending a notification when some other user in the chat approaches the current user
|
|
||||||
//@chat_id Chat identifier
|
|
||||||
//@message_id Identifier of an outgoing successfully sent non-anonymous active live location message
|
|
||||||
disableLiveLocationApproachingNotification chat_id:int53 message_id:int53 = Ok;
|
|
||||||
|
|
||||||
//@description Returns the last message sent in a chat no later than the specified date @chat_id Chat identifier @date Point in time (Unix timestamp) relative to which to search for messages
|
//@description Returns the last message sent in a chat no later than the specified date @chat_id Chat identifier @date Point in time (Unix timestamp) relative to which to search for messages
|
||||||
getChatMessageByDate chat_id:int53 date:int32 = Message;
|
getChatMessageByDate chat_id:int53 date:int32 = Message;
|
||||||
|
|
||||||
@ -3854,8 +3845,9 @@ 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; 0-360. Pass 0 if unknown
|
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
|
||||||
editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 = Message;
|
//@approaching_notification_distance The new maximum distance for notifications about approaching another chat member, in meters. Pass 0 if notification is disabled
|
||||||
|
editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 approaching_notification_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
|
||||||
@ -3874,8 +3866,9 @@ 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; 0-360. Pass 0 if unknown
|
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
|
||||||
editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 = Ok;
|
//@approaching_notification_distance The new maximum distance for notifications about approaching another chat member, in meters. Pass 0 if notification is disabled
|
||||||
|
editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 approaching_notification_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.
@ -56,7 +56,7 @@ inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = In
|
|||||||
inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
|
inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
|
||||||
inputMediaGame#d33f43f3 id:InputGame = InputMedia;
|
inputMediaGame#d33f43f3 id:InputGame = InputMedia;
|
||||||
inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
|
inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
|
||||||
inputMediaGeoLive#a22c410e flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:int period:flags.1?int = InputMedia;
|
inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;
|
||||||
inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
|
inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
|
||||||
inputMediaDice#e66fbf7b emoticon:string = InputMedia;
|
inputMediaDice#e66fbf7b emoticon:string = InputMedia;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
|
|||||||
messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
|
messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
|
||||||
messageMediaGame#fdb19008 game:Game = MessageMedia;
|
messageMediaGame#fdb19008 game:Game = MessageMedia;
|
||||||
messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
|
messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
|
||||||
messageMediaGeoLive#c65b8990 geo:GeoPoint heading:int period:int = MessageMedia;
|
messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;
|
||||||
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
|
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
|
||||||
messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
|
messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ messages.savedGifs#2e0709a5 hash:int gifs:Vector<Document> = messages.SavedGifs;
|
|||||||
|
|
||||||
inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||||
inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||||
inputBotInlineMessageMediaGeo#db94eea4 flags:# geo_point:InputGeoPoint period:int heading:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||||
inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||||
inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||||
inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||||
@ -630,7 +630,7 @@ inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:Input
|
|||||||
|
|
||||||
botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||||
botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||||
botInlineMessageMediaGeo#cd65660 flags:# geo:GeoPoint period:int heading:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||||
botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||||
botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||||
|
|
||||||
@ -1412,7 +1412,6 @@ messages.getOldFeaturedStickers#5fe7025b offset:int limit:int hash:int = message
|
|||||||
messages.getReplies#24b581ba peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
messages.getReplies#24b581ba peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
||||||
messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage;
|
messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage;
|
||||||
messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;
|
messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;
|
||||||
messages.requestProximityNotification#b12ba31c flags:# peer:InputPeer msg_id:int max_distance:flags.0?int = Bool;
|
|
||||||
messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;
|
messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;
|
||||||
|
|
||||||
updates.getState#edd4882a = updates.State;
|
updates.getState#edd4882a = updates.State;
|
||||||
|
Binary file not shown.
@ -257,9 +257,16 @@ Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> InlineQueriesManager:
|
|||||||
}
|
}
|
||||||
if (constructor_id == td_api::inputMessageLocation::ID) {
|
if (constructor_id == td_api::inputMessageLocation::ID) {
|
||||||
TRY_RESULT(location, process_input_message_location(std::move(input_message_content)));
|
TRY_RESULT(location, process_input_message_location(std::move(input_message_content)));
|
||||||
return make_tl_object<telegram_api::inputBotInlineMessageMediaGeo>(flags, location.location.get_input_geo_point(),
|
if (location.heading != 0) {
|
||||||
location.live_period, location.heading,
|
flags |= telegram_api::inputBotInlineMessageMediaGeo::HEADING_MASK;
|
||||||
std::move(input_reply_markup));
|
}
|
||||||
|
if (location.live_period != 0) {
|
||||||
|
flags |= telegram_api::inputBotInlineMessageMediaGeo::PERIOD_MASK;
|
||||||
|
flags |= telegram_api::inputBotInlineMessageMediaGeo::PROXIMITY_NOTIFICATION_RADIUS_MASK;
|
||||||
|
}
|
||||||
|
return make_tl_object<telegram_api::inputBotInlineMessageMediaGeo>(
|
||||||
|
flags, location.location.get_input_geo_point(), location.heading, location.live_period,
|
||||||
|
location.approaching_notification_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)));
|
||||||
|
@ -151,10 +151,16 @@ 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_;
|
||||||
|
if (approaching_notification_distance < 0) {
|
||||||
|
return Status::Error(400, "Wrong live location approaching notification 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;
|
||||||
return std::move(result);
|
return std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ struct InputMessageLocation {
|
|||||||
Location location;
|
Location location;
|
||||||
int32 live_period;
|
int32 live_period;
|
||||||
int32 heading;
|
int32 heading;
|
||||||
|
int32 approaching_notification_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;
|
||||||
|
@ -568,14 +568,24 @@ 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;
|
||||||
|
|
||||||
MessageLiveLocation() = default;
|
MessageLiveLocation() = default;
|
||||||
MessageLiveLocation(Location &&location, int32 period, int32 heading)
|
MessageLiveLocation(Location &&location, int32 period, int32 heading, int32 approaching_notification_distance)
|
||||||
: location(std::move(location)), period(period), heading(heading) {
|
: location(std::move(location))
|
||||||
|
, period(period)
|
||||||
|
, heading(heading)
|
||||||
|
, approaching_notification_distance(approaching_notification_distance) {
|
||||||
|
if (period < 0) {
|
||||||
|
period = 0;
|
||||||
|
}
|
||||||
if (heading < 0 || heading > 360) {
|
if (heading < 0 || heading > 360) {
|
||||||
LOG(ERROR) << "Receive wrong heading " << heading;
|
LOG(ERROR) << "Receive wrong heading " << heading;
|
||||||
heading = 0;
|
heading = 0;
|
||||||
}
|
}
|
||||||
|
if (approaching_notification_distance < 0) {
|
||||||
|
approaching_notification_distance = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageContentType get_type() const override {
|
MessageContentType get_type() const override {
|
||||||
@ -755,6 +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);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageContentType::Location: {
|
case MessageContentType::Location: {
|
||||||
@ -1061,6 +1072,11 @@ 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)) {
|
||||||
|
parse(m->approaching_notification_distance, parser);
|
||||||
|
} else {
|
||||||
|
m->approaching_notification_distance = 0;
|
||||||
|
}
|
||||||
content = std::move(m);
|
content = std::move(m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1396,9 +1412,18 @@ InlineMessageContent create_inline_message_content(Td *td, FileId file_id,
|
|||||||
}
|
}
|
||||||
case telegram_api::botInlineMessageMediaGeo::ID: {
|
case telegram_api::botInlineMessageMediaGeo::ID: {
|
||||||
auto inline_message_geo = move_tl_object_as<telegram_api::botInlineMessageMediaGeo>(inline_message);
|
auto inline_message_geo = move_tl_object_as<telegram_api::botInlineMessageMediaGeo>(inline_message);
|
||||||
if (inline_message_geo->period_ > 0) {
|
if ((inline_message_geo->flags_ & telegram_api::botInlineMessageMediaGeo::PERIOD_MASK) != 0 &&
|
||||||
|
inline_message_geo->period_ > 0) {
|
||||||
|
auto heading = (inline_message_geo->flags_ & telegram_api::botInlineMessageMediaGeo::HEADING_MASK) != 0
|
||||||
|
? inline_message_geo->heading_
|
||||||
|
: 0;
|
||||||
|
auto approacing_notification_distance =
|
||||||
|
(inline_message_geo->flags_ & telegram_api::botInlineMessageMediaGeo::PROXIMITY_NOTIFICATION_RADIUS_MASK) !=
|
||||||
|
0
|
||||||
|
? inline_message_geo->proximity_notification_radius_
|
||||||
|
: 0;
|
||||||
result.message_content = make_unique<MessageLiveLocation>(
|
result.message_content = make_unique<MessageLiveLocation>(
|
||||||
Location(inline_message_geo->geo_), inline_message_geo->period_, inline_message_geo->heading_);
|
Location(inline_message_geo->geo_), inline_message_geo->period_, heading, approacing_notification_distance);
|
||||||
} else {
|
} else {
|
||||||
result.message_content = make_unique<MessageLocation>(Location(inline_message_geo->geo_));
|
result.message_content = make_unique<MessageLocation>(Location(inline_message_geo->geo_));
|
||||||
}
|
}
|
||||||
@ -1661,8 +1686,8 @@ static Result<InputMessageContent> create_input_message_content(
|
|||||||
if (location.live_period == 0) {
|
if (location.live_period == 0) {
|
||||||
content = make_unique<MessageLocation>(std::move(location.location));
|
content = make_unique<MessageLocation>(std::move(location.location));
|
||||||
} else {
|
} else {
|
||||||
content =
|
content = make_unique<MessageLiveLocation>(std::move(location.location), location.live_period, location.heading,
|
||||||
make_unique<MessageLiveLocation>(std::move(location.location), location.live_period, location.heading);
|
location.approaching_notification_distance);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2258,8 +2283,13 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
|
|||||||
case MessageContentType::LiveLocation: {
|
case MessageContentType::LiveLocation: {
|
||||||
auto m = static_cast<const MessageLiveLocation *>(content);
|
auto m = static_cast<const MessageLiveLocation *>(content);
|
||||||
int32 flags = telegram_api::inputMediaGeoLive::PERIOD_MASK;
|
int32 flags = telegram_api::inputMediaGeoLive::PERIOD_MASK;
|
||||||
|
if (m->heading != 0) {
|
||||||
|
flags |= telegram_api::inputMediaGeoLive::HEADING_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);
|
||||||
}
|
}
|
||||||
case MessageContentType::Location: {
|
case MessageContentType::Location: {
|
||||||
auto m = static_cast<const MessageLocation *>(content);
|
auto m = static_cast<const MessageLocation *>(content);
|
||||||
@ -2841,7 +2871,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
if (old_->location != new_->location) {
|
if (old_->location != new_->location) {
|
||||||
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) {
|
||||||
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()) {
|
||||||
@ -2929,8 +2960,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
auto volume_id = -new_file_view.remote_location().get_id();
|
auto volume_id = -new_file_view.remote_location().get_id();
|
||||||
FileId file_id = td->file_manager_->register_remote(
|
FileId file_id = td->file_manager_->register_remote(
|
||||||
FullRemoteFileLocation({FileType::Photo, 'i'}, new_file_view.remote_location().get_id(),
|
FullRemoteFileLocation({FileType::Photo, 'i'}, new_file_view.remote_location().get_id(),
|
||||||
new_file_view.remote_location().get_access_hash(), 0, volume_id,
|
new_file_view.remote_location().get_access_hash(), 0, volume_id, DcId::invalid(),
|
||||||
DcId::invalid(), new_file_view.remote_location().get_file_reference().str()),
|
new_file_view.remote_location().get_file_reference().str()),
|
||||||
FileLocationSource::FromServer, dialog_id, old_photo->photos.back().size, 0, "");
|
FileLocationSource::FromServer, dialog_id, old_photo->photos.back().size, 0, "");
|
||||||
LOG_STATUS(td->file_manager_->merge(file_id, old_file_id));
|
LOG_STATUS(td->file_manager_->merge(file_id, old_file_id));
|
||||||
}
|
}
|
||||||
@ -3876,7 +3907,8 @@ unique_ptr<MessageContent> get_message_content(Td *td, FormattedText message,
|
|||||||
LOG(ERROR) << "Receive wrong live location period = " << period;
|
LOG(ERROR) << "Receive wrong live location period = " << period;
|
||||||
return make_unique<MessageLocation>(std::move(location));
|
return make_unique<MessageLocation>(std::move(location));
|
||||||
}
|
}
|
||||||
return make_unique<MessageLiveLocation>(std::move(location), period, message_geo_point_live->heading_);
|
return make_unique<MessageLiveLocation>(std::move(location), period, message_geo_point_live->heading_,
|
||||||
|
message_geo_point_live->proximity_notification_radius_);
|
||||||
}
|
}
|
||||||
case telegram_api::messageMediaVenue::ID: {
|
case telegram_api::messageMediaVenue::ID: {
|
||||||
auto message_venue = move_tl_object_as<telegram_api::messageMediaVenue>(media);
|
auto message_venue = move_tl_object_as<telegram_api::messageMediaVenue>(media);
|
||||||
@ -4454,11 +4486,13 @@ 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;
|
||||||
return make_tl_object<td_api::messageLocation>(m->location.get_location_object(), m->period, expires_in, heading);
|
auto approaching_notification_distance = expires_in == 0 ? 0 : m->approaching_notification_distance;
|
||||||
|
return make_tl_object<td_api::messageLocation>(m->location.get_location_object(), m->period, expires_in, heading,
|
||||||
|
approaching_notification_distance);
|
||||||
}
|
}
|
||||||
case MessageContentType::Location: {
|
case MessageContentType::Location: {
|
||||||
const MessageLocation *m = static_cast<const MessageLocation *>(content);
|
const MessageLocation *m = static_cast<const MessageLocation *>(content);
|
||||||
return make_tl_object<td_api::messageLocation>(m->location.get_location_object(), 0, 0, 0);
|
return make_tl_object<td_api::messageLocation>(m->location.get_location_object(), 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
case MessageContentType::Photo: {
|
case MessageContentType::Photo: {
|
||||||
const MessagePhoto *m = static_cast<const MessagePhoto *>(content);
|
const MessagePhoto *m = static_cast<const MessagePhoto *>(content);
|
||||||
|
@ -1872,41 +1872,6 @@ class ReadDiscussionQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class RequestProximityNotificationQuery : public Td::ResultHandler {
|
|
||||||
Promise<Unit> promise_;
|
|
||||||
DialogId dialog_id_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit RequestProximityNotificationQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void send(DialogId dialog_id, MessageId message_id, int32 distance) {
|
|
||||||
dialog_id_ = dialog_id;
|
|
||||||
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
|
|
||||||
CHECK(input_peer != nullptr);
|
|
||||||
int32 flags = 0;
|
|
||||||
if (distance > 0) {
|
|
||||||
flags |= telegram_api::messages_requestProximityNotification::MAX_DISTANCE_MASK;
|
|
||||||
}
|
|
||||||
send_query(G()->net_query_creator().create(telegram_api::messages_requestProximityNotification(
|
|
||||||
flags, std::move(input_peer), message_id.get_server_message_id().get(), distance)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_result(uint64 id, BufferSlice packet) override {
|
|
||||||
auto result_ptr = fetch_result<telegram_api::messages_requestProximityNotification>(packet);
|
|
||||||
if (result_ptr.is_error()) {
|
|
||||||
return on_error(id, result_ptr.move_as_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
promise_.set_value(Unit());
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_error(uint64 id, Status status) override {
|
|
||||||
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "RequestProximityNotificationQuery");
|
|
||||||
promise_.set_error(std::move(status));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class SearchMessagesQuery : public Td::ResultHandler {
|
class SearchMessagesQuery : public Td::ResultHandler {
|
||||||
Promise<Unit> promise_;
|
Promise<Unit> promise_;
|
||||||
DialogId dialog_id_;
|
DialogId dialog_id_;
|
||||||
@ -20692,45 +20657,6 @@ void MessagesManager::on_message_live_location_viewed_on_server(int64 task_id) {
|
|||||||
pending_message_live_location_view_timeout_.add_timeout_in(task_id, LIVE_LOCATION_VIEW_PERIOD);
|
pending_message_live_location_view_timeout_.add_timeout_in(task_id, LIVE_LOCATION_VIEW_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::enable_live_location_approaching_notification(DialogId dialog_id, MessageId message_id,
|
|
||||||
int32 distance, Promise<Unit> &&promise) {
|
|
||||||
Dialog *d = get_dialog_force(dialog_id);
|
|
||||||
if (d == nullptr) {
|
|
||||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
|
||||||
}
|
|
||||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
|
||||||
return promise.set_error(Status::Error(400, "Can't access the chat"));
|
|
||||||
}
|
|
||||||
if (is_broadcast_channel(dialog_id)) {
|
|
||||||
return promise.set_error(Status::Error(400, "Can't use approaching notifications in channels"));
|
|
||||||
}
|
|
||||||
if (dialog_id.get_type() == DialogType::SecretChat) {
|
|
||||||
return promise.set_error(Status::Error(400, "Can't use approaching notifications in secret chats"));
|
|
||||||
}
|
|
||||||
if (dialog_id == get_my_dialog_id()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Can't use approaching notifications in Saved Messages"));
|
|
||||||
}
|
|
||||||
|
|
||||||
auto m = get_message_force(d, message_id, "enable_approaching_notification");
|
|
||||||
if (m == nullptr) {
|
|
||||||
return promise.set_error(Status::Error(400, "Message not found"));
|
|
||||||
}
|
|
||||||
if (!m->is_outgoing) {
|
|
||||||
return promise.set_error(Status::Error(400, "Message is not outgoing"));
|
|
||||||
}
|
|
||||||
if (!m->sender_user_id.is_valid()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Message is anonymous"));
|
|
||||||
}
|
|
||||||
if (get_message_content_live_location_period(m->content.get()) <= G()->unix_time() - m->date + 1) {
|
|
||||||
return promise.set_error(Status::Error(400, "Message has no active live location"));
|
|
||||||
}
|
|
||||||
if (!message_id.is_server()) {
|
|
||||||
return promise.set_error(Status::Error(400, "Message is not server"));
|
|
||||||
}
|
|
||||||
|
|
||||||
td_->create_handler<RequestProximityNotificationQuery>(std::move(promise))->send(dialog_id, message_id, distance);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileSourceId MessagesManager::get_message_file_source_id(FullMessageId full_message_id) {
|
FileSourceId MessagesManager::get_message_file_source_id(FullMessageId full_message_id) {
|
||||||
auto dialog_id = full_message_id.get_dialog_id();
|
auto dialog_id = full_message_id.get_dialog_id();
|
||||||
auto message_id = full_message_id.get_message_id();
|
auto message_id = full_message_id.get_message_id();
|
||||||
@ -24172,7 +24098,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,
|
||||||
Promise<Unit> &&promise) {
|
int32 approaching_notification_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);
|
||||||
@ -24218,8 +24144,12 @@ void MessagesManager::edit_message_live_location(FullMessageId full_message_id,
|
|||||||
if (location.empty()) {
|
if (location.empty()) {
|
||||||
flags |= telegram_api::inputMediaGeoLive::STOPPED_MASK;
|
flags |= telegram_api::inputMediaGeoLive::STOPPED_MASK;
|
||||||
}
|
}
|
||||||
|
if (heading != 0) {
|
||||||
|
flags |= telegram_api::inputMediaGeoLive::HEADING_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);
|
flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, approaching_notification_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),
|
||||||
@ -24533,6 +24463,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,
|
||||||
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"));
|
||||||
@ -24557,8 +24488,12 @@ void MessagesManager::edit_inline_message_live_location(const string &inline_mes
|
|||||||
if (location.empty()) {
|
if (location.empty()) {
|
||||||
flags |= telegram_api::inputMediaGeoLive::STOPPED_MASK;
|
flags |= telegram_api::inputMediaGeoLive::STOPPED_MASK;
|
||||||
}
|
}
|
||||||
|
if (heading != 0) {
|
||||||
|
flags |= telegram_api::inputMediaGeoLive::HEADING_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);
|
flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, approaching_notification_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()));
|
||||||
|
@ -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,
|
||||||
Promise<Unit> &&promise);
|
int32 approaching_notification_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,
|
||||||
Promise<Unit> &&promise);
|
int32 approaching_notification_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,
|
||||||
@ -751,9 +751,6 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
vector<FullMessageId> get_active_live_location_messages(Promise<Unit> &&promise);
|
vector<FullMessageId> get_active_live_location_messages(Promise<Unit> &&promise);
|
||||||
|
|
||||||
void enable_live_location_approaching_notification(DialogId dialog_id, MessageId message_id, int32 distance,
|
|
||||||
Promise<Unit> &&promise);
|
|
||||||
|
|
||||||
int64 get_dialog_message_by_date(DialogId dialog_id, int32 date, Promise<Unit> &&promise);
|
int64 get_dialog_message_by_date(DialogId dialog_id, int32 date, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void on_get_dialog_message_by_date_success(DialogId dialog_id, int32 date, int64 random_id,
|
void on_get_dialog_message_by_date_success(DialogId dialog_id, int32 date, int64 random_id,
|
||||||
|
@ -1202,10 +1202,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_;
|
||||||
|
|
||||||
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_, std::move(promise));
|
heading_, approaching_notification_distance_, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_send_result() override {
|
void do_send_result() override {
|
||||||
@ -1215,12 +1216,14 @@ class EditMessageLiveLocationRequest : public RequestOnceActor {
|
|||||||
public:
|
public:
|
||||||
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)
|
||||||
: 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) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -5583,23 +5586,6 @@ void Td::on_request(uint64 id, const td_api::getActiveLiveLocationMessages &requ
|
|||||||
CREATE_NO_ARGS_REQUEST(GetActiveLiveLocationMessagesRequest);
|
CREATE_NO_ARGS_REQUEST(GetActiveLiveLocationMessagesRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::enableLiveLocationApproachingNotification &request) {
|
|
||||||
CHECK_IS_USER();
|
|
||||||
if (request.distance_ <= 0) {
|
|
||||||
return send_error_raw(id, 400, "Invalid distance specified");
|
|
||||||
}
|
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
|
||||||
messages_manager_->enable_live_location_approaching_notification(
|
|
||||||
DialogId(request.chat_id_), MessageId(request.message_id_), request.distance_, std::move(promise));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::disableLiveLocationApproachingNotification &request) {
|
|
||||||
CHECK_IS_USER();
|
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
|
||||||
messages_manager_->enable_live_location_approaching_notification(
|
|
||||||
DialogId(request.chat_id_), MessageId(request.message_id_), 0, std::move(promise));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::getChatMessageByDate &request) {
|
void Td::on_request(uint64 id, const td_api::getChatMessageByDate &request) {
|
||||||
CREATE_REQUEST(GetChatMessageByDateRequest, request.chat_id_, request.date_);
|
CREATE_REQUEST(GetChatMessageByDateRequest, request.chat_id_, request.date_);
|
||||||
}
|
}
|
||||||
@ -5751,7 +5737,8 @@ 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_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::editMessageMedia &request) {
|
void Td::on_request(uint64 id, td_api::editMessageMedia &request) {
|
||||||
@ -5782,9 +5769,9 @@ void Td::on_request(uint64 id, td_api::editInlineMessageLiveLocation &request) {
|
|||||||
CHECK_IS_BOT();
|
CHECK_IS_BOT();
|
||||||
CLEAN_INPUT_STRING(request.inline_message_id_);
|
CLEAN_INPUT_STRING(request.inline_message_id_);
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
messages_manager_->edit_inline_message_live_location(std::move(request.inline_message_id_),
|
messages_manager_->edit_inline_message_live_location(
|
||||||
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_, std::move(promise));
|
request.heading_, request.approaching_notification_distance_, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::editInlineMessageMedia &request) {
|
void Td::on_request(uint64 id, td_api::editInlineMessageMedia &request) {
|
||||||
|
@ -587,10 +587,6 @@ class Td final : public NetQueryCallback {
|
|||||||
|
|
||||||
void on_request(uint64 id, const td_api::getActiveLiveLocationMessages &request);
|
void on_request(uint64 id, const td_api::getActiveLiveLocationMessages &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::enableLiveLocationApproachingNotification &request);
|
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::disableLiveLocationApproachingNotification &request);
|
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::getChatMessageByDate &request);
|
void on_request(uint64 id, const td_api::getChatMessageByDate &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::getChatMessageCount &request);
|
void on_request(uint64 id, td_api::getChatMessageCount &request);
|
||||||
|
@ -41,6 +41,7 @@ enum class Version : int32 {
|
|||||||
AddDialogPhotoHasAnimation,
|
AddDialogPhotoHasAnimation,
|
||||||
AddPhotoProgressiveSizes,
|
AddPhotoProgressiveSizes,
|
||||||
AddLiveLocationHeading,
|
AddLiveLocationHeading,
|
||||||
|
AddLiveLocationApproachingNotificationDistance, // 30
|
||||||
Next
|
Next
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3159,14 +3159,16 @@ class CliClient final : public Actor {
|
|||||||
string longitude;
|
string longitude;
|
||||||
string accuracy;
|
string accuracy;
|
||||||
string heading;
|
string heading;
|
||||||
|
string approaching_notification_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, heading) = split(args);
|
std::tie(accuracy, args) = split(args);
|
||||||
|
std::tie(heading, approaching_notification_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>(heading), to_integer<int32>(approaching_notification_distance)));
|
||||||
} else if (op == "emss") {
|
} else if (op == "emss") {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
string message_id;
|
string message_id;
|
||||||
@ -3177,19 +3179,6 @@ class CliClient final : public Actor {
|
|||||||
as_chat_id(chat_id), as_message_id(message_id), as_message_scheduling_state(date)));
|
as_chat_id(chat_id), as_message_id(message_id), as_message_scheduling_state(date)));
|
||||||
} else if (op == "gallm") {
|
} else if (op == "gallm") {
|
||||||
send_request(td_api::make_object<td_api::getActiveLiveLocationMessages>());
|
send_request(td_api::make_object<td_api::getActiveLiveLocationMessages>());
|
||||||
} else if (op == "ellan" || op == "dllan") {
|
|
||||||
string chat_id;
|
|
||||||
string message_id;
|
|
||||||
string distance;
|
|
||||||
std::tie(chat_id, args) = split(args);
|
|
||||||
std::tie(message_id, distance) = split(args);
|
|
||||||
if (op == "ellan") {
|
|
||||||
send_request(td_api::make_object<td_api::enableLiveLocationApproachingNotification>(
|
|
||||||
as_chat_id(chat_id), as_message_id(message_id), to_integer<int32>(distance)));
|
|
||||||
} else {
|
|
||||||
send_request(td_api::make_object<td_api::disableLiveLocationApproachingNotification>(
|
|
||||||
as_chat_id(chat_id), as_message_id(message_id)));
|
|
||||||
}
|
|
||||||
} else if (op == "sbsm") {
|
} else if (op == "sbsm") {
|
||||||
string bot_id;
|
string bot_id;
|
||||||
string chat_id;
|
string chat_id;
|
||||||
@ -3434,8 +3423,8 @@ class CliClient final : public Actor {
|
|||||||
std::tie(latitude, args) = split(args);
|
std::tie(latitude, args) = split(args);
|
||||||
std::tie(longitude, accuracy) = split(args);
|
std::tie(longitude, accuracy) = split(args);
|
||||||
|
|
||||||
send_message(chat_id,
|
send_message(chat_id, td_api::make_object<td_api::inputMessageLocation>(
|
||||||
td_api::make_object<td_api::inputMessageLocation>(as_location(latitude, longitude, accuracy), 0, 0));
|
as_location(latitude, longitude, accuracy), 0, 0, 0));
|
||||||
} else if (op == "sll") {
|
} else if (op == "sll") {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
string period;
|
string period;
|
||||||
@ -3443,15 +3432,17 @@ class CliClient final : public Actor {
|
|||||||
string longitude;
|
string longitude;
|
||||||
string accuracy;
|
string accuracy;
|
||||||
string heading;
|
string heading;
|
||||||
|
string approaching_notification_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, heading) = split(args);
|
std::tie(accuracy, args) = split(args);
|
||||||
|
std::tie(heading, approaching_notification_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>(heading), to_integer<int32>(approaching_notification_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;
|
||||||
|
Loading…
Reference in New Issue
Block a user