Use normal URL dialog for t.me/+... links

This commit is contained in:
Sebastian Wolf 2022-05-01 01:17:37 +02:00
parent 6d6b07b9a9
commit 81cf5b6852
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
3 changed files with 19 additions and 0 deletions

View file

@ -386,6 +386,9 @@ function handleTMeLink(link, usedPrefix) {
tdLibWrapper.joinChatByInviteLink(link); tdLibWrapper.joinChatByInviteLink(link);
// Do the necessary stuff to open the chat if successful // Do the necessary stuff to open the chat if successful
// Fail with nice error message if it doesn't work // 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 { } else {
Debug.log("Search public chat: ", link.substring(usedPrefix.length)); Debug.log("Search public chat: ", link.substring(usedPrefix.length));
tdLibWrapper.searchPublicChat(link.substring(usedPrefix.length), true); tdLibWrapper.searchPublicChat(link.substring(usedPrefix.length), true);

View file

@ -661,6 +661,21 @@ void TDLibWrapper::getMessageLinkInfo(const QString &url, const QString &extra)
this->sendRequest(requestObject); 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) void TDLibWrapper::getCallbackQueryAnswer(const QString &chatId, const QString &messageId, const QVariantMap &payload)
{ {
LOG("Getting Callback Query Answer" << chatId << messageId); LOG("Getting Callback Query Answer" << chatId << messageId);

View file

@ -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 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 getMessage(qlonglong chatId, qlonglong messageId);
Q_INVOKABLE void getMessageLinkInfo(const QString &url, const QString &extra = ""); 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 getCallbackQueryAnswer(const QString &chatId, const QString &messageId, const QVariantMap &payload);
Q_INVOKABLE void getChatPinnedMessage(qlonglong chatId); Q_INVOKABLE void getChatPinnedMessage(qlonglong chatId);
Q_INVOKABLE void getChatSponsoredMessage(qlonglong chatId); Q_INVOKABLE void getChatSponsoredMessage(qlonglong chatId);