diff options
author | Julien Dessaux | 2011-09-30 23:54:22 +0200 |
---|---|---|
committer | Julien Dessaux | 2011-09-30 23:54:22 +0200 |
commit | 2cfccca8e227367a865cc16dfdd5190be66a4b8f (patch) | |
tree | 42cb99616c665eab5c28b4469700dcc1cc3bac82 /Hsbot | |
parent | Updated the getRandomQuote transaction. (diff) | |
download | hsbot-2cfccca8e227367a865cc16dfdd5190be66a4b8f.tar.gz hsbot-2cfccca8e227367a865cc16dfdd5190be66a4b8f.tar.bz2 hsbot-2cfccca8e227367a865cc16dfdd5190be66a4b8f.zip |
Added back the setLastActiveQuote transaction.
Diffstat (limited to 'Hsbot')
-rw-r--r-- | Hsbot/Plugin/Quote.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Hsbot/Plugin/Quote.hs b/Hsbot/Plugin/Quote.hs index a4d5d42..33c29cc 100644 --- a/Hsbot/Plugin/Quote.hs +++ b/Hsbot/Plugin/Quote.hs @@ -103,6 +103,8 @@ setQuote quoteId theQuote = get >>= \db -> put db { quoteBotDB = M.insert quoteI getLastActiveQuote :: IRC.Channel -> Query QuoteDB (Maybe QuoteID) getLastActiveQuote channel = fmap (M.lookup channel) (asks lastActive) +setLastActiveQuote :: IRC.Channel -> QuoteID -> Update QuoteDB () +setLastActiveQuote channel quoteID = get >>= \db -> put db { lastActive = M.insert channel quoteID (lastActive db) } takeNextQuoteID :: IRC.UserName -> IRC.Channel -> UTCTime -> Update QuoteDB (QuoteID) takeNextQuoteID requestor channel now = do db <- get @@ -113,7 +115,7 @@ takeNextQuoteID requestor channel now = do return quoteId $(makeAcidic ''QuoteDB [ 'getQuote, 'getQuoteDB, 'isQuoteLockedFor, 'lockQuoteIdFor, 'deleteQuote, 'setQuote - , 'getLastActiveQuote, 'takeNextQuoteID ]) + , 'getLastActiveQuote, 'setLastActiveQuote, 'takeNextQuoteID ]) -- | gets a random quote from the database getRandomQuote :: AcidState QuoteDB -> IO (Maybe (Quote, QuoteID)) |