2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Game sharing and inline results supported. Qt patch updated.

Qt patch now disables QT_SCALE_FACTOR and other HighDpi
environment variables reading because tdesktop doesn't support them.
This commit is contained in:
John Preston
2016-09-28 19:23:25 +03:00
parent 5529e24000
commit 344890c533
24 changed files with 546 additions and 83 deletions

View File

@@ -3349,7 +3349,7 @@ void MainWidget::openLocalUrl(const QString &url) {
} else if (auto usernameMatch = regex_match(qsl("^resolve/?\\?(.+)(#|$)"), command, matchOptions)) {
auto params = url_parse_params(usernameMatch->captured(1), UrlParamNameTransform::ToLower);
auto domain = params.value(qsl("domain"));
if (auto domainMatch = regex_match(qsl("^[a-zA-Z0-9\\.\\_]+$"), domain, matchOptions)) {
if (regex_match(qsl("^[a-zA-Z0-9\\.\\_]+$"), domain, matchOptions)) {
auto start = qsl("start");
auto startToken = params.value(start);
if (startToken.isEmpty()) {
@@ -3364,6 +3364,11 @@ void MainWidget::openLocalUrl(const QString &url) {
if (auto postId = postParam.toInt()) {
post = postId;
}
auto gameParam = params.value(qsl("game"));
if (!gameParam.isEmpty() && regex_match(qsl("^[a-zA-Z0-9\\.\\_]+$"), gameParam, matchOptions)) {
startToken = gameParam;
post = ShowAtGameShareMsgId;
}
openPeerByName(domain, post, startToken);
}
} else if (auto shareGameScoreMatch = regex_match(qsl("^share_game_score/?\\?(.+)(#|$)"), command, matchOptions)) {
@@ -3377,7 +3382,14 @@ void MainWidget::openPeerByName(const QString &username, MsgId msgId, const QStr
PeerData *peer = App::peerByName(username);
if (peer) {
if (msgId == ShowAtProfileMsgId && !peer->isChannel()) {
if (msgId == ShowAtGameShareMsgId) {
if (peer->isUser() && peer->asUser()->botInfo && !startToken.isEmpty()) {
peer->asUser()->botInfo->shareGameShortName = startToken;
Ui::showLayer(new ContactsBox(peer->asUser()));
} else {
Ui::showPeerHistoryAsync(peer->id, ShowAtUnreadMsgId, Ui::ShowWay::Forward);
}
} else if (msgId == ShowAtProfileMsgId && !peer->isChannel()) {
if (peer->isUser() && peer->asUser()->botInfo && !peer->asUser()->botInfo->cantJoinGroups && !startToken.isEmpty()) {
peer->asUser()->botInfo->startGroupToken = startToken;
Ui::showLayer(new ContactsBox(peer->asUser()));