local_url_handlers.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. namespace qthelp {
  9. class RegularExpressionMatch;
  10. } // namespace qthelp
  11. namespace ChatHelpers {
  12. class Show;
  13. } // namespace ChatHelpers
  14. namespace Settings {
  15. struct CreditsEntryBoxStyleOverrides;
  16. } // namespace Settings
  17. namespace Window {
  18. class SessionController;
  19. } // namespace Window
  20. namespace Core {
  21. struct LocalUrlHandler {
  22. QString expression;
  23. Fn<bool(
  24. Window::SessionController *controller,
  25. const qthelp::RegularExpressionMatch &match,
  26. const QVariant &context)> handler;
  27. };
  28. [[nodiscard]] const std::vector<LocalUrlHandler> &LocalUrlHandlers();
  29. [[nodiscard]] const std::vector<LocalUrlHandler> &InternalUrlHandlers();
  30. [[nodiscard]] QString TryConvertUrlToLocal(QString url);
  31. [[nodiscard]] bool InternalPassportLink(const QString &url);
  32. [[nodiscard]] bool StartUrlRequiresActivate(const QString &url);
  33. void ResolveAndShowUniqueGift(
  34. std::shared_ptr<ChatHelpers::Show> show,
  35. const QString &slug,
  36. ::Settings::CreditsEntryBoxStyleOverrides st);
  37. void ResolveAndShowUniqueGift(
  38. std::shared_ptr<ChatHelpers::Show> show,
  39. const QString &slug);
  40. [[nodiscard]] TimeId ParseVideoTimestamp(QStringView value);
  41. } // namespace Core