2013-03-04 15:26:48 -05:00
|
|
|
#ifndef RETROSHARE_GXS_COMMON_OBJS_INTERFACE_H
|
|
|
|
#define RETROSHARE_GXS_COMMON_OBJS_INTERFACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* libretroshare/src/retroshare: rsgxscommong.h
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
|
|
|
* Copyright 2012-2012 by Robert Fernie.
|
|
|
|
*
|
|
|
|
* 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 "rsgxsifacetypes.h"
|
|
|
|
|
|
|
|
class RsGxsFile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGxsFile();
|
|
|
|
std::string mName;
|
2014-03-17 16:56:06 -04:00
|
|
|
RsFileHash mHash;
|
2013-03-04 15:26:48 -05:00
|
|
|
uint64_t mSize;
|
2013-03-12 20:24:57 -04:00
|
|
|
//std::string mPath;
|
2013-03-04 15:26:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class RsGxsImage
|
|
|
|
{
|
|
|
|
public:
|
2013-03-11 16:40:28 -04:00
|
|
|
RsGxsImage();
|
|
|
|
~RsGxsImage();
|
2013-03-12 20:24:57 -04:00
|
|
|
RsGxsImage(const RsGxsImage& a); // TEMP use copy constructor and duplicate memory.
|
2013-03-15 16:46:49 -04:00
|
|
|
RsGxsImage &operator=(const RsGxsImage &a); // Need this as well?
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
//NB: Must make sure that we always use methods - to be consistent about malloc/free for this data.
|
|
|
|
static uint8_t *allocate(uint32_t size);
|
|
|
|
static void release(void *data);
|
|
|
|
|
|
|
|
void take(uint8_t *data, uint32_t size); // Copies Pointer.
|
|
|
|
void copy(uint8_t *data, uint32_t size); // Allocates and Copies.
|
|
|
|
void clear(); // Frees.
|
|
|
|
void shallowClear(); // Clears Pointer.
|
|
|
|
|
2013-03-04 15:26:48 -05:00
|
|
|
uint8_t *mData;
|
|
|
|
uint32_t mSize;
|
2013-03-12 20:24:57 -04:00
|
|
|
|
2013-03-04 15:26:48 -05:00
|
|
|
};
|
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
|
2013-03-15 16:46:49 -04:00
|
|
|
#define GXS_VOTE_NONE 0x0000
|
2013-03-04 15:26:48 -05:00
|
|
|
#define GXS_VOTE_DOWN 0x0001
|
|
|
|
#define GXS_VOTE_UP 0x0002
|
|
|
|
|
2013-06-04 17:00:43 -04:00
|
|
|
|
|
|
|
// Status Flags to indicate Voting....
|
|
|
|
// All Services that use the Comment service must not Use This space.
|
|
|
|
namespace GXS_SERV {
|
|
|
|
/* Msg Vote Status */
|
|
|
|
static const uint32_t GXS_MSG_STATUS_GXSCOMMENT_MASK = 0x000f0000;
|
|
|
|
static const uint32_t GXS_MSG_STATUS_VOTE_MASK = 0x00030000;
|
|
|
|
|
|
|
|
static const uint32_t GXS_MSG_STATUS_VOTE_UP = 0x00010000;
|
|
|
|
static const uint32_t GXS_MSG_STATUS_VOTE_DOWN = 0x00020000;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-04 15:26:48 -05:00
|
|
|
class RsGxsVote
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGxsVote();
|
|
|
|
RsMsgMetaData mMeta;
|
|
|
|
uint32_t mVoteType;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsGxsComment
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGxsComment();
|
|
|
|
RsMsgMetaData mMeta;
|
|
|
|
std::string mComment;
|
|
|
|
|
|
|
|
// below is calculated.
|
|
|
|
uint32_t mUpVotes;
|
|
|
|
uint32_t mDownVotes;
|
2013-03-12 20:24:57 -04:00
|
|
|
double mScore;
|
2013-03-04 15:26:48 -05:00
|
|
|
|
2013-03-15 16:46:49 -04:00
|
|
|
uint32_t mOwnVote;
|
|
|
|
|
2013-03-04 15:26:48 -05:00
|
|
|
// This is filled in if detailed Comment Data is called.
|
2013-03-12 20:24:57 -04:00
|
|
|
std::list<RsGxsVote> mVotes;
|
2013-03-04 15:26:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class RsGxsCommentService
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
RsGxsCommentService() { return; }
|
|
|
|
virtual ~RsGxsCommentService() { return; }
|
|
|
|
|
|
|
|
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 getDetailedCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments);
|
|
|
|
|
|
|
|
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
|
|
|
|
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
|
|
|
|
|
|
|
|
virtual bool acknowledgeComment(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
|
2013-03-15 16:46:49 -04:00
|
|
|
virtual bool acknowledgeVote(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
|
2013-03-04 15:26:48 -05:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|