diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-08 21:09:22 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-20 20:46:53 +0100 |
commit | 8ddd1311f5988d68cacf0c528e8fe7dc9faa9e6f (patch) | |
tree | 613dd3cf0f79931556ab89f52e20efd353ed713b /main/Test.hs | |
parent | 8a5898cc06d54c30679678eb204725852786ee84 (diff) |
Deleting chatrooms
Changelog: Added `/delete` command to delete chatrooms for current user
Diffstat (limited to 'main/Test.hs')
-rw-r--r-- | main/Test.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main/Test.hs b/main/Test.hs index 183ed51..0181575 100644 --- a/main/Test.hs +++ b/main/Test.hs @@ -287,6 +287,7 @@ commands = map (T.pack *** id) , ("dm-list-peer", cmdDmListPeer) , ("dm-list-contact", cmdDmListContact) , ("chatroom-create", cmdChatroomCreate) + , ("chatroom-delete", cmdChatroomDelete) , ("chatroom-list-local", cmdChatroomListLocal) , ("chatroom-watch-local", cmdChatroomWatchLocal) , ("chatroom-set-name", cmdChatroomSetName) @@ -764,6 +765,13 @@ cmdChatroomCreate = do room <- createChatroom (Just name) Nothing cmdOut $ unwords $ "chatroom-create-done" : chatroomInfo room +cmdChatroomDelete :: Command +cmdChatroomDelete = do + [ cid ] <- asks tiParams + sdata <- getChatroomStateData cid + deleteChatroomByStateData sdata + cmdOut $ unwords [ "chatroom-delete-done", T.unpack cid ] + getChatroomStateData :: Text -> CommandM (Stored ChatroomStateData) getChatroomStateData tref = do st <- asks tiStorage |