Add a way to add private notes for users on their profile
This is a common feature in other chat applications (like Discord) as a way to keep track of important information. While there isn't a standard API for this, we can use account data to store notes.
This commit is contained in:
@@ -619,4 +619,21 @@ bool NeoChatConnection::supportsMatrixSpecVersion(const QString &version)
|
||||
return supportedMatrixSpecVersions().contains(version);
|
||||
}
|
||||
|
||||
QString NeoChatConnection::noteForUser(const QString &userId)
|
||||
{
|
||||
const auto object = accountDataJson(QStringLiteral("org.kde.neochat.user_note"));
|
||||
return object[userId].toString();
|
||||
}
|
||||
|
||||
void NeoChatConnection::setNoteForUser(const QString &userId, const QString ¬e)
|
||||
{
|
||||
auto object = accountDataJson(QStringLiteral("org.kde.neochat.user_note"));
|
||||
if (note.isEmpty()) {
|
||||
object.remove(userId);
|
||||
} else {
|
||||
object[userId] = note;
|
||||
}
|
||||
setAccountData(QStringLiteral("org.kde.neochat.user_note"), object);
|
||||
}
|
||||
|
||||
#include "moc_neochatconnection.cpp"
|
||||
|
||||
Reference in New Issue
Block a user