diff options
author | DeepBlueV7.X <nicolas.werner@hotmail.de> | 2022-11-05 18:32:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 18:32:17 +0100 |
commit | a81aaa182adff10b561de9b7433b9d8c8b5fc737 (patch) | |
tree | d68ffae8320f82c0af2d3eb4422cd27262ce0897 /src | |
parent | Merge pull request #1221 from LordMZTE/invert-enter (diff) | |
parent | Add status message to D-Bus API (diff) | |
download | nheko-a81aaa182adff10b561de9b7433b9d8c8b5fc737.tar.xz |
Merge pull request #1222 from Nheko-Reborn/dbusStatus
Add status message to D-Bus API
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus/NhekoDBusApi.cpp | 9 | ||||
-rw-r--r-- | src/dbus/NhekoDBusApi.h | 3 | ||||
-rw-r--r-- | src/dbus/NhekoDBusBackend.cpp | 6 | ||||
-rw-r--r-- | src/dbus/NhekoDBusBackend.h | 2 |
4 files changed, 20 insertions, 0 deletions
diff --git a/src/dbus/NhekoDBusApi.cpp b/src/dbus/NhekoDBusApi.cpp index 2367c27b..a58812ef 100644 --- a/src/dbus/NhekoDBusApi.cpp +++ b/src/dbus/NhekoDBusApi.cpp @@ -152,6 +152,15 @@ directChat(const QString &userId) interface.isValid()) interface.call(QDBus::NoBlock, QStringLiteral("directChat"), userId); } + +void +setStatusMessage(const QString &message) +{ + if (QDBusInterface interface{QStringLiteral(NHEKO_DBUS_SERVICE_NAME), QStringLiteral("/")}; + interface.isValid()) + interface.call(QDBus::NoBlock, QStringLiteral("setStatusMessage"), message); +} + } // nheko::dbus /** diff --git a/src/dbus/NhekoDBusApi.h b/src/dbus/NhekoDBusApi.h index 3995404a..20316b64 100644 --- a/src/dbus/NhekoDBusApi.h +++ b/src/dbus/NhekoDBusApi.h @@ -80,6 +80,9 @@ joinRoom(const QString &alias); //! desired). void directChat(const QString &userId); +//! Sets the user's status message (if supported by the homeserver). +void +setStatusMessage(const QString &message); QDBusArgument & operator<<(QDBusArgument &arg, const RoomInfoItem &item); diff --git a/src/dbus/NhekoDBusBackend.cpp b/src/dbus/NhekoDBusBackend.cpp index 56fdfe8d..a7fa2d74 100644 --- a/src/dbus/NhekoDBusBackend.cpp +++ b/src/dbus/NhekoDBusBackend.cpp @@ -101,6 +101,12 @@ NhekoDBusBackend::directChat(const QString &userId) const } void +NhekoDBusBackend::setStatusMessage(const QString &message) +{ + ChatPage::instance()->setStatus(message); +} + +void NhekoDBusBackend::bringWindowToTop() const { MainWindow::instance()->show(); diff --git a/src/dbus/NhekoDBusBackend.h b/src/dbus/NhekoDBusBackend.h index 6fb9dd72..83562da2 100644 --- a/src/dbus/NhekoDBusBackend.h +++ b/src/dbus/NhekoDBusBackend.h @@ -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; + //! Sets the user's status message. + Q_SCRIPTABLE void setStatusMessage(const QString &message); private: void bringWindowToTop() const; |