diff --git a/qml/js/functions.js b/qml/js/functions.js index d63394b..24f7592 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -386,6 +386,9 @@ function handleTMeLink(link, usedPrefix) { tdLibWrapper.joinChatByInviteLink(link); // Do the necessary stuff to open the chat if successful // Fail with nice error message if it doesn't work + } else if (link.indexOf("/+") !== -1) { + // Can't handle t.me/+... links, let the user choose the browser instead + Qt.openUrlExternally(link); } else { Debug.log("Search public chat: ", link.substring(usedPrefix.length)); tdLibWrapper.searchPublicChat(link.substring(usedPrefix.length), true); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 07e4bf6..b36599c 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -661,6 +661,21 @@ void TDLibWrapper::getMessageLinkInfo(const QString &url, const QString &extra) this->sendRequest(requestObject); } +void TDLibWrapper::getExternalLinkInfo(const QString &url, const QString &extra) +{ + LOG("Retrieving external link info" << url << extra); + QVariantMap requestObject; + requestObject.insert(_TYPE, "getExternalLinkInfo"); + requestObject.insert("url", url); + if (extra == "") { + requestObject.insert(_EXTRA, url); + } else { + requestObject.insert(_EXTRA, url + "|" + extra); + } + + this->sendRequest(requestObject); +} + void TDLibWrapper::getCallbackQueryAnswer(const QString &chatId, const QString &messageId, const QVariantMap &payload) { LOG("Getting Callback Query Answer" << chatId << messageId); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 6873fef..1df9c60 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -172,6 +172,7 @@ public: Q_INVOKABLE void forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, bool sendCopy, bool removeCaption); Q_INVOKABLE void getMessage(qlonglong chatId, qlonglong messageId); Q_INVOKABLE void getMessageLinkInfo(const QString &url, const QString &extra = ""); + Q_INVOKABLE void getExternalLinkInfo(const QString &url, const QString &extra = ""); Q_INVOKABLE void getCallbackQueryAnswer(const QString &chatId, const QString &messageId, const QVariantMap &payload); Q_INVOKABLE void getChatPinnedMessage(qlonglong chatId); Q_INVOKABLE void getChatSponsoredMessage(qlonglong chatId);