Update layer to 110. Add textEntityTypeBankCardNumber.
GitOrigin-RevId: 2d525fb0b6639f6b803d381a97f47bd91a12e23e
This commit is contained in:
parent
5f07b07f18
commit
30eaa49ffd
@ -95,6 +95,7 @@ messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;
|
||||
messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity;
|
||||
messageEntityPhone#9b69e34b offset:int length:int = MessageEntity;
|
||||
messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity;
|
||||
messageEntityBankCard#761e6af4 offset:int length:int = MessageEntity;
|
||||
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
|
||||
inputStickerSetEmpty#ffb62b95 = InputStickerSet;
|
||||
decryptedMessageMediaVenue#8a0df56f lat:double long:double title:string address:string provider:string venue_id:string = DecryptedMessageMedia;
|
||||
|
Binary file not shown.
@ -1466,6 +1466,9 @@ textEntityTypeEmailAddress = TextEntityType;
|
||||
//@description A phone number
|
||||
textEntityTypePhoneNumber = TextEntityType;
|
||||
|
||||
//@description A bank card number
|
||||
textEntityTypeBankCardNumber = TextEntityType;
|
||||
|
||||
//@description A bold text
|
||||
textEntityTypeBold = TextEntityType;
|
||||
|
||||
@ -3400,7 +3403,7 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup =
|
||||
editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok;
|
||||
|
||||
|
||||
//@description Returns all entities (mentions, hashtags, cashtags, bot commands, URLs, and email addresses) contained in the text. This is an offline method. Can be called before authorization. Can be called synchronously @text The text in which to look for entites
|
||||
//@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. This is an offline method. Can be called before authorization. Can be called synchronously @text The text in which to look for entites
|
||||
getTextEntities text:string = TextEntities;
|
||||
|
||||
//@description Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. This is an offline method. Can be called before authorization. Can be called synchronously @text The text which should be parsed @parse_mode Text parse mode
|
||||
|
Binary file not shown.
@ -561,6 +561,7 @@ messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity;
|
||||
messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity;
|
||||
messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity;
|
||||
messageEntityBlockquote#20df5d0 offset:int length:int = MessageEntity;
|
||||
messageEntityBankCard#761e6af4 offset:int length:int = MessageEntity;
|
||||
|
||||
inputChannelEmpty#ee8c1e86 = InputChannel;
|
||||
inputChannel#afeb712e channel_id:int access_hash:long = InputChannel;
|
||||
@ -1060,6 +1061,7 @@ channelLocationEmpty#bfb5ad8b = ChannelLocation;
|
||||
channelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation;
|
||||
|
||||
peerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated;
|
||||
peerSelfLocated#f8ec284b expires:int = PeerLocated;
|
||||
|
||||
restrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason;
|
||||
|
||||
@ -1097,6 +1099,10 @@ messageUserVoteMultiple#e8fe0de user_id:int options:Vector<bytes> date:int = Mes
|
||||
|
||||
messages.votesList#823f649 flags:# count:int votes:Vector<MessageUserVote> users:Vector<User> next_offset:flags.0?string = messages.VotesList;
|
||||
|
||||
bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl;
|
||||
|
||||
payments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
@ -1214,7 +1220,7 @@ contacts.getSaved#82f1e39f = Vector<SavedContact>;
|
||||
contacts.toggleTopPeers#8514bdda enabled:Bool = Bool;
|
||||
contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;
|
||||
contacts.acceptContact#f831a20f id:InputUser = Updates;
|
||||
contacts.getLocated#a356056 geo_point:InputGeoPoint = Updates;
|
||||
contacts.getLocated#d348bc44 flags:# background:flags.1?true geo_point:InputGeoPoint self_expires:flags.0?int = Updates;
|
||||
|
||||
messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
|
||||
messages.getDialogs#a0ee3b73 flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs;
|
||||
@ -1419,6 +1425,7 @@ payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int inf
|
||||
payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult;
|
||||
payments.getSavedInfo#227d824b = payments.SavedInfo;
|
||||
payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool;
|
||||
payments.getBankCardData#2e79d779 number:string = payments.BankCardData;
|
||||
|
||||
stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector<InputStickerSetItem> = messages.StickerSet;
|
||||
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
|
||||
|
Binary file not shown.
@ -772,9 +772,13 @@ class SearchDialogsNearbyQuery : public Td::ResultHandler {
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(const Location &location) {
|
||||
void send(const Location &location, bool from_background) {
|
||||
int32 flags = 0;
|
||||
if (from_background) {
|
||||
flags |= telegram_api::contacts_getLocated::BACKGROUND_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
create_storer(telegram_api::contacts_getLocated(location.get_input_geo_point()))));
|
||||
create_storer(telegram_api::contacts_getLocated(flags, false /*ignored*/, location.get_input_geo_point(), 0))));
|
||||
}
|
||||
|
||||
void on_result(uint64 id, BufferSlice packet) override {
|
||||
@ -4824,7 +4828,7 @@ void ContactsManager::search_dialogs_nearby(const Location &location,
|
||||
Result<tl_object_ptr<telegram_api::Updates>> result) mutable {
|
||||
send_closure(actor_id, &ContactsManager::on_get_dialogs_nearby, std::move(result), std::move(promise));
|
||||
});
|
||||
td_->create_handler<SearchDialogsNearbyQuery>(std::move(query_promise))->send(location);
|
||||
td_->create_handler<SearchDialogsNearbyQuery>(std::move(query_promise))->send(location, false);
|
||||
}
|
||||
|
||||
vector<td_api::object_ptr<td_api::chatNearby>> ContactsManager::get_chats_nearby_object(
|
||||
@ -4880,11 +4884,18 @@ void ContactsManager::on_get_dialogs_nearby(Result<tl_object_ptr<telegram_api::U
|
||||
get_chats_nearby_object(channels_nearby_)));
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_peer_located(vector<tl_object_ptr<telegram_api::peerLocated>> &&peers,
|
||||
void ContactsManager::on_update_peer_located(vector<tl_object_ptr<telegram_api::PeerLocated>> &&peers,
|
||||
bool from_update) {
|
||||
auto now = G()->unix_time();
|
||||
bool need_update = false;
|
||||
for (auto &peer_located : peers) {
|
||||
for (auto &peer_located_ptr : peers) {
|
||||
if (peer_located_ptr->get_id() == telegram_api::peerSelfLocated::ID) {
|
||||
// auto peer_self_located = telegram_api::move_object_as<telegram_api::peerSelfLocated>(peer_located_ptr);
|
||||
continue;
|
||||
}
|
||||
|
||||
CHECK(peer_located_ptr->get_id() == telegram_api::peerLocated::ID);
|
||||
auto peer_located = telegram_api::move_object_as<telegram_api::peerLocated>(peer_located_ptr);
|
||||
DialogId dialog_id(peer_located->peer_);
|
||||
int32 expires_at = peer_located->expires_;
|
||||
int32 distance = peer_located->distance_;
|
||||
|
@ -196,7 +196,7 @@ class ContactsManager : public Actor {
|
||||
void on_update_channel_default_permissions(ChannelId channel_id, RestrictedRights default_permissions);
|
||||
void on_update_channel_administrator_count(ChannelId channel_id, int32 administrator_count);
|
||||
|
||||
void on_update_peer_located(vector<tl_object_ptr<telegram_api::peerLocated>> &&peers, bool from_update);
|
||||
void on_update_peer_located(vector<tl_object_ptr<telegram_api::PeerLocated>> &&peers, bool from_update);
|
||||
|
||||
void on_update_dialog_administrators(DialogId dialog_id, vector<DialogAdministrator> &&administrators,
|
||||
bool have_access);
|
||||
|
@ -64,6 +64,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, const MessageEntity::Ty
|
||||
return string_builder << "Cashtag";
|
||||
case MessageEntity::Type::PhoneNumber:
|
||||
return string_builder << "PhoneNumber";
|
||||
case MessageEntity::Type::BankCardNumber:
|
||||
return string_builder << "BankCardNumber";
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return string_builder << "Impossible";
|
||||
@ -119,6 +121,8 @@ tl_object_ptr<td_api::TextEntityType> MessageEntity::get_text_entity_type_object
|
||||
return make_tl_object<td_api::textEntityTypeCashtag>();
|
||||
case MessageEntity::Type::PhoneNumber:
|
||||
return make_tl_object<td_api::textEntityTypePhoneNumber>();
|
||||
case MessageEntity::Type::BankCardNumber:
|
||||
return make_tl_object<td_api::textEntityTypeBankCardNumber>();
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
@ -406,6 +410,11 @@ static vector<Slice> match_cashtags(Slice str) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static vector<Slice> match_bank_card_numbers(Slice str) {
|
||||
vector<Slice> result;
|
||||
return result;
|
||||
}
|
||||
|
||||
static vector<Slice> match_urls(Slice str) {
|
||||
vector<Slice> result;
|
||||
const unsigned char *begin = str.ubegin();
|
||||
@ -1010,6 +1019,10 @@ vector<Slice> find_cashtags(Slice str) {
|
||||
return match_cashtags(str);
|
||||
}
|
||||
|
||||
vector<Slice> find_bank_card_numbers(Slice str) {
|
||||
return match_bank_card_numbers(str);
|
||||
}
|
||||
|
||||
vector<std::pair<Slice, bool>> find_urls(Slice str) {
|
||||
vector<std::pair<Slice, bool>> result;
|
||||
for (auto url : match_urls(str)) {
|
||||
@ -1132,6 +1145,13 @@ vector<MessageEntity> find_entities(Slice text, bool skip_bot_commands, bool onl
|
||||
}
|
||||
|
||||
// TODO find_phone_numbers
|
||||
|
||||
auto bank_card_numbers = find_bank_card_numbers(text);
|
||||
for (auto &bank_card_number : bank_card_numbers) {
|
||||
entities.emplace_back(MessageEntity::Type::BankCardNumber,
|
||||
narrow_cast<int32>(bank_card_number.begin() - text.begin()),
|
||||
narrow_cast<int32>(bank_card_numbers.size()));
|
||||
}
|
||||
}
|
||||
|
||||
auto urls = find_urls(text);
|
||||
@ -1271,6 +1291,8 @@ string get_first_url(Slice text, const vector<MessageEntity> &entities) {
|
||||
break;
|
||||
case MessageEntity::Type::PhoneNumber:
|
||||
break;
|
||||
case MessageEntity::Type::BankCardNumber:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -1955,6 +1977,7 @@ vector<tl_object_ptr<telegram_api::MessageEntity>> get_input_message_entities(co
|
||||
case MessageEntity::Type::EmailAddress:
|
||||
case MessageEntity::Type::Cashtag:
|
||||
case MessageEntity::Type::PhoneNumber:
|
||||
case MessageEntity::Type::BankCardNumber:
|
||||
continue;
|
||||
case MessageEntity::Type::Bold:
|
||||
result.push_back(make_tl_object<telegram_api::messageEntityBold>(entity.offset, entity.length));
|
||||
@ -2023,6 +2046,10 @@ vector<tl_object_ptr<secret_api::MessageEntity>> get_input_secret_message_entiti
|
||||
break;
|
||||
case MessageEntity::Type::BotCommand:
|
||||
break;
|
||||
case MessageEntity::Type::PhoneNumber:
|
||||
break;
|
||||
case MessageEntity::Type::BankCardNumber:
|
||||
break;
|
||||
case MessageEntity::Type::Url:
|
||||
result.push_back(make_tl_object<secret_api::messageEntityUrl>(entity.offset, entity.length));
|
||||
break;
|
||||
@ -2065,8 +2092,6 @@ vector<tl_object_ptr<secret_api::MessageEntity>> get_input_secret_message_entiti
|
||||
break;
|
||||
case MessageEntity::Type::MentionName:
|
||||
break;
|
||||
case MessageEntity::Type::PhoneNumber:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -2091,6 +2116,7 @@ Result<vector<MessageEntity>> get_message_entities(const ContactsManager *contac
|
||||
case td_api::textEntityTypeEmailAddress::ID:
|
||||
case td_api::textEntityTypeCashtag::ID:
|
||||
case td_api::textEntityTypePhoneNumber::ID:
|
||||
case td_api::textEntityTypeBankCardNumber::ID:
|
||||
break;
|
||||
case td_api::textEntityTypeBold::ID:
|
||||
entities.emplace_back(MessageEntity::Type::Bold, entity->offset_, entity->length_);
|
||||
@ -2182,6 +2208,12 @@ vector<MessageEntity> get_message_entities(const ContactsManager *contacts_manag
|
||||
entity_bot_command->length_);
|
||||
break;
|
||||
}
|
||||
case telegram_api::messageEntityBankCard::ID: {
|
||||
auto entity_bank_card = static_cast<const telegram_api::messageEntityBankCard *>(entity.get());
|
||||
entities.emplace_back(MessageEntity::Type::BankCardNumber, entity_bank_card->offset_,
|
||||
entity_bank_card->length_);
|
||||
break;
|
||||
}
|
||||
case telegram_api::messageEntityUrl::ID: {
|
||||
auto entity_url = static_cast<const telegram_api::messageEntityUrl *>(entity.get());
|
||||
entities.emplace_back(MessageEntity::Type::Url, entity_url->offset_, entity_url->length_);
|
||||
@ -2291,6 +2323,9 @@ vector<MessageEntity> get_message_entities(vector<tl_object_ptr<secret_api::Mess
|
||||
case secret_api::messageEntityBotCommand::ID:
|
||||
// skip all bot commands in secret chats
|
||||
break;
|
||||
case secret_api::messageEntityBankCard::ID:
|
||||
// skip, will find it ourselves
|
||||
break;
|
||||
case secret_api::messageEntityUrl::ID: {
|
||||
auto entity_url = static_cast<const secret_api::messageEntityUrl *>(entity.get());
|
||||
// TODO skip URL when find_urls will be better
|
||||
|
@ -45,7 +45,8 @@ class MessageEntity {
|
||||
PhoneNumber,
|
||||
Underline,
|
||||
Strikethrough,
|
||||
BlockQuote
|
||||
BlockQuote,
|
||||
BankCardNumber
|
||||
};
|
||||
Type type;
|
||||
int32 offset;
|
||||
@ -135,6 +136,7 @@ vector<Slice> find_mentions(Slice str);
|
||||
vector<Slice> find_bot_commands(Slice str);
|
||||
vector<Slice> find_hashtags(Slice str);
|
||||
vector<Slice> find_cashtags(Slice str);
|
||||
vector<Slice> find_bank_card_numbers(Slice str);
|
||||
bool is_email_address(Slice str);
|
||||
vector<std::pair<Slice, bool>> find_urls(Slice str); // slice + is_email_address
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
constexpr int32 MTPROTO_LAYER = 109;
|
||||
constexpr int32 MTPROTO_LAYER = 110;
|
||||
|
||||
enum class Version : int32 {
|
||||
Initial,
|
||||
|
Loading…
Reference in New Issue
Block a user