threadDelay microseconds
--- |Given a 'Message' and a 'Status', update that message's body and
--- subject with the information contained in the status. Returns the
--- updated message.
-message_from_status :: Message -> Status -> Message
-message_from_status message status =
+-- |Given a 'Message', 'Status', and date, update that message's body
+-- and subject with the information contained in the status. Adds a
+-- /Date: / header, and returns the updated message.
+message_from_status :: Message -> String -> Status -> Message
+message_from_status message date status =
message { subject = "Twat: " ++ (screen_name (user status)),
- body = (pretty_print status) }
+ body = (pretty_print status),
+ headers = ((headers message) ++ ["Date: " ++ date])}
-- |This is the main recursive loop. It takes a username, a
recurse username new_latest_status_id maybe_message
return ()
Just message -> do
- let messages = map (message_from_status message) new_statuses
+ date_header <- construct_date_header
+ let messages = map (message_from_status message (date_header)) new_statuses
sendmail_results <- mapM sendmail messages
mapM print_sendmail_result sendmail_results
recurse username new_latest_status_id maybe_message