From e6958e11cb745d1cfb43fb1daea64bdb036c4e08 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 19 Feb 2020 23:48:21 +0000 Subject: [PATCH] [client] Only send packets when the corresponding permission is set --- src/Forest/Client.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Forest/Client.hs b/src/Forest/Client.hs index df887a0..846cbb0 100644 --- a/src/Forest/Client.hs +++ b/src/Forest/Client.hs @@ -62,12 +62,14 @@ onKeyWithoutEditor cs (Vty.EvKey k _) | k `elem` downKeys = onUiState cs moveFocusDown | k `elem` editKeys = onUiState cs editCurrentNode | k `elem` deleteKeys = do - liftIO $ sendPacket (csConn cs) $ ClientDelete (getFocusedPath $ csUiState cs) + when (flagDelete $ nodeFlags $ getFocusedNode $ csUiState cs) $ + liftIO $ sendPacket (csConn cs) $ ClientDelete (getFocusedPath $ csUiState cs) continue cs | k `elem` replyKeys = onUiState cs (replyToCurrentNode . unfoldAtFocus) | k `elem` replyKeys' = onUiState cs replyAfterCurrentNode | k `elem` actKeys = do - liftIO $ sendPacket (csConn cs) $ ClientAct (getFocusedPath $ csUiState cs) + when (flagAct $ nodeFlags $ getFocusedNode $ csUiState cs) $ + liftIO $ sendPacket (csConn cs) $ ClientAct (getFocusedPath $ csUiState cs) continue cs where quitKeys = [Vty.KChar 'q', Vty.KEsc]