From e0c2294d50668e49b68260cdd43e580320a5ab8f Mon Sep 17 00:00:00 2001 From: ZavaruKitsu Date: Wed, 3 Jan 2024 20:46:36 +0300 Subject: [PATCH] feat: pseudo support `tg://ayu` --- Telegram/SourceFiles/ayu/ayu_url_handlers.cpp | 13 +++++++++++++ Telegram/SourceFiles/ayu/ayu_url_handlers.h | 5 +++++ Telegram/SourceFiles/core/local_url_handlers.cpp | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/Telegram/SourceFiles/ayu/ayu_url_handlers.cpp b/Telegram/SourceFiles/ayu/ayu_url_handlers.cpp index 5f079f5e8..10546d936 100644 --- a/Telegram/SourceFiles/ayu/ayu_url_handlers.cpp +++ b/Telegram/SourceFiles/ayu/ayu_url_handlers.cpp @@ -9,6 +9,7 @@ #include "base/qthelp_url.h" #include "lang_auto.h" +#include "mainwindow.h" #include "ui/boxes/confirm_box.h" #include "ayu/utils/telegram_helpers.h" #include "boxes/abstract_box.h" @@ -54,4 +55,16 @@ bool ResolveUser( return true; } +bool HandleAyu( + Window::SessionController *controller, + const Match &match, + const QVariant &context) +{ + if (!controller) { + return false; + } + controller->showToast(QString(":3"), 500); + return true; +} + } \ No newline at end of file diff --git a/Telegram/SourceFiles/ayu/ayu_url_handlers.h b/Telegram/SourceFiles/ayu/ayu_url_handlers.h index 6c025573a..6a85b650c 100644 --- a/Telegram/SourceFiles/ayu/ayu_url_handlers.h +++ b/Telegram/SourceFiles/ayu/ayu_url_handlers.h @@ -19,4 +19,9 @@ bool ResolveUser( const Match &match, const QVariant &context); +bool HandleAyu( + Window::SessionController *controller, + const Match &match, + const QVariant &context); + } \ No newline at end of file diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 64c86668a..49b4a9e22 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -1003,6 +1003,10 @@ const std::vector &LocalUrlHandlers() { u"^user\\?(.+)(#|$)"_q, AyuUrlHandlers::ResolveUser }, + { + u"^ayu/?(.+)?(#|$)"_q, + AyuUrlHandlers::HandleAyu + }, { u"^([^\\?]+)(\\?|#|$)"_q, HandleUnknown