2022-04-14 17:02:55 +02:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#ifndef NHEKODBUSBACKEND_H
|
|
|
|
#define NHEKODBUSBACKEND_H
|
|
|
|
|
|
|
|
#include <QDBusMessage>
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include "NhekoDBusApi.h"
|
|
|
|
#include "config/nheko.h"
|
|
|
|
|
|
|
|
class RoomlistModel;
|
|
|
|
|
2022-10-10 14:38:29 +02:00
|
|
|
class NhekoDBusBackend final : public QObject
|
2022-04-14 17:02:55 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_CLASSINFO("D-Bus Interface", "im.nheko.Nheko")
|
|
|
|
|
|
|
|
public:
|
|
|
|
NhekoDBusBackend(RoomlistModel *parent);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
//! Get the nheko D-Bus API version.
|
2022-04-18 18:50:15 +02:00
|
|
|
Q_SCRIPTABLE QString apiVersion() const { return nheko::dbus::dbusApiVersion.toString(); }
|
2022-04-14 17:02:55 +02:00
|
|
|
//! Get the nheko version.
|
2022-04-18 18:50:15 +02:00
|
|
|
Q_SCRIPTABLE QString nhekoVersion() const { return nheko::version; }
|
2022-04-14 17:02:55 +02:00
|
|
|
//! Call this function to get a list of all joined rooms.
|
2022-10-09 00:56:02 +02:00
|
|
|
Q_SCRIPTABLE QVector<nheko::dbus::RoomInfoItem> rooms() const;
|
|
|
|
//! Call this function to convert a URI into an image
|
|
|
|
Q_SCRIPTABLE QImage image(const QString &uri, const QDBusMessage &message) const;
|
2022-04-14 17:02:55 +02:00
|
|
|
//! Activates a currently joined room.
|
|
|
|
Q_SCRIPTABLE void activateRoom(const QString &alias) const;
|
|
|
|
//! Joins a room. It is your responsibility to ask for confirmation (if desired).
|
|
|
|
Q_SCRIPTABLE void joinRoom(const QString &alias) const;
|
|
|
|
//! Starts or activates a direct chat. It is your responsibility to ask for confirmation (if
|
|
|
|
//! desired).
|
2022-04-18 18:50:15 +02:00
|
|
|
Q_SCRIPTABLE void directChat(const QString &userId) const;
|
2022-11-05 18:13:18 +01:00
|
|
|
//! Sets the user's status message.
|
|
|
|
Q_SCRIPTABLE void setStatusMessage(const QString &message);
|
2022-04-14 17:02:55 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void bringWindowToTop() const;
|
|
|
|
|
|
|
|
RoomlistModel *m_parent;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NHEKODBUSBACKEND_H
|