more refactoring for new types

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7135 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2014-02-19 22:16:07 +00:00
parent 1edc3c083f
commit 7dbbb7f0d4
12 changed files with 95 additions and 82 deletions

View file

@ -2187,7 +2187,7 @@ RsGeneralDataService* RsGenExchange::getDataStore()
bool RsGenExchange::getGroupKeys(const RsGxsGroupId &grpId, RsTlvSecurityKeySet &keySet)
{
if(grpId.empty())
if(grpId.isNull())
return false;
RsStackMutex stack(mGenMtx);
@ -2377,8 +2377,8 @@ void RsGenExchange::processRecvdGroups()
return;
NxsGrpPendValidVect::iterator vit = mReceivedGrps.begin();
std::vector<std::string> existingGrpIds;
std::list<std::string> grpIds;
std::vector<RsGxsGroupId> existingGrpIds;
std::list<RsGxsGroupId> grpIds;
std::map<RsNxsGrp*, RsGxsGrpMetaData*> grps;
@ -2489,7 +2489,7 @@ void RsGenExchange::performUpdateValidation()
if(mGroupUpdates.empty())
return;
std::map<std::string, RsGxsGrpMetaData*> grpMetas;
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetas;
std::vector<GroupUpdate>::iterator vit = mGroupUpdates.begin();
for(; vit != mGroupUpdates.end(); vit++)
@ -2504,7 +2504,7 @@ void RsGenExchange::performUpdateValidation()
for(; vit != mGroupUpdates.end(); vit++)
{
GroupUpdate& gu = *vit;
std::map<std::string, RsGxsGrpMetaData*>::iterator mit =
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit =
grpMetas.find(gu.newGrp->grpId);
gu.oldGrpMeta = mit->second;
gu.validUpdate = updateValid(*(gu.oldGrpMeta), *(gu.newGrp));
@ -2557,7 +2557,7 @@ bool RsGenExchange::updateValid(RsGxsGrpMetaData& oldGrpMeta, RsNxsGrp& newGrp)
RsTlvKeySignature adminSign = mit->second;
std::map<std::string, RsTlvSecurityKey>& keys = oldGrpMeta.keys.keys;
std::map<std::string, RsTlvSecurityKey>::iterator keyMit = keys.find(oldGrpMeta.mGroupId);
std::map<std::string, RsTlvSecurityKey>::iterator keyMit = keys.find(oldGrpMeta.mGroupId.toStdString());
if(keyMit == keys.end())
{

View file

@ -37,8 +37,8 @@ uint32_t RsGxsGrpMetaData::serial_size()
{
uint32_t s = 8; // header size
s += GetTlvStringSize(mGroupId);
s += GetTlvStringSize(mOrigGrpId);
s += mGroupId.serial_size();
s += mOrigGrpId.serial_size();
s += GetTlvStringSize(mGroupName);
s += 4;
s += 4;
@ -49,7 +49,7 @@ uint32_t RsGxsGrpMetaData::serial_size()
s += 4; // for mCircleType
s += GetTlvStringSize(mCircleId);
s += 4; // mAuthenFlag
s += GetTlvStringSize(mParentGrpId);
s += mParentGrpId.serial_size();
return s;
}
@ -104,9 +104,9 @@ bool RsGxsGrpMetaData::serialise(void *data, uint32_t &pktsize)
/* skip header */
offset += 8;
ok &= SetTlvString(data, tlvsize, &offset, 0, mGroupId);
ok &= SetTlvString(data, tlvsize, &offset, 0, mOrigGrpId);
ok &= SetTlvString(data, tlvsize, &offset, 0, mParentGrpId);
ok &= mGroupId.serialise(data, tlvsize, offset);
ok &= mOrigGrpId.serialise(data, tlvsize, offset);
ok &= mParentGrpId.serialise(data, tlvsize, offset);
ok &= SetTlvString(data, tlvsize, &offset, 0, mGroupName);
ok &= setRawUInt32(data, tlvsize, &offset, mGroupFlags);
ok &= setRawUInt32(data, tlvsize, &offset, mPublishTs);
@ -135,9 +135,9 @@ bool RsGxsGrpMetaData::deserialise(void *data, uint32_t &pktsize)
if(!ok) return false;
ok &= GetTlvString(data, pktsize, &offset, 0, mGroupId);
ok &= GetTlvString(data, pktsize, &offset, 0, mOrigGrpId);
ok &= GetTlvString(data, pktsize, &offset, 0, mParentGrpId);
ok &= mGroupId.deserialise(data, pktsize, offset);
ok &= mOrigGrpId.deserialise(data, pktsize, offset);
ok &= mParentGrpId.deserialise(data, pktsize, offset);
ok &= GetTlvString(data, pktsize, &offset, 0, mGroupName);
ok &= getRawUInt32(data, pktsize, &offset, &mGroupFlags);
ok &= getRawUInt32(data, pktsize, &offset, &mPublishTs);
@ -170,7 +170,7 @@ uint32_t RsGxsMsgMetaData::serial_size()
uint32_t s = 8; // header size
s += GetTlvStringSize(mGroupId);
s += mGroupId.serial_size();
s += GetTlvStringSize(mMsgId);
s += GetTlvStringSize(mThreadId);
s += GetTlvStringSize(mParentId);
@ -227,7 +227,7 @@ bool RsGxsMsgMetaData::serialise(void *data, uint32_t *size)
/* skip header */
offset += 8;
ok &= SetTlvString(data, *size, &offset, 0, mGroupId);
ok &= mGroupId.serialise(data, *size, offset);
ok &= SetTlvString(data, *size, &offset, 0, mMsgId);
ok &= SetTlvString(data, *size, &offset, 0, mThreadId);
ok &= SetTlvString(data, *size, &offset, 0, mParentId);
@ -254,7 +254,7 @@ bool RsGxsMsgMetaData::deserialise(void *data, uint32_t *size)
if(!ok) return false;
ok &= GetTlvString(data, *size, &offset, 0, mGroupId);
ok &= mGroupId.deserialise(data, *size, offset);
ok &= GetTlvString(data, *size, &offset, 0, mMsgId);
ok &= GetTlvString(data, *size, &offset, 0, mThreadId);
ok &= GetTlvString(data, *size, &offset, 0, mParentId);

View file

@ -65,7 +65,7 @@ RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds)
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts,
const std::list<std::string> &groupIds)
const std::list<RsGxsGroupId> &groupIds)
{
if(groupIds.empty())
{
@ -854,7 +854,7 @@ bool RsGxsDataAccess::getGroupList(const std::list<RsGxsGroupId>& grpIdsIn, cons
mDataStore->retrieveGxsGrpMetaData(grpMeta);
std::map<std::string, RsGxsGrpMetaData*>::iterator mit = grpMeta.begin();
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMeta.begin();
for(; mit != grpMeta.end(); mit++)
{
@ -958,8 +958,8 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions&
std::vector<RsGxsMsgMetaData*>::const_iterator vit = metaV.begin();
// RUN THROUGH ALL MSGS... in map origId -> TS.
std::map<RsGxsGroupId, std::pair<RsGxsMessageId, time_t> > origMsgTs;
std::map<RsGxsGroupId, std::pair<RsGxsMessageId, time_t> >::iterator oit;
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> > origMsgTs;
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> >::iterator oit;
for(; vit != metaV.end(); vit++)
{

View file

@ -108,7 +108,7 @@ void RsGxsNetService::syncWithPeers()
}
}
#ifdef GXS_ENABLE_SYNC_MSGS
#ifndef GXS_DISABLE_SYNC_MSGS
std::map<RsGxsGroupId, RsGxsGrpMetaData* > grpMeta;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
@ -513,7 +513,7 @@ void RsGxsNetService::collateGrpFragments(GrpFragments fragments,
struct MsgFragCollate
{
RsGxsGroupId mMsgId;
RsGxsMessageId mMsgId;
MsgFragCollate(const RsGxsMessageId& msgId) : mMsgId(msgId){ }
bool operator()(RsNxsMsg* msg) { return msg->msgId == mMsgId;}
};
@ -1256,13 +1256,13 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
std::vector<RsNxsMsg*> msgs;
std::string grpId;
RsGxsGroupId grpId;
while(tr->mItems.size() > 0)
{
RsNxsMsg* msg = dynamic_cast<RsNxsMsg*>(tr->mItems.front());
if(msg)
{
if(grpId.empty())
if(grpId.isNull())
grpId = msg->grpId;
tr->mItems.pop_front();
@ -1307,7 +1307,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
return;
}
void RsGxsNetService::locked_doMsgUpdateWork(const RsNxsTransac *nxsTrans, const std::string &grpId)
void RsGxsNetService::locked_doMsgUpdateWork(const RsNxsTransac *nxsTrans, const RsGxsGroupId &grpId)
{
// firts check if peer exists
@ -1457,7 +1457,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
// get grp id for this transaction
RsNxsSyncMsgItem* item = msgItemL.front();
const std::string& grpId = item->grpId;
const RsGxsGroupId& grpId = item->grpId;
// std::map<std::string, RsGxsGrpMetaData*> grpMetaMap;
// grpMetaMap[grpId] = NULL;
@ -1590,7 +1590,7 @@ void RsGxsNetService::locked_pushGrpTransactionFromList(
delete newTrans;
}
void RsGxsNetService::addGroupItemToList(NxsTransaction*& tr,
const std::string& grpId, uint32_t& transN,
const RsGxsGroupId& grpId, uint32_t& transN,
std::list<RsNxsItem*>& reqList)
{
RsNxsSyncGrpItem* grpItem = new RsNxsSyncGrpItem(mServType);
@ -1644,7 +1644,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
for(; llit != grpItemL.end(); llit++)
{
RsNxsSyncGrpItem*& grpSyncItem = *llit;
const std::string& grpId = grpSyncItem->grpId;
const RsGxsGroupId& grpId = grpSyncItem->grpId;
metaIter = grpMetaMap.find(grpId);
bool haveItem = false;
bool latestVersion = false;
@ -1724,7 +1724,7 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
std::list<RsNxsItem*>::iterator lit = tr->mItems.begin();
std::map<std::string, RsNxsGrp*> grps;
std::map<RsGxsGroupId, RsNxsGrp*> grps;
for(;lit != tr->mItems.end(); lit++)
{
@ -1755,7 +1755,7 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
uint32_t transN = locked_getTransactionId();
// store grp items to send in transaction
std::map<std::string, RsNxsGrp*>::iterator mit = grps.begin();
std::map<RsGxsGroupId, RsNxsGrp*>::iterator mit = grps.begin();
RsPeerId peerId = tr->mTransaction->PeerId();
for(;mit != grps.end(); mit++)
{
@ -1893,7 +1893,7 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
return;
}
std::string grpId = "";
RsGxsGroupId grpId;
for(;lit != tr->mItems.end(); lit++)
{
@ -1902,7 +1902,7 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
{
msgIds[item->grpId].push_back(item->msgId);
if(grpId.empty())
if(grpId.isNull())
grpId = item->grpId;
}
else
@ -2073,13 +2073,13 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrp* item)
std::map<std::string, RsGxsGrpMetaData*> grp;
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grp;
mDataStore->retrieveGxsGrpMetaData(grp);
if(grp.empty())
return;
std::map<std::string, RsGxsGrpMetaData*>::iterator mit =
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit =
grp.begin();
std::list<RsNxsItem*> itemL;
@ -2213,7 +2213,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsg* item)
GxsMsgMetaResult metaResult;
GxsMsgReq req;
std::map<std::string, RsGxsGrpMetaData*> grpMetas;
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetas;
grpMetas[item->grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetas);
RsGxsGrpMetaData* grpMeta = grpMetas[item->grpId];

View file

@ -318,14 +318,14 @@ private:
void locked_pushMsgRespFromList(std::list<RsNxsItem*>& itemL, const RsPeerId& sslId, const uint32_t& transN);
void syncWithPeers();
void addGroupItemToList(NxsTransaction*& tr,
const std::string& grpId, uint32_t& transN,
const RsGxsGroupId& grpId, uint32_t& transN,
std::list<RsNxsItem*>& reqList);
bool locked_canReceive(const RsGxsGrpMetaData * const grpMeta, const RsPeerId& peerId);
void processExplicitGroupRequests();
void locked_doMsgUpdateWork(const RsNxsTransac* nxsTrans, const std::string& grpId);
void locked_doMsgUpdateWork(const RsNxsTransac* nxsTrans, const RsGxsGroupId& grpId);
void updateServerSyncTS();
@ -442,7 +442,7 @@ private:
public:
typedef std::map<RsPeerId, RsGxsMsgUpdateItem*> ClientMsgMap;
typedef std::map<std::string, RsGxsServerMsgUpdateItem*> ServerMsgMap;
typedef std::map<RsGxsGroupId, RsGxsServerMsgUpdateItem*> ServerMsgMap;
typedef std::map<RsPeerId, RsGxsGrpUpdateItem*> ClientGrpMap;
private:

View file

@ -50,7 +50,7 @@ class GroupMetaReq : public GxsRequest
{
public:
std::list<std::string> mGroupIds;
std::list<RsGxsGroupId> mGroupIds;
std::list<RsGxsGrpMetaData*> mGroupMetaData;
};
@ -59,8 +59,8 @@ class GroupIdReq : public GxsRequest
public:
std::list<std::string> mGroupIds;
std::list<std::string> mGroupIdResult;
std::list<RsGxsGroupId> mGroupIds;
std::list<RsGxsGroupId> mGroupIdResult;
};
class GroupDataReq : public GxsRequest

View file

@ -60,13 +60,13 @@ public:
uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK.
time_t mPublishTs; // Mandatory.
RsPeerId mAuthorId; // Optional.
std::string mAuthorId; // Optional.
// for circles
std::string mCircleId;
uint32_t mCircleType;
uint32_t mAuthenFlags;
std::string mParentGrpId;
RsGxsGroupId mParentGrpId;
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
@ -109,7 +109,7 @@ public:
std::string mParentId;
std::string mOrigMsgId;
RsPeerId mAuthorId;
std::string mAuthorId;
std::string mMsgName;
time_t mPublishTs;

View file

@ -94,7 +94,7 @@ public:
virtual void clear();
virtual std::ostream &print(std::ostream &out, uint16_t indent);
std::string grpId;
RsGxsGroupId grpId;
uint32_t msgUpdateTS; // the last time this group received a new msg
};

View file

@ -203,7 +203,7 @@ bool RsNxsSerialiser::serialiseNxsSynMsgItem(RsNxsSyncMsgItem *item, void *data,
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
ok &= setRawUInt8(data, *size, &offset, item->flag);
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
ok &= item->grpId.serialise(data, *size, offset);
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID, item->msgId);
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
@ -454,7 +454,7 @@ bool RsNxsSerialiser::serialiseNxsSyncGrpItem(RsNxsSyncGrpItem *item, void *data
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
ok &= setRawUInt8(data, *size, &offset, item->flag);
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
ok &= item->grpId.serialise(data, *size, offset);
ok &= setRawUInt32(data, *size, &offset, item->publishTs);
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
@ -504,7 +504,7 @@ bool RsNxsSerialiser::serialiseNxsSyncMsg(RsNxsSyncMsg *item, void *data, uint32
ok &= setRawUInt8(data, *size, &offset, item->flag);
ok &= setRawUInt32(data, *size, &offset, item->createdSince);
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
ok &= item->grpId.serialise(data, *size, offset);
ok &= setRawUInt32(data, *size, &offset, item->updateTS);
if(offset != tlvsize){
@ -780,7 +780,7 @@ RsNxsSyncGrpItem* RsNxsSerialiser::deserialNxsSyncGrpItem(void *data, uint32_t *
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
ok &= item->grpId.deserialise(data, *size, offset);
ok &= getRawUInt32(data, *size, &offset, &(item->publishTs));
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
@ -916,7 +916,7 @@ RsNxsSyncMsgItem* RsNxsSerialiser::deserialNxsSyncMsgItem(void *data, uint32_t *
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
ok &= item->grpId.deserialise(data, *size, offset);
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID, item->msgId);
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
@ -989,7 +989,7 @@ RsNxsSyncMsg* RsNxsSerialiser::deserialNxsSyncMsg(void *data, uint32_t *size)
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
ok &= getRawUInt32(data, *size, &offset, &(item->createdSince));
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
ok &= item->grpId.deserialise(data, *size, offset);
ok &= getRawUInt32(data, *size, &offset, &(item->updateTS));
if (offset != rssize)
@ -1074,7 +1074,7 @@ uint32_t RsNxsSerialiser::sizeNxsSyncGrpItem(RsNxsSyncGrpItem *item)
s += 4; // transaction number
s += 4; // publishTs
s += 1; // flag
s += GetTlvStringSize(item->grpId);
s += item->grpId.serial_size();
s += GetTlvStringSize(item->authorId);
return s;
@ -1089,7 +1089,7 @@ uint32_t RsNxsSerialiser::sizeNxsSyncMsg(RsNxsSyncMsg *item)
s += 4; // transaction number
s += 1; // flag
s += 4; // age
s += GetTlvStringSize(item->grpId);
s += item->grpId.serial_size();
s += GetTlvStringSize(item->syncHash);
s += 4; // updateTS
@ -1103,7 +1103,7 @@ uint32_t RsNxsSerialiser::sizeNxsSyncMsgItem(RsNxsSyncMsgItem *item)
s += 4; // transaction number
s += 1; // flag
s += GetTlvStringSize(item->grpId);
s += item->grpId.serial_size();
s += GetTlvStringSize(item->msgId);
s += GetTlvStringSize(item->authorId);

View file

@ -178,7 +178,7 @@ public:
uint32_t publishTs; // to compare to Ts of receiving peer's grp of same id
/// grpId of grp held by sending peer
std::string grpId;
RsGxsGroupId grpId;
std::string authorId;
};
@ -237,7 +237,7 @@ public:
virtual void clear();
virtual std::ostream &print(std::ostream &out, uint16_t indent);
std::string grpId;
RsGxsGroupId grpId;
uint8_t flag;
uint32_t createdSince;
uint32_t updateTS; // time of last update
@ -261,7 +261,7 @@ public:
virtual std::ostream &print(std::ostream &out, uint16_t indent);
uint8_t flag; // response/req
std::string grpId;
RsGxsGroupId grpId;
std::string msgId;
std::string authorId;

View file

@ -628,7 +628,7 @@ bool p3IdService::createGroup(uint32_t& token, RsGxsIdGroup &group)
bool p3IdService::updateGroup(uint32_t& token, RsGxsIdGroup &group)
{
RsGxsId id = group.mMeta.mGroupId;
RsGxsId id = group.mMeta.mGroupId.toStdString();
RsGxsIdGroupItem* item = new RsGxsIdGroupItem();
item->group = group;
item->meta = group.mMeta;
@ -1009,7 +1009,7 @@ RsGxsIdCache::RsGxsIdCache(const RsGxsIdGroupItem *item, const RsTlvSecurityKey
// Fill in Details.
details.mNickname = item->meta.mGroupName;
details.mId = item->meta.mGroupId;
details.mId = item->meta.mGroupId.toStdString();
#ifdef DEBUG_IDS
std::cerr << "RsGxsIdCache::RsGxsIdCache() for: " << details.mId;
@ -1205,7 +1205,7 @@ bool p3IdService::cache_process_recogntaginfo(const RsGxsIdGroupItem *item, std:
{
RsRecognTag info((*it)->tag_class, (*it)->tag_type, false);
bool isPending = false;
if (recogn_checktag(item->meta.mGroupId, item->meta.mGroupName, *it, false, isPending))
if (recogn_checktag(item->meta.mGroupId.toStdString(), item->meta.mGroupName, *it, false, isPending))
{
info.valid = true;
}
@ -1256,8 +1256,8 @@ bool p3IdService::cache_store(const RsGxsIdGroupItem *item)
bool pub_key_ok = false;
bool full_key_ok = false;
RsGxsId id = item->meta.mGroupId;
if (!getGroupKeys(id, keySet))
RsGxsId id = item->meta.mGroupId.toStdString();
if (!getGroupKeys(RsGxsGroupId(id), keySet))
{
std::cerr << "p3IdService::cache_store() ERROR getting GroupKeys for: ";
std::cerr << item->meta.mGroupId;
@ -1378,7 +1378,7 @@ bool p3IdService::cache_start_load()
std::cerr << "p3IdService::cache_start_load() GroupId: " << it->first;
std::cerr << std::endl;
#endif // DEBUG_IDS
groupIds.push_back(it->first); // might need conversion?
groupIds.push_back(RsGxsGroupId(it->first)); // might need conversion?
}
mPendingCache.insert(mCacheLoad_ToCache.begin(), mCacheLoad_ToCache.end());
@ -1438,7 +1438,7 @@ bool p3IdService::cache_load_for_token(uint32_t token)
{
// remove identities that are present
RsStackMutex stack(mIdMtx);
mPendingCache.erase(item->meta.mGroupId);
mPendingCache.erase(item->meta.mGroupId.toStdString());
}
/* cache the data */
@ -1497,8 +1497,16 @@ void p3IdService::requestIdsFromNet()
for(cit2 = requests.begin(); cit2 != requests.end(); cit2++)
{
if(mNes)
mNes->requestGrp(cit2->second, cit2->first);
{
std::list<RsGxsId>::const_iterator gxs_id_it = cit2->second.begin();
std::list<RsGxsGroupId> grpIds;
for(; gxs_id_it != cit2->second.end(); gxs_id_it++)
grpIds.push_back(RsGxsGroupId(*gxs_id_it));
mNes->requestGrp(grpIds, cit2->first);
}
}
mIdsNotPresent.clear();
@ -1599,7 +1607,7 @@ bool p3IdService::cache_load_ownids(uint32_t token)
if (item->meta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
{
mOwnIds.push_back(item->meta.mGroupId);
mOwnIds.push_back(item->meta.mGroupId.toStdString());
}
delete item ;
}
@ -1668,7 +1676,12 @@ bool p3IdService::cachetest_handlerequest(uint32_t token)
#endif // DEBUG_IDS
std::list<RsGxsId> grpIds;
bool ok = RsGenExchange::getGroupList(token, grpIds);
std::list<RsGxsGroupId> grpIdsC;
bool ok = RsGenExchange::getGroupList(token, grpIdsC);
std::list<RsGxsGroupId>::const_iterator cit = grpIdsC.begin();
for(; cit != grpIdsC.end(); cit++)
grpIds.push_back(cit->toStdString());
if(ok)
{
@ -1963,7 +1976,7 @@ RsGenExchange::ServiceCreate_Return p3IdService::service_CreateGroup(RsGxsGrpIte
std::cerr << "p3IdService::service_CreateGroup() OwnFingerprint: " << ownFinger.toStdString();
std::cerr << std::endl;
calcPGPHash(item->group.mMeta.mGroupId, ownFinger, hash);
calcPGPHash(item->group.mMeta.mGroupId.toStdString(), ownFinger, hash);
item->group.mPgpIdHash = hash.toStdString();
#ifdef DEBUG_IDS
@ -2254,7 +2267,7 @@ bool p3IdService::pgphash_process()
std::string serviceString = ssdata.save();
setGroupServiceString(dummyToken, pg.mMeta.mGroupId, serviceString);
cache_update_if_cached(pg.mMeta.mGroupId, serviceString);
cache_update_if_cached(pg.mMeta.mGroupId.toStdString(), serviceString);
// Schedule Next Processing.
RsTickEvent::schedule_in(GXSID_EVENT_PGPHASH_PROC, PGPHASH_PROC_PERIOD);
@ -2299,7 +2312,7 @@ bool p3IdService::checkId(const RsGxsIdGroup &grp, PGPIdType &pgpId)
for(mit = mPgpFingerprintMap.begin(); mit != mPgpFingerprintMap.end(); mit++)
{
GxsIdPgpHash hash;
calcPGPHash(grp.mMeta.mGroupId, mit->second, hash);
calcPGPHash(grp.mMeta.mGroupId.toStdString(), mit->second, hash);
if (ans == hash)
{
std::cerr << "p3IdService::checkId() HASH MATCH!";
@ -2621,7 +2634,7 @@ bool p3IdService::recogn_process()
for(it = tagItems.begin(); it != tagItems.end(); it++)
{
bool isTagPending = false;
bool isTagOk = recogn_checktag(item->meta.mGroupId, item->meta.mGroupName, *it, true, isPending);
bool isTagOk = recogn_checktag(item->meta.mGroupId.toStdString(), item->meta.mGroupName, *it, true, isPending);
if (isTagOk)
{
tagValidFlags |= i;
@ -2652,7 +2665,7 @@ bool p3IdService::recogn_process()
std::string serviceString = ssdata.save();
setGroupServiceString(dummyToken, item->meta.mGroupId, serviceString);
cache_update_if_cached(item->meta.mGroupId, serviceString);
cache_update_if_cached(item->meta.mGroupId.toStdString(), serviceString);
delete item;
@ -3239,7 +3252,7 @@ bool p3IdService::background_requestGroups()
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts;
std::list<std::string> groupIds;
std::list<RsGxsGroupId> groupIds;
/**
TODO
@ -3268,7 +3281,7 @@ bool p3IdService::background_requestNewMessages()
std::list<RsGroupMetaData> modGroupList;
std::list<RsGroupMetaData>::iterator it;
std::list<std::string> groupIds;
std::list<RsGxsGroupId> groupIds;
uint32_t token = 0;
{
@ -3351,7 +3364,7 @@ bool p3IdService::background_processNewMessages()
* If a message is not an original -> store groupId for requiring full analysis later.
*/
std::map<std::string, RsGroupMetaData>::iterator mit;
std::map<RsGxsGroupId, RsGroupMetaData>::iterator mit;
for (it = newMsgMap.begin(); it != newMsgMap.end(); it++)
{
@ -3513,7 +3526,7 @@ bool p3IdService::background_FullCalcRequest()
* - request all latest mesgs
*/
std::list<std::string> groupIds;
std::list<RsGxsGroupId> groupIds;
{
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
mBgPhase = ID_BG_REQUEST_FULLCALC;
@ -3586,13 +3599,13 @@ bool p3IdService::background_processFullCalc()
return false;
}
std::string groupId;
RsGxsGroupId groupId;
for(vit = opinions.begin(); vit != opinions.end(); vit++)
{
RsGxsIdOpinion &opinion = *vit;
/* These should all be same group - should check for sanity! */
if (groupId == "")
if (groupId.isNull())
{
groupId = opinion.mMeta.mGroupId;
}

View file

@ -420,8 +420,8 @@ std::string genRandomId(int len = 20);
uint32_t mBgToken;
uint32_t mBgPhase;
std::map<std::string, RsGroupMetaData> mBgGroupMap;
std::list<std::string> mBgFullCalcGroups;
std::map<RsGxsGroupId, RsGroupMetaData> mBgGroupMap;
std::list<RsGxsGroupId> mBgFullCalcGroups;
/************************************************************************
* Other Data that is protected by the Mutex.