This commit is contained in:
spaced4ndy
2024-04-04 18:01:20 +04:00
parent 8761cf9cee
commit 109686cbb5
4 changed files with 195 additions and 10 deletions
+6
View File
@@ -1585,6 +1585,11 @@ processChatCommand' vr = \case
forwardedItemId <- withStore $ \db -> getDirectChatItemIdByText db userId contactId msgDir forwardedMsg
toChatRef <- getChatRef user toChatName
processChatCommand $ APIForwardChatItem (ChatRef CTDirect contactId) toChatRef forwardedItemId
ForwardLocalMessage toChatName forwardedMsg -> withUser $ \user -> do
folderId <- withStore (`getUserNoteFolderId` user)
forwardedItemId <- withStore $ \db -> getLocalChatItemIdByText' db user folderId forwardedMsg
toChatRef <- getChatRef user toChatName
processChatCommand $ APIForwardChatItem (ChatRef CTLocal folderId) toChatRef forwardedItemId
DeleteMessage chatName deletedMsg -> withUser $ \user -> do
chatRef <- getChatRef user chatName
deletedItemId <- getSentChatItemIdByText user chatRef deletedMsg
@@ -7058,6 +7063,7 @@ chatCommandP =
"/live " *> (SendLiveMessage <$> chatNameP <*> (A.space *> msgTextP <|> pure "")),
(">@" <|> "> @") *> forwardMsgP (AMsgDirection SMDRcv),
(">>@" <|> ">> @") *> forwardMsgP (AMsgDirection SMDSnd),
(">* -> " <|> "> * -> ") *> (ForwardLocalMessage <$> chatNameP <* A.space <*> msgTextP),
(">@" <|> "> @") *> sendMsgQuote (AMsgDirection SMDRcv),
(">>@" <|> ">> @") *> sendMsgQuote (AMsgDirection SMDSnd),
("\\ " <|> "\\") *> (DeleteMessage <$> chatNameP <* A.space <*> textP),
+1
View File
@@ -412,6 +412,7 @@ data ChatCommand
| SendLiveMessage ChatName Text
| SendMessageQuote {contactName :: ContactName, msgDir :: AMsgDirection, quotedMsg :: Text, message :: Text}
| ForwardMessage {contactName :: ContactName, msgDir :: AMsgDirection, toChatName :: ChatName, forwardedMsg :: Text}
| ForwardLocalMessage {toChatName :: ChatName, forwardedMsg :: Text}
| SendMessageBroadcast Text -- UserId (not used in UI)
| DeleteMessage ChatName Text
| DeleteMemberMessage GroupName ContactName Text
+1
View File
@@ -87,6 +87,7 @@ runInputLoop ct@ChatTerminal {termState, liveMessageState} cc = forever $ do
Right SendFile {} -> True
Right SendMessageQuote {} -> True
Right ForwardMessage {} -> True
Right ForwardLocalMessage {} -> True
Right SendGroupMessageQuote {} -> True
Right ForwardGroupMessage {} -> True
Right SendMessageBroadcast {} -> True