Added update capability to forums ui

Added timestamp check for group update in nxs
decided to add control variable to allow meta changes in updates rather than none


git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs_finale@6803 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2013-10-05 11:36:31 +00:00
parent 2a841d7ab3
commit 9470e5562a
12 changed files with 208 additions and 22 deletions

View file

@ -128,7 +128,6 @@ public:
class GxsGroupStatistic
{
public:
/// number of message
RsGxsGroupId mGrpId;
uint32_t mNumMsgs;
@ -147,4 +146,67 @@ public:
uint32_t mSizeStore;
};
class UpdateItem
{
public:
virtual ~UpdateItem() { }
};
class StringUpdateItem : public UpdateItem
{
public:
StringUpdateItem(const std::string update) : mUpdate(update) {}
const std::string& getUpdate() const { return mUpdate; }
private:
std::string mUpdate;
};
class RsGxsGroupUpdateMeta
{
public:
// expand as support is added for other utypes
enum UpdateType { DESCRIPTION, NAME };
RsGxsGroupUpdateMeta(const std::string& groupId);
~RsGxsGroupUpdateMeta()
{
GxsMetaUpdate::iterator mit = mUpdates.begin();
for(; mit != mUpdates.end(); mit++)
delete mit->second;
}
typedef std::map<UpdateType, UpdateItem*> GxsMetaUpdate;
/*!
* Only one item of a utype can exist
* @param utype the type of meta update
* @param item update item containing the change value
*/
void setMetaUpdate(UpdateType utype, UpdateItem* item)
{
GxsMetaUpdate::iterator mit;
if ((mit = mUpdates.find(utype)) != mUpdates.end())
mUpdates[utype] = item;
else
delete mUpdates[utype];
}
/*!
* @param utype update type to remove
* @return false if update did not exist, true if update successfully removed
*/
bool removeUpdateType(UpdateType utype){ return mUpdates.erase(utype) == 1; }
const GxsMetaUpdate* getUpdate() { return &mUpdates; }
const std::string& getGroupId() { return mGroupId; }
private:
GxsMetaUpdate mUpdates;
std::string mGroupId;
};
#endif /* RSGXSIFACETYPES_H_ */