Add support for GxsChanges as RsEvents

This commit is contained in:
Gioacchino Mazzurco 2019-04-23 17:20:23 +02:00
parent de0dd63e3f
commit 13ba26251c
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
5 changed files with 170 additions and 153 deletions

View file

@ -3,7 +3,8 @@
* *
* libretroshare: retroshare core library *
* *
* Copyright 2012 by Christopher Evi-Parker *
* Copyright (C) 2012 Christopher Evi-Parker *
* Copyright (C) 2019 Gioacchino Mazzurco <gio@eigenlab.org> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -19,9 +20,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef RSGXSIFACE_H_
#define RSGXSIFACE_H_
#pragma once
#include "retroshare/rsreputations.h"
#include "retroshare/rsgxsservice.h"
@ -29,6 +28,8 @@
#include "retroshare/rsgxsifacetypes.h"
#include "util/rsdeprecate.h"
#include "serialiser/rsserializable.h"
#include "rsitems/rsserviceids.h"
#include "retroshare/rsevents.h"
/*!
* This structure is used to transport group summary information when a GXS
@ -71,17 +72,34 @@ struct RsGxsGroupSummary : RsSerializable
/*!
* Stores ids of changed gxs groups and messages. It is used to notify the GUI about changes.
* Stores ids of changed gxs groups and messages.
* It is used to notify about GXS changes.
*/
struct RsGxsChanges
struct RsGxsChanges : RsEvent
{
RsGxsChanges(): mService(nullptr){}
RsTokenService *mService;
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgs;
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
std::list<RsGxsGroupId> mGrps;
std::list<RsGxsGroupId> mGrpsMeta;
std::list<TurtleRequestId> mDistantSearchReqs;
RsGxsChanges();
/// Type of the service
RsServiceType mServiceType;
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgs;
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
std::list<RsGxsGroupId> mGrps;
std::list<RsGxsGroupId> mGrpsMeta;
std::list<TurtleRequestId> mDistantSearchReqs;
/// @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx) override
{
RS_SERIAL_PROCESS(mServiceType);
RS_SERIAL_PROCESS(mMsgs);
RS_SERIAL_PROCESS(mMsgsMeta);
RS_SERIAL_PROCESS(mGrps);
RS_SERIAL_PROCESS(mGrpsMeta);
RS_SERIAL_PROCESS(mDistantSearchReqs);
}
RsTokenService* mService; // Weak pointer, not serialized
};
/*!
@ -220,7 +238,3 @@ struct RsGxsIface
virtual RsReputationLevel minReputationForForwardingMessages(
uint32_t group_sign_flags,uint32_t identity_flags ) = 0;
};
#endif /* RSGXSIFACE_H_ */