mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 02:25:34 -04:00
Adding Basics of GxsChannel Service into libretroshare.
This includes a generic CommentService, which will be used by other Services. + Bugfix, gxs service threads were started before global variables were set. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6186 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
99c5633a63
commit
22782e5edd
17 changed files with 2326 additions and 66 deletions
111
libretroshare/src/retroshare/rsgxschannels.h
Normal file
111
libretroshare/src/retroshare/rsgxschannels.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
#ifndef RETROSHARE_GXS_CHANNEL_GUI_INTERFACE_H
|
||||
#define RETROSHARE_GXS_CHANNEL_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/retroshare: rsgxschannel.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 "gxs/rstokenservice.h"
|
||||
#include "retroshare/rsgxsifacehelper.h"
|
||||
#include "retroshare/rsgxscommon.h"
|
||||
|
||||
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsGxsChannels;
|
||||
extern RsGxsChannels *rsGxsChannels;
|
||||
|
||||
|
||||
// These should be in rsgxscommon.h
|
||||
|
||||
class RsGxsChannelGroup
|
||||
{
|
||||
public:
|
||||
RsGroupMetaData mMeta;
|
||||
std::string mDescription;
|
||||
|
||||
//RsGxsImage mChanImage;
|
||||
bool mAutoDownload;
|
||||
|
||||
};
|
||||
|
||||
class RsGxsChannelPost
|
||||
{
|
||||
public:
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mMsg; // UTF8 encoded.
|
||||
|
||||
//std::list<RsGxsFile> mFiles;
|
||||
uint32_t mCount; // auto calced.
|
||||
uint64_t mSize; // auto calced.
|
||||
//RsGxsImage mThumbnail;
|
||||
};
|
||||
|
||||
|
||||
//typedef std::map<RsGxsGroupId, std::vector<RsGxsChannelMsg> > GxsChannelMsgResult;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsChannelGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsChannelPost &post);
|
||||
|
||||
class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsChannels(RsGxsIface *gxs)
|
||||
:RsGxsIfaceHelper(gxs) { return; }
|
||||
virtual ~RsGxsChannels() { return; }
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups) = 0;
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts) = 0;
|
||||
|
||||
virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &posts) = 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 setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
|
||||
//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
||||
|
||||
//virtual bool groupRestoreKeys(const std::string &groupId);
|
||||
//virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group) = 0;
|
||||
virtual bool createPost(uint32_t &token, RsGxsChannelPost &post) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
103
libretroshare/src/retroshare/rsgxscommon.h
Normal file
103
libretroshare/src/retroshare/rsgxscommon.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
#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;
|
||||
std::string mHash;
|
||||
uint64_t mSize;
|
||||
std::string mPath;
|
||||
};
|
||||
|
||||
class RsGxsImage
|
||||
{
|
||||
public:
|
||||
RsGxsImage();
|
||||
uint8_t *mData;
|
||||
uint32_t mSize;
|
||||
};
|
||||
|
||||
#define GXS_VOTE_DOWN 0x0001
|
||||
#define GXS_VOTE_UP 0x0002
|
||||
|
||||
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;
|
||||
double score;
|
||||
|
||||
// This is filled in if detailed Comment Data is called.
|
||||
std::list<RsGxsVote> votes;
|
||||
};
|
||||
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue