Added notify of meta changes to RsGenExchange

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7428 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-07-04 21:51:17 +00:00
parent 15718cbca9
commit 60a67846b0
15 changed files with 177 additions and 48 deletions

View File

@ -915,15 +915,21 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
}
void RsGenExchange::msgsChanged(std::map<RsGxsGroupId,
std::vector<RsGxsMessageId> >& msgs)
void RsGenExchange::msgsChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgsMeta)
{
if(mGenMtx.trylock())
{
while(!mMsgChange.empty())
{
RsGxsMsgChange* mc = mMsgChange.back();
msgs = mc->msgChangeMap;
if (mc->metaChange())
{
msgsMeta = mc->msgChangeMap;
}
else
{
msgs = mc->msgChangeMap;
}
mMsgChange.pop_back();
delete mc;
}
@ -931,7 +937,7 @@ void RsGenExchange::msgsChanged(std::map<RsGxsGroupId,
}
}
void RsGenExchange::groupsChanged(std::list<RsGxsGroupId>& grpIds)
void RsGenExchange::groupsChanged(std::list<RsGxsGroupId>& grpIds, std::list<RsGxsGroupId>& grpIdsMeta)
{
if(mGenMtx.trylock())
@ -942,7 +948,14 @@ void RsGenExchange::groupsChanged(std::list<RsGxsGroupId>& grpIds)
std::list<RsGxsGroupId>& gList = gc->mGrpIdList;
std::list<RsGxsGroupId>::iterator lit = gList.begin();
for(; lit != gList.end(); lit++)
if (gc->metaChange())
{
grpIdsMeta.push_back(*lit);
}
else
{
grpIds.push_back(*lit);
}
mGroupChange.pop_back();
delete gc;
@ -1480,9 +1493,10 @@ void RsGenExchange::setMsgServiceString(uint32_t& token, const RsGxsGrpMsgIdPair
void RsGenExchange::processMsgMetaChanges()
{
RsStackMutex stack(mGenMtx);
GxsMsgReq msgIds;
std::map<uint32_t, MsgLocMetaData>::iterator mit = mMsgLocMetaMap.begin(),
mit_end = mMsgLocMetaMap.end();
@ -1492,6 +1506,7 @@ void RsGenExchange::processMsgMetaChanges()
int32_t value, mask;
bool ok = true;
bool changed = false;
// for meta flag changes get flag to apply mask
if(m.val.getAsInt32(RsGeneralDataService::MSG_META_STATUS, value))
@ -1515,6 +1530,7 @@ void RsGenExchange::processMsgMetaChanges()
{
RsGxsMsgMetaData* meta = *(msgMetaV.begin());
value = (meta->mMsgStatus & ~mask) | (mask & value);
changed = (meta->mMsgStatus != value);
m.val.put(RsGeneralDataService::MSG_META_STATUS, value);
delete meta;
ok = true;
@ -1524,20 +1540,30 @@ void RsGenExchange::processMsgMetaChanges()
}
}
ok &= mDataStore->updateMessageMetaData(m) == 1;
uint32_t token = mit->first;
if(ok)
{
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
}else
if (changed)
{
msgIds[m.msgId.first].push_back(m.msgId.second);
}
}
else
{
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
}
mMsgNotify.insert(std::make_pair(token, m.msgId));
}
if (!msgIds.empty()) {
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_PROCESSED, true);
c->msgChangeMap = msgIds;
mNotifications.push_back(c);
}
mMsgLocMetaMap.clear();
}
@ -1545,6 +1571,8 @@ void RsGenExchange::processGrpMetaChanges()
{
RsStackMutex stack(mGenMtx);
std::list<RsGxsGroupId> grpChanged;
std::map<uint32_t, GrpLocMetaData>::iterator mit = mGrpLocMetaMap.begin(),
mit_end = mGrpLocMetaMap.end();
@ -1561,6 +1589,7 @@ void RsGenExchange::processGrpMetaChanges()
if(ok)
{
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
grpChanged.push_back(g.grpId);
}else
{
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
@ -1568,6 +1597,13 @@ void RsGenExchange::processGrpMetaChanges()
mGrpNotify.insert(std::make_pair(token, g.grpId));
}
if(!grpChanged.empty())
{
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PROCESSED, true);
gc->mGrpIdList = grpChanged;
mNotifications.push_back(gc);
}
mGrpLocMetaMap.clear();
}
@ -1798,7 +1834,7 @@ void RsGenExchange::publishMsgs()
if(!msgChangeMap.empty())
{
RsGxsMsgChange* ch = new RsGxsMsgChange(RsGxsNotify::TYPE_PUBLISH);
RsGxsMsgChange* ch = new RsGxsMsgChange(RsGxsNotify::TYPE_PUBLISH, false);
ch->msgChangeMap = msgChangeMap;
mNotifications.push_back(ch);
}
@ -1929,7 +1965,7 @@ void RsGenExchange::processGroupDelete()
if(!grpDeleted.empty())
{
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH, false);
gc->mGrpIdList = grpDeleted;
mNotifications.push_back(gc);
}
@ -2168,7 +2204,7 @@ void RsGenExchange::publishGrps()
if(!grpChanged.empty())
{
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH, false);
gc->mGrpIdList = grpChanged;
mNotifications.push_back(gc);
}
@ -2374,7 +2410,7 @@ void RsGenExchange::processRecvdMessages()
{
removeDeleteExistingMessages(msgs, msgIds);
mDataStore->storeMessage(msgs);
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_RECEIVE);
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_RECEIVE, false);
c->msgChangeMap = msgIds;
mNotifications.push_back(c);
}
@ -2483,7 +2519,7 @@ void RsGenExchange::processRecvdGroups()
if(!grpIds.empty())
{
RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE);
RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, false);
c->mGrpIdList = grpIds;
mNotifications.push_back(c);
mDataStore->storeGroup(grps);

View File

@ -269,9 +269,10 @@ public:
* If receivedChanges is not passed RsGxsNotify changes
* this function does nothing
* @param grpIds returns list of grpIds that have changed
* @param grpIdsMeta returns list of grpIds with meta data changes
* @see updated
*/
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
void groupsChanged(std::list<RsGxsGroupId>& grpIds, std::list<RsGxsGroupId>& grpIdsMeta);
/*!
* The msg changed. \n
@ -280,10 +281,10 @@ public:
* If receivedChanges is not passed RsGxsNotify changes
* this function does nothing
* @param msgs returns map of message ids that have changed
* @param msgsMeta returns map of message ids with meta data changes
* @see updated
*/
void msgsChanged(std::map<RsGxsGroupId,
std::vector<RsGxsMessageId> >& msgs);
void msgsChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgsMeta);
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);

View File

@ -69,9 +69,10 @@ public:
* If receivedChanges is not passed RsGxsNotify changes
* this function does nothing
* @param grpIds returns list of grpIds that have changed
* @param grpIdsMeta returns list of grpIds with meta data changes
* @see updated
*/
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds) = 0;
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds, std::list<RsGxsGroupId>& grpIdsMeta) = 0;
/*!
* The msg changed. \n
@ -80,10 +81,10 @@ public:
* If receivedChanges is not passed RsGxsNotify changes
* this function does nothing
* @param msgs returns map of message ids that have changed
* @param msgsMeta returns map of message ids with meta data changes
* @see updated
*/
virtual void msgsChanged(std::map<RsGxsGroupId,
std::vector<RsGxsMessageId> >& msgs) = 0;
virtual void msgsChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgsMeta) = 0;
/*!
* @return handle to token service for this GXS service

View File

@ -84,11 +84,12 @@ public:
* If receivedChanges is not passed RsGxsNotify changes
* this function does nothing
* @param grpIds returns list of grpIds that have changed
* @param grpIdsMeta returns list of grpIds with meta data changes
* @see updated
*/
void groupsChanged(std::list<RsGxsGroupId> &grpIds)
void groupsChanged(std::list<RsGxsGroupId> &grpIds, std::list<RsGxsGroupId>& grpIdsMeta)
{
mGxs->groupsChanged(grpIds);
mGxs->groupsChanged(grpIds, grpIdsMeta);
}
/*!
@ -98,11 +99,12 @@ public:
* If receivedChanges is not passed RsGxsNotify changes
* this function does nothing
* @param msgs returns map of message ids that have changed
* @param msgsMeta returns map of message ids with meta data changes
* @see updated
*/
void msgsChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs)
void msgsChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgsMeta)
{
mGxs->msgsChanged(msgs);
mGxs->msgsChanged(msgs, msgsMeta);
}
/*!
* @return handle to token service for this GXS service

View File

@ -31,30 +31,32 @@ public:
/*!
* Relevant to group changes
* TODO: extent to indicate whether a meta change or actual data
*/
class RsGxsGroupChange : public RsGxsNotify
{
public:
RsGxsGroupChange(NotifyType type) : NOTIFY_TYPE(type) {}
RsGxsGroupChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
std::list<RsGxsGroupId> mGrpIdList;
NotifyType getType(){ return NOTIFY_TYPE;}
bool metaChange() { return mMetaChange; }
private:
const NotifyType NOTIFY_TYPE;
bool mMetaChange;
};
/*!
* Relevant to message changes
* TODO: extent to indicate whether a meta change or actual data
*/
class RsGxsMsgChange : public RsGxsNotify
{
public:
RsGxsMsgChange(NotifyType type) : NOTIFY_TYPE(type) {}
RsGxsMsgChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgChangeMap;
NotifyType getType(){ return NOTIFY_TYPE;}
bool metaChange() { return mMetaChange; }
private:
const NotifyType NOTIFY_TYPE;
bool mMetaChange;
};

