diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2020-02-03 22:29:31 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2020-02-04 22:52:47 +0100 |
commit | 6f0bcff200598d085c89d167aa126d25fc5df3ed (patch) | |
tree | 0868edc1759b7c90eaba7ab8d4835179b42541ff /src/Message.hs | |
parent | 84d7c83bc85ff0862a39d6de3bd227550175ebce (diff) |
Service: stored or ref-only reply packet
Use the ref-only packet to acknowledge successful storage of received
direct message.
Diffstat (limited to 'src/Message.hs')
-rw-r--r-- | src/Message.hs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/Message.hs b/src/Message.hs index bfb4b66..ee59dad 100644 --- a/src/Message.hs +++ b/src/Message.hs @@ -84,14 +84,11 @@ instance Service DirectMessageService where shared <- makeSharedStateUpdate st [next] (lsShared $ fromStored erb) wrappedStore st (fromStored erb) { lsShared = [shared] } svcSetLocal erb' - if powner `sameIdentity` msgFrom msg - then do - svcPrint $ formatMessage tzone msg - return $ Just $ DirectMessagePacket smsg - else return Nothing - - else do svcPrint "Owner mismatch" - return Nothing + when (powner `sameIdentity` msgFrom msg) $ do + svcPrint $ formatMessage tzone msg + replyStoredRef packet + + else svcPrint "Owner mismatch" instance Storable (ServicePacket DirectMessageService) where store' (DirectMessagePacket smsg) = store' smsg |