mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
Lots of progress with Gxs Services:
- Added gxsForum interface, service + serialiser to libretroshare. - Bugfix in rsgenservices getSize() at the wrong point, Added lots of debug too. - Dummy Collections to Wiki, can now create and retrieve Groups from the GUI. - Bugfix in rsinit (wrong backend for wiki) + added forum to startup. - improved debugging in GxsId serialiser. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5797 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8170697029
commit
eeb96c5e62
13 changed files with 1214 additions and 19 deletions
|
@ -201,6 +201,8 @@ void RsGenExchange::generateGroupKeys(RsTlvSecurityKeySet& keySet)
|
|||
|
||||
bool RsGenExchange::createGroup(RsNxsGrp *grp, RsTlvSecurityKeySet& keySet)
|
||||
{
|
||||
std::cerr << "RsGenExchange::createGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
RsGxsGrpMetaData* meta = grp->metaData;
|
||||
|
@ -224,7 +226,12 @@ bool RsGenExchange::createGroup(RsNxsGrp *grp, RsTlvSecurityKeySet& keySet)
|
|||
}
|
||||
|
||||
if(mit == keySet.keys.end())
|
||||
{
|
||||
std::cerr << "RsGenExchange::createGroup() Missing ADMIN Key";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// group is self signing
|
||||
// for the creation of group signature
|
||||
|
@ -253,6 +260,12 @@ bool RsGenExchange::createGroup(RsNxsGrp *grp, RsTlvSecurityKeySet& keySet)
|
|||
delete[] allGrpData;
|
||||
delete[] metaData;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
std::cerr << "RsGenExchange::createGroup() ERROR !okay (getSignature error)";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -412,6 +425,9 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
|||
|
||||
std::list<RsNxsGrp*>::iterator lit = nxsGrps.begin();
|
||||
|
||||
std::cerr << "RsGenExchange::getGroupData() RsNxsGrp::len: " << nxsGrps.size();
|
||||
std::cerr << std::endl;
|
||||
|
||||
if(ok)
|
||||
{
|
||||
for(; lit != nxsGrps.end(); lit++)
|
||||
|
@ -426,6 +442,11 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
|
|||
grpItem.push_back(gItem);
|
||||
delete *lit;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "RsGenExchange::getGroupData() ERROR deserialising item";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
|
@ -751,15 +772,20 @@ void RsGenExchange::publishGrps()
|
|||
|
||||
RsNxsGrp* grp = new RsNxsGrp(mServType);
|
||||
RsGxsGrpItem* grpItem = mit->second;
|
||||
uint32_t size = mSerialiser->size(grpItem);
|
||||
|
||||
RsTlvSecurityKeySet keySet;
|
||||
generateGroupKeys(keySet);
|
||||
|
||||
service_CreateGroup(grpItem, keySet);
|
||||
|
||||
uint32_t size = mSerialiser->size(grpItem);
|
||||
char gData[size];
|
||||
bool ok = mSerialiser->serialise(grpItem, gData, &size);
|
||||
if (!ok)
|
||||
{
|
||||
std::cerr << "RsGenExchange::publishGrps() !ok ERROR After First Serialise" << std::endl;
|
||||
}
|
||||
|
||||
grp->grp.setBinData(gData, size);
|
||||
|
||||
if(ok)
|
||||
|
@ -769,14 +795,26 @@ void RsGenExchange::publishGrps()
|
|||
*(grp->metaData) = grpItem->meta;
|
||||
grp->metaData->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
|
||||
ok &= createGroup(grp, keySet);
|
||||
if (!ok)
|
||||
{
|
||||
std::cerr << "RsGenExchange::publishGrps() !ok ERROR After createGroup" << std::endl;
|
||||
}
|
||||
|
||||
size = grp->metaData->serial_size();
|
||||
char mData[size];
|
||||
grp->metaData->mGroupId = grp->grpId;
|
||||
ok &= grp->metaData->serialise(mData, size);
|
||||
if (!ok)
|
||||
{
|
||||
std::cerr << "RsGenExchange::publishGrps() !ok ERROR After Meta Serialise" << std::endl;
|
||||
}
|
||||
|
||||
grp->meta.setBinData(mData, size);
|
||||
RsGxsGroupId grpId = grp->grpId;
|
||||
mDataAccess->addGroupData(grp);
|
||||
|
||||
std::cerr << "RsGenExchange::publishGrps() ok -> pushing to notifies" << std::endl;
|
||||
|
||||
// add to published to allow acknowledgement
|
||||
mGrpNotify.insert(std::make_pair(mit->first, grpId));
|
||||
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||
|
@ -786,8 +824,8 @@ void RsGenExchange::publishGrps()
|
|||
{
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << "RsGenExchange::publishGrps() failed to publish grp " << std::endl;
|
||||
#endif
|
||||
std::cerr << "RsGenExchange::publishGrps() failed to publish grp " << std::endl;
|
||||
delete grp;
|
||||
|
||||
// add to published to allow acknowledgement, grpid is empty as grp creation failed
|
||||
|
@ -890,8 +928,8 @@ void RsGenExchange::createDummyGroup(RsGxsGrpItem *grpItem)
|
|||
{
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << "RsGenExchange::createDummyGroup(); failed to publish grp " << std::endl;
|
||||
#endif
|
||||
std::cerr << "RsGenExchange::createDummyGroup(); failed to publish grp " << std::endl;
|
||||
delete grp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue