2013-03-11 16:40:28 -04:00
|
|
|
#ifndef RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H
|
|
|
|
#define RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H
|
2012-10-05 14:12:52 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* libretroshare/src/retroshare: rsposted.h
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
2012-10-21 15:45:35 -04:00
|
|
|
* Copyright 2008-2012 by Robert Fernie, Christopher Evi-Parker
|
2012-10-05 14:12:52 -04:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
2013-03-11 16:40:28 -04:00
|
|
|
* License Version 2.1 as published by the Free Software Foundation.
|
2012-10-05 14:12:52 -04:00
|
|
|
*
|
|
|
|
* 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>
|
2013-03-11 16:40:28 -04:00
|
|
|
|
2013-03-06 18:33:23 -05:00
|
|
|
#include "retroshare/rstokenservice.h"
|
2013-02-28 16:58:38 -05:00
|
|
|
#include "retroshare/rsgxsifacehelper.h"
|
2013-03-11 16:40:28 -04:00
|
|
|
#include "retroshare/rsgxscommon.h"
|
2012-10-05 14:12:52 -04:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
/* The Main Interface Class - for information about your Posted */
|
2012-10-21 15:45:35 -04:00
|
|
|
class RsPosted;
|
|
|
|
extern RsPosted *rsPosted;
|
2012-10-05 14:12:52 -04:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
class RsPostedPost;
|
2012-10-05 14:12:52 -04:00
|
|
|
class RsPostedGroup
|
|
|
|
{
|
2013-03-11 16:40:28 -04:00
|
|
|
public:
|
|
|
|
RsPostedGroup() { return; }
|
|
|
|
|
|
|
|
RsGroupMetaData mMeta;
|
|
|
|
std::string mDescription;
|
2012-10-05 14:12:52 -04:00
|
|
|
};
|
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
|
2012-10-21 15:45:35 -04:00
|
|
|
//#define RSPOSTED_MSGTYPE_POST 0x0001
|
|
|
|
//#define RSPOSTED_MSGTYPE_VOTE 0x0002
|
|
|
|
//#define RSPOSTED_MSGTYPE_COMMENT 0x0004
|
2012-10-05 14:12:52 -04:00
|
|
|
|
|
|
|
#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);
|
|
|
|
|
2012-12-08 16:50:13 -05:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService
|
2012-10-05 14:12:52 -04:00
|
|
|
{
|
2013-03-11 16:40:28 -04:00
|
|
|
public:
|
2012-10-05 14:12:52 -04:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
enum RankType {TopRankType, HotRankType, NewRankType };
|
2012-11-30 13:54:25 -05:00
|
|
|
|
2013-06-04 17:00:43 -04:00
|
|
|
//static const uint32_t FLAG_MSGTYPE_POST;
|
|
|
|
//static const uint32_t FLAG_MSGTYPE_MASK;
|
2012-10-21 15:45:35 -04:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
RsPosted(RsGxsIface* gxs) : RsGxsIfaceHelper(gxs) { return; }
|
2012-10-05 14:12:52 -04:00
|
|
|
virtual ~RsPosted() { return; }
|
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
/* 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;
|
2012-10-21 15:45:35 -04:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
/* 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;
|
|
|
|
|
2014-02-19 06:08:37 -05:00
|
|
|
virtual bool updateGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
2014-10-13 14:31:47 -04:00
|
|
|
|
2015-04-17 17:36:22 -04:00
|
|
|
virtual bool groupShareKeys(const RsGxsGroupId& group,const std::set<RsPeerId>& peers) = 0 ;
|
2012-10-05 14:12:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
class RsPostedPost
|
2012-10-21 15:45:35 -04:00
|
|
|
{
|
2013-03-11 16:40:28 -04:00
|
|
|
public:
|
|
|
|
RsPostedPost()
|
|
|
|
{
|
2013-06-04 17:00:43 -04:00
|
|
|
//mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
|
2013-03-11 16:40:28 -04:00
|
|
|
mUpVotes = 0;
|
|
|
|
mDownVotes = 0;
|
|
|
|
mComments = 0;
|
2013-06-04 17:00:43 -04:00
|
|
|
mHaveVoted = false;
|
2015-06-19 08:47:38 -04:00
|
|
|
|
|
|
|
mHotScore = 0;
|
|
|
|
mTopScore = 0;
|
|
|
|
mNewScore = 0;
|
2013-03-11 16:40:28 -04:00
|
|
|
}
|
|
|
|
|
2013-06-04 17:00:43 -04:00
|
|
|
bool calculateScores(time_t ref_time);
|
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
RsMsgMetaData mMeta;
|
|
|
|
std::string mLink;
|
|
|
|
std::string mNotes;
|
|
|
|
|
2013-06-04 17:00:43 -04:00
|
|
|
bool mHaveVoted;
|
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
// Calculated.
|
|
|
|
uint32_t mUpVotes;
|
|
|
|
uint32_t mDownVotes;
|
|
|
|
uint32_t mComments;
|
|
|
|
|
2013-06-04 17:00:43 -04:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
// and Calculated Scores:???
|
|
|
|
double mHotScore;
|
|
|
|
double mTopScore;
|
|
|
|
double mNewScore;
|
2012-10-21 15:45:35 -04:00
|
|
|
};
|
|
|
|
|
2012-12-11 17:26:11 -05:00
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
#endif // RETROSHARE_GXS_RSPOSTED_GUI_INTERFACE_H
|