mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 12:38:48 +03:00
Allow querying your status message over dbus
Contributed by a Nheko user starting with S.
This commit is contained in:
parent
164de9c21c
commit
5557b949e1
4 changed files with 21 additions and 0 deletions
|
@ -152,6 +152,16 @@ directChat(const QString &userId)
|
||||||
interface.call(QDBus::NoBlock, QStringLiteral("directChat"), 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
|
void
|
||||||
setStatusMessage(const QString &message)
|
setStatusMessage(const QString &message)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,6 +80,9 @@ joinRoom(const QString &alias);
|
||||||
//! desired).
|
//! desired).
|
||||||
void
|
void
|
||||||
directChat(const QString &userId);
|
directChat(const QString &userId);
|
||||||
|
//! Get the user's status message.
|
||||||
|
QString
|
||||||
|
statusMessage();
|
||||||
//! Sets the user's status message (if supported by the homeserver).
|
//! Sets the user's status message (if supported by the homeserver).
|
||||||
void
|
void
|
||||||
setStatusMessage(const QString &message);
|
setStatusMessage(const QString &message);
|
||||||
|
|
|
@ -100,6 +100,12 @@ NhekoDBusBackend::directChat(const QString &userId) const
|
||||||
ChatPage::instance()->startChat(userId);
|
ChatPage::instance()->startChat(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
NhekoDBusBackend::statusMessage() const
|
||||||
|
{
|
||||||
|
return ChatPage::instance()->status();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NhekoDBusBackend::setStatusMessage(const QString &message)
|
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
|
//! Starts or activates a direct chat. It is your responsibility to ask for confirmation (if
|
||||||
//! desired).
|
//! desired).
|
||||||
Q_SCRIPTABLE void directChat(const QString &userId) const;
|
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.
|
//! Sets the user's status message.
|
||||||
Q_SCRIPTABLE void setStatusMessage(const QString &message);
|
Q_SCRIPTABLE void setStatusMessage(const QString &message);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue