-- /Date: / header, and returns the updated message.
message_from_status :: Maybe TimeZone -> Message -> String -> Status -> Message
message_from_status mtz message default_date status =
- message { subject = "Twat: " ++ (screen_name (user status)),
+ message { subject = "Halcyon: " ++ (screen_name (user status)),
body = (pretty_print mtz status),
headers = ((headers message) ++ ["Date: " ++ date])}
where
-- recursive loop that checks for updates forever. The message
-- argument is optional and is passed to recurse in case the updates
-- should be emailed.
-run_twat :: Cfg -> Maybe Message -> String -> IO ()
-run_twat cfg msg username = do
+run :: Cfg -> Maybe Message -> String -> IO ()
+run cfg msg username = do
latest_status_id <- get_latest_status_id cfg username
recurse cfg username latest_status_id msg
return ()
from = f }
-- |The main function just parses the command-line arguments and then
--- forks off calls to 'run_twat' for each supplied username. After
+-- forks off calls to 'run' for each supplied username. After
-- forking, main loops forever.
main :: IO ()
main = do
-- message object to be passed to all of our threads.
let message = construct_message cfg
- -- Execute run_twat on each username in a new thread.
- let run_twat_curried = run_twat cfg message
- _ <- mapM (forkIO . run_twat_curried) (get_usernames (usernames cfg))
+ -- Execute run on each username in a new thread.
+ let run_curried = run cfg message
+ _ <- mapM (forkIO . run_curried) (get_usernames (usernames cfg))
_ <- forever $
-- This thread (the one executing main) doesn't do anything,