From fba3191de71867e91eb51cde93136fcdda64c0ab Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 7 Apr 2013 10:39:42 +0200 Subject: Added RSS Feed support --- rssreader.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 rssreader.h (limited to 'rssreader.h') diff --git a/rssreader.h b/rssreader.h new file mode 100644 index 0000000..44fe36a --- /dev/null +++ b/rssreader.h @@ -0,0 +1,58 @@ +#ifndef __NOPACITY_RSSREADER_H +#define __NOPACITY_RSSREADER_H + +#include +#include +#include +#include +#include +#include + +#define NOPACITY_USERAGENT "libcurl-agent/1.0" + +struct XMLMemoryStruct { + char *memory; + size_t size; +}; + +struct RssElement { + std::string title; + std::string content; + int width; +}; + +class cRssReader : public cThread{ +public: + cRssReader(cOsd *osd, cFont *font, cPoint position, cPoint size); + ~cRssReader(); + virtual void Action(void); + void Stop(void) {Cancel(-1);}; + void SetFeed(std::string feedUrl) {this->feedUrl = feedUrl;}; + void SwitchNextMessage(void) {switchToNextMessage = true;}; +private: + cOsd *osd; + cFont *font; + cPixmap *pixmap; + std::string feedUrl; + int x, y; + int width, height; + void createPixmap(void); + void drawText(void); + int readRssURL(const char *url); + void saveRss(void); + void traverseTree(xmlNode * a_node, bool foundItem); + void saveItem(void); + void fadeInOut(bool fadeIn); + XMLMemoryStruct xmlData; + xmlDoc *doc; + std::string title, content; + std::vector rssElements; + int currentElement; + bool useProxy; + std::string httpproxy; + std::string separator; + void DoSleep(int duration); + bool switchToNextMessage; +}; + +#endif //__NOPACITY_RSSREADER_H \ No newline at end of file -- cgit v1.2.3