Skip to content

Commit

Permalink
Update nheko API files
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenDB committed Jan 20, 2023
1 parent d360c81 commit b49a00c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/NhekoDBusApi.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2010 David Sansome <[email protected]>
// SPDX-FileCopyrightText: 2022 Nheko Contributors
// SPDX-FileCopyrightText: 2023 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -152,6 +153,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

/**
Expand Down Expand Up @@ -186,7 +196,7 @@ operator<<(QDBusArgument &arg, const QImage &image)
int channels = i.hasAlphaChannel() ? 4 : 3;
arg << i.depth() / channels;
arg << channels;
arg << QByteArray(reinterpret_cast<const char *>(i.bits()), i.sizeInBytes());
arg << QByteArray(reinterpret_cast<const char *>(i.bits()), static_cast<int>(i.sizeInBytes()));
arg.endStructure();

return arg;
Expand Down
6 changes: 5 additions & 1 deletion src/NhekoDBusApi.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: 2022 Nheko Contributors
// SPDX-FileCopyrightText: 2023 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -18,7 +19,7 @@ init();

//! The nheko D-Bus API version provided by this file. The API version number follows semantic
//! versioning as defined by https://semver.org.
const QVersionNumber dbusApiVersion{1, 0, 0};
const QVersionNumber dbusApiVersion{1, 0, 1};

//! Compare the installed Nheko API to the version that your client app targets to see if they
//! are compatible.
Expand Down Expand Up @@ -80,6 +81,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);
Expand Down

0 comments on commit b49a00c

Please sign in to comment.