diff --git a/td/telegram/DialogFilterInviteLink.cpp b/td/telegram/DialogFilterInviteLink.cpp index 5c1c0de66..146080a49 100644 --- a/td/telegram/DialogFilterInviteLink.cpp +++ b/td/telegram/DialogFilterInviteLink.cpp @@ -6,6 +6,7 @@ // #include "td/telegram/DialogFilterInviteLink.h" +#include "td/telegram/LinkManager.h" #include "td/telegram/MessagesManager.h" #include "td/telegram/Td.h" @@ -14,6 +15,7 @@ namespace td { DialogFilterInviteLink::DialogFilterInviteLink( Td *td, telegram_api::object_ptr exported_invite) { CHECK(exported_invite != nullptr); + LOG_IF(ERROR, !is_valid_invite_link(exported_invite->url_)) << "Unsupported " << to_string(exported_invite); invite_link_ = std::move(exported_invite->url_); title_ = std::move(exported_invite->title_); for (const auto &peer : exported_invite->peers_) { @@ -30,6 +32,10 @@ td_api::object_ptr DialogFilterInviteLink::get_cha invite_link_, title_, transform(dialog_ids_, [](DialogId dialog_id) { return dialog_id.get(); })); } +bool DialogFilterInviteLink::is_valid_invite_link(Slice invite_link) { + return !LinkManager::get_dialog_filter_invite_link_slug(invite_link).empty(); +} + bool operator==(const DialogFilterInviteLink &lhs, const DialogFilterInviteLink &rhs) { return lhs.invite_link_ == rhs.invite_link_ && lhs.title_ == rhs.title_ && lhs.dialog_ids_ == rhs.dialog_ids_; } diff --git a/td/telegram/DialogFilterInviteLink.h b/td/telegram/DialogFilterInviteLink.h index dd774acdc..65c79e029 100644 --- a/td/telegram/DialogFilterInviteLink.h +++ b/td/telegram/DialogFilterInviteLink.h @@ -38,6 +38,8 @@ class DialogFilterInviteLink { bool is_valid() const { return !invite_link_.empty(); } + + static bool is_valid_invite_link(Slice invite_link); }; bool operator==(const DialogFilterInviteLink &lhs, const DialogFilterInviteLink &rhs);