diff options
Diffstat (limited to 'src/Message.hs')
-rw-r--r-- | src/Message.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Message.hs b/src/Message.hs index 0039d7e..874e375 100644 --- a/src/Message.hs +++ b/src/Message.hs @@ -113,14 +113,15 @@ findMsgProperty pid sel mss = concat $ flip findProperty mss $ \x -> do return $ sel x -sendDirectMessage :: (MonadIO m, MonadError String m) => UnifiedIdentity -> Peer -> Text -> m (Stored DirectMessage) -sendDirectMessage self peer text = do +sendDirectMessage :: (MonadIO m, MonadError String m) => Head LocalState -> Peer -> Text -> m (Stored DirectMessage) +sendDirectMessage h peer text = do pid <- case peerIdentity peer of PeerIdentityFull pid -> return pid _ -> throwError "incomplete peer identity" - let st = storedStorage $ idData self + let st = refStorage $ headRef h + self = headLocalIdentity h powner = finalOwner pid - smsg <- liftIO $ updateSharedState st $ \prev -> do + smsg <- liftIO $ updateSharedState h $ \prev -> do let sent = findMsgProperty powner msSent prev received = findMsgProperty powner msReceived prev |