mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-31 18:36:24 -05:00
93 lines
3.6 KiB
C++
93 lines
3.6 KiB
C++
/*******************************************************************************
|
|
* libretroshare/src/retroshare: rsgxsservice.h *
|
|
* *
|
|
* libretroshare: retroshare core library *
|
|
* *
|
|
* Copyright (C) 2015 Retroshare Team <retroshare.team@gmail.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/>. *
|
|
* *
|
|
*******************************************************************************/
|
|
#ifndef RSGXSSERVICE_H
|
|
#define RSGXSSERVICE_H
|
|
|
|
|
|
#include "retroshare/rsgxsifacetypes.h"
|
|
#include "retroshare/rstokenservice.h"
|
|
|
|
struct RsMsgMetaData ;
|
|
typedef uint32_t TurtleRequestId;
|
|
|
|
typedef std::map<RsGxsGroupId, std::vector<RsMsgMetaData> > GxsMsgMetaMap;
|
|
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsMsgMetaData> > GxsMsgRelatedMetaMap;
|
|
|
|
/*!
|
|
* The aim of this class is to abstract how changes are represented so they can
|
|
* be determined outside the client API without explcitly enumerating all
|
|
* possible changes at the interface
|
|
*/
|
|
struct RsGxsNotify
|
|
{
|
|
enum NotifyType
|
|
{ TYPE_PUBLISHED, TYPE_RECEIVED_NEW, TYPE_PROCESSED, TYPE_RECEIVED_PUBLISHKEY, TYPE_RECEIVED_DISTANT_SEARCH_RESULTS };
|
|
|
|
virtual ~RsGxsNotify() {}
|
|
virtual NotifyType getType() = 0;
|
|
};
|
|
|
|
/*!
|
|
* Relevant to group changes
|
|
*/
|
|
class RsGxsGroupChange : public RsGxsNotify
|
|
{
|
|
public:
|
|
RsGxsGroupChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
|
|
std::list<RsGxsGroupId> mGrpIdList;
|
|
NotifyType getType(){ return NOTIFY_TYPE;}
|
|
bool metaChange() { return mMetaChange; }
|
|
private:
|
|
const NotifyType NOTIFY_TYPE;
|
|
bool mMetaChange;
|
|
};
|
|
|
|
class RsGxsDistantSearchResultChange: public RsGxsNotify
|
|
{
|
|
public:
|
|
RsGxsDistantSearchResultChange(TurtleRequestId id,const RsGxsGroupId& group_id) : mRequestId(id),mGroupId(group_id){}
|
|
|
|
NotifyType getType() { return TYPE_RECEIVED_DISTANT_SEARCH_RESULTS ; }
|
|
|
|
TurtleRequestId mRequestId ;
|
|
RsGxsGroupId mGroupId;
|
|
};
|
|
|
|
/*!
|
|
* Relevant to message changes
|
|
*/
|
|
class RsGxsMsgChange : public RsGxsNotify
|
|
{
|
|
public:
|
|
RsGxsMsgChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
|
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgChangeMap;
|
|
NotifyType getType(){ return NOTIFY_TYPE;}
|
|
bool metaChange() { return mMetaChange; }
|
|
private:
|
|
const NotifyType NOTIFY_TYPE;
|
|
bool mMetaChange;
|
|
};
|
|
|
|
|
|
|
|
#endif // RSGXSSERVICE_H
|