Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
Get rid of offline mode
Browse files Browse the repository at this point in the history
As far as I can tell, offline mode only ever worked with Google Reader,
and since the latter was discontinued in 2013, offline mode became
totally useless. It certainly isn't used for The Old Reader and FeedHQ,
despite some code being written for them.

Given no-one complained in the last three years, I think it's safe to
assume that offline mode isn't used by any of our users, and can be
safely removed.
  • Loading branch information
Minoru committed Oct 17, 2016
1 parent 8f7a74b commit 4d17e43
Show file tree
Hide file tree
Showing 31 changed files with 17 additions and 280 deletions.
1 change: 0 additions & 1 deletion doc/chapter-firststeps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ After you've installed newsbeuter, you can run it for the first time by typing
-C, --config-file=<configfile> read configuration from <configfile>
-X, --vacuum clean up cache thoroughly
-x, --execute=<command>... execute list of commands
-o, --offline-mode activate offline mode (only applies to The Old Reader synchronization mode)
-q, --quiet quiet startup
-v, --version get version information
-l, --log-level=<loglevel> write a log with a certain loglevel (valid values: 1 to 6)
Expand Down
6 changes: 0 additions & 6 deletions doc/manpage-newsbeuter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ OPTIONS
Execute one or more commands to run newsbeuter unattended. Currently available
commands are "reload" and "print-unread".

-o, --offline-mode::
Active offline reading mode. When Google Reader synchronization mode is configured,
then the list of feeds will not be loaded from Google Reader, but instead from
the local cache. This makes it possible to read locally cached articles even
without internet connection to connect to Google Reader.

-l loglevel, --log-level=loglevel::
Generate a logfile with a certain loglevel. Valid loglevels are 1 to 6. An
actual logfile will only be written when you provide a logfile name.
Expand Down
3 changes: 1 addition & 2 deletions doc/newsbeuter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,7 @@ To enable this mode, the following configuration needs to be done:
opml-url "<opml url>" ["<opml url>" ...]

"opml" must be specified as source for the feed URLs, and the URLs of the OPML
file needs to be specified, too. As with Google Reader synchronization mode, the offline
mode via "newsbeuter -o" also works with OPML online subscription mode.
file needs to be specified, too.


Flagging Articles
Expand Down
6 changes: 0 additions & 6 deletions include/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

