Add knock command
This commit is contained in:
committed by
Tobias Fella
parent
a1abf22174
commit
e1b9bc7d0e
@@ -11,6 +11,9 @@
|
||||
#include <QQuickTextDocument>
|
||||
#include <QStandardPaths>
|
||||
#include <csapi/joining.h>
|
||||
#ifdef QUOTIENT_07
|
||||
#include <csapi/knocking.h>
|
||||
#endif
|
||||
#include <qt_connection_util.h>
|
||||
#include <user.h>
|
||||
|
||||
@@ -209,6 +212,27 @@ void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAli
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: maybe need use the function upstream later
|
||||
#ifdef QUOTIENT_07
|
||||
void RoomManager::knockRoom(Quotient::Connection *account, const QString &roomAliasOrId, const QString &reason, const QStringList &viaServers)
|
||||
{
|
||||
auto *const job = account->callApi<KnockRoomJob>(roomAliasOrId, viaServers, reason);
|
||||
// Upon completion, ensure a room object is created in case it hasn't come
|
||||
// with a sync yet. If the room object is not there, provideRoom() will
|
||||
// create it in Join state. finished() is used here instead of success()
|
||||
// to overtake clients that may add their own slots to finished().
|
||||
connectSingleShot(job, &BaseJob::finished, this, [this, job, account] {
|
||||
if (job->status() == Quotient::BaseJob::Success) {
|
||||
connectSingleShot(account, &Quotient::Connection::newRoom, this, [this](Quotient::Room *room) {
|
||||
Q_EMIT currentRoom()->showMessage(NeoChatRoom::Info, i18n("You requested to join '%1'", room->name()));
|
||||
});
|
||||
} else {
|
||||
Q_EMIT warning(i18n("Failed to request joining room"), job->errorString());
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
bool RoomManager::visitNonMatrix(const QUrl &url)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
|
||||
Reference in New Issue
Block a user