X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhalcyon.git;a=blobdiff_plain;f=src%2FMain.hs;h=7025b4bb1544c43fe4d54ebaa92df6a1c4920970;hp=f42f2ce57738a4899005d146bf0700b46c88a377;hb=6954f707adaa34e2fdc6df78b6bcce79e35279ee;hpb=69b8af30f49aaad0f5c051998d2556b9ec291df7 diff --git a/src/Main.hs b/src/Main.hs index f42f2ce..7025b4b 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -26,13 +26,14 @@ thread_sleep seconds = do 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 @@ -64,7 +65,8 @@ recurse username latest_status_id maybe_message = do 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