lambdabot-irc-plugins 5.0.1 → 5.0.3
raw patch · 2 files changed
+27/−5 lines, 2 filesdep ~lambdabot-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: lambdabot-core
API changes (from Hackage documentation)
Files
lambdabot-irc-plugins.cabal view
@@ -1,5 +1,5 @@ name: lambdabot-irc-plugins-version: 5.0.1+version: 5.0.3 license: GPL license-file: LICENSE@@ -49,7 +49,7 @@ containers >= 0.4, directory >= 1.1, filepath >= 1.3,- lambdabot-core >= 5.0.1 && < 5.1,+ lambdabot-core >= 5.0.3 && < 5.1, lifted-base >= 0.2, mtl >= 2, network >= 2.3.0.13,
src/Lambdabot/Plugin/IRC/Log.hs view
@@ -37,7 +37,9 @@ Said Nick UTCTime String | Joined Nick String UTCTime | Parted Nick String UTCTime -- covers quitting as well+ | Kicked Nick Nick String UTCTime String | Renick Nick String UTCTime Nick+ | Mode Nick String UTCTime String deriving (Eq) instance Show Event where@@ -46,8 +48,13 @@ ++ " (" ++ usr ++ ") joined." show (Parted nick usr ct) = timeStamp ct ++ " " ++ show (FreenodeNick nick) ++ " (" ++ usr ++ ") left."- show (Renick nick usr ct new) = timeStamp ct ++ " " ++ show (FreenodeNick nick)+ show (Kicked nick op usrop ct reason) = timeStamp ct ++ " " ++ show (FreenodeNick nick)+ ++ " was kicked by " ++ show (FreenodeNick op)+ ++ " (" ++ usrop ++ "): " ++ reason ++ "."+ show (Renick nick usr ct new) = timeStamp ct ++ " " ++ show (FreenodeNick nick) ++ " (" ++ usr ++ ") is now " ++ show (FreenodeNick new) ++ "."+ show (Mode nick usr ct mode) = timeStamp ct ++ " " ++ show (FreenodeNick nick)+ ++ " (" ++ usr ++ ") changed mode to " ++ mode ++ "." -- * Dispatchers and Module instance declaration --@@ -67,7 +74,9 @@ connect "PRIVMSG" msgCB connect "JOIN" joinCB connect "PART" partCB+ connect "KICK" kickCB connect "NICK" nickCB+ connect "MODE" modeCB } -- * Logging helpers@@ -141,8 +150,8 @@ -- | Open a file to write the log to. openChannelFile :: Channel -> UTCTime -> Log Handle openChannelFile chan ct = do- stateDir <- getConfig outputDir- let dir = stateDir </> "Log" </> nTag chan </> nName chan+ logDir <- lb $ findLBFileForWriting "Log"+ let dir = logDir </> nTag chan </> nName chan file = dir </> (dateToString date) <.> "txt" io $ createDirectoryIfMissing True dir >> openFile file AppendMode where date = dateStamp ct@@ -190,11 +199,24 @@ partCB :: IrcMessage -> UTCTime -> Event partCB msg ct = Parted (Msg.nick msg) (Msg.fullName msg) ct +-- | When somebody is kicked.+kickCB :: IrcMessage -> UTCTime -> Event+kickCB msg ct = Kicked (Msg.nick msg) { nName = head $ tail $ ircMsgParams msg }+ (Msg.nick msg)+ (Msg.fullName msg)+ ct+ (tail . concat . tail . tail $ ircMsgParams msg)+ -- | When somebody changes his\/her name. -- TODO: We should only do this for channels that the user is currently on. nickCB :: IrcMessage -> UTCTime -> Event nickCB msg ct = Renick (Msg.nick msg) (Msg.fullName msg) ct (parseNick (Msg.server msg) $ drop 1 $ head $ ircMsgParams msg)++-- | When somebody changes channel mode.+modeCB :: IrcMessage -> UTCTime -> Event+modeCB msg ct = Mode (Msg.nick msg) (Msg.fullName msg) ct+ (unwords $ tail $ ircMsgParams msg) -- | When somebody speaks. msgCB :: IrcMessage -> UTCTime -> Event