summaryrefslogtreecommitdiff
path: root/include/oldreader_api.h
blob: 0f063ede348ece5ef02f85925f9734f520a3ae5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef NEWSBEUTER_GOOGLE_API__H
#define NEWSBEUTER_GOOGLE_API__H

#include <remote_api.h>
#include <urlreader.h>
#include <cache.h>

namespace newsbeuter {

class oldreader_api : public remote_api {
	public:
		explicit oldreader_api(configcontainer * c);
		virtual ~oldreader_api();
		virtual bool authenticate();
		virtual std::vector<tagged_feedurl> get_subscribed_urls();
		virtual void add_custom_headers(curl_slist** custom_headers);
		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);
	private:
		std::vector<std::string> get_tags(xmlNode * node);
		std::string get_new_token();
		std::string retrieve_auth();
		std::string post_content(const std::string& url, const std::string& postdata);
		bool star_article(const std::string& guid, bool star);
		bool share_article(const std::string& guid, bool share);
		bool mark_article_read_with_token(const std::string& guid, bool read, const std::string& token);
		std::string auth;
		std::string auth_header;
};

class oldreader_urlreader : public urlreader {
	public:
		oldreader_urlreader(configcontainer * c, const std::string& url_file, remote_api * a);
		virtual ~oldreader_urlreader();
		virtual void write_config();
		virtual void reload();
		virtual std::string get_source();
	private:
		configcontainer * cfg;
		std::string file;
		remote_api * api;

};

}

#endif