kevin 0.6.1 → 0.7
raw patch · 5 files changed
+10/−12 lines, 5 files
Files
- Kevin/Base.hs +2/−4
- Kevin/Damn/Packet.hs +1/−1
- Kevin/Damn/Protocol.hs +2/−2
- Kevin/IRC/Protocol/Send.hs +3/−3
- kevin.cabal +2/−2
Kevin/Base.hs view
@@ -37,7 +37,7 @@ import System.IO.Error runPrinter :: Chan T.Text -> Handle -> IO ()-runPrinter ch h = void . forkIO . forever $ readChan ch >>= T.hPutStr h . T.encodeUtf8+runPrinter ch h = void $ forkIO $ forever $ readChan ch >>= T.hPutStr h . T.encodeUtf8 io :: MonadIO m => IO a -> m a io = liftIO@@ -69,9 +69,7 @@ hSetBuffering h NoBuffering ready <- hWaitForInput h t if ready- then do- c <- hGetChar h- return c+ then hGetChar h else throwIO $ mkIOError eofErrorType "read timeout" (Just h) Nothing hGetSep :: Char -> Handle -> IO String
Kevin/Damn/Packet.hs view
@@ -68,7 +68,7 @@ parsePacket :: T.Text -> Packet parsePacket pack = case parseOnly parseHead top of Left _ -> throw ParseFailure- Right res -> res & body .~ (T.drop 2 <$> toMaybe T.null b)+ Right res -> res & body .~ (T.drop 2 <$> toMaybe (not . T.null) b) where (top, b) = T.breakOn "\n\n" pack
Kevin/Damn/Protocol.hs view
@@ -7,7 +7,7 @@ import Control.Applicative ((<$>)) import Control.Exception.Lens-import Data.List (delete, nub, sortBy)+import Data.List (delete, nub, minimumBy) import Data.Maybe (fromJust, fromMaybe) import Data.Monoid import Data.Ord (comparing)@@ -113,7 +113,7 @@ ) . tail . T.splitOn "conn" $ fixedPacket^.body._Just allRooms = nub $ conns >>= (\(_,_,c) -> c)- (onlinespan,idle,_) = head . sortBy (comparing (view _1)) $ conns+ (onlinespan,idle,_) = minimumBy (comparing (view _1)) conns signon = curtime - onlinespan I.sendWhoisReply us uname (entityDecode rn) allRooms idle signon
Kevin/IRC/Protocol/Send.hs view
@@ -108,9 +108,9 @@ chunkedNames = reverse . map reverse . subchunk' 432 names $ [[]] subchunk' n = fix (\f x y -> let hy = head y; hx = head x; ty = tail y; tx = tail x in if null x then y- else if sum (map T.length hy) + T.length hx <= n- then f tx ((hx:hy):ty)- else f tx ([hx]:y))+ else f tx $ if sum (map T.length hy) + T.length hx <= n+ then (hx:hy):ty+ else [hx]:y) sendPong p = sendPacket $ printf "%s PONG chat.deviantart.com :%s" [hostname, p]
kevin.cabal view
@@ -1,5 +1,5 @@ Name: kevin-Version: 0.6.1+Version: 0.7 Synopsis: a dAmn ↔ IRC proxy Description: a dAmn ↔ IRC proxy License: GPL@@ -56,4 +56,4 @@ default-extensions: CPP, DeriveDataTypeable, ExistentialQuantification, FlexibleContexts, OverloadedStrings, ScopedTypeVariables, TemplateHaskell ghc-options: -Wall -fno-warn-unused-do-bind -threaded- cpp-options: -DVERSION="0.6.1"+ cpp-options: -DVERSION="0.7"