Updated for the latest hs-tls api.
This commit is contained in:
parent
fca73a28e3
commit
c7b7b55ecb
1 changed files with 2 additions and 3 deletions
|
@ -41,8 +41,7 @@ initHsbot config = do
|
||||||
tlsenv <- initTLSEnv (configTLS config)
|
tlsenv <- initTLSEnv (configTLS config)
|
||||||
randomGen <- newGenIO :: IO SystemRandom
|
randomGen <- newGenIO :: IO SystemRandom
|
||||||
sCtx <- client tlsenv randomGen connhdl
|
sCtx <- client tlsenv randomGen connhdl
|
||||||
success <- handshake sCtx
|
handshake sCtx
|
||||||
unless success $ errorM "Hsbot.Core" "TLS handshake failed" -- TODO: do some usefull error handling
|
|
||||||
return (Just tlsenv, Just sCtx))
|
return (Just tlsenv, Just sCtx))
|
||||||
else return (Nothing, Nothing)
|
else return (Nothing, Nothing)
|
||||||
return BotEnv { envBotState = botState
|
return BotEnv { envBotState = botState
|
||||||
|
@ -135,7 +134,7 @@ botReader env handle mctx chan = do
|
||||||
writeChan chan $ IncomingMsg msg
|
writeChan chan $ IncomingMsg msg
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
readThis :: Handle -> Maybe (TLSCtx Handle) -> IO String
|
readThis :: Handle -> Maybe (TLSCtx Handle) -> IO String
|
||||||
readThis _ (Just ctx) = fmap L.toString (recvData ctx)
|
readThis _ (Just ctx) = fmap L.toString (recvData' ctx)
|
||||||
readThis h Nothing = hGetLine h >>= \s -> return $ s ++ "\n"
|
readThis h Nothing = hGetLine h >>= \s -> return $ s ++ "\n"
|
||||||
|
|
||||||
botLoop :: Env IO ()
|
botLoop :: Env IO ()
|
||||||
|
|
Reference in a new issue