React to externally left and joined rooms, and add "leave room" button in room menu (#75)

* Initial "join room" feature.
* React correctly to remotely joined rooms.
* Leaving rooms implemented both locally using the room menu
   in nheko, and reacting properly when leaving a room remotely 
   from another client.
This commit is contained in:
Max Sandholm 2017-10-01 19:49:36 +03:00 committed by mujx
parent ea296321c9
commit 7ad45d8d64
23 changed files with 571 additions and 41 deletions

View file

@ -52,6 +52,8 @@ public:
void downloadImage(const QString &event_id, const QUrl &url);
void messages(const QString &room_id, const QString &from_token, int limit = 20) noexcept;
void uploadImage(const QString &roomid, const QString &filename);
void joinRoom(const QString &roomIdOrAlias);
void leaveRoom(const QString &roomId);
inline QUrl getHomeServer();
inline int transactionId();
@ -94,6 +96,8 @@ signals:
void messageSent(const QString &event_id, const QString &roomid, const int txn_id);
void emoteSent(const QString &event_id, const QString &roomid, const int txn_id);
void messagesRetrieved(const QString &room_id, const RoomMessages &msgs);
void joinedRoom(const QString &room_id);
void leftRoom(const QString &room_id);
private slots:
void onResponse(QNetworkReply *reply);
@ -115,6 +119,8 @@ private:
Sync,
UserAvatar,
Versions,
JoinRoom,
LeaveRoom,
};
// Response handlers.
@ -132,6 +138,8 @@ private:
void onSyncResponse(QNetworkReply *reply);
void onUserAvatarResponse(QNetworkReply *reply);
void onVersionsResponse(QNetworkReply *reply);
void onJoinRoomResponse(QNetworkReply *reply);
void onLeaveRoomResponse(QNetworkReply *reply);
// Client API prefix.
QString clientApiUrl_;