mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 17:21:27 -05:00
- 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:
parent
160e04fe9a
commit
33abca82e5
@ -882,7 +882,7 @@ bool CacheStrapper::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
// Fixup lazy behaviour in clients...
|
// Fixup lazy behaviour in clients...
|
||||||
// This ensures correct loading later.
|
// This ensures correct loading later.
|
||||||
// (used to be: rscc->pid = cit->pid;)
|
// (used to be: rscc->pid = cit->pid;)
|
||||||
rscc->pid = ownId.toStdString();
|
rscc->pid = ownId;
|
||||||
|
|
||||||
//rscc->pname = cit->pname;
|
//rscc->pname = cit->pname;
|
||||||
rscc->cachetypeid = cit->cid.type;
|
rscc->cachetypeid = cit->cid.type;
|
||||||
@ -909,7 +909,7 @@ bool CacheStrapper::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
|
|
||||||
RsCacheConfig *rscc = new RsCacheConfig();
|
RsCacheConfig *rscc = new RsCacheConfig();
|
||||||
|
|
||||||
rscc->pid = cit->pid.toStdString();
|
rscc->pid = cit->pid;
|
||||||
//rscc->pname = cit->pname;
|
//rscc->pname = cit->pname;
|
||||||
rscc->cachetypeid = cit->cid.type;
|
rscc->cachetypeid = cit->cid.type;
|
||||||
rscc->cachesubid = cit->cid.subid;
|
rscc->cachesubid = cit->cid.subid;
|
||||||
|
@ -199,7 +199,7 @@ HashCache::HashCache(const std::string& path)
|
|||||||
|
|
||||||
f->getline(buff,max_line_size,'\n') ; if(sscanf(buff,RsDirUtil::scanf_string_for_uint(sizeof(info.time_stamp)),&info.time_stamp) != 1) { std::cerr << "Could not read one entry! Giving up." << std::endl; break ; }
|
f->getline(buff,max_line_size,'\n') ; if(sscanf(buff,RsDirUtil::scanf_string_for_uint(sizeof(info.time_stamp)),&info.time_stamp) != 1) { std::cerr << "Could not read one entry! Giving up." << std::endl; break ; }
|
||||||
f->getline(buff,max_line_size,'\n') ; if(sscanf(buff,RsDirUtil::scanf_string_for_uint(sizeof(info.modf_stamp)),&info.modf_stamp) != 1) { std::cerr << "Could not read one entry! Giving up." << std::endl; break ; }
|
f->getline(buff,max_line_size,'\n') ; if(sscanf(buff,RsDirUtil::scanf_string_for_uint(sizeof(info.modf_stamp)),&info.modf_stamp) != 1) { std::cerr << "Could not read one entry! Giving up." << std::endl; break ; }
|
||||||
f->getline(buff,max_line_size,'\n') ; info.hash = std::string(buff) ;
|
f->getline(buff,max_line_size,'\n') ; info.hash = RsFileHash(std::string(buff)) ;
|
||||||
|
|
||||||
#ifdef FIM_DEBUG
|
#ifdef FIM_DEBUG
|
||||||
std::cerr << " (" << name << ", " << info.size << ", " << info.time_stamp << ", " << info.modf_stamp << ", " << info.hash << std::endl ;
|
std::cerr << " (" << name << ", " << info.size << ", " << info.time_stamp << ", " << info.modf_stamp << ", " << info.hash << std::endl ;
|
||||||
|
@ -941,7 +941,7 @@ int FileIndex::loadIndex(const std::string& filename, const RsFileHash& expected
|
|||||||
nfile = new FileEntry();
|
nfile = new FileEntry();
|
||||||
registerEntry((void*)nfile) ;
|
registerEntry((void*)nfile) ;
|
||||||
nfile->name = tokens[0];
|
nfile->name = tokens[0];
|
||||||
nfile->hash = tokens[1];
|
nfile->hash = RsFileHash(tokens[1]);
|
||||||
nfile->size = atoll(tokens[2].c_str());
|
nfile->size = atoll(tokens[2].c_str());
|
||||||
nfile->modtime = atoi(tokens[3].c_str());
|
nfile->modtime = atoi(tokens[3].c_str());
|
||||||
nfile->pop = atoi(tokens[4].c_str());
|
nfile->pop = atoi(tokens[4].c_str());
|
||||||
@ -1051,7 +1051,7 @@ int FileIndex::saveIndex(const std::string& filename, RsFileHash &fileHash, uint
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileHash = RsDirUtil::sha1sum((unsigned char *)compressed_data,compressed_data_size).toStdString() ;
|
fileHash = RsDirUtil::sha1sum((unsigned char *)compressed_data,compressed_data_size);
|
||||||
|
|
||||||
std::cerr << " file = " << filename << std::endl;
|
std::cerr << " file = " << filename << std::endl;
|
||||||
std::cerr << " old size = " << s.length() << std::endl;
|
std::cerr << " old size = " << s.length() << std::endl;
|
||||||
|
@ -280,19 +280,19 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
|
|||||||
// grpId
|
// grpId
|
||||||
std::string tempId;
|
std::string tempId;
|
||||||
c.getString(COL_GRP_ID, tempId);
|
c.getString(COL_GRP_ID, tempId);
|
||||||
grpMeta->mGroupId = tempId;
|
grpMeta->mGroupId = RsGxsGroupId(tempId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
c.getString(COL_IDENTITY, tempId);
|
c.getString(COL_IDENTITY, tempId);
|
||||||
grpMeta->mAuthorId = tempId;
|
grpMeta->mAuthorId = RsGxsId(tempId);
|
||||||
c.getString(COL_GRP_NAME, grpMeta->mGroupName);
|
c.getString(COL_GRP_NAME, grpMeta->mGroupName);
|
||||||
c.getString(COL_ORIG_GRP_ID, tempId);
|
c.getString(COL_ORIG_GRP_ID, tempId);
|
||||||
grpMeta->mOrigGrpId = tempId;
|
grpMeta->mOrigGrpId = RsGxsGroupId(tempId);
|
||||||
c.getString(COL_GRP_SERV_STRING, grpMeta->mServiceString);
|
c.getString(COL_GRP_SERV_STRING, grpMeta->mServiceString);
|
||||||
std::string temp;
|
std::string temp;
|
||||||
c.getString(COL_HASH, temp);
|
c.getString(COL_HASH, temp);
|
||||||
grpMeta->mHash = temp;
|
grpMeta->mHash = RsFileHash(temp);
|
||||||
grpMeta->mReputationCutOff = c.getInt32(COL_GRP_REP_CUTOFF);
|
grpMeta->mReputationCutOff = c.getInt32(COL_GRP_REP_CUTOFF);
|
||||||
grpMeta->mSignFlags = c.getInt32(COL_GRP_SIGN_FLAGS);
|
grpMeta->mSignFlags = c.getInt32(COL_GRP_SIGN_FLAGS);
|
||||||
|
|
||||||
@ -318,10 +318,10 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
|
|||||||
grpMeta->mGroupStatus = c.getInt32(COL_GRP_STATUS);
|
grpMeta->mGroupStatus = c.getInt32(COL_GRP_STATUS);
|
||||||
|
|
||||||
c.getString(COL_GRP_CIRCLE_ID, tempId);
|
c.getString(COL_GRP_CIRCLE_ID, tempId);
|
||||||
grpMeta->mCircleId = tempId;
|
grpMeta->mCircleId = RsGxsCircleId(tempId);
|
||||||
grpMeta->mCircleType = c.getInt32(COL_GRP_CIRCL_TYPE);
|
grpMeta->mCircleType = c.getInt32(COL_GRP_CIRCL_TYPE);
|
||||||
c.getString(COL_GRP_INTERN_CIRCLE, tempId);
|
c.getString(COL_GRP_INTERN_CIRCLE, tempId);
|
||||||
grpMeta->mInternalCircle = tempId;
|
grpMeta->mInternalCircle = RsGxsCircleId(tempId);
|
||||||
|
|
||||||
std::string s ; c.getString(COL_GRP_ORIGINATOR, s) ;
|
std::string s ; c.getString(COL_GRP_ORIGINATOR, s) ;
|
||||||
grpMeta->mOriginator = RsPeerId(s);
|
grpMeta->mOriginator = RsPeerId(s);
|
||||||
@ -330,7 +330,7 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
|
|||||||
|
|
||||||
|
|
||||||
c.getString(COL_PARENT_GRP_ID, tempId);
|
c.getString(COL_PARENT_GRP_ID, tempId);
|
||||||
grpMeta->mParentGrpId = tempId;
|
grpMeta->mParentGrpId = RsGxsGroupId(tempId);
|
||||||
|
|
||||||
if(ok)
|
if(ok)
|
||||||
return grpMeta;
|
return grpMeta;
|
||||||
@ -410,19 +410,19 @@ RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
|
|||||||
msgMeta->mGroupId = RsGxsGroupId(gId);
|
msgMeta->mGroupId = RsGxsGroupId(gId);
|
||||||
std::string temp;
|
std::string temp;
|
||||||
c.getString(COL_MSG_ID, temp);
|
c.getString(COL_MSG_ID, temp);
|
||||||
msgMeta->mMsgId = temp;
|
msgMeta->mMsgId = RsGxsMessageId(temp);
|
||||||
// without these, a msg is meaningless
|
// without these, a msg is meaningless
|
||||||
ok &= (!msgMeta->mGroupId.isNull()) && (!msgMeta->mMsgId.isNull());
|
ok &= (!msgMeta->mGroupId.isNull()) && (!msgMeta->mMsgId.isNull());
|
||||||
|
|
||||||
c.getString(COL_ORIG_MSG_ID, temp);
|
c.getString(COL_ORIG_MSG_ID, temp);
|
||||||
msgMeta->mOrigMsgId = temp;
|
msgMeta->mOrigMsgId = RsGxsMessageId(temp);
|
||||||
c.getString(COL_IDENTITY, temp);
|
c.getString(COL_IDENTITY, temp);
|
||||||
msgMeta->mAuthorId = temp;
|
msgMeta->mAuthorId = RsGxsId(temp);
|
||||||
c.getString(COL_MSG_NAME, msgMeta->mMsgName);
|
c.getString(COL_MSG_NAME, msgMeta->mMsgName);
|
||||||
c.getString(COL_MSG_SERV_STRING, msgMeta->mServiceString);
|
c.getString(COL_MSG_SERV_STRING, msgMeta->mServiceString);
|
||||||
|
|
||||||
c.getString(COL_HASH, temp);
|
c.getString(COL_HASH, temp);
|
||||||
msgMeta->mHash = temp;
|
msgMeta->mHash = RsFileHash(temp);
|
||||||
msgMeta->recvTS = c.getInt32(COL_MSG_RECV_TS);
|
msgMeta->recvTS = c.getInt32(COL_MSG_RECV_TS);
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
@ -437,9 +437,9 @@ RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
|
|||||||
|
|
||||||
// thread and parent id
|
// thread and parent id
|
||||||
c.getString(COL_THREAD_ID, temp);
|
c.getString(COL_THREAD_ID, temp);
|
||||||
msgMeta->mThreadId = temp;
|
msgMeta->mThreadId = RsGxsMessageId(temp);
|
||||||
c.getString(COL_PARENT_ID, temp);
|
c.getString(COL_PARENT_ID, temp);
|
||||||
msgMeta->mParentId = temp;
|
msgMeta->mParentId = RsGxsMessageId(temp);
|
||||||
|
|
||||||
// local meta
|
// local meta
|
||||||
msgMeta->mMsgStatus = c.getInt32(COL_MSG_STATUS);
|
msgMeta->mMsgStatus = c.getInt32(COL_MSG_STATUS);
|
||||||
@ -467,7 +467,7 @@ RsNxsMsg* RsDataService::locked_getMessage(RetroCursor &c)
|
|||||||
c.getStringT<RsGxsGroupId>(COL_ACT_GROUP_ID, msg->grpId);
|
c.getStringT<RsGxsGroupId>(COL_ACT_GROUP_ID, msg->grpId);
|
||||||
std::string temp;
|
std::string temp;
|
||||||
c.getString(COL_ACT_MSG_ID, temp);
|
c.getString(COL_ACT_MSG_ID, temp);
|
||||||
msg->msgId = temp;
|
msg->msgId = RsGxsMessageId(temp);
|
||||||
|
|
||||||
ok &= (!msg->grpId.isNull()) && (!msg->msgId.isNull());
|
ok &= (!msg->grpId.isNull()) && (!msg->msgId.isNull());
|
||||||
|
|
||||||
@ -1437,7 +1437,7 @@ void RsDataService::locked_getMessageOffsets(const RsGxsGroupId& grpId, std::vec
|
|||||||
int32_t msgOffSet;
|
int32_t msgOffSet;
|
||||||
std::string temp;
|
std::string temp;
|
||||||
c->getString(0, temp);
|
c->getString(0, temp);
|
||||||
msgId = temp;
|
msgId = RsGxsMessageId(temp);
|
||||||
msgOffSet = c->getInt32(1);
|
msgOffSet = c->getInt32(1);
|
||||||
msgLen = c->getInt32(2);
|
msgLen = c->getInt32(2);
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ bool RsPluginManager::loadPlugin(RsPlugin *p)
|
|||||||
PluginInfo pinfo ;
|
PluginInfo pinfo ;
|
||||||
pinfo.plugin = p ;
|
pinfo.plugin = p ;
|
||||||
pinfo.file_name = "No file" ;
|
pinfo.file_name = "No file" ;
|
||||||
pinfo.file_hash = "No hash" ;
|
pinfo.file_hash.clear() ;
|
||||||
pinfo.info_string = "" ;
|
pinfo.info_string = "" ;
|
||||||
|
|
||||||
p->setPlugInHandler(this); // WIN fix, cannot share global space with shared libraries
|
p->setPlugInHandler(this); // WIN fix, cannot share global space with shared libraries
|
||||||
@ -456,7 +456,7 @@ bool RsPluginManager::loadList(std::list<RsItem*>& list)
|
|||||||
}
|
}
|
||||||
else if((*kit).key == "REFERENCE_EXECUTABLE_HASH")
|
else if((*kit).key == "REFERENCE_EXECUTABLE_HASH")
|
||||||
{
|
{
|
||||||
reference_executable_hash = kit->value ;
|
reference_executable_hash = RsFileHash(kit->value) ;
|
||||||
std::cerr << " Reference executable hash: " << kit->value << std::endl;
|
std::cerr << " Reference executable hash: " << kit->value << std::endl;
|
||||||
}
|
}
|
||||||
else if((*kit).key == "ACCEPTED")
|
else if((*kit).key == "ACCEPTED")
|
||||||
|
@ -162,7 +162,7 @@ bool p3ServiceControl::getOwnServices(RsPeerServiceInfo &info)
|
|||||||
|
|
||||||
RsStackMutex stack(mCtrlMtx); /***** LOCK STACK MUTEX ****/
|
RsStackMutex stack(mCtrlMtx); /***** LOCK STACK MUTEX ****/
|
||||||
|
|
||||||
info.mPeerId = "";
|
info.mPeerId.clear() ;
|
||||||
info.mServiceList = mOwnServices;
|
info.mServiceList = mOwnServices;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -83,14 +83,6 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> c
|
|||||||
return id ;
|
return id ;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void operator=(const std::string& str)
|
|
||||||
{
|
|
||||||
t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> temp = t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER>(str);
|
|
||||||
|
|
||||||
for(uint32_t i = 0; i < ID_SIZE_IN_BYTES; i++)
|
|
||||||
this->bytes[i] = temp.toByteArray()[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void clear() { memset(bytes,0,SIZE_IN_BYTES) ; }
|
inline void clear() { memset(bytes,0,SIZE_IN_BYTES) ; }
|
||||||
|
|
||||||
// Converts to a std::string using cached value.
|
// Converts to a std::string using cached value.
|
||||||
|
@ -393,7 +393,7 @@ bool RsGxsChannelPostItem::toChannelPost(RsGxsChannelPost &post, bool moveImage)
|
|||||||
RsGxsFile fi;
|
RsGxsFile fi;
|
||||||
fi.mName = RsDirUtil::getTopDir(fit->name);
|
fi.mName = RsDirUtil::getTopDir(fit->name);
|
||||||
fi.mSize = fit->filesize;
|
fi.mSize = fit->filesize;
|
||||||
fi.mHash = fit->hash.toStdString();
|
fi.mHash = fit->hash;
|
||||||
|
|
||||||
post.mFiles.push_back(fi);
|
post.mFiles.push_back(fi);
|
||||||
post.mCount++;
|
post.mCount++;
|
||||||
|
@ -1122,8 +1122,8 @@ bool p3GxsChannels::generatePost(uint32_t &token, const RsGxsGroupId &grpId)
|
|||||||
msg.mMeta.mMsgName = msg.mMsg;
|
msg.mMeta.mMsgName = msg.mMsg;
|
||||||
|
|
||||||
msg.mMeta.mGroupId = grpId;
|
msg.mMeta.mGroupId = grpId;
|
||||||
msg.mMeta.mThreadId = "";
|
msg.mMeta.mThreadId.clear() ;
|
||||||
msg.mMeta.mParentId = "";
|
msg.mMeta.mParentId.clear() ;
|
||||||
|
|
||||||
msg.mMeta.mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_UNREAD;
|
msg.mMeta.mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_UNREAD;
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ RsGenExchange::ServiceCreate_Return p3GxsCircles::service_CreateGroup(RsGxsGrpIt
|
|||||||
if (item->meta.mCircleType == GXS_CIRCLE_TYPE_EXT_SELF)
|
if (item->meta.mCircleType == GXS_CIRCLE_TYPE_EXT_SELF)
|
||||||
{
|
{
|
||||||
item->meta.mCircleType = GXS_CIRCLE_TYPE_EXTERNAL;
|
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)
|
bool RsGxsCircleCache::loadBaseCircle(const RsGxsCircleGroup &circle)
|
||||||
{
|
{
|
||||||
|
|
||||||
mCircleId = circle.mMeta.mGroupId.toStdString();
|
mCircleId = RsGxsCircleId(circle.mMeta.mGroupId);
|
||||||
mCircleName = circle.mMeta.mGroupName;
|
mCircleName = circle.mMeta.mGroupName;
|
||||||
mUpdateTime = time(NULL);
|
mUpdateTime = time(NULL);
|
||||||
mProcessedCircles.insert(mCircleId);
|
mProcessedCircles.insert(mCircleId);
|
||||||
|
@ -1138,7 +1138,7 @@ RsGxsIdCache::RsGxsIdCache(const RsGxsIdGroupItem *item, const RsTlvSecurityKey
|
|||||||
|
|
||||||
// Fill in Details.
|
// Fill in Details.
|
||||||
details.mNickname = item->meta.mGroupName;
|
details.mNickname = item->meta.mGroupName;
|
||||||
details.mId = item->meta.mGroupId.toStdString();
|
details.mId = RsGxsId(item->meta.mGroupId);
|
||||||
|
|
||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
std::cerr << "RsGxsIdCache::RsGxsIdCache() for: " << details.mId;
|
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))
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2150,8 +2150,8 @@ RsGenExchange::ServiceCreate_Return p3IdService::service_CreateGroup(RsGxsGrpIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enforce no AuthorId.
|
// Enforce no AuthorId.
|
||||||
item->meta.mAuthorId = "";
|
item->meta.mAuthorId.clear() ;
|
||||||
item->group.mMeta.mAuthorId = "";
|
item->group.mMeta.mAuthorId.clear() ;
|
||||||
// copy meta data to be sure its all the same.
|
// copy meta data to be sure its all the same.
|
||||||
//item->group.mMeta = item->meta;
|
//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_KNOWN_PGPIDS 20
|
||||||
#define MAX_UNKNOWN_PGPIDS 20
|
#define MAX_UNKNOWN_PGPIDS 20
|
||||||
#define MAX_PSEUDOIDS 20
|
#define MAX_PSEUDOIDS 20
|
||||||
@ -3008,7 +2988,7 @@ void p3IdService::generateDummy_FriendPGP()
|
|||||||
for(int j = 0; j < idx; j++, it++) ;
|
for(int j = 0; j < idx; j++, it++) ;
|
||||||
|
|
||||||
// HACK FOR DUMMY GENERATION.
|
// HACK FOR DUMMY GENERATION.
|
||||||
id.mMeta.mAuthorId = it->toStdString();
|
id.mMeta.mAuthorId = RsGxsId::random() ;
|
||||||
|
|
||||||
RsPeerDetails details;
|
RsPeerDetails details;
|
||||||
if (/*rsPeers->getPeerDetails(*it, details)*/false)
|
if (/*rsPeers->getPeerDetails(*it, details)*/false)
|
||||||
@ -3021,7 +3001,7 @@ void p3IdService::generateDummy_FriendPGP()
|
|||||||
{
|
{
|
||||||
std::cerr << "p3IdService::generateDummy_FriendPGP() missing" << std::endl;
|
std::cerr << "p3IdService::generateDummy_FriendPGP() missing" << std::endl;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
id.mMeta.mGroupName = genRandomId();
|
id.mMeta.mGroupName = RSRandom::random_alphaNumericString(10) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t dummyToken = 0;
|
uint32_t dummyToken = 0;
|
||||||
@ -3037,9 +3017,9 @@ void p3IdService::generateDummy_UnknownPGP()
|
|||||||
|
|
||||||
// FAKE DATA.
|
// FAKE DATA.
|
||||||
id.mMeta.mGroupFlags = RSGXSID_GROUPFLAG_REALID;
|
id.mMeta.mGroupFlags = RSGXSID_GROUPFLAG_REALID;
|
||||||
id.mPgpIdHash = genRandomId(40);
|
id.mPgpIdHash = Sha1CheckSum::random() ;
|
||||||
id.mPgpIdSign = genRandomId(40);
|
id.mPgpIdSign = RSRandom::random_alphaNumericString(20) ;
|
||||||
id.mMeta.mGroupName = genRandomId();
|
id.mMeta.mGroupName = RSRandom::random_alphaNumericString(10) ;
|
||||||
|
|
||||||
uint32_t dummyToken = 0;
|
uint32_t dummyToken = 0;
|
||||||
createGroup(dummyToken, id);
|
createGroup(dummyToken, id);
|
||||||
@ -3054,7 +3034,7 @@ void p3IdService::generateDummy_UnknownPseudo()
|
|||||||
|
|
||||||
// FAKE DATA.
|
// FAKE DATA.
|
||||||
id.mMeta.mGroupFlags = 0;
|
id.mMeta.mGroupFlags = 0;
|
||||||
id.mMeta.mGroupName = genRandomId();
|
id.mMeta.mGroupName = RSRandom::random_alphaNumericString(10) ;
|
||||||
|
|
||||||
uint32_t dummyToken = 0;
|
uint32_t dummyToken = 0;
|
||||||
createGroup(dummyToken, id);
|
createGroup(dummyToken, id);
|
||||||
|
@ -359,17 +359,6 @@ std::ostream &operator<<(std::ostream &out, const RsWikiComment &comment)
|
|||||||
|
|
||||||
/***** FOR TESTING *****/
|
/***** 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 int about_len = 10;
|
||||||
const std::string about_txt[] =
|
const std::string about_txt[] =
|
||||||
{ "Welcome to RsWiki, a fully distributed Wiki system that anyone can edit.",
|
{ "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++)
|
for(i = 0; i < GEN_COLLECTIONS; i++)
|
||||||
{
|
{
|
||||||
RsWikiCollection wiki;
|
RsWikiCollection wiki;
|
||||||
wiki.mMeta.mGroupId = genRandomId();
|
wiki.mMeta.mGroupId = RsGxsGroupId::random();
|
||||||
wiki.mMeta.mGroupFlags = 0;
|
wiki.mMeta.mGroupFlags = 0;
|
||||||
wiki.mMeta.mGroupName = genRandomId();
|
wiki.mMeta.mGroupName = RsGxsGroupId::random().toStdString();
|
||||||
|
|
||||||
uint32_t dummyToken = 0;
|
uint32_t dummyToken = 0;
|
||||||
submitCollection(dummyToken, wiki);
|
submitCollection(dummyToken, wiki);
|
||||||
@ -523,7 +512,7 @@ bool generateNextDummyPage(const RsGxsMessageId &threadId, const int lines, cons
|
|||||||
|
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
|
|
||||||
std::string chooseRandomAuthorId()
|
RsGxsId chooseRandomAuthorId()
|
||||||
{
|
{
|
||||||
/* chose a random Id to sign with */
|
/* chose a random Id to sign with */
|
||||||
std::list<RsGxsId> ownIds;
|
std::list<RsGxsId> ownIds;
|
||||||
@ -531,16 +520,11 @@ std::string chooseRandomAuthorId()
|
|||||||
|
|
||||||
rsIdentity->getOwnIds(ownIds);
|
rsIdentity->getOwnIds(ownIds);
|
||||||
|
|
||||||
uint32_t idx = (uint32_t) (ownIds.size() * RSRandom::random_f32());
|
uint32_t idx = (uint32_t) (RSRandom::random_u32() % (int)ownIds.size()) ;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(it = ownIds.begin(); (it != ownIds.end()) && (i < idx); it++, i++) ;
|
for(it = ownIds.begin(); (it != ownIds.end()) && (i < idx); it++, i++) ;
|
||||||
|
|
||||||
RsGxsId answer;
|
return *it ;
|
||||||
if (it != ownIds.end())
|
|
||||||
{
|
|
||||||
answer = *it;
|
|
||||||
}
|
|
||||||
return answer.toStdString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public:
|
|||||||
inline void getStringT(int columnIndex, T &str){
|
inline void getStringT(int columnIndex, T &str){
|
||||||
std::string temp;
|
std::string temp;
|
||||||
getString(columnIndex, temp);
|
getString(columnIndex, temp);
|
||||||
str = temp;
|
str = T(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -692,7 +692,7 @@ bool RsDirUtil::getFileHash(const std::string& filepath, RsFileHash &hash, uint6
|
|||||||
|
|
||||||
SHA1_Final(&sha_buf[0], sha_ctx);
|
SHA1_Final(&sha_buf[0], sha_ctx);
|
||||||
|
|
||||||
hash = Sha1CheckSum(sha_buf).toStdString() ;
|
hash = Sha1CheckSum(sha_buf);
|
||||||
|
|
||||||
delete sha_ctx;
|
delete sha_ctx;
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
|
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
LinksCloud \
|
|
||||||
VOIP \
|
VOIP \
|
||||||
FeedReader
|
FeedReader
|
||||||
|
@ -290,7 +290,7 @@ void CreateCircleDialog::createCircle()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// set distribution from GUI.
|
// set distribution from GUI.
|
||||||
circle.mMeta.mCircleId = "";
|
circle.mMeta.mCircleId.clear() ;
|
||||||
if (ui.radioButton_Public->isChecked())
|
if (ui.radioButton_Public->isChecked())
|
||||||
{
|
{
|
||||||
std::cerr << "CreateCircleDialog::createCircle() Public Circle";
|
std::cerr << "CreateCircleDialog::createCircle() Public Circle";
|
||||||
@ -342,7 +342,7 @@ void CreateCircleDialog::createCircle()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// set personal distribution
|
// set personal distribution
|
||||||
circle.mMeta.mCircleId = "";
|
circle.mMeta.mCircleId.clear() ;
|
||||||
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL;
|
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL;
|
||||||
}
|
}
|
||||||
std::cerr << "CreateCircleDialog::createCircle() : mCircleType: " << circle.mMeta.mCircleType;
|
std::cerr << "CreateCircleDialog::createCircle() : mCircleType: " << circle.mMeta.mCircleType;
|
||||||
|
@ -1949,7 +1949,7 @@ void TransfersDialog::showFileDetails()
|
|||||||
for(int i = 0; i <= DLListModel->rowCount(); i++)
|
for(int i = 0; i <= DLListModel->rowCount(); i++)
|
||||||
if(selection->isRowSelected(i, QModelIndex()))
|
if(selection->isRowSelected(i, QModelIndex()))
|
||||||
{
|
{
|
||||||
file_hash = getID(i, DLListModel).toStdString();
|
file_hash = RsFileHash(getID(i, DLListModel).toStdString());
|
||||||
++nb_select ;
|
++nb_select ;
|
||||||
}
|
}
|
||||||
if(nb_select != 1)
|
if(nb_select != 1)
|
||||||
|
@ -362,7 +362,7 @@ void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &m
|
|||||||
|
|
||||||
void PostedListDialog::changedTopic(const QString &id)
|
void PostedListDialog::changedTopic(const QString &id)
|
||||||
{
|
{
|
||||||
mCurrTopicId = id.toStdString();
|
mCurrTopicId = RsGxsGroupId(id.toStdString());
|
||||||
insertThreads();
|
insertThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ bool WikiDialog::getSelectedPage(RsGxsGroupId &groupId, RsGxsMessageId &pageId,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pageId = item->text(WIKI_GROUP_COL_PAGEID).toStdString();
|
pageId = RsGxsMessageId(item->text(WIKI_GROUP_COL_PAGEID).toStdString());
|
||||||
origPageId = RsGxsMessageId(item->text(WIKI_GROUP_COL_ORIGPAGEID).toStdString());
|
origPageId = RsGxsMessageId(item->text(WIKI_GROUP_COL_ORIGPAGEID).toStdString());
|
||||||
|
|
||||||
#ifdef WIKI_DEBUG
|
#ifdef WIKI_DEBUG
|
||||||
@ -559,7 +559,7 @@ void WikiDialog::wikiSubscribe(bool subscribe)
|
|||||||
|
|
||||||
void WikiDialog::wikiGroupChanged(const QString &groupId)
|
void WikiDialog::wikiGroupChanged(const QString &groupId)
|
||||||
{
|
{
|
||||||
mGroupId = groupId.toStdString();
|
mGroupId = RsGxsGroupId(groupId.toStdString());
|
||||||
|
|
||||||
if (mGroupId.isNull()) {
|
if (mGroupId.isNull()) {
|
||||||
return;
|
return;
|
||||||
|
@ -162,7 +162,7 @@ void WikiEditDialog::historySelected()
|
|||||||
|
|
||||||
RsGxsGrpMsgIdPair newSnapshot = mThreadMsgIdPair;
|
RsGxsGrpMsgIdPair newSnapshot = mThreadMsgIdPair;
|
||||||
std::string pageId = item->data(WET_DATA_COLUMN, WET_ROLE_PAGEID).toString().toStdString();
|
std::string pageId = item->data(WET_DATA_COLUMN, WET_ROLE_PAGEID).toString().toStdString();
|
||||||
newSnapshot.second = pageId;
|
newSnapshot.second = RsGxsMessageId(pageId);
|
||||||
|
|
||||||
std::cerr << "WikiEditDialog::historySelected() New PageId: " << pageId;
|
std::cerr << "WikiEditDialog::historySelected() New PageId: " << pageId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -469,10 +469,10 @@ void WikiEditDialog::submitEdit()
|
|||||||
if (mNewPage)
|
if (mNewPage)
|
||||||
{
|
{
|
||||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||||
mWikiSnapshot.mMeta.mOrigMsgId = "";
|
mWikiSnapshot.mMeta.mOrigMsgId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mMsgId = "";
|
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mParentId = "";
|
mWikiSnapshot.mMeta.mParentId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mThreadId = "";
|
mWikiSnapshot.mMeta.mThreadId.clear() ;
|
||||||
|
|
||||||
std::cerr << "WikiEditDialog::submitEdit() Is New Page";
|
std::cerr << "WikiEditDialog::submitEdit() Is New Page";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -484,9 +484,9 @@ void WikiEditDialog::submitEdit()
|
|||||||
// A New Version of the ThreadHead.
|
// A New Version of the ThreadHead.
|
||||||
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
mWikiSnapshot.mMeta.mGroupId = mWikiCollection.mMeta.mGroupId;
|
||||||
mWikiSnapshot.mMeta.mOrigMsgId = mRepublishOrigId;
|
mWikiSnapshot.mMeta.mOrigMsgId = mRepublishOrigId;
|
||||||
mWikiSnapshot.mMeta.mParentId = "";
|
mWikiSnapshot.mMeta.mParentId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mThreadId = "";
|
mWikiSnapshot.mMeta.mThreadId.clear() ;
|
||||||
mWikiSnapshot.mMeta.mMsgId = "";
|
mWikiSnapshot.mMeta.mMsgId.clear() ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ bool GxsCircleChooser::getChosenCircle(RsGxsCircleId &id)
|
|||||||
int idx = currentIndex();
|
int idx = currentIndex();
|
||||||
|
|
||||||
QVariant var = itemData(idx);
|
QVariant var = itemData(idx);
|
||||||
id = var.toString().toStdString();
|
id = RsGxsCircleId(var.toString().toStdString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ void GxsCommentTreeWidget::setCurrentMsgId(QTreeWidgetItem *current, QTreeWidget
|
|||||||
|
|
||||||
if(current)
|
if(current)
|
||||||
{
|
{
|
||||||
mCurrentMsgId = current->text(PCITEM_COLUMN_MSGID).toStdString();
|
mCurrentMsgId = RsGxsMessageId(current->text(PCITEM_COLUMN_MSGID).toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ bool GxsGroupDialog::setCircleParameters(RsGroupMetaData &meta)
|
|||||||
meta.mCircleType = GXS_CIRCLE_TYPE_YOUREYESONLY;
|
meta.mCircleType = GXS_CIRCLE_TYPE_YOUREYESONLY;
|
||||||
meta.mCircleId.clear();
|
meta.mCircleId.clear();
|
||||||
meta.mOriginator.clear();
|
meta.mOriginator.clear();
|
||||||
meta.mInternalCircle = "Internal Circle Id";
|
meta.mInternalCircle.clear() ;
|
||||||
|
|
||||||
if (!ui.localComboBox->getChosenCircle(meta.mInternalCircle))
|
if (!ui.localComboBox->getChosenCircle(meta.mInternalCircle))
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@ bool GxsIdChooser::getChosenId(RsGxsId &id)
|
|||||||
int idx = currentIndex();
|
int idx = currentIndex();
|
||||||
|
|
||||||
QVariant var = itemData(idx);
|
QVariant var = itemData(idx);
|
||||||
id = var.toString().toStdString();
|
id = RsGxsId(var.toString().toStdString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -617,9 +617,9 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str
|
|||||||
RsGxsChannelPost post;
|
RsGxsChannelPost post;
|
||||||
|
|
||||||
post.mMeta.mGroupId = mChannelId;
|
post.mMeta.mGroupId = mChannelId;
|
||||||
post.mMeta.mParentId = "";
|
post.mMeta.mParentId.clear() ;
|
||||||
post.mMeta.mThreadId = "";
|
post.mMeta.mThreadId.clear() ;
|
||||||
post.mMeta.mMsgId = "";
|
post.mMeta.mMsgId.clear() ;
|
||||||
|
|
||||||
post.mMeta.mMsgName = subject;
|
post.mMeta.mMsgName = subject;
|
||||||
post.mMsg = msg;
|
post.mMsg = msg;
|
||||||
|
@ -428,7 +428,7 @@ void GxsChannelDialog::restoreChannelKeys()
|
|||||||
|
|
||||||
void GxsChannelDialog::selectChannel(const QString &id)
|
void GxsChannelDialog::selectChannel(const QString &id)
|
||||||
{
|
{
|
||||||
mChannelId = id.toStdString();
|
mChannelId = RsGxsGroupId(id.toStdString());
|
||||||
|
|
||||||
bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
|
bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
|
||||||
setAutoDownloadButton(autoDl);
|
setAutoDownloadButton(autoDl);
|
||||||
|
@ -271,7 +271,7 @@ void CreateGxsForumMsg::createMsg()
|
|||||||
RsGxsForumMsg msg;
|
RsGxsForumMsg msg;
|
||||||
msg.mMeta.mGroupId = mForumId;
|
msg.mMeta.mGroupId = mForumId;
|
||||||
msg.mMeta.mParentId = mParentId;
|
msg.mMeta.mParentId = mParentId;
|
||||||
msg.mMeta.mMsgId = "";
|
msg.mMeta.mMsgId.clear() ;
|
||||||
if (mParentMsgLoaded)
|
if (mParentMsgLoaded)
|
||||||
{
|
{
|
||||||
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
|
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
|
||||||
|
@ -473,7 +473,7 @@ void GxsForumThreadWidget::changedThread()
|
|||||||
if (!item || !item->isSelected()) {
|
if (!item || !item->isSelected()) {
|
||||||
mThreadId.clear();
|
mThreadId.clear();
|
||||||
} else {
|
} else {
|
||||||
mThreadId = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString();
|
mThreadId = RsGxsMessageId(item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFillThread) {
|
if (mFillThread) {
|
||||||
|
@ -382,7 +382,7 @@ GxsForumThreadWidget *GxsForumsDialog::createThreadWidget(const RsGxsGroupId &fo
|
|||||||
|
|
||||||
void GxsForumsDialog::changedForum(const QString &forumId)
|
void GxsForumsDialog::changedForum(const QString &forumId)
|
||||||
{
|
{
|
||||||
mForumId = forumId.toStdString();
|
mForumId = RsGxsGroupId(forumId.toStdString());
|
||||||
if (mForumId.isNull()) {
|
if (mForumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ void MessageComposer::pasteRecommended()
|
|||||||
if (links[i].valid() && links[i].type() == RetroShareLink::TYPE_FILE) {
|
if (links[i].valid() && links[i].type() == RetroShareLink::TYPE_FILE) {
|
||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
fileInfo.fname = links[i].name().toStdString();
|
fileInfo.fname = links[i].name().toStdString();
|
||||||
fileInfo.hash = links[i].hash().toStdString();
|
fileInfo.hash = RsFileHash(links[i].hash().toStdString());
|
||||||
fileInfo.size = links[i].size();
|
fileInfo.size = links[i].size();
|
||||||
|
|
||||||
addFile(fileInfo);
|
addFile(fileInfo);
|
||||||
|
@ -321,7 +321,7 @@ void MessageWidget::getcurrentrecommended()
|
|||||||
fi.size = it->data().toULongLong() ;
|
fi.size = it->data().toULongLong() ;
|
||||||
break ;
|
break ;
|
||||||
case COLUMN_FILE_HASH:
|
case COLUMN_FILE_HASH:
|
||||||
fi.hash = it->data().toString().toStdString() ;
|
fi.hash = RsFileHash(it->data().toString().toStdString()) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSplashScreen>
|
#include <QSplashScreen>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user