diff options
-rw-r--r-- | connection.cpp | 6 | ||||
-rw-r--r-- | connection.h | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/connection.cpp b/connection.cpp index dff88bef..2fbcf686 100644 --- a/connection.cpp +++ b/connection.cpp @@ -199,14 +199,14 @@ PostReceiptJob* Connection::postReceipt(Room* room, Event* event) return job; } -void Connection::joinRoom(QString roomAlias) +JoinRoomJob* Connection::joinRoom(QString roomAlias) { - JoinRoomJob* job = new JoinRoomJob(d->data, roomAlias); + auto job = callApi<JoinRoomJob>(roomAlias); connect( job, &BaseJob::success, [=] () { if ( Room* r = provideRoom(job->roomId()) ) emit joinedRoom(r); }); - job->start(); + return job; } void Connection::leaveRoom(Room* room) diff --git a/connection.h b/connection.h index 1ce3e0de..55b688a2 100644 --- a/connection.h +++ b/connection.h @@ -34,6 +34,7 @@ namespace QMatrixClient class RoomMessagesJob; class PostReceiptJob; class MediaThumbnailJob; + class JoinRoomJob; class Connection: public QObject { Q_OBJECT @@ -53,9 +54,11 @@ namespace QMatrixClient Q_INVOKABLE virtual void logout(); Q_INVOKABLE virtual void sync(int timeout=-1); + /** @deprecated Use callApi<PostMessageJob>() or Room::postMessage() instead */ Q_INVOKABLE virtual void postMessage( Room* room, QString type, QString message ); + /** @deprecated Use callApi<PostReceiptJob>() or Room::postReceipt() instead */ Q_INVOKABLE virtual PostReceiptJob* postReceipt( Room* room, Event* event ); - Q_INVOKABLE virtual void joinRoom( QString roomAlias ); + Q_INVOKABLE virtual JoinRoomJob* joinRoom( QString roomAlias ); Q_INVOKABLE virtual void leaveRoom( Room* room ); Q_INVOKABLE virtual RoomMessagesJob* getMessages( Room* room, QString from ); virtual MediaThumbnailJob* getThumbnail( QUrl url, QSize requestedSize ); |