diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-03-30 23:38:38 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-03-30 23:40:12 +0200 |
commit | a59b3147a68ab67629d76d1c18d53950bfeb0277 (patch) | |
tree | 549522adecb1e09a3f1560606374ea5436b28f06 /src/timeline | |
parent | Add /knock command (diff) | |
download | nheko-a59b3147a68ab67629d76d1c18d53950bfeb0277.tar.xz |
Add reasons to everything
fixes #1030
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/InputBar.cpp | 6 | ||||
-rw-r--r-- | src/timeline/RoomlistModel.cpp | 6 | ||||
-rw-r--r-- | src/timeline/RoomlistModel.h | 4 | ||||
-rw-r--r-- | src/timeline/TimelineViewManager.h | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp index 4116729d..1de7a141 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp @@ -669,11 +669,11 @@ InputBar::command(const QString &command, QString args) if (!eventId.isEmpty()) reaction(eventId, args.trimmed()); } else if (command == QLatin1String("join")) { - ChatPage::instance()->joinRoom(args); + ChatPage::instance()->joinRoom(args.section(' ', 0, 0), args.section(' ', 1, -1)); } else if (command == QLatin1String("knock")) { - ChatPage::instance()->knockRoom(args); + ChatPage::instance()->knockRoom(args.section(' ', 0, 0), args.section(' ', 1, -1)); } else if (command == QLatin1String("part") || command == QLatin1String("leave")) { - ChatPage::instance()->timelineManager()->openLeaveRoomDialog(room->roomId()); + ChatPage::instance()->timelineManager()->openLeaveRoomDialog(room->roomId(), args); } else if (command == QLatin1String("invite")) { ChatPage::instance()->inviteUser(args.section(' ', 0, 0), args.section(' ', 1, -1)); } else if (command == QLatin1String("kick")) { diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index 3846b643..31e5a33d 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -659,12 +659,12 @@ RoomlistModel::declineInvite(QString roomid) roomids.erase(roomids.begin() + idx); invites.remove(roomid); endRemoveRows(); - ChatPage::instance()->leaveRoom(roomid); + ChatPage::instance()->leaveRoom(roomid, ""); } } } void -RoomlistModel::leave(QString roomid) +RoomlistModel::leave(QString roomid, QString reason) { if (models.contains(roomid)) { auto idx = roomidToIndex(roomid); @@ -674,7 +674,7 @@ RoomlistModel::leave(QString roomid) roomids.erase(roomids.begin() + idx); models.remove(roomid); endRemoveRows(); - ChatPage::instance()->leaveRoom(roomid); + ChatPage::instance()->leaveRoom(roomid, reason); } } } diff --git a/src/timeline/RoomlistModel.h b/src/timeline/RoomlistModel.h index 2476b21b..73ccd929 100644 --- a/src/timeline/RoomlistModel.h +++ b/src/timeline/RoomlistModel.h @@ -102,7 +102,7 @@ public slots: void joinPreview(QString roomid, QString parentSpace); void acceptInvite(QString roomid); void declineInvite(QString roomid); - void leave(QString roomid); + void leave(QString roomid, QString reason = ""); TimelineModel *currentRoom() const { return currentRoom_.get(); } RoomPreview currentRoomPreview() const { return currentRoomPreview_.value_or(RoomPreview{}); } void setCurrentRoom(QString roomid); @@ -165,7 +165,7 @@ public slots: } void acceptInvite(QString roomid) { roomlistmodel->acceptInvite(roomid); } void declineInvite(QString roomid) { roomlistmodel->declineInvite(roomid); } - void leave(QString roomid) { roomlistmodel->leave(roomid); } + void leave(QString roomid, QString reason = "") { roomlistmodel->leave(roomid, reason); } void toggleTag(QString roomid, QString tag, bool on); TimelineModel *currentRoom() const { return roomlistmodel->currentRoom(); } diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 07ebfe79..df622ac6 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -89,7 +89,7 @@ signals: void openInviteUsersDialog(InviteesModel *invitees); void openProfile(UserProfile *profile); void showImagePackSettings(TimelineModel *room, ImagePackListModel *packlist); - void openLeaveRoomDialog(QString roomid); + void openLeaveRoomDialog(QString roomid, QString reason); void showImageOverlay(TimelineModel *room, QString eventId, QString url); public slots: |