Start chat from @-mention
This commit is contained in:
parent
23d0af9836
commit
bbd8e3eabf
3 changed files with 14 additions and 4 deletions
|
@ -224,7 +224,7 @@ function enhanceMessageText(formattedText) {
|
||||||
messageInsertions.push(new MessageInsertion((formattedText.entities[i].offset + formattedText.entities[i].length), "</i>", 0 ));
|
messageInsertions.push(new MessageInsertion((formattedText.entities[i].offset + formattedText.entities[i].length), "</i>", 0 ));
|
||||||
}
|
}
|
||||||
if (entityType === "textEntityTypeMention") {
|
if (entityType === "textEntityTypeMention") {
|
||||||
messageInsertions.push(new MessageInsertion(formattedText.entities[i].offset, "<a href=\"user:" + messageText.substring(formattedText.entities[i].offset, ( formattedText.entities[i].offset + formattedText.entities[i].length )) + "\">", 0 ));
|
messageInsertions.push(new MessageInsertion(formattedText.entities[i].offset, "<a href=\"user://" + messageText.substring(formattedText.entities[i].offset, ( formattedText.entities[i].offset + formattedText.entities[i].length )) + "\">", 0 ));
|
||||||
messageInsertions.push(new MessageInsertion((formattedText.entities[i].offset + formattedText.entities[i].length), "</a>", 0 ));
|
messageInsertions.push(new MessageInsertion((formattedText.entities[i].offset + formattedText.entities[i].length), "</a>", 0 ));
|
||||||
}
|
}
|
||||||
if (entityType === "textEntityTypeMentionName") {
|
if (entityType === "textEntityTypeMentionName") {
|
||||||
|
@ -277,9 +277,10 @@ function enhanceMessageText(formattedText) {
|
||||||
|
|
||||||
function handleLink(link) {
|
function handleLink(link) {
|
||||||
if (link.indexOf("user://") === 0) {
|
if (link.indexOf("user://") === 0) {
|
||||||
//pageStack.push(Qt.resolvedUrl("../pages/UserPage.qml"), {"userName": link.substring(7)});
|
var userInformation = tdLibWrapper.getUserInformationByName(link.substring(8));
|
||||||
} else if (link.indexOf("userid://") === 0) {
|
tdLibWrapper.createPrivateChat(userInformation.id);
|
||||||
//pageStack.push(Qt.resolvedUrl("../pages/UserPage.qml"), {"userId": link.substring(9)});
|
} else if (link.indexOf("userId://") === 0) {
|
||||||
|
tdLibWrapper.createPrivateChat(link.substring(9));
|
||||||
} else {
|
} else {
|
||||||
Qt.openUrlExternally(link);
|
Qt.openUrlExternally(link);
|
||||||
}
|
}
|
||||||
|
|
|
@ -708,6 +708,11 @@ QVariantMap TDLibWrapper::getUserInformation(const QString &userId)
|
||||||
return this->allUsers.value(userId).toMap();
|
return this->allUsers.value(userId).toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap TDLibWrapper::getUserInformationByName(const QString &userName)
|
||||||
|
{
|
||||||
|
return this->allUserNames.value(userName).toMap();
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap TDLibWrapper::getUnreadMessageInformation()
|
QVariantMap TDLibWrapper::getUnreadMessageInformation()
|
||||||
{
|
{
|
||||||
return this->unreadMessageInformation;
|
return this->unreadMessageInformation;
|
||||||
|
@ -898,6 +903,7 @@ void TDLibWrapper::handleUserUpdated(const QVariantMap &userInformation)
|
||||||
}
|
}
|
||||||
LOG("User information updated:" << userInformation.value("username").toString() << userInformation.value("first_name").toString() << userInformation.value("last_name").toString());
|
LOG("User information updated:" << userInformation.value("username").toString() << userInformation.value("first_name").toString() << userInformation.value("last_name").toString());
|
||||||
this->allUsers.insert(updatedUserId, userInformation);
|
this->allUsers.insert(updatedUserId, userInformation);
|
||||||
|
this->allUserNames.insert(userInformation.value("username").toString(), userInformation);
|
||||||
emit userUpdated(updatedUserId, userInformation);
|
emit userUpdated(updatedUserId, userInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,6 +917,7 @@ void TDLibWrapper::handleUserStatusUpdated(const QString &userId, const QVariant
|
||||||
QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap();
|
QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap();
|
||||||
updatedUserInformation.insert("status", userStatusInformation);
|
updatedUserInformation.insert("status", userStatusInformation);
|
||||||
this->allUsers.insert(userId, updatedUserInformation);
|
this->allUsers.insert(userId, updatedUserInformation);
|
||||||
|
this->allUserNames.insert(userInformation.value("username").toString(), userInformation);
|
||||||
emit userUpdated(userId, updatedUserInformation);
|
emit userUpdated(userId, updatedUserInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ public:
|
||||||
Q_INVOKABLE TDLibWrapper::ConnectionState getConnectionState();
|
Q_INVOKABLE TDLibWrapper::ConnectionState getConnectionState();
|
||||||
Q_INVOKABLE QVariantMap getUserInformation();
|
Q_INVOKABLE QVariantMap getUserInformation();
|
||||||
Q_INVOKABLE QVariantMap getUserInformation(const QString &userId);
|
Q_INVOKABLE QVariantMap getUserInformation(const QString &userId);
|
||||||
|
Q_INVOKABLE QVariantMap getUserInformationByName(const QString &userName);
|
||||||
Q_INVOKABLE QVariantMap getUnreadMessageInformation();
|
Q_INVOKABLE QVariantMap getUnreadMessageInformation();
|
||||||
Q_INVOKABLE QVariantMap getUnreadChatInformation();
|
Q_INVOKABLE QVariantMap getUnreadChatInformation();
|
||||||
Q_INVOKABLE QVariantMap getBasicGroup(qlonglong groupId) const;
|
Q_INVOKABLE QVariantMap getBasicGroup(qlonglong groupId) const;
|
||||||
|
@ -239,6 +240,7 @@ private:
|
||||||
QVariantMap options;
|
QVariantMap options;
|
||||||
QVariantMap userInformation;
|
QVariantMap userInformation;
|
||||||
QVariantMap allUsers;
|
QVariantMap allUsers;
|
||||||
|
QVariantMap allUserNames;
|
||||||
QVariantMap chats;
|
QVariantMap chats;
|
||||||
QVariantMap unreadMessageInformation;
|
QVariantMap unreadMessageInformation;
|
||||||
QVariantMap unreadChatInformation;
|
QVariantMap unreadChatInformation;
|
||||||
|
|
Loading…
Reference in a new issue