Added Phenom's patch AddGxsIdDeleting_v0.6_7328.patch

Changed some context menu icons for GxsGroupFrameDialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7337 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-05-06 17:15:20 +00:00
parent d2bd938e82
commit a9dcd24ba7
17 changed files with 275 additions and 71 deletions

View file

@ -53,13 +53,13 @@
#define MSG_CLEANUP_PERIOD 60*5 // 5 minutes
#define INTEGRITY_CHECK_PERIOD 60*30 // 30 minutes
RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns,
RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs,
uint32_t authenPolicy, uint32_t messageStorePeriod)
: mGenMtx("GenExchange"),
mDataStore(gds),
mNetService(ns),
mSerialiser(serviceSerialiser),
RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns,
RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs,
uint32_t authenPolicy, uint32_t messageStorePeriod)
: mGenMtx("GenExchange"),
mDataStore(gds),
mNetService(ns),
mSerialiser(serviceSerialiser),
mServType(servType),
mGixs(gixs),
mAuthenPolicy(authenPolicy),
@ -130,12 +130,14 @@ void RsGenExchange::tick()
publishGrps();
publishMsgs();
processGroupUpdatePublish();
processRecvdData();
if(!mNotifications.empty())
processGroupUpdatePublish();
processGroupDelete();
processRecvdData();
if(!mNotifications.empty())
{
notifyChanges(mNotifications);
mNotifications.clear();
@ -1029,18 +1031,18 @@ bool RsGenExchange::subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId,
setGroupSubscribeFlags(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED,
(GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED | GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED));
return true;
}
bool RsGenExchange::getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats)
{
return false;
}
bool RsGenExchange::getServiceStatistic(const uint32_t& token, GxsServiceStatistic& stats)
{
return false;
}
return true;
}
bool RsGenExchange::getGroupStatistic(const uint32_t& /*token*/, GxsGroupStatistic& /*stats*/)
{
return false;
}
bool RsGenExchange::getServiceStatistic(const uint32_t& /*token*/, GxsServiceStatistic& /*stats*/)
{
return false;
}
bool RsGenExchange::updated(bool willCallGrpChanged, bool willCallMsgChanged)
{
@ -1457,12 +1459,23 @@ void RsGenExchange::updateGroup(uint32_t& token, RsGxsGrpItem* grpItem)
#ifdef GEN_EXCH_DEBUG
std::cerr << "RsGenExchange::updateGroup() token: " << token;
std::cerr << std::endl;
#endif
}
void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
{
#endif
}
void RsGenExchange::deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem)
{
RsStackMutex stack(mGenMtx);
token = mDataAccess->generatePublicToken();
mGroupDeletePublish.push_back(GroupDeletePublish(grpItem, token));
#ifdef GEN_EXCH_DEBUG
std::cerr << "RsGenExchange::deleteGroup() token: " << token;
std::cerr << std::endl;
#endif
}
void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
{
RsStackMutex stack(mGenMtx);
token = mDataAccess->generatePublicToken();
mMsgsToPublish.insert(std::make_pair(token, msgItem));
@ -1944,12 +1957,60 @@ void RsGenExchange::processGroupUpdatePublish()
delete meta;
}
mGroupUpdatePublish.clear();
}
bool RsGenExchange::checkKeys(const RsTlvSecurityKeySet& keySet)
{
mGroupUpdatePublish.clear();
}
void RsGenExchange::processGroupDelete()
{
RsStackMutex stack(mGenMtx);
// get keys for group delete publish
typedef std::pair<bool, RsGxsGroupId> GrpNote;
std::map<uint32_t, GrpNote> toNotify;
std::vector<GroupDeletePublish>::iterator vit = mGroupDeletePublish.begin();
for(; vit != mGroupDeletePublish.end(); vit++)
{
GroupDeletePublish& gdp = *vit;
uint32_t token = gdp.mToken;
const RsGxsGroupId& groupId = gdp.grpItem->meta.mGroupId;
std::vector<RsGxsGroupId> gprIds;
gprIds.push_back(groupId);
mDataStore->removeGroups(gprIds);
toNotify.insert(std::make_pair(
token, GrpNote(true, RsGxsGroupId())));
}
std::list<RsGxsGroupId> grpDeleted;
std::map<uint32_t, GrpNote>::iterator mit = toNotify.begin();
for(; mit != toNotify.end(); mit++)
{
GrpNote& note = mit->second;
uint8_t status = note.first ? RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
: RsTokenService::GXS_REQUEST_V2_STATUS_FAILED;
mGrpNotify.insert(std::make_pair(mit->first, note.second));
mDataAccess->updatePublicRequestStatus(mit->first, status);
if(note.first)
grpDeleted.push_back(note.second);
}
if(!grpDeleted.empty())
{
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH);
gc->mGrpIdList = grpDeleted;
mNotifications.push_back(gc);
}
mGroupDeletePublish.clear();
}
bool RsGenExchange::checkKeys(const RsTlvSecurityKeySet& keySet)
{
typedef std::map<std::string, RsTlvSecurityKey> keyMap;
const keyMap& allKeys = keySet.keys;
keyMap::const_iterator cit = allKeys.begin();

View file

@ -526,22 +526,30 @@ protected:
* Ownership of item passes to this rsgenexchange \n
* @param token
* @param grpItem
*/
void publishGroup(uint32_t& token, RsGxsGrpItem* grpItem);
/*!
* Updates an existing group item \n
* This will induce a related change message \n
*/
void publishGroup(uint32_t& token, RsGxsGrpItem* grpItem);
/*!
* Updates an existing group item \n
* This will induce a related change message \n
* Ownership of item passes to this rsgenexchange \n
* @param token
* @param grpItem
*/
void updateGroup(uint32_t& token, RsGxsGrpItem* grpItem);
public:
/*!
* Enables publication of a message item \n
*/
void updateGroup(uint32_t& token, RsGxsGrpItem* grpItem);
/*!
* Deletes an existing group item \n
* This will induce a related change message \n
* Ownership of item passes to this rsgenexchange \n
* @param token
* @param grpItem
*/
void deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem);
public:
/*!
* Enables publication of a message item \n
* Setting mOrigMsgId meta member to blank \n
* leads to this msg being an original msg \n
* if mOrigMsgId is not blank the msgId then this msg is \n
@ -651,12 +659,14 @@ private:
void processRecvdGroups();
void publishGrps();
void processGroupUpdatePublish();
void publishMsgs();
/*!
void processGroupUpdatePublish();
void processGroupDelete();
void publishMsgs();
/*!
* processes msg local meta changes
*/
void processMsgMetaChanges();
@ -864,9 +874,11 @@ private:
private:
std::vector<GroupUpdate> mGroupUpdates, mPeersGroupUpdate;
std::vector<GroupUpdatePublish> mGroupUpdatePublish;
};
#endif // RSGENEXCHANGE_H
std::vector<GroupUpdatePublish> mGroupUpdatePublish;
std::vector<GroupDeletePublish> mGroupDeletePublish;
};
#endif // RSGENEXCHANGE_H

