diff --git a/qml/js/functions.js b/qml/js/functions.js
index 77bebd6..c2ce688 100644
--- a/qml/js/functions.js
+++ b/qml/js/functions.js
@@ -312,8 +312,13 @@ function enhanceMessageText(formattedText) {
function handleLink(link) {
var tMePrefix = tdLibWrapper.getOptionString("t_me_url");
if (link.indexOf("user://") === 0) {
- var userInformation = tdLibWrapper.getUserInformationByName(link.substring(8));
- tdLibWrapper.createPrivateChat(userInformation.id);
+ var userName = link.substring(8);
+ var userInformation = tdLibWrapper.getUserInformationByName(userName);
+ if (typeof userInformation.id === "undefined") {
+ appNotification.show(qsTr("Unable to find user %1").arg(userName));
+ } else {
+ tdLibWrapper.createPrivateChat(userInformation.id);
+ }
} else if (link.indexOf("userId://") === 0) {
tdLibWrapper.createPrivateChat(link.substring(9));
} else if (link.indexOf("tg://") === 0) {
diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml
index deb8145..174ec2b 100644
--- a/qml/pages/ChatPage.qml
+++ b/qml/pages/ChatPage.qml
@@ -320,7 +320,7 @@ Page {
Connections {
target: chatListModel
onChatJoined: {
- chatPageNotification.show(qsTr("You joined the chat %1").arg(chatTitle));
+ appNotification.show(qsTr("You joined the chat %1").arg(chatTitle));
}
}
@@ -419,7 +419,7 @@ Page {
}
AppNotification {
- id: chatPageNotification
+ id: appNotification
}
BackgroundItem {
@@ -469,13 +469,6 @@ Page {
width: parent.width
maximumLineCount: 1
horizontalAlignment: Text.AlignRight
- onTruncatedChanged: {
- // There is obviously a bug in QML in truncating text with images.
- // We simply remove Emojis then...
- if (truncated) {
- text = text.replace(/\]+\/\>/g, "");
- }
- }
}
Text {
id: chatStatusText
diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml
index 4bfeab8..b47d0f8 100644
--- a/qml/pages/OverviewPage.qml
+++ b/qml/pages/OverviewPage.qml
@@ -159,6 +159,11 @@ Page {
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : tdLibWrapper.getChat(chat.id) });
}
}
+ onErrorReceived: {
+ if (message === "USER_ALREADY_PARTICIPANT") {
+ appNotification.show(qsTr("You are already a member of this chat."));
+ }
+ }
}
Component.onCompleted: {
@@ -184,7 +189,7 @@ Page {
}
AppNotification {
- id: overviewPageNotification
+ id: appNotification
}
Column {
diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp
index 99ba7d6..c9fe08d 100644
--- a/src/chatlistmodel.cpp
+++ b/src/chatlistmodel.cpp
@@ -405,7 +405,10 @@ void ChatListModel::addVisibleChat(ChatData *chat)
chatIndexMap.insert(chatList.at(i)->chatId, i);
}
endInsertRows();
- emit chatJoined(chat->chatId, chat->chatData.value("title").toString());
+ if (this->tdLibWrapper->getJoinChatRequested()) {
+ this->tdLibWrapper->registerJoinChat();
+ emit chatJoined(chat->chatId, chat->chatData.value("title").toString());
+ }
}
void ChatListModel::updateChatVisibility(const TDLibWrapper::Group *group)
diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp
index 383108a..dd0fb6e 100644
--- a/src/tdlibreceiver.cpp
+++ b/src/tdlibreceiver.cpp
@@ -117,6 +117,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
handlers.insert("updateChatPermissions", &TDLibReceiver::processUpdateChatPermissions);
handlers.insert("updateChatTitle", &TDLibReceiver::processUpdateChatTitle);
handlers.insert("users", &TDLibReceiver::processUsers);
+ handlers.insert("error", &TDLibReceiver::processError);
}
void TDLibReceiver::setActive(bool active)
@@ -501,3 +502,9 @@ void TDLibReceiver::processUsers(const QVariantMap &receivedInformation)
LOG("Received Users");
emit usersReceived(receivedInformation.value(EXTRA).toString(), receivedInformation.value("user_ids").toList(), receivedInformation.value("total_count").toInt());
}
+
+void TDLibReceiver::processError(const QVariantMap &receivedInformation)
+{
+ LOG("Received an error");
+ emit errorReceived(receivedInformation.value("code").toInt(), receivedInformation.value("message").toString());
+}
diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h
index 36f4fc5..9225970 100644
--- a/src/tdlibreceiver.h
+++ b/src/tdlibreceiver.h
@@ -81,6 +81,7 @@ signals:
void chatPermissionsUpdated(const QString &chatId, const QVariantMap &chatPermissions);
void chatTitleUpdated(const QString &chatId, const QString &title);
void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers);
+ void errorReceived(const int code, const QString &message);
private:
typedef void (TDLibReceiver::*Handler)(const QVariantMap &);
@@ -136,6 +137,7 @@ private:
void processUpdateChatPermissions(const QVariantMap &receivedInformation);
void processUpdateChatTitle(const QVariantMap &receivedInformation);
void processUsers(const QVariantMap &receivedInformation);
+ void processError(const QVariantMap &receivedInformation);
};
#endif // TDLIBRECEIVER_H
diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp
index f1445ef..cdf3b9c 100644
--- a/src/tdlibwrapper.cpp
+++ b/src/tdlibwrapper.cpp
@@ -112,6 +112,7 @@ TDLibWrapper::TDLibWrapper(AppSettings *appSettings, QObject *parent) : QObject(
connect(this->tdLibReceiver, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)), this, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(chatTitleUpdated(QString, QString)), this, SIGNAL(chatTitleUpdated(QString, QString)));
connect(this->tdLibReceiver, SIGNAL(usersReceived(QString, QVariantList, int)), this, SIGNAL(usersReceived(QString, QVariantList, int)));
+ connect(this->tdLibReceiver, SIGNAL(errorReceived(int, QString)), this, SIGNAL(errorReceived(int, QString)));
connect(&emojiSearchWorker, SIGNAL(searchCompleted(QString, QVariantList)), this, SLOT(handleEmojiSearchCompleted(QString, QVariantList)));
@@ -250,6 +251,7 @@ void TDLibWrapper::joinChat(const QString &chatId)
QVariantMap requestObject;
requestObject.insert(_TYPE, "joinChat");
requestObject.insert("chat_id", chatId);
+ this->joinChatRequested = true;
this->sendRequest(requestObject);
}
@@ -741,6 +743,7 @@ void TDLibWrapper::joinChatByInviteLink(const QString &inviteLink)
QVariantMap requestObject;
requestObject.insert(_TYPE, "joinChatByInviteLink");
requestObject.insert("invite_link", inviteLink);
+ this->joinChatRequested = true;
this->sendRequest(requestObject);
}
@@ -872,6 +875,16 @@ void TDLibWrapper::controlScreenSaver(bool enabled)
}
}
+bool TDLibWrapper::getJoinChatRequested()
+{
+ return this->joinChatRequested;
+}
+
+void TDLibWrapper::registerJoinChat()
+{
+ this->joinChatRequested = false;
+}
+
DBusAdaptor *TDLibWrapper::getDBusAdaptor()
{
return this->dbusInterface->getDBusAdaptor();
diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h
index 20f34d1..a03e837 100644
--- a/src/tdlibwrapper.h
+++ b/src/tdlibwrapper.h
@@ -103,6 +103,8 @@ public:
Q_INVOKABLE void copyFileToDownloads(const QString &filePath);
Q_INVOKABLE void openFileOnDevice(const QString &filePath);
Q_INVOKABLE void controlScreenSaver(bool enabled);
+ Q_INVOKABLE bool getJoinChatRequested();
+ Q_INVOKABLE void registerJoinChat();
DBusAdaptor *getDBusAdaptor();
@@ -215,6 +217,7 @@ signals:
void chatPermissionsUpdated(const QString &chatId, const QVariantMap &permissions);
void chatTitleUpdated(const QString &chatId, const QString &title);
void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers);
+ void errorReceived(const int code, const QString &message);
public slots:
void handleVersionDetected(const QString &version);
@@ -261,6 +264,7 @@ private:
EmojiSearchWorker emojiSearchWorker;
QString activeChatSearchName;
+ bool joinChatRequested;
};
diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts
index 0afb9f2..0ddabe3 100644
--- a/translations/harbour-fernschreiber-de.ts
+++ b/translations/harbour-fernschreiber-de.ts
@@ -839,6 +839,10 @@
Sie haben noch keine Chats.
+
+
+ Sie sind bereits Mitglied dieses Chats.
+
PollCreationPage
@@ -1448,5 +1452,9 @@
hat ein selbstzerstörendes Bild gesendet, das abgelaufen ist
+
+
+ Konnte Benutzer %1 nicht finden
+
diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts
index e824740..52b6271 100644
--- a/translations/harbour-fernschreiber-es.ts
+++ b/translations/harbour-fernschreiber-es.ts
@@ -839,6 +839,10 @@
No hay todavía ninguna charla.
+
+
+
+
PollCreationPage
@@ -1442,5 +1446,9 @@
envió un vídeo autodestructivo que está caducado
+
+
+
+
diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts
index e04bb8e..6db1b2a 100644
--- a/translations/harbour-fernschreiber-fi.ts
+++ b/translations/harbour-fernschreiber-fi.ts
@@ -840,6 +840,10 @@
Sinulla ei ole vielä keskusteluja.
+
+
+
+
PollCreationPage
@@ -1449,5 +1453,9 @@
+
+
+
+
diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts
index d0dc370..24595d1 100644
--- a/translations/harbour-fernschreiber-hu.ts
+++ b/translations/harbour-fernschreiber-hu.ts
@@ -839,6 +839,10 @@
+
+
+
+
PollCreationPage
@@ -1442,5 +1446,9 @@
+
+
+
+
diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts
index 3c922cb..2702d15 100644
--- a/translations/harbour-fernschreiber-it.ts
+++ b/translations/harbour-fernschreiber-it.ts
@@ -839,6 +839,10 @@
Carica lista chat...
+
+
+
+
PollCreationPage
@@ -1448,5 +1452,9 @@
ha inviato un video effimero già scaduto
+
+
+
+
diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts
index b4dba21..3461f14 100644
--- a/translations/harbour-fernschreiber-pl.ts
+++ b/translations/harbour-fernschreiber-pl.ts
@@ -839,6 +839,10 @@
Nie masz jeszcze żadnych czatów.
+
+
+
+
PollCreationPage
@@ -1454,5 +1458,9 @@
+
+
+
+
diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts
index f3a170b..fde9eef 100644
--- a/translations/harbour-fernschreiber-ru.ts
+++ b/translations/harbour-fernschreiber-ru.ts
@@ -839,6 +839,10 @@
Тут пока ничего нет
+
+
+
+
PollCreationPage
@@ -1454,5 +1458,9 @@
+
+
+
+
diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts
index f6cce56..849fbad 100644
--- a/translations/harbour-fernschreiber-sv.ts
+++ b/translations/harbour-fernschreiber-sv.ts
@@ -839,6 +839,10 @@
Du har inga chattar än.
+
+
+
+
PollCreationPage
@@ -1448,5 +1452,9 @@
+
+
+
+
diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts
index 5e61dd4..a9c31a9 100644
--- a/translations/harbour-fernschreiber-zh_CN.ts
+++ b/translations/harbour-fernschreiber-zh_CN.ts
@@ -839,6 +839,10 @@
你尚无任何对话。
+
+
+
+
PollCreationPage
@@ -1442,5 +1446,9 @@
+
+
+
+
diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts
index 7abeed8..3b529ef 100644
--- a/translations/harbour-fernschreiber.ts
+++ b/translations/harbour-fernschreiber.ts
@@ -839,6 +839,10 @@
+
+
+
+
PollCreationPage
@@ -1442,5 +1446,9 @@
+
+
+
+