namespace newsbeuter {

typedef std::pair<std::string, unsigned int> google_replay_pair;
enum { GOOGLE_MARK_READ = 1, GOOGLE_MARK_UNREAD = 2 };

class cache {
public:
cache(const std::string& cachefile, configcontainer * c);
Expand All @@ -34,9 +31,6 @@ class cache {
void mark_items_read_by_guid(const std::vector<std::string>& guids);
std::vector<std::string> get_read_item_guids();
void fetch_descriptions(rss_feed * feed);
void record_google_replay(const std::string& guid, unsigned int state);
std::vector<google_replay_pair> get_google_replay();
void delete_google_replay_by_guid(const std::vector<std::string>& guids);
private:
void populate_tables();
void set_pragmas();
Expand Down
2 changes: 0 additions & 2 deletions include/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class controller {
void update_visible_feeds();
void mark_all_read(unsigned int pos);
void mark_article_read(const std::string& guid, bool read);
void record_google_replay(const std::string& guid, bool read);
void catchup_all(const std::string& feedurl);
inline void catchup_all(std::shared_ptr<rss_feed> feed) {
rsscache->catchup_all(feed);
Expand Down Expand Up @@ -146,7 +145,6 @@ class controller {
regexmanager rxman;
remote_api * api;
std::mutex feeds_mutex;
bool offline_mode;
};

}
Expand Down
1 change: 0 additions & 1 deletion include/feedhq_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class feedhq_api : public remote_api {
virtual bool mark_all_read(const std::string& feedurl);
virtual bool mark_article_read(const std::string& guid, bool read);
virtual bool update_article_flags(const std::string& oldflags, const std::string& newflags, const std::string& guid);
std::vector<std::string> bulk_mark_articles_read(const std::vector<google_replay_pair>& actions);
private:
std::vector<std::string> get_tags(xmlNode * node);
std::string get_new_token();
Expand Down
1 change: 0 additions & 1 deletion include/oldreader_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class oldreader_api : public remote_api {
virtual bool mark_all_read(const std::string& feedurl);
virtual bool mark_article_read(const std::string& guid, bool read);
virtual bool update_article_flags(const std::string& oldflags, const std::string& newflags, const std::string& guid);
std::vector<std::string> bulk_mark_articles_read(const std::vector<google_replay_pair>& actions);
private:
std::vector<std::string> get_tags(xmlNode * node);
std::string get_new_token();
Expand Down
4 changes: 0 additions & 4 deletions include/urlreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ class urlreader {
std::vector<std::string>& get_urls();
std::vector<std::string>& get_tags(const std::string& url);
std::vector<std::string> get_alltags();
inline void set_offline(bool off) {
offline = off;
}
protected:
std::vector<std::string> urls;
std::map<std::string, std::vector<std::string>> tags;
std::set<std::string> alltags;
bool offline;
};

class file_urlreader : public urlreader {
Expand Down
5 changes: 0 additions & 5 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@ msgstr "<kommando>..."
msgid "execute list of commands"
msgstr "führe eine Liste von Befehlen aus"

#: src/controller.cpp:1051
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "Offline-Modus aktivieren (nur im The Old Reader Synchronisationsmodus)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "ruhiger Start"
Expand Down
8 changes: 0 additions & 8 deletions po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,6 @@ msgstr "<comando>..."
msgid "execute list of commands"
msgstr "ejecutar lista de comandos"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"activar modo «fuera de línea» (aplica únicamente al modo de sincronización "
"de Google Reader)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "inicio silencioso"
Expand Down
8 changes: 0 additions & 8 deletions po/es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,6 @@ msgstr "<comando>..."
msgid "execute list of commands"
msgstr "ejecutar lista de comandos"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"activar modo desconectado (solo se aplica al modo de sincronizacion de "
"bloglines)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
7 changes: 0 additions & 7 deletions po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,6 @@ msgstr "<commande>..."
msgid "execute list of commands"
msgstr "exécuter une liste de commandes"

#: src/controller.cpp:1051
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"activer le mode offline (seulement pour la synchronisation avec The Old "
"Reader)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "démarrage silencieux (sans sortie d'affichage)"
Expand Down
6 changes: 0 additions & 6 deletions po/hu.po
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,6 @@ msgstr "<command>..."
msgid "execute list of commands"
msgstr "parancsok listájának futtatása"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "offline mód aktiválása (csak a blogline szinkronizációra érvényes)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
8 changes: 0 additions & 8 deletions po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,6 @@ msgstr "<comando>..."
msgid "execute list of commands"
msgstr "esegui un elenco di comandi"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"attiva modalità non in linea (si applica solo alla modalità sincronizzazione "
"di bloglines)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
5 changes: 0 additions & 5 deletions po/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,6 @@ msgstr "<コマンド>…"
msgid "execute list of commands"
msgstr "コマンドリストを実行する"

#: src/controller.cpp:1051
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "オフラインモード(theoldreader.comからのフィードにしか効果がない)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "出力を制御する"
Expand Down
6 changes: 0 additions & 6 deletions po/nb.po
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,6 @@ msgstr "<kommando>..."
msgid "execute list of commands"
msgstr "utfør kommandoliste"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "bytt til frakoblet modus (kun for Google Reader-synkroniseringsmodus)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "stille oppstart"
Expand Down
5 changes: 0 additions & 5 deletions po/newsbeuter.pot
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,6 @@ msgstr ""
msgid "execute list of commands"
msgstr ""

#: src/controller.cpp:1051
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
8 changes: 0 additions & 8 deletions po/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,6 @@ msgstr "<opdracht>…"
msgid "execute list of commands"
msgstr "lijst van opdrachten uitvoeren"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"activeer offline-modus (alleen geldig voor synchronizatiemodus van Google "
"Reader)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "opstarten zonder opdrachtregeluitvoer"
Expand Down
6 changes: 0 additions & 6 deletions po/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,6 @@ msgstr "<polecenie>..."
msgid "execute list of commands"
msgstr "wykonaj listę poleceń"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "aktywuj tryb offline (dotyczy trybu synchronizacji z Google Reader)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "cichy start"
Expand Down
7 changes: 0 additions & 7 deletions po/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,6 @@ msgstr "<comando>..."
msgid "execute list of commands"
msgstr "executar lista de comandos"

#: src/controller.cpp:1051
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"ativar modo offline (aplica-se somente ao modo de sincronização do The Old "
"Reader)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "início silencioso"
Expand Down
6 changes: 0 additions & 6 deletions po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,6 @@ msgstr "<команда>..."
msgid "execute list of commands"
msgstr "выполнить список команд"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "включить автономный режим (только для синхронизации Google Reader)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr "тихий запуск"
Expand Down
8 changes: 0 additions & 8 deletions po/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,6 @@ msgstr "<kommando>..."
msgid "execute list of commands"
msgstr "verkställ lista över kommandon"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"aktivera frånkopplingsläge (verkställs bara till läge för bloglines-"
"synkronisering)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
7 changes: 0 additions & 7 deletions po/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,6 @@ msgstr "<komut>..."
msgid "execute list of commands"
msgstr "bir dizi komut çalıştır"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"çevrimdışı modunu aktifleştir (sadece bloglines eşleştirme modunu etkiler)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
7 changes: 0 additions & 7 deletions po/uk.po
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,6 @@ msgstr "<команда>..."
msgid "execute list of commands"
msgstr "виконати список команд"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr ""
"актувувати режим поза мережею (застосовує тільки синхронізацію з блоґом)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
6 changes: 0 additions & 6 deletions po/zh.po
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,6 @@ msgstr "命令 ..."
msgid "execute list of commands"
msgstr "执行一系列命令"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "激活离线模式(只对bloglines同步模式有效)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
6 changes: 0 additions & 6 deletions po/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,6 @@ msgstr "<命令>..."
msgid "execute list of commands"
msgstr "執行列出的命令"

#: src/controller.cpp:1051
#, fuzzy
msgid ""
"activate offline mode (only applies to The Old Reader synchronization mode)"
msgstr "啟動離線模式((只套用到bloglines synchronization mode)"

#: src/controller.cpp:1052
msgid "quiet startup"
msgstr ""
Expand Down
45 changes: 0 additions & 45 deletions src/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,49 +879,4 @@ void cache::fetch_descriptions(rss_feed * feed) {
}
}

void cache::record_google_replay(const std::string& guid, unsigned int state) {
std::lock_guard<std::mutex> lock(mtx);

std::string query = prepare_query("INSERT INTO google_replay ( guid, state, ts ) VALUES ( '%q', %u, %u );", guid.c_str(), state, (unsigned int)time(NULL));

int rc = sqlite3_exec(db, query.c_str(), NULL, NULL, NULL);
LOG(LOG_DEBUG, "ran SQL statement: %s rc = %d", query.c_str(), rc);
}

void cache::delete_google_replay_by_guid(const std::vector<std::string>& guids) {
std::vector<std::string> escaped_guids;

for (auto guid : guids) {
escaped_guids.push_back(prepare_query("'%q'", guid.c_str()));
}

std::string query = prepare_query("DELETE FROM google_replay WHERE guid IN ( %s );", utils::join(escaped_guids, ", ").c_str());

int rc = sqlite3_exec(db, query.c_str(), NULL, NULL, NULL);
LOG(LOG_DEBUG, "ran SQL statement: %s rc = %d", query.c_str(), rc);
}

static int google_replay_cb(void * result, int argc, char ** argv, char ** /* azColName */) {
std::vector<google_replay_pair> * google_replay_data = static_cast<std::vector<google_replay_pair> *>(result);
assert(argc == 2);

google_replay_data->push_back(google_replay_pair(argv[0], utils::to_u(argv[1])));

return 0;
}

std::vector<google_replay_pair> cache::get_google_replay() {
std::vector<google_replay_pair> result;

std::string query = "SELECT guid, state FROM google_replay ORDER BY ts;";

int rc = sqlite3_exec(db, query.c_str(), google_replay_cb, &result, NULL);
if (rc != SQLITE_OK) {
LOG(LOG_CRITICAL, "query \"%s\" failed: error = %d", query.c_str(), rc);
throw dbexception(db);
}

return result;
}

}
Loading

0 comments on commit 4d17e43

Please sign in to comment.