merging gxs_phase2 branch

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6401 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2013-06-04 21:00:43 +00:00
parent 1150366913
commit 325fa4f222
116 changed files with 6050 additions and 3596 deletions

View file

@ -307,7 +307,37 @@ protected:
*/
bool getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem*>& grpItem);
template<class GrpType>
bool getGroupDataT(const uint32_t &token, std::vector<GrpType*>& grpItem)
{
std::vector<RsGxsGrpItem*> items;
bool ok = getGroupData(token, items);
std::vector<RsGxsGrpItem*>::iterator vit = items.begin();
for(; vit != items.end(); vit++)
{
RsGxsGrpItem* gi = *vit;
GrpType* item = dynamic_cast<GrpType*>(gi);
if(item)
{
grpItem.push_back(item);
}
else
{
#ifdef GXS_DEBUG
std::cerr << "\nRsGenExchange::getGroupDataT(): Wrong type!\n";
#endif
delete gi;
}
}
return ok;
}
public:
/*!
* retrieves message data associated to a request token
* @param token token to be redeemed for message item retrieval
@ -315,6 +345,40 @@ public:
*/
bool getMsgData(const uint32_t &token, GxsMsgDataMap& msgItems);
template <class MsgType>
bool getMsgDataT(const uint32_t &token, std::map<RsGxsGroupId,
std::vector<MsgType*> >& msgItems)
{
GxsMsgDataMap msgData;
bool ok = getMsgData(token, msgData);
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); mit++)
{
const RsGxsGroupId& grpId = mit->first;
std::vector<RsGxsMsgItem*>& mv = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = mv.begin();
for(; vit != mv.end(); vit++)
{
RsGxsMsgItem* mi = *vit;
MsgType* mt = dynamic_cast<MsgType*>(mi);
if(mt != NULL)
{
msgItems[grpId].push_back(mt);
}
else
{
std::cerr << "RsGenExchange::getMsgDataT(): bad cast to msg type" << std::endl;
delete mi;
}
}
}
return ok;
}
/*!
* retrieves message related data associated to a request token
* @param token token to be redeemed for message item retrieval
@ -670,6 +734,8 @@ private:
void groupShareKeys(std::list<std::string> peers);
static void computeHash(const RsTlvBinaryData& data, std::string& hash);
private:
RsMutex mGenMtx;
@ -718,6 +784,11 @@ private:
time_t mLastClean;
RsGxsMessageCleanUp* mMsgCleanUp;
bool mChecking, mCheckStarted;
time_t mLastCheck;
RsGxsIntegrityCheck* mIntegrityCheck;
private:
std::vector<RsGxsNotify*> mChanges;