changed back RsGxsUpdateBroadCast.cpp to dos line ending

This commit is contained in:
csoler 2018-06-18 22:37:31 +02:00
parent 2e7398ac9b
commit 6139632378
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -1,83 +1,83 @@
#include <QMap> #include <QMap>
#include "RsGxsUpdateBroadcast.h" #include "RsGxsUpdateBroadcast.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include <retroshare/rsgxsifacehelper.h> #include <retroshare/rsgxsifacehelper.h>
//#define DEBUG_GXS_BROADCAST 1 //#define DEBUG_GXS_BROADCAST 1
// previously gxs allowed only one event consumer to poll for changes // previously gxs allowed only one event consumer to poll for changes
// this required a single broadcast instance per service // this required a single broadcast instance per service
// now the update notify works through rsnotify and notifyqt // now the update notify works through rsnotify and notifyqt
// so the single instance per service is not really needed anymore // so the single instance per service is not really needed anymore
QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*> updateBroadcastMap; QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*> updateBroadcastMap;
RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceHelper *ifaceImpl) : RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceHelper *ifaceImpl) :
QObject(NULL), mIfaceImpl(ifaceImpl) QObject(NULL), mIfaceImpl(ifaceImpl)
{ {
connect(NotifyQt::getInstance(), SIGNAL(gxsChange(RsGxsChanges)), this, SLOT(onChangesReceived(RsGxsChanges))); connect(NotifyQt::getInstance(), SIGNAL(gxsChange(RsGxsChanges)), this, SLOT(onChangesReceived(RsGxsChanges)));
} }
void RsGxsUpdateBroadcast::cleanup() void RsGxsUpdateBroadcast::cleanup()
{ {
QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it; QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it;
for (it = updateBroadcastMap.begin(); it != updateBroadcastMap.end(); ++it) { for (it = updateBroadcastMap.begin(); it != updateBroadcastMap.end(); ++it) {
delete(it.value()); delete(it.value());
} }
updateBroadcastMap.clear(); updateBroadcastMap.clear();
} }
RsGxsUpdateBroadcast *RsGxsUpdateBroadcast::get(RsGxsIfaceHelper *ifaceImpl) RsGxsUpdateBroadcast *RsGxsUpdateBroadcast::get(RsGxsIfaceHelper *ifaceImpl)
{ {
QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it = updateBroadcastMap.find(ifaceImpl); QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*>::iterator it = updateBroadcastMap.find(ifaceImpl);
if (it != updateBroadcastMap.end()) { if (it != updateBroadcastMap.end()) {
return it.value(); return it.value();
} }
RsGxsUpdateBroadcast *updateBroadcast = new RsGxsUpdateBroadcast(ifaceImpl); RsGxsUpdateBroadcast *updateBroadcast = new RsGxsUpdateBroadcast(ifaceImpl);
updateBroadcastMap.insert(ifaceImpl, updateBroadcast); updateBroadcastMap.insert(ifaceImpl, updateBroadcast);
return updateBroadcast; return updateBroadcast;
} }
void RsGxsUpdateBroadcast::onChangesReceived(const RsGxsChanges& changes) void RsGxsUpdateBroadcast::onChangesReceived(const RsGxsChanges& changes)
{ {
#ifdef DEBUG_GXS_BROADCAST #ifdef DEBUG_GXS_BROADCAST
std::cerr << "onChangesReceived()" << std::endl; std::cerr << "onChangesReceived()" << std::endl;
{ {
std::cerr << "Received changes for service " << (void*)changes.mService << ", expecting service " << (void*)mIfaceImpl->getTokenService() << std::endl; std::cerr << "Received changes for service " << (void*)changes.mService << ", expecting service " << (void*)mIfaceImpl->getTokenService() << std::endl;
for(std::list<RsGxsGroupId>::const_iterator it(changes.mGrps.begin());it!=changes.mGrps.end();++it) for(std::list<RsGxsGroupId>::const_iterator it(changes.mGrps.begin());it!=changes.mGrps.end();++it)
std::cerr << "[GRP CHANGE] grp id: " << *it << std::endl; std::cerr << "[GRP CHANGE] grp id: " << *it << std::endl;
for(std::list<RsGxsGroupId>::const_iterator it(changes.mGrpsMeta.begin());it!=changes.mGrpsMeta.end();++it) for(std::list<RsGxsGroupId>::const_iterator it(changes.mGrpsMeta.begin());it!=changes.mGrpsMeta.end();++it)
std::cerr << "[GRP CHANGE] grp meta: " << *it << std::endl; std::cerr << "[GRP CHANGE] grp meta: " << *it << std::endl;
for(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >::const_iterator it(changes.mMsgs.begin());it!=changes.mMsgs.end();++it) for(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >::const_iterator it(changes.mMsgs.begin());it!=changes.mMsgs.end();++it)
for(uint32_t i=0;i<it->second.size();++i) for(uint32_t i=0;i<it->second.size();++i)
std::cerr << "[MSG CHANGE] grp id: " << it->first << ". Msg ID " << it->second[i] << std::endl; std::cerr << "[MSG CHANGE] grp id: " << it->first << ". Msg ID " << it->second[i] << std::endl;
for(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >::const_iterator it(changes.mMsgsMeta.begin());it!=changes.mMsgsMeta.end();++it) for(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >::const_iterator it(changes.mMsgsMeta.begin());it!=changes.mMsgsMeta.end();++it)
for(uint32_t i=0;i<it->second.size();++i) for(uint32_t i=0;i<it->second.size();++i)
std::cerr << "[MSG CHANGE] grp id: " << it->first << ". Msg Meta " << it->second[i] << std::endl; std::cerr << "[MSG CHANGE] grp id: " << it->first << ". Msg Meta " << it->second[i] << std::endl;
} }
#endif #endif
if(changes.mService != mIfaceImpl->getTokenService()) if(changes.mService != mIfaceImpl->getTokenService())
{ {
// std::cerr << "(EE) Incorrect service. Dropping." << std::endl; // std::cerr << "(EE) Incorrect service. Dropping." << std::endl;
return; return;
} }
if (!changes.mMsgs.empty() || !changes.mMsgsMeta.empty()) if (!changes.mMsgs.empty() || !changes.mMsgsMeta.empty())
{ {
emit msgsChanged(changes.mMsgs, changes.mMsgsMeta); emit msgsChanged(changes.mMsgs, changes.mMsgsMeta);
} }
if (!changes.mGrps.empty() || !changes.mGrpsMeta.empty()) if (!changes.mGrps.empty() || !changes.mGrpsMeta.empty())
{ {
emit grpsChanged(changes.mGrps, changes.mGrpsMeta); emit grpsChanged(changes.mGrps, changes.mGrpsMeta);
} }
emit changed(); emit changed();
} }