commit 1f72b5524eb94d18b9f76418447978b6a1c37236
parent cc4c43cc807b30064644412a78345faa82edf48d
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date: Sun, 15 Sep 2019 00:44:37 -0400
Move logic that pulls user's own twturl to timeline
Diffstat:
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/config.rs b/src/config.rs
@@ -19,14 +19,10 @@ impl Config {
let config = Ini::load_from_file(config_path).unwrap();
let twtxt_config = config.section(Some("twtxt".to_owned())).unwrap();
- let mut following = config
+ let following = config
.section(Some("following".to_owned()))
.unwrap()
.to_owned();
- // Always follow oneself.
- *following
- .entry(twtxt_config["nick"].to_owned())
- .or_default() = twtxt_config["twturl"].to_owned();
// Parse hook commands.
let pre_tweet_hook = strfmt::strfmt(&twtxt_config["pre_tweet_hook"], twtxt_config).unwrap();
let post_tweet_hook =
diff --git a/src/timeline.rs b/src/timeline.rs
@@ -11,7 +11,12 @@ pub fn timeline(config: &Config, _subcommand: &ArgMatches) {
// Store (post_time, nick, content).
let mut all_tweets = BinaryHeap::<(DateTime<FixedOffset>, String, String)>::new();
- for (nick, twturl) in config.following.iter() {
+ // Pull and parse twtxt files from user and each followed source.
+ for (nick, twturl) in config
+ .following
+ .iter()
+ .chain(vec![(&config.nick, &config.twturl)].into_iter())
+ {
let tweets = parse_twtxt(twturl);
for (post_time, content) in tweets {
all_tweets.push((post_time, nick.to_owned(), content));