2018-05-29 15:54:27 -04:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/services: p3posted.h *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2012-2013 Robert Fernie <retroshare@lunamutt.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
#ifndef P3_POSTED_SERVICE_HEADER
|
|
|
|
#define P3_POSTED_SERVICE_HEADER
|
|
|
|
|
|
|
|
|
|
|
|
#include "retroshare/rsposted.h"
|
2014-01-20 06:42:27 -05:00
|
|
|
#include "services/p3postbase.h"
|
2013-03-11 16:40:28 -04:00
|
|
|
|
2013-06-04 17:00:43 -04:00
|
|
|
#include <retroshare/rsidentity.h>
|
|
|
|
|
2013-03-11 16:40:28 -04:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2013-06-04 17:00:43 -04:00
|
|
|
#include <list>
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-01-20 06:42:27 -05:00
|
|
|
class p3Posted: public p3PostBase, public RsPosted
|
2013-03-11 16:40:28 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
p3Posted(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs);
|
2014-03-21 23:53:44 -04:00
|
|
|
virtual RsServiceInfo getServiceInfo();
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2014-01-20 06:42:27 -05:00
|
|
|
virtual void notifyChanges(std::vector<RsGxsNotify*>& changes)
|
|
|
|
{
|
|
|
|
return p3PostBase::notifyChanges(changes);
|
|
|
|
}
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-01-20 06:42:27 -05:00
|
|
|
virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
|
|
|
|
{
|
|
|
|
return RsGxsIfaceHelper::receiveChanges(changes);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Posted Specific DataTypes.
|
2013-03-11 16:40:28 -04:00
|
|
|
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups);
|
2016-07-22 19:48:23 -04:00
|
|
|
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts);
|
|
|
|
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) { std::vector<RsGxsComment> cmts; return getPostData( token, posts, cmts);}
|
2016-06-18 14:03:55 -04:00
|
|
|
//Not currently used
|
|
|
|
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts);
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
virtual bool createGroup(uint32_t &token, RsPostedGroup &group);
|
|
|
|
virtual bool createPost(uint32_t &token, RsPostedPost &post);
|
|
|
|
|
2014-02-19 06:08:37 -05:00
|
|
|
virtual bool updateGroup(uint32_t &token, RsPostedGroup &group);
|
2015-04-17 17:36:22 -04:00
|
|
|
virtual bool groupShareKeys(const RsGxsGroupId &group, const std::set<RsPeerId>& peers);
|
2014-02-09 05:33:16 -05:00
|
|
|
|
2014-01-20 06:42:27 -05:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// WRAPPERS due to the separate Interface.
|
|
|
|
|
|
|
|
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read)
|
|
|
|
{
|
|
|
|
return p3PostBase::setMessageReadStatus(token, msgId, read);
|
|
|
|
}
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
|
2018-03-28 10:30:35 -04:00
|
|
|
/** Comment service - Provide RsGxsCommentService -
|
|
|
|
* redirect to p3GxsCommentService */
|
|
|
|
virtual bool getCommentData(uint32_t token, std::vector<RsGxsComment> &msgs)
|
|
|
|
{ return mCommentService->getGxsCommentData(token, msgs); }
|
2013-03-11 16:40:28 -04:00
|
|
|
|
2018-03-28 10:30:35 -04:00
|
|
|
virtual bool getRelatedComments( uint32_t token,
|
|
|
|
std::vector<RsGxsComment> &msgs )
|
|
|
|
{ return mCommentService->getGxsRelatedComments(token, msgs); }
|
2013-03-11 16:40:28 -04:00
|
|
|
|
|
|
|
virtual bool createComment(uint32_t &token, RsGxsComment &msg)
|
|
|
|
{
|
|
|
|
return mCommentService->createGxsComment(token, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool createVote(uint32_t &token, RsGxsVote &msg)
|
|
|
|
{
|
|
|
|
return mCommentService->createGxsVote(token, msg);
|
|
|
|
}
|
|
|
|
|
2018-03-28 10:30:35 -04:00
|
|
|
virtual bool acknowledgeComment(
|
|
|
|
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId )
|
|
|
|
{ return acknowledgeMsg(token, msgId); }
|
2013-03-11 16:40:28 -04:00
|
|
|
|
2018-03-28 10:30:35 -04:00
|
|
|
virtual bool acknowledgeVote(
|
|
|
|
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId )
|
2013-03-15 16:46:49 -04:00
|
|
|
{
|
2018-03-28 10:30:35 -04:00
|
|
|
if (mCommentService->acknowledgeVote(token, msgId)) return true;
|
2013-03-15 16:46:49 -04:00
|
|
|
return acknowledgeMsg(token, msgId);
|
|
|
|
}
|
2013-03-11 16:40:28 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|