summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-07-15 22:47:31 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-07-16 20:29:19 +0200
commit79833be3be44766a967f4f1427d9de64b14fee5b (patch)
tree4f43fa88fb9f956154f0f546266e5fd98a57c8c5 /src
parentcf0808dea948fcd3ba21de13be49aab3f03f3cc8 (diff)
Send current chatroom subscriptions to new peers
Diffstat (limited to 'src')
-rw-r--r--src/Erebos/Chatroom.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Erebos/Chatroom.hs b/src/Erebos/Chatroom.hs
index be1a0e4..b2432c5 100644
--- a/src/Erebos/Chatroom.hs
+++ b/src/Erebos/Chatroom.hs
@@ -434,8 +434,13 @@ instance Service ChatroomService where
serviceHandler spacket = do
let ChatroomService {..} = fromStored spacket
+
+ previouslyUpdated <- psSendRoomUpdates <$> svcGet
svcModify $ \s -> s { psSendRoomUpdates = True }
+ when (not previouslyUpdated) $ do
+ syncChatroomsToPeer . lookupSharedValue . lsShared . fromStored =<< getLocalHead
+
when chatRoomQuery $ do
rooms <- listChatrooms
replyPacket emptyPacket