- removed LinksCloud from plugins (based on obsolete cache system)

- removed copy constructor of RsGenericId from std::string as it allowed many inconsistencies and double transforms of IDs from/to strings


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7289 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-04-20 16:34:26 +00:00
parent 160e04fe9a
commit 33abca82e5
33 changed files with 97 additions and 143 deletions

View file

@ -1122,8 +1122,8 @@ bool p3GxsChannels::generatePost(uint32_t &token, const RsGxsGroupId &grpId)
msg.mMeta.mMsgName = msg.mMsg;
msg.mMeta.mGroupId = grpId;
msg.mMeta.mThreadId = "";
msg.mMeta.mParentId = "";
msg.mMeta.mThreadId.clear() ;
msg.mMeta.mParentId.clear() ;
msg.mMeta.mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_UNREAD;

View file

@ -440,7 +440,7 @@ RsGenExchange::ServiceCreate_Return p3GxsCircles::service_CreateGroup(RsGxsGrpIt
if (item->meta.mCircleType == GXS_CIRCLE_TYPE_EXT_SELF)
{
item->meta.mCircleType = GXS_CIRCLE_TYPE_EXTERNAL;
item->meta.mCircleId = item->meta.mGroupId.toStdString();
item->meta.mCircleId = RsGxsCircleId(item->meta.mGroupId);
}
@ -484,7 +484,7 @@ RsGxsCircleCache::RsGxsCircleCache()
bool RsGxsCircleCache::loadBaseCircle(const RsGxsCircleGroup &circle)
{
mCircleId = circle.mMeta.mGroupId.toStdString();
mCircleId = RsGxsCircleId(circle.mMeta.mGroupId);
mCircleName = circle.mMeta.mGroupName;
mUpdateTime = time(NULL);
mProcessedCircles.insert(mCircleId);

View file

@ -1138,7 +1138,7 @@ RsGxsIdCache::RsGxsIdCache(const RsGxsIdGroupItem *item, const RsTlvSecurityKey
// Fill in Details.
details.mNickname = item->meta.mGroupName;
details.mId = item->meta.mGroupId.toStdString();
details.mId = RsGxsId(item->meta.mGroupId);
#ifdef DEBUG_IDS
std::cerr << "RsGxsIdCache::RsGxsIdCache() for: " << details.mId;
@ -2018,7 +2018,7 @@ RsGenExchange::ServiceCreate_Return p3IdService::service_CreateGroup(RsGxsGrpIte
if(pk.keyFlags == (RSTLV_KEY_DISTRIB_ADMIN | RSTLV_KEY_TYPE_FULL))
{
item->group.mMeta.mGroupId = pk.keyId;
item->group.mMeta.mGroupId = RsGxsGroupId(pk.keyId);
break;
}
}
@ -2150,8 +2150,8 @@ RsGenExchange::ServiceCreate_Return p3IdService::service_CreateGroup(RsGxsGrpIte
}
// Enforce no AuthorId.
item->meta.mAuthorId = "";
item->group.mMeta.mAuthorId = "";
item->meta.mAuthorId.clear() ;
item->group.mMeta.mAuthorId.clear() ;
// copy meta data to be sure its all the same.
//item->group.mMeta = item->meta;
@ -2899,26 +2899,6 @@ void p3IdService::loadRecognKeys()
/************************************************************************************/
/************************************************************************************/
std::string p3IdService::genRandomId(int len)
{
std::string randomId;
for(int i = 0; i < len; i++)
{
int val = RSRandom::random_u32() % 16;
if (val < 10)
{
randomId += (char) ('0' + val);
}
else
{
randomId += (char) ('a' + (val - 10));
}
}
return randomId;
}
#define MAX_KNOWN_PGPIDS 20
#define MAX_UNKNOWN_PGPIDS 20
#define MAX_PSEUDOIDS 20
@ -3008,7 +2988,7 @@ void p3IdService::generateDummy_FriendPGP()
for(int j = 0; j < idx; j++, it++) ;
// HACK FOR DUMMY GENERATION.
id.mMeta.mAuthorId = it->toStdString();
id.mMeta.mAuthorId = RsGxsId::random() ;
RsPeerDetails details;
if (/*rsPeers->getPeerDetails(*it, details)*/false)
@ -3021,7 +3001,7 @@ void p3IdService::generateDummy_FriendPGP()
{
std::cerr << "p3IdService::generateDummy_FriendPGP() missing" << std::endl;
std::cerr << std::endl;
id.mMeta.mGroupName = genRandomId();
id.mMeta.mGroupName = RSRandom::random_alphaNumericString(10) ;
}
uint32_t dummyToken = 0;
@ -3037,9 +3017,9 @@ void p3IdService::generateDummy_UnknownPGP()
// FAKE DATA.
id.mMeta.mGroupFlags = RSGXSID_GROUPFLAG_REALID;
id.mPgpIdHash = genRandomId(40);
id.mPgpIdSign = genRandomId(40);
id.mMeta.mGroupName = genRandomId();
id.mPgpIdHash = Sha1CheckSum::random() ;
id.mPgpIdSign = RSRandom::random_alphaNumericString(20) ;
id.mMeta.mGroupName = RSRandom::random_alphaNumericString(10) ;
uint32_t dummyToken = 0;
createGroup(dummyToken, id);
@ -3054,7 +3034,7 @@ void p3IdService::generateDummy_UnknownPseudo()
// FAKE DATA.
id.mMeta.mGroupFlags = 0;
id.mMeta.mGroupName = genRandomId();
id.mMeta.mGroupName = RSRandom::random_alphaNumericString(10) ;
uint32_t dummyToken = 0;
createGroup(dummyToken, id);

View file

@ -359,17 +359,6 @@ std::ostream &operator<<(std::ostream &out, const RsWikiComment &comment)
/***** FOR TESTING *****/
std::string p3Wiki::genRandomId()
{
std::string randomId;
for(int i = 0; i < 20; i++)
{
randomId += (char) ('a' + (RSRandom::random_u32() % 26));
}
return randomId;
}
const int about_len = 10;
const std::string about_txt[] =
{ "Welcome to RsWiki, a fully distributed Wiki system that anyone can edit.",
@ -454,9 +443,9 @@ void p3Wiki::generateDummyData()
for(i = 0; i < GEN_COLLECTIONS; i++)
{
RsWikiCollection wiki;
wiki.mMeta.mGroupId = genRandomId();
wiki.mMeta.mGroupId = RsGxsGroupId::random();
wiki.mMeta.mGroupFlags = 0;
wiki.mMeta.mGroupName = genRandomId();
wiki.mMeta.mGroupName = RsGxsGroupId::random().toStdString();
uint32_t dummyToken = 0;
submitCollection(dummyToken, wiki);
@ -523,24 +512,19 @@ bool generateNextDummyPage(const RsGxsMessageId &threadId, const int lines, cons
#include <retroshare/rsidentity.h>
std::string chooseRandomAuthorId()
RsGxsId chooseRandomAuthorId()
{
/* chose a random Id to sign with */
std::list<RsGxsId> ownIds;
std::list<RsGxsId>::iterator it;
/* chose a random Id to sign with */
std::list<RsGxsId> ownIds;
std::list<RsGxsId>::iterator it;
rsIdentity->getOwnIds(ownIds);
rsIdentity->getOwnIds(ownIds);
uint32_t idx = (uint32_t) (ownIds.size() * RSRandom::random_f32());
int i = 0;
for(it = ownIds.begin(); (it != ownIds.end()) && (i < idx); it++, i++) ;
uint32_t idx = (uint32_t) (RSRandom::random_u32() % (int)ownIds.size()) ;
int i = 0;
for(it = ownIds.begin(); (it != ownIds.end()) && (i < idx); it++, i++) ;
RsGxsId answer;
if (it != ownIds.end())
{
answer = *it;
}
return answer.toStdString();
return *it ;
}