Skip to content

Commit 57a77f7

Browse files
authored
smp server: support adding link data to contact addresses created before July 2024 (#1547)
1 parent 18e73b8 commit 57a77f7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Simplex/Messaging/Server.hs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,15 @@ client
12461246
KEY sKey -> withQueue $ \q _ -> either err (corrId,entId,) <$> secureQueue_ q sKey
12471247
RKEY rKeys -> withQueue $ \q qr -> checkMode QMContact qr $ OK <$$ liftIO (updateKeys (queueStore ms) q rKeys)
12481248
LSET lnkId d ->
1249-
withQueue $ \q qr -> checkMode QMContact qr $ liftIO $ case queueData qr of
1250-
Just (lnkId', _) | lnkId' /= lnkId -> pure $ Left AUTH
1251-
_ -> OK <$$ addQueueLinkData (queueStore ms) q lnkId d
1249+
withQueue $ \q QueueRec {queueMode, senderKey, queueData} ->
1250+
liftIO $ either err (corrId,entId,)
1251+
-- this check allows adding link data to contact addresses created prior to SKEY,
1252+
-- using `queueMode == Just QMContact` would prevent it, they have queueMode `Nothing`.
1253+
<$> if queueMode /= Just QMMessaging && isNothing senderKey
1254+
then case queueData of
1255+
Just (lnkId', _) | lnkId' /= lnkId -> pure $ Left AUTH
1256+
_ -> OK <$$ addQueueLinkData (queueStore ms) q lnkId d
1257+
else pure $ Left AUTH
12521258
LDEL ->
12531259
withQueue $ \q qr -> checkMode QMContact qr $ liftIO $ case queueData qr of
12541260
Just _ -> OK <$$ deleteQueueLinkData (queueStore ms) q

0 commit comments

Comments
 (0)