[client] Only send packets when the corresponding permission is set

This commit is contained in:
Joscha 2020-02-19 23:48:21 +00:00
parent ec61c4d092
commit e6958e11cb

View file

@ -62,12 +62,14 @@ onKeyWithoutEditor cs (Vty.EvKey k _)
| k `elem` downKeys = onUiState cs moveFocusDown | k `elem` downKeys = onUiState cs moveFocusDown
| k `elem` editKeys = onUiState cs editCurrentNode | k `elem` editKeys = onUiState cs editCurrentNode
| k `elem` deleteKeys = do | 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 continue cs
| k `elem` replyKeys = onUiState cs (replyToCurrentNode . unfoldAtFocus) | k `elem` replyKeys = onUiState cs (replyToCurrentNode . unfoldAtFocus)
| k `elem` replyKeys' = onUiState cs replyAfterCurrentNode | k `elem` replyKeys' = onUiState cs replyAfterCurrentNode
| k `elem` actKeys = do | 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 continue cs
where where
quitKeys = [Vty.KChar 'q', Vty.KEsc] quitKeys = [Vty.KChar 'q', Vty.KEsc]