View File

@ -135,7 +135,7 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
for(it = changes.begin(); it != changes.end(); it++)
{
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
if (msgChange)
if (msgChange && !msgChange->metaChange())
{
std::cerr << "p3GxsChannels::notifyChanges() Found Message Change Notification";
std::cerr << std::endl;

View File

@ -184,7 +184,7 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
{
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
if (msgChange)
if (msgChange && !msgChange->metaChange())
{
#ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::notifyChanges() Found Message Change Notification";
@ -203,7 +203,7 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
/* add groups to ExternalIdList (Might get Personal Circles here until NetChecks in place) */
if (groupChange)
if (groupChange && !groupChange->metaChange())
{
#ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::notifyChanges() Found Group Change Notification";

View File

@ -224,7 +224,7 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
{
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
if (msgChange)
if (msgChange && !msgChange->metaChange())
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::notifyChanges() Found Message Change Notification";
@ -243,7 +243,7 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
/* shouldn't need to worry about groups - as they need to be subscribed to */
if (groupChange)
if (groupChange && !groupChange->metaChange())
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::notifyChanges() Found Group Change Notification";

View File

@ -388,7 +388,7 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
// generate vector of changes to push to the GUI.
std::vector<RsGxsNotify *> changes;
RsGxsMsgChange *msgChanges = new RsGxsMsgChange(RsGxsNotify::TYPE_PROCESSED);
RsGxsMsgChange *msgChanges = new RsGxsMsgChange(RsGxsNotify::TYPE_PROCESSED, false);
RsGxsGroupId groupId;
@ -598,7 +598,7 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
// generate vector of changes to push to the GUI.
std::vector<RsGxsNotify *> changes;
RsGxsMsgChange *msgChanges = new RsGxsMsgChange(RsGxsNotify::TYPE_PROCESSED);
RsGxsMsgChange *msgChanges = new RsGxsMsgChange(RsGxsNotify::TYPE_PROCESSED, false);
for(mit = parentMsgList.begin(); mit != parentMsgList.end(); mit++)
{

View File

@ -14,8 +14,8 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl,
mUpdateBroadcast = RsGxsUpdateBroadcast::get(ifaceImpl);
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>)));
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)));
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >, std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >,std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)));
}
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
@ -42,7 +42,9 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
/* Clear updated ids */
mGrpIds.clear();
mGrpIdsMeta.clear(),
mMsgIds.clear();
mMsgIdsMeta.clear();
}
void RsGxsUpdateBroadcastBase::showEvent(QShowEvent */*event*/)
@ -53,7 +55,7 @@ void RsGxsUpdateBroadcastBase::showEvent(QShowEvent */*event*/)
}
if (!mUpdateWhenInvisible) {
if (!mGrpIds.empty() || !mMsgIds.empty()) {
if (!mGrpIds.empty() || !mGrpIdsMeta.empty() || !mMsgIds.empty() || !mMsgIdsMeta.empty()) {
securedUpdateDisplay();
}
}
@ -69,7 +71,7 @@ void RsGxsUpdateBroadcastBase::updateBroadcastChanged()
}
}
void RsGxsUpdateBroadcastBase::updateBroadcastGrpsChanged(const std::list<RsGxsGroupId> &grpIds)
void RsGxsUpdateBroadcastBase::updateBroadcastGrpsChanged(const std::list<RsGxsGroupId> &grpIds, const std::list<RsGxsGroupId> &grpIdsMeta)
{
std::list<RsGxsGroupId>::const_iterator it;
for (it = grpIds.begin(); it != grpIds.end(); ++it) {
@ -77,9 +79,14 @@ void RsGxsUpdateBroadcastBase::updateBroadcastGrpsChanged(const std::list<RsGxsG
mGrpIds.push_back(*it);
}
}
for (it = grpIdsMeta.begin(); it != grpIdsMeta.end(); ++it) {
if (std::find(mGrpIdsMeta.begin(), mGrpIdsMeta.end(), *it) == mGrpIdsMeta.end()) {
mGrpIdsMeta.push_back(*it);
}
}
}
void RsGxsUpdateBroadcastBase::updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
void RsGxsUpdateBroadcastBase::updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIdsMeta)
{
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
for (mapIt = msgIds.begin(); mapIt != msgIds.end(); ++mapIt) {
@ -87,6 +94,54 @@ void RsGxsUpdateBroadcastBase::updateBroadcastMsgsChanged(const std::map<RsGxsGr
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
std::vector<RsGxsMessageId> &destMsgIds = mMsgIds[grpId];
std::vector<RsGxsMessageId>::const_iterator msgIt;
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
destMsgIds.push_back(*msgIt);
}
}
}
for (mapIt = msgIdsMeta.begin(); mapIt != msgIdsMeta.end(); ++mapIt) {
const RsGxsGroupId &grpId = mapIt->first;
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
std::vector<RsGxsMessageId> &destMsgIds = mMsgIdsMeta[grpId];
std::vector<RsGxsMessageId>::const_iterator msgIt;
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
destMsgIds.push_back(*msgIt);
}
}
}
}
void RsGxsUpdateBroadcastBase::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
{
std::list<RsGxsGroupId>::const_iterator it;
for (it = mGrpIds.begin(); it != mGrpIds.end(); ++it) {
if (std::find(grpIds.begin(), grpIds.end(), *it) == grpIds.end()) {
grpIds.push_back(*it);
}
}
for (it = mGrpIdsMeta.begin(); it != mGrpIdsMeta.end(); ++it) {
if (std::find(grpIds.begin(), grpIds.end(), *it) == grpIds.end()) {
grpIds.push_back(*it);
}
}
}
void RsGxsUpdateBroadcastBase::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
{
/* Copy first map */
msgIds = mMsgIds;
/* Append second map */
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
for (mapIt = mMsgIdsMeta.begin(); mapIt != mMsgIdsMeta.end(); ++mapIt) {
const RsGxsGroupId &grpId = mapIt->first;
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
std::vector<RsGxsMessageId> &destMsgIds = msgIds[grpId];
std::vector<RsGxsMessageId>::const_iterator msgIt;
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {

View File

@ -19,7 +19,11 @@ public:
virtual ~RsGxsUpdateBroadcastBase();
const std::list<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
const std::list<RsGxsGroupId> &getGrpIdsMeta() { return mGrpIdsMeta; }
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
protected:
void fillComplete();
@ -32,8 +36,8 @@ signals:
private slots:
void updateBroadcastChanged();
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds);
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds);
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIdsMeta);
void securedUpdateDisplay();
private:
@ -41,5 +45,7 @@ private:
bool mFillComplete;
bool mUpdateWhenInvisible; // Update also when not visible
std::list<RsGxsGroupId> mGrpIds;
std::list<RsGxsGroupId> mGrpIdsMeta;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIds;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIdsMeta;
};

