lambdabot-social-plugins 5.0 → 5.0.1
raw patch · 3 files changed
+24/−10 lines, 3 filesdep ~bytestringdep ~lambdabot-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bytestring, lambdabot-core
API changes (from Hackage documentation)
Files
- lambdabot-social-plugins.cabal +6/−2
- src/Lambdabot/Plugin/Social/Seen.hs +4/−4
- src/Lambdabot/Plugin/Social/Tell.hs +14/−4
lambdabot-social-plugins.cabal view
@@ -1,5 +1,5 @@ name: lambdabot-social-plugins-version: 5.0+version: 5.0.1 license: GPL license-file: LICENSE@@ -15,9 +15,13 @@ Provided plugins: . [activity] Check where and how much is lambdabot used.+ . [karma] Track who's been good and who's been naughty.+ . [poll] Let the people vote.+ . [seen] Track who was around when.+ . [tell] Leave messages for other users. homepage: http://haskell.org/haskellwiki/Lambdabot@@ -50,7 +54,7 @@ binary >= 0.5, bytestring >= 0.9, containers >= 0.4,- lambdabot-core >= 5 && < 5.1,+ lambdabot-core >= 5.0.1 && < 5.1, mtl >= 2, split >= 0.2, time >= 1.4
src/Lambdabot/Plugin/Social/Seen.hs view
@@ -60,9 +60,9 @@ [joinCB, partCB, quitCB, nickCB, joinChanCB, msgCB] ] - c <- lb $ findOrCreateLBFile "seen"- s <- io $ P.readFile c- let ls = L.fromChunks [s]+ c <- lb $ findLBFileForReading "seen"+ s <- maybe (return (P.pack "")) (io . P.readFile) c+ let ls = L.fromStrict s mbDecoded <- io . try . evaluate $ decode ls case mbDecoded of Left exc@SomeException{} -> do@@ -82,7 +82,7 @@ modifyMS $ \(n,m) -> (n, botPart ct (map packNick chans) m) -- and write out our state:- withMS $ \s _ -> lb (findOrCreateLBFile "seen") >>= \ c -> io (encodeFile c s)+ withMS $ \s _ -> lb (findLBFileForWriting "seen") >>= \ c -> io (encodeFile c s) } lcNick :: Nick -> Nick
src/Lambdabot/Plugin/Social/Tell.hs view
@@ -200,6 +200,10 @@ Just (_, [], _) -> Nothing Just (_, ns, _) -> Just ns +-- | Set a user's messages.+setMessages :: Nick -> [Note] -> Cmd Tell ()+setMessages sender msgs = modEntry sender $ \(t, _, a) -> (t, msgs, a)+ -- | Clear a user's messages. clearMessages :: Nick -> Cmd Tell () clearMessages sender = modEntry sender $ \(_, _, a) -> (Nothing, [], a)@@ -232,17 +236,23 @@ doMessages loud = do sender <- getSender msgs <- getMessages sender- clearMessages sender let tellNote = if loud then say else lb . ircPrivmsg sender + let loop [] = clearMessages sender+ loop (msg : msgs) = do+ time <- io getClockTime+ -- Note that 'showNote' may block and thus run into a timeout.+ -- Hence we update the list of pending messages after each message.+ showNote time msg >>= tellNote+ setMessages sender msgs+ loop msgs+ case msgs of Nothing -> say "You don't have any messages"- Just mesgs -> do- time <- io getClockTime- mapM_ (showNote time >=> tellNote) mesgs+ Just msgs -> loop msgs verb :: NoteType -> String verb Ask = "ask"