Merge pull request #454 from csoler/v0.6-ContactList

V0.6 contact list
This commit is contained in:
Cyril Soler 2016-08-04 22:38:59 +02:00 committed by GitHub
commit 96e73b301c
15 changed files with 573 additions and 277 deletions

View file

@ -2822,6 +2822,11 @@ void RsGenExchange::processRecvdMessages()
mNetService->rejectMessage(*it) ;
}
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData *grpMeta)
{
return true;
}
void RsGenExchange::processRecvdGroups()
{
RS_STACK_MUTEX(mGenMtx) ;
@ -2847,12 +2852,12 @@ void RsGenExchange::processRecvdGroups()
RsGxsGrpMetaData* meta = new RsGxsGrpMetaData();
bool deserialOk = false;
if(grp->meta.bin_len != 0)
if(grp->meta.bin_len != 0)
deserialOk = meta->deserialise(grp->meta.bin_data, grp->meta.bin_len);
bool erase = true;
if(deserialOk)
if(deserialOk && acceptNewGroup(meta))
{
#ifdef GEN_EXCH_DEBUG
std::cerr << " processing validation for group " << meta->mGroupId << ", attempts number " << gpsi.mAttempts << std::endl;
@ -2932,8 +2937,10 @@ void RsGenExchange::processRecvdGroups()
}
else
{
std::cerr << "(EE) deserialise error in group meta data" << std::endl;
delete grp;
if(!deserialOk)
std::cerr << "(EE) deserialise error in group meta data" << std::endl;
delete grp;
delete meta;
erase = true;
}

View file

@ -259,6 +259,16 @@ public:
*/
virtual void receiveChanges(std::vector<RsGxsNotify*>& changes);
/*!
* \brief acceptNewGroup
* Early checks if the group can be accepted. This is mainly used to check wether the group is banned for some reasons.
* Returns true unless derived in GXS services.
*
* \param grpMeta Group metadata to check
* \return
*/
virtual bool acceptNewGroup(const RsGxsGrpMetaData *grpMeta) ;
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
/*!

View file

@ -266,7 +266,7 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ;
|| defined(NXS_NET_DEBUG_4) || defined(NXS_NET_DEBUG_5) || defined(NXS_NET_DEBUG_6) || defined(NXS_NET_DEBUG_7)
static const RsPeerId peer_to_print = RsPeerId(std::string("")) ;
static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("30501fac090b65f5b9def169598b53ed" )) ; // use this to allow to this group id only, or "" for all IDs
static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("")) ; // use this to allow to this group id only, or "" for all IDs
static const uint32_t service_to_print = 0x211 ; // use this to allow to this service id only, or 0 for all services
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)