From 14038151485aadd8049e7cf656ba43077ddfc915 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 3 Feb 2021 22:35:43 +0300 Subject: [PATCH] Support t.me/+ links. --- td/generate/scheme/td_api.tl | 4 ++-- td/telegram/DialogInviteLink.cpp | 7 +++++-- td/telegram/DialogInviteLink.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 812ddb898..a89cc441d 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4465,11 +4465,11 @@ deleteRevokedChatInviteLink chat_id:int53 invite_link:string = Ok; //@description Deletes all revoked chat invite links. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links @chat_id Chat identifier deleteAllRevokedChatInviteLinks chat_id:int53 = Ok; -//@description Checks the validity of an invite link for a chat and returns information about the corresponding chat @invite_link Invite link to be checked; must begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/" +//@description Checks the validity of an invite link for a chat and returns information about the corresponding chat @invite_link Invite link to be checked; must have URL "t.me", "telegram.me", or "telegram.dog" and query beginning with "/joinchat/" or "/+" checkChatInviteLink invite_link:string = ChatInviteLinkInfo; //@description Uses an invite link to add the current user to the chat if possible -//@invite_link Invite link to import; must begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/" +//@invite_link Invite link to import; must have URL "t.me", "telegram.me", or "telegram.dog" and query beginning with "/joinchat/" or "/+" joinChatByInviteLink invite_link:string = Chat; diff --git a/td/telegram/DialogInviteLink.cpp b/td/telegram/DialogInviteLink.cpp index 085c09c82..f3aa83061 100644 --- a/td/telegram/DialogInviteLink.cpp +++ b/td/telegram/DialogInviteLink.cpp @@ -14,8 +14,11 @@ namespace td { -const CSlice DialogInviteLink::INVITE_LINK_URLS[3] = {"t.me/joinchat/", "telegram.me/joinchat/", - "telegram.dog/joinchat/"}; +const CSlice DialogInviteLink::INVITE_LINK_URLS[12] = { + "t.me/joinchat/", "telegram.me/joinchat/", "telegram.dog/joinchat/", + "t.me/+", "telegram.me/+", "telegram.dog/+", + "t.me/ ", "telegram.me/ ", "telegram.dog/ ", + "t.me/%20", "telegram.me/%20", "telegram.dog/%20"}; DialogInviteLink::DialogInviteLink(tl_object_ptr exported_invite) { if (exported_invite == nullptr) { diff --git a/td/telegram/DialogInviteLink.h b/td/telegram/DialogInviteLink.h index 2ced9c838..d4e35cdd3 100644 --- a/td/telegram/DialogInviteLink.h +++ b/td/telegram/DialogInviteLink.h @@ -34,7 +34,7 @@ class DialogInviteLink { friend StringBuilder &operator<<(StringBuilder &string_builder, const DialogInviteLink &invite_link); - static const CSlice INVITE_LINK_URLS[3]; + static const CSlice INVITE_LINK_URLS[12]; public: DialogInviteLink() = default;