View file

@ -148,4 +148,13 @@ public:
uint32_t mToken;
};
class GroupDeletePublish
{
public:
GroupDeletePublish(RsGxsGrpItem* item, uint32_t token)
: grpItem(item), mToken(token) {}
RsGxsGrpItem* grpItem;
uint32_t mToken;
};
#endif /* GXSUTIL_H_ */

View file

@ -217,6 +217,7 @@ virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
virtual bool createIdentity(uint32_t& token, RsIdentityParameters &params) = 0;
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
const std::string &tag, RsRecognTagDetails &details) = 0;

View file

@ -352,8 +352,20 @@ bool p3IdService::updateIdentity(uint32_t& token, RsGxsIdGroup &group)
return false;
}
bool p3IdService::deleteIdentity(uint32_t& token, RsGxsIdGroup &group)
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteIdentity()";
std::cerr << std::endl;
#endif
bool p3IdService::parseRecognTag(const RsGxsId &id, const std::string &nickname,
deleteGroup(token, group);
return false;
}
bool p3IdService::parseRecognTag(const RsGxsId &id, const std::string &nickname,
const std::string &tag, RsRecognTagDetails &details)
{
#ifdef DEBUG_RECOGN
@ -823,6 +835,74 @@ bool p3IdService::updateGroup(uint32_t& token, RsGxsIdGroup &group)
return true;
}
bool p3IdService::deleteGroup(uint32_t& token, RsGxsIdGroup &group)
{
RsGxsId id = RsGxsId(group.mMeta.mGroupId.toStdString());
RsGxsIdGroupItem* item = new RsGxsIdGroupItem();
item->group = group;
item->meta = group.mMeta;
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Deleting RsGxsId: " << id;
std::cerr << std::endl;
#endif
RsGenExchange::deleteGroup(token, item);
// if its in the cache - clear it.
{
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
if (mPublicKeyCache.erase(id))
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Removed from PublicKeyCache";
std::cerr << std::endl;
#endif
}
else
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Not in PublicKeyCache";
std::cerr << std::endl;
#endif
}
if (mPrivateKeyCache.erase(id))
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Removed from PrivateKeyCache";
std::cerr << std::endl;
#endif
}
else
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Not in PrivateKeyCache";
std::cerr << std::endl;
#endif
}
std::list<RsGxsId>::iterator lit = std::find( mOwnIds.begin(), mOwnIds.end(), id);
if (lit != mOwnIds.end())
{
mOwnIds.remove((RsGxsId)*lit);
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Removed from OwnIds";
std::cerr << std::endl;
#endif
}
else
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::deleteGroup() Not in OwnIds";
std::cerr << std::endl;
#endif
}
}
return true;
}
/************************************************************************************/
/************************************************************************************/
/************************************************************************************/

View file

@ -242,6 +242,7 @@ virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &grou
// These are local - and not exposed via RsIdentity.
virtual bool createGroup(uint32_t& token, RsGxsIdGroup &group);
virtual bool updateGroup(uint32_t& token, RsGxsIdGroup &group);
virtual bool deleteGroup(uint32_t& token, RsGxsIdGroup &group);
//virtual bool createMsg(uint32_t& token, RsGxsIdOpinion &opinion);
/**************** RsIdentity External Interface.
@ -266,6 +267,7 @@ virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
virtual bool createIdentity(uint32_t& token, RsIdentityParameters &params);
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group);
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group);
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
const std::string &tag, RsRecognTagDetails &details);