mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 11:32:48 -04:00

- Reorganisation of p3posted, stripped out lots of previous stuff. - Converted p3posted to use GxsComment system. - Disabled much of the DummyData - switch it on manually when testing. - Added Basics of ChannelPost processing for AutoDownload. (incomplete). - Added GxsCommon backend for RsGxsImage and RsGxsFile. - Completed Serialiser for GxsChannels. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6207 b45a01b8-16f6-495d-af2f-9b41ad6348cc
162 lines
4.9 KiB
C++
162 lines
4.9 KiB
C++
#ifndef RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H
|
|
#define RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H
|
|
|
|
/*
|
|
* libretroshare/src/retroshare: rsposted.h
|
|
*
|
|
* RetroShare C++ Interface.
|
|
*
|
|
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License Version 2.1 as published by the Free Software Foundation.
|
|
*
|
|
* This library 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
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
* USA.
|
|
*
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
*
|
|
*/
|
|
|
|
#include <inttypes.h>
|
|
#include <string>
|
|
#include <list>
|
|
|
|
#include "retroshare/rstokenservice.h"
|
|
#include "retroshare/rsgxsifacehelper.h"
|
|
#include "retroshare/rsgxscommon.h"
|
|
|
|
/* The Main Interface Class - for information about your Posted */
|
|
class RsPosted;
|
|
extern RsPosted *rsPosted;
|
|
|
|
class RsPostedPost;
|
|
class RsPostedGroup
|
|
{
|
|
public:
|
|
RsPostedGroup() { return; }
|
|
|
|
RsGroupMetaData mMeta;
|
|
std::string mDescription;
|
|
};
|
|
|
|
|
|
//#define RSPOSTED_MSGTYPE_POST 0x0001
|
|
//#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
|
//#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
|
|
|
#define RSPOSTED_PERIOD_YEAR 1
|
|
#define RSPOSTED_PERIOD_MONTH 2
|
|
#define RSPOSTED_PERIOD_WEEK 3
|
|
#define RSPOSTED_PERIOD_DAY 4
|
|
#define RSPOSTED_PERIOD_HOUR 5
|
|
|
|
#define RSPOSTED_VIEWMODE_LATEST 1
|
|
#define RSPOSTED_VIEWMODE_TOP 2
|
|
#define RSPOSTED_VIEWMODE_HOT 3
|
|
#define RSPOSTED_VIEWMODE_COMMENTS 4
|
|
|
|
|
|
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
|
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
|
|
|
|
|
class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService
|
|
{
|
|
public:
|
|
|
|
enum RankType {TopRankType, HotRankType, NewRankType };
|
|
|
|
static const uint32_t FLAG_MSGTYPE_POST;
|
|
static const uint32_t FLAG_MSGTYPE_MASK;
|
|
|
|
RsPosted(RsGxsIface* gxs) : RsGxsIfaceHelper(gxs) { return; }
|
|
virtual ~RsPosted() { return; }
|
|
|
|
/* Specific Service Data */
|
|
|
|
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) = 0;
|
|
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
|
|
virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
|
|
|
|
|
|
// SPECIAL RANKING FNS.
|
|
virtual bool requestPostRankings(uint32_t &token, const RankType &rType, uint32_t count, uint32_t page_no, const RsGxsGroupId &groupId) = 0;
|
|
|
|
virtual bool getPostRanking(const uint32_t &token, std::vector<RsPostedPost> &msgs) = 0;
|
|
|
|
|
|
//virtual bool getPostRanking(const uint32_t& token, std::vector<RsPostedPost> &ranking) = 0;
|
|
|
|
/* From RsGxsCommentService */
|
|
//virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
|
//virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
|
//virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
|
|
//virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
|
|
|
virtual bool createGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
|
virtual bool createPost(uint32_t &token, RsPostedPost &post) = 0;
|
|
|
|
//virtual bool retrieveScores(const std::string& serviceString, uint32_t& upVotes, uint32_t& downVotes, uint32_t& nComments) const = 0;
|
|
|
|
// Special Ranking Request.
|
|
/*!
|
|
* Makes request for posts of a topic
|
|
* @param token
|
|
* @param rType
|
|
* @param groupId
|
|
*/
|
|
//virtual bool requestPostRankings(uint32_t &token, const RankType& rType, const RsGxsGroupId& groupId) = 0;
|
|
|
|
/*!
|
|
* Makes request for ranking of comments for a post
|
|
* @param token
|
|
* @param rType type of ranking to collect
|
|
* @param msgId message id of post as groupid-messageid pair
|
|
*/
|
|
//virtual bool requestCommentRankings(uint32_t &token, const RankType& rType, const RsGxsGrpMsgIdPair& msgId) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsPostedPost
|
|
{
|
|
public:
|
|
RsPostedPost()
|
|
{
|
|
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
|
|
mUpVotes = 0;
|
|
mDownVotes = 0;
|
|
mComments = 0;
|
|
return;
|
|
}
|
|
|
|
RsMsgMetaData mMeta;
|
|
std::string mLink;
|
|
std::string mNotes;
|
|
|
|
// Calculated.
|
|
uint32_t mUpVotes;
|
|
uint32_t mDownVotes;
|
|
uint32_t mComments;
|
|
|
|
// and Calculated Scores:???
|
|
double mHotScore;
|
|
double mTopScore;
|
|
double mNewScore;
|
|
};
|
|
|
|
|
|
#endif // RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H
|