packages feed

kevin 0.1.6 → 0.2

raw patch · 2 files changed

+16/−4 lines, 2 files

Files

Kevin/Base.hs view
@@ -40,7 +40,8 @@ import qualified Data.Text.Encoding as T import Data.List (intercalate, findIndices) import Data.Maybe-import System.IO as K (Handle, hClose, hIsClosed, hGetChar)+import System.IO as K+import System.IO.Error import Control.Exception as K (IOException) import Network as K import Control.Applicative ((<$>))@@ -48,6 +49,7 @@ import Control.Concurrent as K (forkIO) import Control.Concurrent.Chan as K import Control.Concurrent.STM.TVar as K+import Control.Exception import Control.Monad.CatchIO as K import Kevin.Settings as K import qualified Data.Map as M@@ -83,8 +85,18 @@ padLines :: Int -> T.Text -> String padLines len b = let (first:rest) = lines $ T.unpack b in (++) (first ++ "\n") . intercalate "\n" . map (replicate len ' ' ++) $ rest +hGetCharTimeout :: Handle -> Int -> IO Char+hGetCharTimeout h t = do+    hSetBuffering h NoBuffering+    ready <- hWaitForInput h t+    if ready+        then do+            c <- hGetChar h+            return c+        else throwIO $ mkIOError eofErrorType "read timeout" (Just h) Nothing+ hGetSep :: Char -> Handle -> IO String-hGetSep sep h = fix (\f -> hGetChar h >>= \ch -> if ch == sep then return "" else (ch:) <$> f)+hGetSep sep h = fix (\f -> hGetCharTimeout h 90000 >>= \ch -> if ch == sep then return "" else (ch:) <$> f)  instance KevinServer Kevin where     readClient k = do
kevin.cabal view
@@ -1,5 +1,5 @@ Name:             kevin-Version:          0.1.6+Version:          0.2 Synopsis:         a dAmn ↔ IRC proxy Description:      a dAmn ↔ IRC proxy License:          GPL@@ -20,4 +20,4 @@     Other-Modules:    Kevin, Kevin.Protocol, Kevin.Base, Kevin.Util.Logger, Kevin.IRC.Protocol, Kevin.Damn.Protocol, Kevin.Util.Entity, Kevin.Util.Tablump, Kevin.Damn.Packet, Kevin.Damn.Protocol.Send, Kevin.IRC.Protocol.Send, Kevin.IRC.Packet, Kevin.Settings, Kevin.Types, Kevin.Util.Token     extensions:       CPP, DeriveDataTypeable, ExistentialQuantification, OverloadedStrings, ScopedTypeVariables, TemplateHaskell     ghc-options:      -Wall -fno-warn-unused-do-bind -threaded-    cpp-options:      -DVERSION="0.1.6"+    cpp-options:      -DVERSION="0.2"