summaryrefslogtreecommitdiff
path: root/main/Test.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-06-26 21:45:34 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-06-28 20:44:18 +0200
commitf714e508a337c3a9a9dbb1822d78b1042450ae86 (patch)
treeed5c24240cf8287d83b017676437435ac8ba263f /main/Test.hs
parenta8b7cde0814481647d4d2b2aa2ee93a3b04a3251 (diff)
Automatic discovery of peers for pending messages
Changelog: Automatic discovery of peers for pending direct messages
Diffstat (limited to 'main/Test.hs')
-rw-r--r--main/Test.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/main/Test.hs b/main/Test.hs
index c563291..fa8501e 100644
--- a/main/Test.hs
+++ b/main/Test.hs
@@ -300,6 +300,7 @@ commands = map (T.pack *** id)
, ("contact-set-name", cmdContactSetName)
, ("dm-send-peer", cmdDmSendPeer)
, ("dm-send-contact", cmdDmSendContact)
+ , ("dm-send-identity", cmdDmSendIdentity)
, ("dm-list-peer", cmdDmListPeer)
, ("dm-list-contact", cmdDmListContact)
, ("chatroom-create", cmdChatroomCreate)
@@ -816,6 +817,14 @@ cmdDmSendContact = do
Just to <- contactIdentity <$> getContact cid
void $ sendDirectMessage to msg
+cmdDmSendIdentity :: Command
+cmdDmSendIdentity = do
+ st <- asks tiStorage
+ [ tid, msg ] <- asks tiParams
+ Just ref <- liftIO $ readRef st $ encodeUtf8 tid
+ Just to <- return $ validateExtendedIdentity $ wrappedLoad ref
+ void $ sendDirectMessage to msg
+
dmList :: Foldable f => Identity f -> Command
dmList peer = do
threads <- toThreadList . lookupSharedValue . lsShared . headObject <$> getHead