diff options
Diffstat (limited to 'src/cache.cpp')
-rw-r--r-- | src/cache.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cache.cpp b/src/cache.cpp index cfae8b24..0fcade75 100644 --- a/src/cache.cpp +++ b/src/cache.cpp @@ -256,7 +256,7 @@ static int guid_callback(void* myguids, int argc, char** argv, return 0; } -Cache::Cache(const Filepath& cachefile, ConfigContainer* c) +Cache::Cache(const Filepath& cachefile, ConfigContainer& c) : cfg(c) { const int error = sqlite3_open(cachefile.to_locale_string().c_str(), &db); @@ -547,7 +547,7 @@ void Cache::externalize_rssfeed(RssFeed& feed, run_sql(insertquery); } - const unsigned int max_items = cfg->get_configvalue_as_int("max-items"); + const unsigned int max_items = cfg.get_configvalue_as_int("max-items"); LOG(Level::INFO, "Cache::externalize_feed: max_items = %u " @@ -561,7 +561,7 @@ void Cache::externalize_rssfeed(RssFeed& feed, feed.items().begin() + max_items, feed.items().end()); } - const unsigned int days = cfg->get_configvalue_as_int("keep-articles-days"); + const unsigned int days = cfg.get_configvalue_as_int("keep-articles-days"); const time_t old_time = time(nullptr) - days * 24 * 60 * 60; // the reverse iterator is there for the sorting foo below (think about @@ -648,7 +648,7 @@ std::shared_ptr<RssFeed> Cache::internalize_rssfeed(std::string rssurl, items.end()); } - const unsigned int max_items = cfg->get_configvalue_as_int("max-items"); + const unsigned int max_items = cfg.get_configvalue_as_int("max-items"); if (max_items > 0 && feed->total_item_count() > max_items) { std::vector<std::shared_ptr<RssItem>> flagged_items; @@ -668,7 +668,7 @@ std::shared_ptr<RssFeed> Cache::internalize_rssfeed(std::string rssurl, // if some flagged articles were saved, append them feed->add_items(flagged_items); } - feed->sort_unlocked(cfg->get_article_sort_strategy()); + feed->sort_unlocked(cfg.get_article_sort_strategy()); return feed; } @@ -802,7 +802,7 @@ std::vector<std::string> Cache::cleanup_cache(std::vector<std::shared_ptr<RssFee * The behaviour whether the cleanup is done or not is configurable via * the configuration file. */ - if (always_clean || cfg->get_configvalue_as_bool("cleanup-on-quit")) { + if (always_clean || cfg.get_configvalue_as_bool("cleanup-on-quit")) { LOG(Level::DEBUG, "Cache::cleanup_cache: cleaning up cache..."); std::string cleanup_rss_feeds_statement( @@ -820,7 +820,7 @@ std::vector<std::string> Cache::cleanup_cache(std::vector<std::shared_ptr<RssFee run_sql(cleanup_rss_feeds_statement); run_sql(cleanup_rss_items_statement); - if (cfg->get_configvalue_as_bool( + if (cfg.get_configvalue_as_bool( "delete-read-articles-on-quit")) { run_sql(cleanup_read_items_statement); } @@ -1122,7 +1122,7 @@ void Cache::clean_old_articles() { std::lock_guard<std::recursive_mutex> lock(mtx); - const unsigned int days = cfg->get_configvalue_as_int("keep-articles-days"); + const unsigned int days = cfg.get_configvalue_as_int("keep-articles-days"); if (days > 0) { const time_t old_date = time(nullptr) - days * 24 * 60 * 60; |