smp server: support adding link data to contact addresses created before July 2024 (#1547)

This commit is contained in:
Evgeny
2025-05-24 14:20:25 +01:00
committed by GitHub
parent 18e73b8aa7
commit 57a77f75c1
+9 -3
View File
@@ -1246,9 +1246,15 @@ client
KEY sKey -> withQueue $ \q _ -> either err (corrId,entId,) <$> secureQueue_ q sKey
RKEY rKeys -> withQueue $ \q qr -> checkMode QMContact qr $ OK <$$ liftIO (updateKeys (queueStore ms) q rKeys)
LSET lnkId d ->
withQueue $ \q qr -> checkMode QMContact qr $ liftIO $ case queueData qr of
Just (lnkId', _) | lnkId' /= lnkId -> pure $ Left AUTH
_ -> OK <$$ addQueueLinkData (queueStore ms) q lnkId d
withQueue $ \q QueueRec {queueMode, senderKey, queueData} ->
liftIO $ either err (corrId,entId,)
-- this check allows adding link data to contact addresses created prior to SKEY,
-- using `queueMode == Just QMContact` would prevent it, they have queueMode `Nothing`.
<$> if queueMode /= Just QMMessaging && isNothing senderKey
then case queueData of
Just (lnkId', _) | lnkId' /= lnkId -> pure $ Left AUTH
_ -> OK <$$ addQueueLinkData (queueStore ms) q lnkId d
else pure $ Left AUTH
LDEL ->
withQueue $ \q qr -> checkMode QMContact qr $ liftIO $ case queueData qr of
Just _ -> OK <$$ deleteQueueLinkData (queueStore ms) q