View File

@ -27,11 +27,31 @@ const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
return mBase->getGrpIds();
}
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
{
return mBase->getGrpIdsMeta();
}
void RsGxsUpdateBroadcastWidget::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
{
mBase->getAllGrpIds(grpIds);
}
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIds()
{
return mBase->getMsgIds();
}
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIdsMeta()
{
return mBase->getMsgIdsMeta();
}
void RsGxsUpdateBroadcastWidget::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
{
mBase->getAllMsgIds(msgIds);
}
void RsGxsUpdateBroadcastWidget::fillDisplay(bool complete)
{
updateDisplay(complete);

View File

@ -25,7 +25,11 @@ public:
void fillComplete();
void setUpdateWhenInvisible(bool update);
const std::list<RsGxsGroupId> &getGrpIds();
const std::list<RsGxsGroupId> &getGrpIdsMeta();
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta();
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
protected:
virtual void showEvent(QShowEvent *event);

View File

@ -44,20 +44,22 @@ RsGxsUpdateBroadcast *RsGxsUpdateBroadcast::get(RsGxsIfaceHelper *ifaceImpl)
void RsGxsUpdateBroadcast::poll()
{
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgsMeta;
std::list<RsGxsGroupId> grps;
std::list<RsGxsGroupId> grpsMeta;
if (mIfaceImpl->updated(true, true))
{
mIfaceImpl->msgsChanged(msgs);
if (!msgs.empty())
mIfaceImpl->msgsChanged(msgs, msgsMeta);
if (!msgs.empty() || !msgsMeta.empty())
{
emit msgsChanged(msgs);
emit msgsChanged(msgs, msgsMeta);
}
mIfaceImpl->groupsChanged(grps);
if (!grps.empty())
mIfaceImpl->groupsChanged(grps, grpsMeta);
if (!grps.empty() || !grpsMeta.empty())
{
emit grpsChanged(grps);
emit grpsChanged(grps, grpsMeta);
}
emit changed();

View File

@ -19,8 +19,8 @@ public:
signals:
void changed();
void msgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds);
void grpsChanged(const std::list<RsGxsGroupId>& grpIds);
void msgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIdsMeta);
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
private slots:
void poll();