Skip to content
Snippets Groups Projects
Verified Commit 5557b949 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Allow querying your status message over dbus

Contributed by a Nheko user starting with S.
parent 164de9c2
No related branches found
No related tags found
No related merge requests found
Pipeline #4698 passed
......@@ -152,6 +152,16 @@ directChat(const QString &userId)
interface.call(QDBus::NoBlock, QStringLiteral("directChat"), userId);
}
QString
statusMessage()
{
if (QDBusInterface interface{QStringLiteral(NHEKO_DBUS_SERVICE_NAME), QStringLiteral("/")};
interface.isValid())
return QDBusReply<QString>{interface.call(QStringLiteral("statusMessage"))}.value();
else
return {};
}
void
setStatusMessage(const QString &message)
{
......
......@@ -80,6 +80,9 @@ joinRoom(const QString &alias);
//! desired).
void
directChat(const QString &userId);
//! Get the user's status message.
QString
statusMessage();
//! Sets the user's status message (if supported by the homeserver).
void
setStatusMessage(const QString &message);
......
......@@ -100,6 +100,12 @@ NhekoDBusBackend::directChat(const QString &userId) const
ChatPage::instance()->startChat(userId);
}
QString
NhekoDBusBackend::statusMessage() const
{
return ChatPage::instance()->status();
}
void
NhekoDBusBackend::setStatusMessage(const QString &message)
{
......
......@@ -37,6 +37,8 @@ public slots:
//! Starts or activates a direct chat. It is your responsibility to ask for confirmation (if
//! desired).
Q_SCRIPTABLE void directChat(const QString &userId) const;
//! Gets the user's status message.
Q_SCRIPTABLE QString statusMessage() const;
//! Sets the user's status message.
Q_SCRIPTABLE void setStatusMessage(const QString &message);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment