diff options
author | tv <tv@krebsco.de> | 2019-01-27 03:23:17 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-27 03:27:29 +0100 |
commit | e9ca12a945b1d1c068e9c31050e264cb20690db4 (patch) | |
tree | 6f12a1ede100424ebbd24f97f46bf9c31243d672 /src/Reaktor.hs | |
parent | aaddda85c74540d1dab452dcdddf425927983ea9 (diff) |
Reaktor: add data Commandv0.2.0
Diffstat (limited to 'src/Reaktor.hs')
-rw-r--r-- | src/Reaktor.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Reaktor.hs b/src/Reaktor.hs index 21379ca..34baadb 100644 --- a/src/Reaktor.hs +++ b/src/Reaktor.hs @@ -28,6 +28,7 @@ import Prelude.Extended import Reaktor.Internal import Reaktor.Internal as Exports (Actions(..)) import Reaktor.Internal as Exports (Message(Message,Start)) +import Reaktor.IRC as Exports import Reaktor.Internal as Exports (formatMessage) import Reaktor.Nick as Exports import Reaktor.Nick as Nick @@ -104,7 +105,7 @@ logger h takeLog = forever $ takeLog >>= T.hPutStrLn h . pp pinger :: (Message -> IO ()) -> IO () pinger aSend = forever $ do threadDelay time - aSend (Message Nothing "PING" ["heartbeat"]) + aSend (Message Nothing PING ["heartbeat"]) where time = 300 * 1000000 @@ -162,10 +163,10 @@ splitter plugins takeInMsg = logMsgFilter :: Message -> Maybe Message logMsgFilter = \case - Message _ "PING" _ -> Nothing - Message _ "PONG" _ -> Nothing - Message p "PRIVMSG" ["NickServ",xs] | check -> do - Just (Message p "PRIVMSG" ["NickServ",xs']) + Message _ PING _ -> Nothing + Message _ PONG _ -> Nothing + Message p PRIVMSG ["NickServ",xs] | check -> do + Just (Message p PRIVMSG ["NickServ",xs']) where check = elem cmd ["IDENTIFY","REGAIN"] && length ws > 2 ws = T.words xs @@ -206,7 +207,7 @@ showUnprintable = privmsg :: Text -> [Text] -> Message privmsg msgtarget xs = - Message Nothing "PRIVMSG" (msgtarget:T.intercalate " " xs:[]) + Message Nothing PRIVMSG (msgtarget:T.intercalate " " xs:[]) prefixTimestamp :: Blessings Text -> IO (Blessings Text) |