2018-11-04 09:48:33 -05:00
|
|
|
/*******************************************************************************
|
|
|
|
* plugins/FeedReader/services/rsFeedReaderItems.h *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2012 by Thunder <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2012-08-02 09:17:53 -04:00
|
|
|
|
2012-08-10 14:06:29 -04:00
|
|
|
#ifndef RS_FEEDREADER_ITEMS_H
|
2012-08-02 09:17:53 -04:00
|
|
|
#define RS_FEEDREADER_ITEMS_H
|
|
|
|
|
2017-04-18 15:11:37 -04:00
|
|
|
#include "rsitems/rsserviceids.h"
|
2012-08-02 09:17:53 -04:00
|
|
|
#include "serialiser/rsserial.h"
|
2014-04-23 16:48:02 -04:00
|
|
|
#include "serialiser/rstlvstring.h"
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
#include "p3FeedReader.h"
|
|
|
|
|
2012-12-21 19:02:40 -05:00
|
|
|
const uint32_t CONFIG_TYPE_FEEDREADER = 0xf001; // is this correct?
|
2012-09-04 19:53:04 -04:00
|
|
|
|
2012-08-02 09:17:53 -04:00
|
|
|
const uint8_t RS_PKT_SUBTYPE_FEEDREADER_FEED = 0x02;
|
|
|
|
const uint8_t RS_PKT_SUBTYPE_FEEDREADER_MSG = 0x03;
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
#define RS_FEED_FLAG_FOLDER 0x001
|
|
|
|
#define RS_FEED_FLAG_INFO_FROM_FEED 0x002
|
|
|
|
#define RS_FEED_FLAG_STANDARD_STORAGE_TIME 0x004
|
|
|
|
#define RS_FEED_FLAG_STANDARD_UPDATE_INTERVAL 0x008
|
|
|
|
#define RS_FEED_FLAG_STANDARD_PROXY 0x010
|
|
|
|
#define RS_FEED_FLAG_AUTHENTICATION 0x020
|
|
|
|
#define RS_FEED_FLAG_DEACTIVATED 0x040
|
|
|
|
#define RS_FEED_FLAG_FORUM 0x080
|
|
|
|
#define RS_FEED_FLAG_UPDATE_FORUM_INFO 0x100
|
2012-08-10 14:06:29 -04:00
|
|
|
#define RS_FEED_FLAG_EMBED_IMAGES 0x200
|
|
|
|
#define RS_FEED_FLAG_SAVE_COMPLETE_PAGE 0x400
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
class RsFeedReaderFeed : public RsItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum WorkState {
|
|
|
|
WAITING,
|
|
|
|
WAITING_TO_DOWNLOAD,
|
|
|
|
DOWNLOADING,
|
|
|
|
WAITING_TO_PROCESS,
|
|
|
|
PROCESSING
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
RsFeedReaderFeed();
|
|
|
|
virtual ~RsFeedReaderFeed() {}
|
|
|
|
|
|
|
|
virtual void clear();
|
|
|
|
|
2020-11-08 07:22:59 -05:00
|
|
|
uint32_t feedId;
|
|
|
|
uint32_t parentId;
|
2013-01-21 19:11:43 -05:00
|
|
|
std::string name;
|
|
|
|
std::string url;
|
|
|
|
std::string user;
|
|
|
|
std::string password;
|
|
|
|
std::string proxyAddress;
|
|
|
|
uint16_t proxyPort;
|
|
|
|
uint32_t updateInterval;
|
|
|
|
time_t lastUpdate;
|
|
|
|
uint32_t flag; // RS_FEED_FLAG_...
|
|
|
|
std::string forumId;
|
|
|
|
uint32_t storageTime;
|
|
|
|
std::string description;
|
|
|
|
std::string icon;
|
|
|
|
RsFeedReaderErrorState errorState;
|
|
|
|
std::string errorString;
|
|
|
|
|
|
|
|
RsFeedTransformationType transformationType;
|
|
|
|
RsTlvStringSet xpathsToUse;
|
|
|
|
RsTlvStringSet xpathsToRemove;
|
|
|
|
std::string xslt;
|
2012-09-04 19:53:04 -04:00
|
|
|
|
2012-08-02 09:17:53 -04:00
|
|
|
/* Not Serialised */
|
2012-08-13 17:35:11 -04:00
|
|
|
bool preview;
|
2012-08-02 09:17:53 -04:00
|
|
|
WorkState workstate;
|
|
|
|
std::string content;
|
|
|
|
|
2012-09-04 19:53:04 -04:00
|
|
|
std::map<std::string, RsFeedReaderMsg*> msgs;
|
2012-08-02 09:17:53 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define RS_FEEDMSG_FLAG_DELETED 1
|
|
|
|
#define RS_FEEDMSG_FLAG_NEW 2
|
|
|
|
#define RS_FEEDMSG_FLAG_READ 4
|
|
|
|
|
|
|
|
class RsFeedReaderMsg : public RsItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsFeedReaderMsg();
|
|
|
|
virtual ~RsFeedReaderMsg() {}
|
|
|
|
|
|
|
|
virtual void clear();
|
|
|
|
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
|
|
|
|
|
|
|
std::string msgId;
|
2020-11-08 07:22:59 -05:00
|
|
|
uint32_t feedId;
|
2012-08-02 09:17:53 -04:00
|
|
|
std::string title;
|
|
|
|
std::string link;
|
|
|
|
std::string author;
|
|
|
|
std::string description;
|
2013-01-21 19:11:43 -05:00
|
|
|
std::string descriptionTransformed;
|
2012-08-02 09:17:53 -04:00
|
|
|
time_t pubDate;
|
|
|
|
uint32_t flag; // RS_FEEDMSG_FLAG_...
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsFeedReaderSerialiser: public RsSerialType
|
|
|
|
{
|
|
|
|
public:
|
2012-09-04 19:53:04 -04:00
|
|
|
RsFeedReaderSerialiser() : RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_PLUGIN_FEEDREADER) {}
|
2012-08-02 09:17:53 -04:00
|
|
|
virtual ~RsFeedReaderSerialiser() {}
|
|
|
|
|
|
|
|
virtual uint32_t size(RsItem *item);
|
|
|
|
virtual bool serialise(RsItem *item, void *data, uint32_t *size);
|
|
|
|
virtual RsItem *deserialise(void *data, uint32_t *size);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/* For RS_PKT_SUBTYPE_FEEDREADER_FEED */
|
|
|
|
virtual uint32_t sizeFeed(RsFeedReaderFeed *item);
|
|
|
|
virtual bool serialiseFeed(RsFeedReaderFeed *item, void *data, uint32_t *size);
|
|
|
|
virtual RsFeedReaderFeed *deserialiseFeed(void *data, uint32_t *size);
|
|
|
|
|
|
|
|
/* For RS_PKT_SUBTYPE_FEEDREADER_MSG */
|
|
|
|
virtual uint32_t sizeMsg(RsFeedReaderMsg *item);
|
|
|
|
virtual bool serialiseMsg(RsFeedReaderMsg *item, void *data, uint32_t *size);
|
|
|
|
virtual RsFeedReaderMsg *deserialiseMsg(void *data, uint32_t *size);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
#endif
|