master
Abhinav Sarkar 8 years ago
parent 5f7983e1f8
commit ecb405a5bc
  1. 6
      hask-irc-core/Network/IRC/Bot.hs
  2. 1
      hask-irc-handlers/Network/IRC/Handlers/MessageLogger.hs

@ -61,16 +61,16 @@ sendCommandLoop commandChan bot@Bot { .. } = do
forM_ exs $ \(ex :: SomeException) ->
errorM ("Error while formatting command: " ++ show cmd ++ "\nError: " ++ show ex)
when (not . null $ lines_) $
unless (null lines_) $
handle (\(e :: SomeException) -> do
errorM ("Error while writing to connection: " ++ show e)
closeMessageChannel commandChan) $ do
closeMessageChannel commandChan) $
forM_ lines_ $ \line -> do
TF.hprint botSocket "{}\r\n" $ TF.Only line
infoM . unpack $ "> " ++ line
commandChanClosed <- isClosedMessageChannel commandChan
when (not commandChanClosed) $
unless commandChanClosed $
case fromMessage cmd of
Just QuitCmd -> closeMessageChannel commandChan
_ -> sendCommandLoop commandChan bot

@ -7,7 +7,6 @@ import qualified Data.Text.Format as TF
import qualified Data.Text.Format.Params as TF
import ClassyPrelude hiding ((</>), (<.>), FilePath, log)
import Control.Exception.Lifted (mask_)
import Data.Time (diffDays)
import System.Directory (createDirectoryIfMissing, getModificationTime, copyFile, removeFile)
import System.FilePath (FilePath, (</>), (<.>))

Loading…
Cancel
Save