From 2cfccca8e227367a865cc16dfdd5190be66a4b8f Mon Sep 17 00:00:00 2001
From: Julien Dessaux
Date: Fri, 30 Sep 2011 23:54:22 +0200
Subject: Added back the setLastActiveQuote transaction.

---
 Hsbot/Plugin/Quote.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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))
-- 
cgit v1.2.3