Archived
1
0
Fork 0

Fixed bad comments and some cosmetics

This commit is contained in:
Julien Dessaux 2011-08-08 13:03:31 +02:00
parent 1c8cab09cb
commit 4f50db8409
3 changed files with 6 additions and 5 deletions

View file

@ -35,15 +35,15 @@ setGlobalQuitMVar status = do
liftIO $ putMVar quitMv status
-- Access rights
hasAccess :: Maybe IRC.Prefix -> AccessRight -> Env IO (Bool)
hasAccess :: Maybe IRC.Prefix -> AccessRight -> Env IO Bool
hasAccess Nothing _ = return False
hasAccess (Just mask) right = do
botMVar <- asks envBotState
liftIO (readMVar botMVar) >>= evalStateT (gets botAccess >>= return . or . map accessMatch)
liftIO (readMVar botMVar) >>= evalStateT (fmap (any accessMatch) (gets botAccess))
where
accessMatch :: AccessList -> Bool
accessMatch (AccessList amask arights)
| mask == amask = or [L.elem Admin arights, L.elem right arights]
| mask == amask = or [Admin `L.elem` arights, right `L.elem` arights]
| otherwise = False
-- Helpers