diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-21 20:04:22 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-03-21 20:04:22 +0100 |
commit | f612d03ac7d5fb00fa76c3be14d965ab51988504 (patch) | |
tree | 662fc16c3a35a76c3f4c114d4860ff82745f27f9 /src/Erebos/Conversation.hs | |
parent | 652365ffb1c71b5758329c17015cb5c1912da1f4 (diff) | |
parent | 68648650527b769c6ed9f4d3e45aad86187b12b9 (diff) |
Merge branch 'release-0.1'
Diffstat (limited to 'src/Erebos/Conversation.hs')
-rw-r--r-- | src/Erebos/Conversation.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Erebos/Conversation.hs b/src/Erebos/Conversation.hs index fce8780..7c9d329 100644 --- a/src/Erebos/Conversation.hs +++ b/src/Erebos/Conversation.hs @@ -18,6 +18,7 @@ module Erebos.Conversation ( conversationHistory, sendMessage, + deleteConversation, ) where import Control.Monad.Except @@ -103,3 +104,7 @@ conversationHistory (ChatroomConversation rstate) = map (\msg -> ChatroomMessage sendMessage :: (MonadHead LocalState m, MonadError String m) => Conversation -> Text -> m (Maybe Message) sendMessage (DirectMessageConversation thread) text = fmap Just $ DirectMessageMessage <$> (fromStored <$> sendDirectMessage (msgPeer thread) text) <*> pure False sendMessage (ChatroomConversation rstate) text = sendChatroomMessage rstate text >> return Nothing + +deleteConversation :: (MonadHead LocalState m, MonadError String m) => Conversation -> m () +deleteConversation (DirectMessageConversation _) = throwError "deleting direct message conversation is not supported" +deleteConversation (ChatroomConversation rstate) = deleteChatroomByStateData (head $ roomStateData rstate) |