-.TH twat 1
+.TH halcyon 1
.SH NAME
-twat \- Twat twats tweets so you don't have to Twitter.
+halcyon \- Halcyon monitors a list of Twitter accounts and displays or
+emails any new tweets.
.SH SYNOPSIS
-\fBtwat\fR [\fBOPTIONS\fR] [\fBUSERNAMES\fR]
+\fBhalcyon\fR [\fBOPTIONS\fR] [\fBUSERNAMES\fR]
.SH INPUT
.P
-Twat takes no input proper; instead, it takes a list of usernames from
-either the command-line or the ~/.twatrc file, and watches those
+Halcyon takes no input proper; instead, it takes a list of usernames from
+either the command-line or the ~/.halcyonrc file, and watches those
users' timelines.
.SH OUTPUT
.P
Any new tweets from watched users are written to stdout. If to/from
email addresses are provided (either on the command-line or in
-~/.twatrc), then sendmail will be used to email the new tweet to the
+~/.halcyonrc), then sendmail will be used to email the new tweet to the
specified \fIfrom\fR address.
.SH DESCRIPTION
.P
-Twat watches a list of Twitter timelines, and writes any new tweets to
+Halcyon watches a list of Twitter timelines, and writes any new tweets to
stdout. It can also optionally email the new tweets to a given email
address.
.P
New tweets are gathered at a fixed interval, specified in seconds by
the \fB\-\-heartbeat\fR (default: 600) option.
.P
-Twat uses the Twitter API, which now requires you to have a developer
+Halcyon uses the Twitter API, which now requires you to have a developer
account. You can sign up for free at https://dev.twitter.com/. Once
you have done this, you can authorize your own account to access
itself. You will then be given four tokens, which need to be fed to
-twat:
+halcyon:
.IP \[bu] 2
Consumer Key
.SH CONFIGURATION FILE
.P
-The file ~/.twatrc can contain any of the options (and usernames) that
-would otherwise be specified on the command-line.
+The file ~/.halcyonrc can contain any of the options (and usernames)
+that would otherwise be specified on the command-line.
.SH BUGS
-name: twat
-version: 0.0
+name: halcyon
+version: 0.0.1
cabal-version: >= 1.8
author: Michael Orlitzky
maintainer: Michael Orlitzky <michael@orlitzky.com>
license: GPL-3
license-file: doc/LICENSE
-homepage: http://michael.orlitzky.com/code/twat.php
+homepage: http://michael.orlitzky.com/code/halcyon.php
bug-reports: mailto:michael@orlitzky.com
category: Utils, Web
synopsis:
- Twat twats tweets so you don't have to Twitter.
+ Halcyon monitors a list of Twitter accounts and displays or emails
+ any new tweets.
build-type: Simple
-executable twat
+executable halcyon
build-depends:
aeson == 0.6.*,
authenticate-oauth == 1.4.*,
source-repository head
type: git
- location: http://michael.orlitzky.com/git/twat.git
+ location: http://michael.orlitzky.com/git/halcyon.git
branch: master
-BIN = dist/build/twat/twat
+BIN = dist/build/halcyon/halcyon
TESTSUITE_BIN = dist/build/testsuite/testsuite
.PHONY : dist doc test
import System.IO (hPutStrLn, stderr)
-- Get the version from Cabal.
-import Paths_twat (version)
+import Paths_halcyon (version)
import Data.Version (showVersion)
import ExitCodes
import OptionalConfiguration
description :: String
-description = "Twat twats tweets so you don't have to twitter."
+description =
+ "Monitor a list of Twitter accounts and display or email any new tweets."
program_name :: String
-program_name = "twat"
+program_name = "halcyon"
my_summary :: String
my_summary = program_name ++ "-" ++ (showVersion version)
-- /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,
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
--- | The program will parse ~/.twatrc for any available configuration
+-- | The program will parse ~/.halcyonrc for any available configuration
-- directives, resulting in an OptionalCfg. The command-line
-- arguments will be used to create another OptionalCfg, and the two
-- will be merged. Finally, a default_config will be updated from
from_rc :: IO OptionalCfg
from_rc = do
- cfg <- DC.load [ DC.Optional "$(HOME)/.twatrc" ]
+ cfg <- DC.load [ DC.Optional "$(HOME)/.halcyonrc" ]
cfg_consumer_key <- DC.lookup cfg "consumer-key"
cfg_consumer_secret <- DC.lookup cfg "consumer-secret"
cfg_access_token <- DC.lookup cfg "access-token"