summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2011-09-30 22:58:59 +0200
committerJulien Dessaux2011-09-30 22:58:59 +0200
commitd7e6ca9a302bcce9e1ba530e49ef833e33890fa8 (patch)
tree9d2f134809ce9d63488a1434a2348e5913065492
parentForgot to add a notification on quote start command. (diff)
downloadhsbot-d7e6ca9a302bcce9e1ba530e49ef833e33890fa8.tar.gz
hsbot-d7e6ca9a302bcce9e1ba530e49ef833e33890fa8.tar.bz2
hsbot-d7e6ca9a302bcce9e1ba530e49ef833e33890fa8.zip
Updated schema to save the channel on which the quote is from.
-rw-r--r--Hsbot/Plugin/Quote.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/Hsbot/Plugin/Quote.hs b/Hsbot/Plugin/Quote.hs
index 953ae52..30d5e7e 100644
--- a/Hsbot/Plugin/Quote.hs
+++ b/Hsbot/Plugin/Quote.hs
@@ -32,6 +32,7 @@ type QuoteID = Int
-- | A quote object
data Quote = Quote
{ quoter :: IRC.UserName
+ , quoteFrom :: IRC.Channel
, quotE :: [QuoteElt]
, quoteTime :: UTCTime
, votes :: Int
@@ -40,6 +41,7 @@ data Quote = Quote
emptyQuote :: Quote
emptyQuote = Quote { quoter = ""
+ , quoteFrom = ""
, quotE = []
, quoteTime = posixSecondsToUTCTime 0
, votes = 0
@@ -259,6 +261,7 @@ quoteStart quoteDB msg quotee phrase =
now <- liftIO getCurrentTime
quoteID <- update' quoteDB (TakeNextQuoteID sender channel now)
let newQuote = emptyQuote { quoter = sender
+ , quoteFrom = channel
, quotE = [ QuoteElt { eltQuotee = quotee, eltQuote = thatQuote } ]
, quoteTime = now }
_ <- update' quoteDB (SetQuote quoteID newQuote)