This commit is contained in:
RetroPooh 2017-01-23 00:21:23 +03:00
commit 9268fd5ff0
37 changed files with 225 additions and 117 deletions

View File

@ -1634,10 +1634,14 @@ bool RsDataService::locked_removeGroupEntries(const std::vector<RsGxsGroupId>& g
const RsGxsGroupId& grpId = *vit; const RsGxsGroupId& grpId = *vit;
mDb->sqlDelete(GRP_TABLE_NAME, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", ""); mDb->sqlDelete(GRP_TABLE_NAME, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", "");
// also remove the group meta from cache.
mGrpMetaDataCache.erase(*vit) ;
} }
ret &= mDb->commitTransaction(); ret &= mDb->commitTransaction();
mGrpMetaDataCache_ContainsAllDatabase = false ;
return ret; return ret;
} }
uint32_t RsDataService::cacheSize() const { uint32_t RsDataService::cacheSize() const {

View File

@ -90,6 +90,8 @@ public:
uint32_t mSuppliers ; uint32_t mSuppliers ;
uint32_t mMaxVisibleCount ; uint32_t mMaxVisibleCount ;
bool mGrpAutoSync ;
bool mAllowMsgSync;
}; };
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult; typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult;

View File

@ -63,8 +63,8 @@ static const uint32_t INDEX_AUTHEN_ADMIN = 0x00000040; // admin key
//#define GEN_EXCH_DEBUG 1 //#define GEN_EXCH_DEBUG 1
#define MSG_CLEANUP_PERIOD 60*59 // 59 minutes static const uint32_t MSG_CLEANUP_PERIOD = 60*59; // 59 minutes
#define INTEGRITY_CHECK_PERIOD 60*31 // 31 minutes static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes
RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns, RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService *ns,
RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs, RsSerialType *serviceSerialiser, uint16_t servType, RsGixs* gixs,
@ -81,7 +81,7 @@ RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService
mLastClean((int)time(NULL) - (int)(RSRandom::random_u32() % MSG_CLEANUP_PERIOD)), // this helps unsynchronising the checks for the different services mLastClean((int)time(NULL) - (int)(RSRandom::random_u32() % MSG_CLEANUP_PERIOD)), // this helps unsynchronising the checks for the different services
mMsgCleanUp(NULL), mMsgCleanUp(NULL),
mChecking(false), mChecking(false),
mLastCheck((int)time(NULL) - (int)(RSRandom::random_u32() % INTEGRITY_CHECK_PERIOD)), // this helps unsynchronising the checks for the different services mLastCheck((int)time(NULL) - (int)(RSRandom::random_u32() % INTEGRITY_CHECK_PERIOD) + 120), // this helps unsynchronising the checks for the different services, with 2 min security to avoid checking right away before statistics come up.
mIntegrityCheck(NULL), mIntegrityCheck(NULL),
CREATE_FAIL(0), CREATE_FAIL(0),
CREATE_SUCCESS(1), CREATE_SUCCESS(1),
@ -211,6 +211,11 @@ void RsGenExchange::tick()
std::cerr << " " << *it << std::endl; std::cerr << " " << *it << std::endl;
#endif #endif
mNotifications.push_back(gc); mNotifications.push_back(gc);
// also notify the network exchange service that these groups no longer exist.
if(mNetService)
mNetService->removeGroups(grpIds) ;
} }
if (!msgIds.empty()) { if (!msgIds.empty()) {
@ -1718,6 +1723,11 @@ uint32_t RsGenExchange::getSyncPeriod(const RsGxsGroupId& grpId)
return RS_GXS_DEFAULT_MSG_REQ_PERIOD; return RS_GXS_DEFAULT_MSG_REQ_PERIOD;
} }
bool RsGenExchange::getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats)
{
return (!mNetService) || mNetService->getGroupNetworkStats(grpId,stats) ;
}
void RsGenExchange::setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) void RsGenExchange::setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs)
{ {
if(mNetService != NULL) if(mNetService != NULL)

View File

@ -646,6 +646,7 @@ public:
virtual uint32_t getDefaultSyncPeriod(); virtual uint32_t getDefaultSyncPeriod();
virtual uint32_t getSyncPeriod(const RsGxsGroupId& grpId) ; virtual uint32_t getSyncPeriod(const RsGxsGroupId& grpId) ;
virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ; virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ;
virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats);
uint16_t serviceType() const { return mServType ; } uint16_t serviceType() const { return mServType ; }
uint32_t serviceFullType() const { return ((uint32_t)mServType << 8) + (((uint32_t) RS_PKT_VERSION_SERVICE) << 24); } uint32_t serviceFullType() const { return ((uint32_t)mServType << 8) + (((uint32_t) RS_PKT_VERSION_SERVICE) << 24); }

View File

@ -2311,6 +2311,8 @@ bool RsGxsNetService::getGroupNetworkStats(const RsGxsGroupId& gid,RsGroupNetwor
stats.mSuppliers = it->second.suppliers.ids.size(); stats.mSuppliers = it->second.suppliers.ids.size();
stats.mMaxVisibleCount = it->second.max_visible_count ; stats.mMaxVisibleCount = it->second.max_visible_count ;
stats.mAllowMsgSync = mAllowMsgSync ;
stats.mGrpAutoSync = mGrpAutoSync ;
return true ; return true ;
} }
@ -2971,9 +2973,8 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "locked_genReqGrpTransaction(): " << std::endl; GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << "locked_genReqGrpTransaction(): " << std::endl;
#endif #endif
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetaMap;
std::list<RsNxsSyncGrpItem*> grpItemL; std::list<RsNxsSyncGrpItem*> grpItemL;
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetaMap;
for(std::list<RsNxsItem*>::iterator lit = tr->mItems.begin(); lit != tr->mItems.end(); ++lit) for(std::list<RsNxsItem*>::iterator lit = tr->mItems.begin(); lit != tr->mItems.end(); ++lit)
{ {
@ -2991,7 +2992,23 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
} }
if (grpItemL.empty()) if (grpItemL.empty())
return; {
// Normally the client grp updateTS is set after the transaction, but if no transaction is to happen, we have to set it here.
// Possible change: always do the update of the grpClientTS here. Needs to be tested...
RsGxsGrpUpdate& item (mClientGrpUpdateMap[tr->mTransaction->PeerId()]);
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << " reqList is empty, updating anyway ClientGrpUpdate TS for peer " << tr->mTransaction->PeerId() << " to: " << tr->mTransaction->updateTS << std::endl;
#endif
if(item.grpUpdateTS != tr->mTransaction->updateTS)
{
item.grpUpdateTS = tr->mTransaction->updateTS;
IndicateConfigChanged();
}
return;
}
mDataStore->retrieveGxsGrpMetaData(grpMetaMap); mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
@ -3036,16 +3053,23 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
if(!reqList.empty()) if(!reqList.empty())
locked_pushGrpTransactionFromList(reqList, tr->mTransaction->PeerId(), transN); locked_pushGrpTransactionFromList(reqList, tr->mTransaction->PeerId(), transN);
else else
{ {
RsGxsGrpUpdate& item (mClientGrpUpdateMap[tr->mTransaction->PeerId()]); // Normally the client grp updateTS is set after the transaction, but if no transaction is to happen, we have to set it here.
// Possible change: always do the update of the grpClientTS here. Needs to be tested...
RsGxsGrpUpdate& item (mClientGrpUpdateMap[tr->mTransaction->PeerId()]);
#ifdef NXS_NET_DEBUG_0 #ifdef NXS_NET_DEBUG_0
GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << " reqList is empty, updating anyway ClientGrpUpdate TS for peer " << tr->mTransaction->PeerId() << " to: " << tr->mTransaction->updateTS << std::endl; GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << " reqList is empty, updating anyway ClientGrpUpdate TS for peer " << tr->mTransaction->PeerId() << " to: " << tr->mTransaction->updateTS << std::endl;
#endif #endif
item.grpUpdateTS = tr->mTransaction->updateTS;
IndicateConfigChanged(); if(item.grpUpdateTS != tr->mTransaction->updateTS)
} {
item.grpUpdateTS = tr->mTransaction->updateTS;
IndicateConfigChanged();
}
}
} }
void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr) void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
@ -4046,7 +4070,12 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
GXSNETDEBUG_PG(item->PeerId(),item->grpId) << "handleRecvSyncMsg(): Received last update TS of group " << item->grpId << ", for peer " << peer << ", TS = " << time(NULL) - item->updateTS << " secs ago." ; GXSNETDEBUG_PG(item->PeerId(),item->grpId) << "handleRecvSyncMsg(): Received last update TS of group " << item->grpId << ", for peer " << peer << ", TS = " << time(NULL) - item->updateTS << " secs ago." ;
#endif #endif
if(grp_is_known) // We update suppliers in two cases:
// Case 1: the grp is known because it is the hash of an existing group, but it's not yet in the server config map
// Case 2: the gtp is not known, possibly because it was deleted, but there's an entry in mServerGrpConfigMap due to statistics gathering. Still, statistics are only
// gathered from known suppliers. So statistics never add new suppliers. These are only added here.
if(grp_is_known || mServerGrpConfigMap.find(item->grpId)!=mServerGrpConfigMap.end())
{ {
RsGxsGrpConfig & rec(mServerGrpConfigMap[item->grpId]) ; // this creates it if needed. When the grp is unknown (and hashed) this will would create a unused entry RsGxsGrpConfig & rec(mServerGrpConfigMap[item->grpId]) ; // this creates it if needed. When the grp is unknown (and hashed) this will would create a unused entry
rec.suppliers.ids.insert(peer) ; rec.suppliers.ids.insert(peer) ;
@ -4143,7 +4172,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
if(details.mReputation.mOverallReputationLevel < minReputationForForwardingMessages(grpMeta->mSignFlags, details.mFlags)) if(details.mReputation.mOverallReputationLevel < minReputationForForwardingMessages(grpMeta->mSignFlags, details.mFlags))
{ {
#ifdef NXS_NET_DEBUG_0 #ifdef NXS_NET_DEBUG_0
std::cerr << GXSNETDEBUG_PG(item->PeerId(),item->grpId) << " not sending item ID " << (*vit)->mMsgId << ", because the author is flags " << std::hex << details.mFlags << std::dec << " and reputation level " << details.mReputation.mOverallReputationLevel << std::endl; GXSNETDEBUG_PG(item->PeerId(),item->grpId) << " not sending item ID " << (*vit)->mMsgId << ", because the author is flags " << std::hex << details.mFlags << std::dec << " and reputation level " << details.mReputation.mOverallReputationLevel << std::endl;
#endif #endif
continue ; continue ;
} }
@ -4724,7 +4753,7 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item)
if(ret) if(ret)
{ {
#ifdef NXS_NET_DEBUG #ifdef NXS_NET_DEBUG_3
GXSNETDEBUG_PG(item->PeerId(),item->grpId)<< " updated database with new publish keys." << std::endl; GXSNETDEBUG_PG(item->PeerId(),item->grpId)<< " updated database with new publish keys." << std::endl;
#endif #endif
mNewPublishKeysToNotify.insert(item->grpId) ; mNewPublishKeysToNotify.insert(item->grpId) ;
@ -4751,6 +4780,44 @@ bool RsGxsNetService::getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& gro
return true ; return true ;
} }
bool RsGxsNetService::removeGroups(const std::list<RsGxsGroupId>& groups)
{
RS_STACK_MUTEX(mNxsMutex) ;
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG___ << "Removing group information from deleted groups:" << std::endl;
#endif
for(std::list<RsGxsGroupId>::const_iterator git(groups.begin());git!=groups.end();++git)
{
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG__G(*git) << " deleting info for group " << *git << std::endl;
#endif
GrpConfigMap::iterator it = mServerGrpConfigMap.find(*git) ;
if(it != mServerGrpConfigMap.end())
{
it->second.suppliers.TlvClear(); // we dont erase the entry, because we want to keep the user-defined sync parameters.
it->second.max_visible_count = 0;
}
mServerMsgUpdateMap.erase(*git) ;
for(ClientMsgMap::iterator it(mClientMsgUpdateMap.begin());it!=mClientMsgUpdateMap.end();++it)
it->second.msgUpdateInfos.erase(*git) ;
// This last step is very important: it makes RS re-sync all groups after deleting, with every new peer. If may happen indeed that groups
// are deleted because there's no suppliers since the actual supplier friend is offline for too long. In this case, the group needs
// to re-appear when the friend who is a subscriber comes online again.
mClientGrpUpdateMap.clear();
}
IndicateConfigChanged();
return true ;
}
bool RsGxsNetService::stampMsgServerUpdateTS(const RsGxsGroupId& gid) bool RsGxsNetService::stampMsgServerUpdateTS(const RsGxsGroupId& gid)
{ {
RS_STACK_MUTEX(mNxsMutex) ; RS_STACK_MUTEX(mNxsMutex) ;

View File

@ -161,6 +161,7 @@ public:
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ; virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) ; virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) ;
virtual bool removeGroups(const std::list<RsGxsGroupId>& groups);
/* p3Config methods */ /* p3Config methods */
public: public:

View File

@ -40,7 +40,7 @@ bool AuthorPending::expired() const
return time(NULL) > (mTimeStamp + EXPIRY_PERIOD_OFFSET); return time(NULL) > (mTimeStamp + EXPIRY_PERIOD_OFFSET);
} }
bool AuthorPending::getAuthorRep(GixsReputation& rep, const RsGxsId& authorId, const RsPeerId& peerId) bool AuthorPending::getAuthorRep(GixsReputation& rep, const RsGxsId& authorId, const RsPeerId& /*peerId*/)
{ {
rep.id = authorId ; rep.id = authorId ;
rep.reputation_level = mRep->overallReputationLevel(authorId); rep.reputation_level = mRep->overallReputationLevel(authorId);
@ -96,7 +96,7 @@ bool MsgRespPending::accepted()
GixsReputation rep; GixsReputation rep;
if(getAuthorRep(rep, entry.mAuthorId, mPeerId)) if(getAuthorRep(rep, entry.mAuthorId, mPeerId))
{ {
if(rep.reputation_level >= mCutOff) if(rep.reputation_level >= (uint32_t)mCutOff)
{ {
entry.mPassedVetting = true; entry.mPassedVetting = true;
count++; count++;
@ -131,7 +131,7 @@ bool GrpRespPending::accepted()
if(getAuthorRep(rep, entry.mAuthorId, mPeerId)) if(getAuthorRep(rep, entry.mAuthorId, mPeerId))
{ {
if(rep.reputation_level >= mCutOff) if(rep.reputation_level >= (uint32_t)mCutOff)
{ {
entry.mPassedVetting = true; entry.mPassedVetting = true;
count++; count++;

View File

@ -188,20 +188,17 @@ bool RsGxsIntegrityCheck::check()
grpsToDel.push_back(grp->grpId); grpsToDel.push_back(grp->grpId);
} }
#ifdef TODO if(!(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) && !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) && !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH))
if(!(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED))
{ {
RsGroupNetworkStats stats ; RsGroupNetworkStats stats ;
mGenExchangeClient->getGroupNetworkStats(grp->grpId,stats); mGenExchangeClient->getGroupNetworkStats(grp->grpId,stats);
if(stats.mSuppliers == 0 && stats.mMaxVisibleCount == 0) if(stats.mSuppliers == 0 && stats.mMaxVisibleCount == 0 && stats.mGrpAutoSync)
{ {
GXSUTIL_DEBUG() << "Scheduling group \"" << grp->metaData->mGroupName << "\" ID=" << grp->grpId << " for deletion because it has no suppliers not any visible data at friends." << std::endl; GXSUTIL_DEBUG() << "Scheduling group \"" << grp->metaData->mGroupName << "\" ID=" << grp->grpId << " in service " << std::hex << mGenExchangeClient->serviceType() << std::dec << " for deletion because it has no suppliers not any visible data at friends." << std::endl;
#warning Should we do that here? What happens for groups that are normally empty such as identities?
grpsToDel.push_back(grp->grpId); grpsToDel.push_back(grp->grpId);
} }
} }
#endif
delete grp; delete grp;
} }

View File

@ -162,6 +162,14 @@ public:
*/ */
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) =0; virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) =0;
/*!
* \brief removeGroups
* Removes time stamp information from the list of groups. This allows to re-sync them if suppliers are present.
* \param groups list of groups to remove from the update maps
* \return true if nothing bad happens.
*/
virtual bool removeGroups(const std::list<RsGxsGroupId>& groups)=0;
/*! /*!
* \brief minReputationForForwardingMessages * \brief minReputationForForwardingMessages
* Encodes the policy for sending/requesting messages depending on anti-spam settings. * Encodes the policy for sending/requesting messages depending on anti-spam settings.

View File

@ -91,9 +91,9 @@ public:
virtual ~RsGxsReputationSetItem_deprecated3() {} virtual ~RsGxsReputationSetItem_deprecated3() {}
virtual void clear() {} virtual void clear() {}
std::ostream &print(std::ostream &out, uint16_t indent = 0) { return out;} std::ostream &print(std::ostream &out, uint16_t /*indent*/ = 0) { return out;}
virtual bool serialise(void *data,uint32_t& size) const { return false ;} virtual bool serialise(void */*data*/,uint32_t& /*size*/) const { return false ;}
virtual uint32_t serial_size() const { return 0;} virtual uint32_t serial_size() const { return 0;}
RsGxsId mGxsId; RsGxsId mGxsId;

View File

@ -18,7 +18,7 @@ class RsSharedPtr
{ {
public: public:
RsSharedPtr() : mShared(NULL), mCount(NULL) {} RsSharedPtr() : mShared(NULL), mCount(NULL), mSharedPtrMutex(NULL){}
RsSharedPtr(T* shared) RsSharedPtr(T* shared)
: mShared(shared), mCount(new int(0)), mSharedPtrMutex(new RsMutex("SharedMutex")) : mShared(shared), mCount(new int(0)), mSharedPtrMutex(new RsMutex("SharedMutex"))
@ -96,8 +96,8 @@ private:
private: private:
int* mCount;
T* mShared; T* mShared;
int* mCount;
RsMutex* mSharedPtrMutex; RsMutex* mSharedPtrMutex;
}; };

View File

@ -55,7 +55,9 @@ VOIPToasterItem::VOIPToasterItem(const RsPeerId &peer_id, const QString &msg, co
connect(closeButton, SIGNAL(clicked()), SLOT(hide())); connect(closeButton, SIGNAL(clicked()), SLOT(hide()));
/* set informations */ /* set informations */
textLabel->setText(RsHtml().formatText(NULL, msg, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE)); // emoticons disabled because of crazy cost
//textLabel->setText(RsHtml().formatText(NULL, msg, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
textLabel->setText(RsHtml().formatText(NULL, msg, RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
//toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(mPeerId).c_str())); //toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(mPeerId).c_str()));
avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME); avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
avatarWidget->setId(ChatId(mPeerId)); avatarWidget->setId(ChatId(mPeerId));

View File

@ -177,7 +177,9 @@ void MsgItem::updateItemStatic()
void MsgItem::fillExpandFrame() void MsgItem::fillExpandFrame()
{ {
msgLabel->setText(RsHtml().formatText(NULL, mMsg, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); // emoticons disabled because of crazy cost.
//msgLabel->setText(RsHtml().formatText(NULL, mMsg, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
msgLabel->setText(RsHtml().formatText(NULL, mMsg, RSHTML_FORMATTEXT_EMBED_LINKS));
} }
void MsgItem::updateItem() void MsgItem::updateItem()

View File

@ -1389,10 +1389,10 @@ void GxsForumThreadWidget::fillThreads(QList<QTreeWidgetItem *> &threadList, boo
++index; ++index;
} }
// (csoler) QTreeWidget::findItems apparently does not always work so I need to make the search manually, which I do using a map for efficiency reasons. //(csoler) QTreeWidget::findItems apparently does not always work so I need to make the search manually, which I do using a map for efficiency reasons.
std::map<QString,QTreeWidgetItem*> oldThreadMap ; std::map<QString,QTreeWidgetItem*> oldThreadMap;
for(uint32_t i=0;i<ui->threadTreeWidget->topLevelItemCount();++i) for(int i=0; i<ui->threadTreeWidget->topLevelItemCount(); ++i)
oldThreadMap[ui->threadTreeWidget->topLevelItem(i)->data(COLUMN_THREAD_MSGID,Qt::DisplayRole).toString()] = ui->threadTreeWidget->topLevelItem(i) ; oldThreadMap[ui->threadTreeWidget->topLevelItem(i)->data(COLUMN_THREAD_MSGID, Qt::DisplayRole).toString()] = ui->threadTreeWidget->topLevelItem(i);
// iterate all new threads // iterate all new threads
for (QList<QTreeWidgetItem *>::iterator newThread = threadList.begin (); newThread != threadList.end (); ++newThread) { for (QList<QTreeWidgetItem *>::iterator newThread = threadList.begin (); newThread != threadList.end (); ++newThread) {

View File

@ -571,7 +571,9 @@ void MessageWidget::fill(const std::string &msgId)
ui.subjectText->setText(QString::fromUtf8(msgInfo.title.c_str())); ui.subjectText->setText(QString::fromUtf8(msgInfo.title.c_str()));
text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS); // emoticons disabled because of crazy cost.
//text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), RSHTML_FORMATTEXT_EMBED_LINKS);
ui.msgText->resetImagesStatus(Settings->getMsgLoadEmbeddedImages() || (msgInfo.msgflags & RS_MSG_LOAD_EMBEDDED_IMAGES)); ui.msgText->resetImagesStatus(Settings->getMsgLoadEmbeddedImages() || (msgInfo.msgflags & RS_MSG_LOAD_EMBEDDED_IMAGES));
ui.msgText->setHtml(text); ui.msgText->setHtml(text);

View File

@ -55,6 +55,10 @@ no_rs_gxs:CONFIG -= rs_gxs
CONFIG *= no_rs_nodeprecatedwarning CONFIG *= no_rs_nodeprecatedwarning
rs_nodeprecatedwarning:CONFIG -= no_rs_nodeprecatedwarning rs_nodeprecatedwarning:CONFIG -= no_rs_nodeprecatedwarning
# To disable Cpp #Warning append the following
# assignation to qmake command line "CONFIG+=rs_nocppwarning"
CONFIG *= no_rs_nocppwarning
rs_nocppwarning:CONFIG -= no_rs_nocppwarning
unix { unix {
isEmpty(PREFIX) { PREFIX = "/usr" } isEmpty(PREFIX) { PREFIX = "/usr" }
@ -166,4 +170,10 @@ rs_nodeprecatedwarning {
warning("QMAKE: You have disable deprecated warnings.") warning("QMAKE: You have disable deprecated warnings.")
} }
rs_nocppwarning {
QMAKE_CXXFLAGS += -Wno-cpp
DEFINES *= RS_NO_WARN_CPP
warning("QMAKE: You have disable cpp warnings.")
}
rs_gxs_mail:DEFINES *= RS_GXS_MAIL rs_gxs_mail:DEFINES *= RS_GXS_MAIL

View File

@ -97,7 +97,7 @@ SetPacket &SetServiceTester::examinePacket(uint32_t idx)
return mPackets[idx]; return mPackets[idx];
} }
bool SetServiceTester::injectPacket(const SetPacket &pkt) bool SetServiceTester::injectPacket(const SetPacket &/*pkt*/)
{ {
std::cerr << "SetServiceTester::injectPacket() Incomplete"; std::cerr << "SetServiceTester::injectPacket() Incomplete";
std::cerr << std::endl; std::cerr << std::endl;

View File

@ -124,7 +124,7 @@ void test_groupStoreAndRetrieve(){
grpMetaR.clear(); grpMetaR.clear();
EXPECT_TRUE(grpMatch); EXPECT_TRUE(grpMatch && grpMetaMatch);
tearDown(); tearDown();
} }
@ -225,12 +225,12 @@ void test_messageStoresAndRetrieve()
std::vector<RsNxsMsg*>& result0 = msgResult[grpId0]; std::vector<RsNxsMsg*>& result0 = msgResult[grpId0];
std::vector<RsNxsMsg*>& result1 = msgResult[grpId1]; std::vector<RsNxsMsg*>& result1 = msgResult[grpId1];
std::vector<RsGxsMsgMetaData*>& resultMeta0 = msgMetaResult[grpId0]; std::vector<RsGxsMsgMetaData*>& resultMeta0 = msgMetaResult[grpId0];
std::vector<RsGxsMsgMetaData*>& resultMeta1 = msgMetaResult[grpId1]; //std::vector<RsGxsMsgMetaData*>& resultMeta1 = msgMetaResult[grpId1];
bool msgGrpId0_Match = true, msgGrpId1_Match = true; bool msgGrpId0_Match = true, msgGrpId1_Match = true;
bool msgMetaGrpId0_Match = true, msgMetaGrpId1_Match = true; bool msgMetaGrpId0_Match = true/*, msgMetaGrpId1_Match = true*/;
// MSG test, selective retrieval // MSG test, selective retrieval
for(std::vector<RsNxsMsg*>::size_type i = 0; i < result0.size(); i++) for(std::vector<RsNxsMsg*>::size_type i = 0; i < result0.size(); i++)

View File

@ -334,7 +334,8 @@ void GenExchangeTest::init(RsGroupMetaData& grpMetaData) const
randString(SHORT_STR, grpMetaData.mServiceString); randString(SHORT_STR, grpMetaData.mServiceString);
grpMetaData.mGroupFlags = randNum(); grpMetaData.mGroupFlags = randNum() & (0x00000007);//See GXS_SERV::FLAG_PRIVACY_XXX values /libretroshare/src/retroshare/rsgxsflags.h:21
if (grpMetaData.mGroupFlags == 0) grpMetaData.mGroupFlags = GXS_SERV::FLAG_PRIVACY_PRIVATE;
grpMetaData.mLastPost = randNum(); grpMetaData.mLastPost = randNum();
grpMetaData.mGroupStatus = randNum(); grpMetaData.mGroupStatus = randNum();
grpMetaData.mVisibleMsgCount = randNum(); grpMetaData.mVisibleMsgCount = randNum();
@ -595,7 +596,7 @@ bool operator ==(const RsDummyMsg& lMsg, const RsDummyMsg& rMsg)
return true; return true;
} }
bool operator ==(const RsGxsGrpItem& lGrp, const RsGxsGrpItem& rGrp) bool operator ==(const RsGxsGrpItem& /*lGrp*/, const RsGxsGrpItem& /*rGrp*/)
{ {
return false; return false;
} }

View File

@ -13,7 +13,7 @@ RsServiceInfo GenExchangeTestService::getServiceInfo()
return info; return info;
} }
void GenExchangeTestService::notifyChanges(std::vector<RsGxsNotify *> &changes) void GenExchangeTestService::notifyChanges(std::vector<RsGxsNotify *> &/*changes*/)
{ {
return; return;
} }
@ -23,7 +23,7 @@ void GenExchangeTestService::publishDummyGrp(uint32_t &token, RsDummyGrp *grp)
publishGroup(token, grp); publishGroup(token, grp);
} }
void GenExchangeTestService::updateDummyGrp(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta, RsDummyGrp *group) void GenExchangeTestService::updateDummyGrp(uint32_t &token, RsGxsGroupUpdateMeta &/*updateMeta*/, RsDummyGrp *group)
{ {
//updateGroup(token, updateMeta, group); //updateGroup(token, updateMeta, group);
updateGroup(token, group); updateGroup(token, group);

View File

@ -15,18 +15,18 @@ public:
RsDummyNetService(){ return;} RsDummyNetService(){ return;}
virtual ~RsDummyNetService() { } virtual ~RsDummyNetService() { }
void setSyncAge(const RsGxsGroupId& id,uint32_t age_in_secs){} void setSyncAge(const RsGxsGroupId& /*id*/,uint32_t /*age_in_secs*/){}
void setKeepAge(const RsGxsGroupId& id,uint32_t age_in_secs){} void setKeepAge(const RsGxsGroupId& /*id*/,uint32_t /*age_in_secs*/){}
void requestGroupsOfPeer(const std::string& peerId){} void requestGroupsOfPeer(const std::string& /*peerId*/){}
void requestMessagesOfPeer(const std::string& peerId, const std::string& grpId){} void requestMessagesOfPeer(const std::string& /*peerId*/, const std::string& /*grpId*/){}
void pauseSynchronisation(bool enabled) {} void pauseSynchronisation(bool /*enabled*/) {}
int requestMsg(const std::string& msgId, uint8_t hops){ return 0;} int requestMsg(const std::string& /*msgId*/, uint8_t /*hops*/){ return 0;}
int requestGrp(const std::list<std::string>& grpId, uint8_t hops) { return 0;} int requestGrp(const std::list<std::string>& /*grpId*/, uint8_t /*hops*/) { return 0;}
}; };
@ -44,7 +44,7 @@ public:
std::string msgData; std::string msgData;
std::ostream &print(std::ostream &out, uint16_t indent = 0){ return out; } std::ostream &print(std::ostream &out, uint16_t /*indent*/ = 0){ return out; }
void clear() { msgData.clear(); } void clear() { msgData.clear(); }
}; };
@ -59,7 +59,7 @@ public:
std::string grpData; std::string grpData;
void clear() { grpData.clear(); } void clear() { grpData.clear(); }
std::ostream &print(std::ostream &out, uint16_t indent = 0){ return out; } std::ostream &print(std::ostream &out, uint16_t /*indent*/ = 0){ return out; }
}; };
@ -108,7 +108,7 @@ public:
* @param * @param
* @param dummyId This is is the only id thats exists in this dummy interface * @param dummyId This is is the only id thats exists in this dummy interface
*/ */
RsGixsDummy(const RsGxsId& incomingId, const RsGxsId& outgoingId){} RsGixsDummy(const RsGxsId& /*incomingId*/, const RsGxsId& /*outgoingId*/){}
virtual ~RsGixsDummy(){} virtual ~RsGixsDummy(){}
@ -130,14 +130,14 @@ public:
* @param keyref the keyref of key that is being checked for * @param keyref the keyref of key that is being checked for
* @return true if available, false otherwise * @return true if available, false otherwise
*/ */
bool haveKey(const RsGxsId &id){ return false;} bool haveKey(const RsGxsId &/*id*/){ return false;}
/*! /*!
* Use to query whether private key member of the given key reference is available * Use to query whether private key member of the given key reference is available
* @param keyref the KeyRef of the key being checked for * @param keyref the KeyRef of the key being checked for
* @return true if private key is held here, false otherwise * @return true if private key is held here, false otherwise
*/ */
bool havePrivateKey(const RsGxsId &id){ return false; } bool havePrivateKey(const RsGxsId &/*id*/){ return false; }
// The fetchKey has an optional peerList.. this is people that had the msg with the signature. // The fetchKey has an optional peerList.. this is people that had the msg with the signature.
// These same people should have the identity - so we ask them first. // These same people should have the identity - so we ask them first.
@ -146,8 +146,8 @@ public:
* @param keyref the KeyRef of the key being requested * @param keyref the KeyRef of the key being requested
* @return will * @return will
*/ */
bool requestKey(const RsGxsId &id, const std::list<RsPeerId> &peers){ return false ;} bool requestKey(const RsGxsId &/*id*/, const std::list<RsPeerId> &/*peers*/){ return false ;}
bool requestPrivateKey(const RsGxsId &id){ return false;} bool requestPrivateKey(const RsGxsId &/*id*/){ return false;}
/*! /*!
@ -156,8 +156,8 @@ public:
* @return a pointer to a valid profile if successful, otherwise NULL * @return a pointer to a valid profile if successful, otherwise NULL
* *
*/ */
bool getKey(const RsGxsId &id, RsTlvPublicRSAKey& key){ return false; } bool getKey(const RsGxsId &/*id*/, RsTlvPublicRSAKey& /*key*/){ return false; }
bool getPrivateKey(const RsGxsId &id, RsTlvPrivateRSAKey& key){ return false; } // For signing outgoing messages. bool getPrivateKey(const RsGxsId &/*id*/, RsTlvPrivateRSAKey& /*key*/){ return false; } // For signing outgoing messages.
private: private:

View File

@ -14,53 +14,54 @@ rs_nxs_test::RsNxsSimpleDummyCircles::RsNxsSimpleDummyCircles() {
} }
bool rs_nxs_test::RsNxsSimpleDummyCircles::isLoaded( bool rs_nxs_test::RsNxsSimpleDummyCircles::isLoaded(
const RsGxsCircleId& circleId) { const RsGxsCircleId& /*circleId*/) {
return true; return true;
} }
bool rs_nxs_test::RsNxsSimpleDummyCircles::loadCircle( bool rs_nxs_test::RsNxsSimpleDummyCircles::loadCircle(
const RsGxsCircleId& circleId) { const RsGxsCircleId& /*circleId*/) {
return true; return true;
} }
int rs_nxs_test::RsNxsSimpleDummyCircles::canSend(const RsGxsCircleId& circleId, int rs_nxs_test::RsNxsSimpleDummyCircles::canSend(const RsGxsCircleId& /*circleId*/,
const RsPgpId& id, bool &should_encrypt) { const RsPgpId& /*id*/, bool &/*should_encrypt*/) {
return true; return true;
} }
int rs_nxs_test::RsNxsSimpleDummyCircles::canReceive( int rs_nxs_test::RsNxsSimpleDummyCircles::canReceive(
const RsGxsCircleId& circleId, const RsPgpId& id) { const RsGxsCircleId& /*circleId*/, const RsPgpId& /*id*/) {
return true; return true;
} }
bool rs_nxs_test::RsNxsSimpleDummyCircles::isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId &destination_group, const RsGxsId& id) bool rs_nxs_test::RsNxsSimpleDummyCircles::isRecipient(const RsGxsCircleId &/*circleId*/, const RsGxsGroupId &/*destination_group*/, const RsGxsId& /*id*/)
{ {
return true ; return true ;
} }
bool rs_nxs_test::RsNxsSimpleDummyCircles::recipients( bool rs_nxs_test::RsNxsSimpleDummyCircles::recipients(
const RsGxsCircleId& circleId, std::list<RsPgpId>& friendlist) { const RsGxsCircleId& /*circleId*/, std::list<RsPgpId>& /*friendlist*/) {
return true; return true;
} }
bool rs_nxs_test::RsNxsSimpleDummyCircles::recipients(const RsGxsCircleId& circleId, const RsGxsGroupId &destination_group, std::list<RsGxsId>& friendlist) { bool rs_nxs_test::RsNxsSimpleDummyCircles::recipients(const RsGxsCircleId& /*circleId*/, const RsGxsGroupId &/*destination_group*/, std::list<RsGxsId>& /*friendlist*/) {
return true; return true;
} }
rs_nxs_test::RsNxsSimpleDummyReputation::RsNxsSimpleDummyReputation( rs_nxs_test::RsNxsSimpleDummyReputation::RsNxsSimpleDummyReputation(
RepMap& repMap, bool cached) { RepMap& /*repMap*/, bool /*cached*/) {
} }
bool rs_nxs_test::RsNxsSimpleDummyReputation::haveReputation( bool rs_nxs_test::RsNxsSimpleDummyReputation::haveReputation(
const RsGxsId& id) { const RsGxsId& /*id*/) {
return true; return true;
} }
bool rs_nxs_test::RsNxsSimpleDummyReputation::loadReputation(const RsGxsId& id, bool rs_nxs_test::RsNxsSimpleDummyReputation::loadReputation(const RsGxsId& /*id*/,
const std::list<RsPeerId>& peers) { const std::list<RsPeerId>& /*peers*/) {
return true; return true;
} }
bool rs_nxs_test::RsNxsSimpleDummyReputation::getReputation(const RsGxsId& id, bool rs_nxs_test::RsNxsSimpleDummyReputation::getReputation(const RsGxsId& /*id*/,
GixsReputation& rep) { GixsReputation& rep) {
rep.reputation_level = 5; rep.reputation_level = 5;
return true; return true;
@ -84,17 +85,17 @@ bool rs_nxs_test::RsNxsDelayedDummyCircles::loadCircle(
return allowed(circleId); return allowed(circleId);
} }
int rs_nxs_test::RsNxsDelayedDummyCircles::canSend(const RsGxsCircleId& circleId, const RsPgpId& id, bool &should_encrypt) { int rs_nxs_test::RsNxsDelayedDummyCircles::canSend(const RsGxsCircleId& circleId, const RsPgpId& /*id*/, bool &/*should_encrypt*/) {
return allowed(circleId); return allowed(circleId);
} }
int rs_nxs_test::RsNxsDelayedDummyCircles::canReceive( int rs_nxs_test::RsNxsDelayedDummyCircles::canReceive(
const RsGxsCircleId& circleId, const RsPgpId& id) { const RsGxsCircleId& circleId, const RsPgpId& /*id*/) {
return allowed(circleId); return allowed(circleId);
} }
bool rs_nxs_test::RsNxsDelayedDummyCircles::recipients( bool rs_nxs_test::RsNxsDelayedDummyCircles::recipients(
const RsGxsCircleId& circleId, std::list<RsPgpId>& friendlist) { const RsGxsCircleId& circleId, std::list<RsPgpId>& /*friendlist*/) {
return allowed(circleId); return allowed(circleId);
} }

View File

@ -44,7 +44,7 @@ namespace rs_nxs_test
virtual bool recipients(const RsGxsCircleId &circleId, std::list<RsPgpId> &friendlist); virtual bool recipients(const RsGxsCircleId &circleId, std::list<RsPgpId> &friendlist);
virtual bool recipients(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, std::list<RsGxsId>& idlist) ; virtual bool recipients(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, std::list<RsGxsId>& idlist) ;
virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, const RsGxsId& id) ; virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, const RsGxsId& id) ;
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) { return true ; } virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& /*gid*/,time_t& /*grp_server_update_TS*/,time_t& /*msg_server_update_TS*/) { return true ; }
}; };
/*! /*!
@ -71,9 +71,9 @@ namespace rs_nxs_test
int canSend(const RsGxsCircleId &circleId, const RsPgpId &id,bool& should_encrypt); int canSend(const RsGxsCircleId &circleId, const RsPgpId &id,bool& should_encrypt);
int canReceive(const RsGxsCircleId &circleId, const RsPgpId &id); int canReceive(const RsGxsCircleId &circleId, const RsPgpId &id);
virtual bool recipients(const RsGxsCircleId &circleId, std::list<RsPgpId> &friendlist); virtual bool recipients(const RsGxsCircleId &circleId, std::list<RsPgpId> &friendlist);
virtual bool recipients(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, std::list<RsGxsId>& idlist) { return true ;} virtual bool recipients(const RsGxsCircleId &/*circleId*/, const RsGxsGroupId& /*destination_group*/, std::list<RsGxsId>& /*idlist*/) { return true ;}
virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, const RsGxsId& id) { return allowed(circleId) ; } virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& /*destination_group*/, const RsGxsId& /*id*/) { return allowed(circleId) ; }
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) { return true ; } virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& /*gid*/,time_t& /*grp_server_update_TS*/,time_t& /*msg_server_update_TS*/) { return true ; }
private: private:
bool allowed(const RsGxsCircleId& circleId); bool allowed(const RsGxsCircleId& circleId);
@ -130,7 +130,7 @@ namespace rs_nxs_test
} }
const RsPeerId& getOwnId() { return mOwnId; } const RsPeerId& getOwnId() { return mOwnId; }
void getOnlineList(const uint32_t serviceId, std::set<RsPeerId>& ssl_peers) void getOnlineList(const uint32_t /*serviceId*/, std::set<RsPeerId>& ssl_peers)
{ {
RsPeerId::std_list::iterator lit = mPeers.begin(); RsPeerId::std_list::iterator lit = mPeers.begin();

View File

@ -114,12 +114,12 @@ RsNxsNetMgr* NxsGrpSync::getDummyNetManager(const RsPeerId& peerId)
return mNxsNetMgrs[peerId]; return mNxsNetMgrs[peerId];
} }
RsGcxs* NxsGrpSync::getDummyCircles(const RsPeerId& peerId) RsGcxs* NxsGrpSync::getDummyCircles(const RsPeerId& /*peerId*/)
{ {
return mCircles; return mCircles;
} }
RsGixsReputation* NxsGrpSync::getDummyReputations(const RsPeerId& peerId) RsGixsReputation* NxsGrpSync::getDummyReputations(const RsPeerId& /*peerId*/)
{ {
return mRep; return mRep;
} }

View File

@ -129,12 +129,12 @@ RsNxsNetMgr* rs_nxs_test::NxsMsgSync::getDummyNetManager(
return mNxsNetMgrs[peerId]; return mNxsNetMgrs[peerId];
} }
RsGcxs* rs_nxs_test::NxsMsgSync::getDummyCircles(const RsPeerId& peerId) { RsGcxs* rs_nxs_test::NxsMsgSync::getDummyCircles(const RsPeerId& /*peerId*/) {
return mCircles; return mCircles;
} }
RsGixsReputation* rs_nxs_test::NxsMsgSync::getDummyReputations( RsGixsReputation* rs_nxs_test::NxsMsgSync::getDummyReputations(
const RsPeerId& peerId) { const RsPeerId& /*peerId*/) {
return mRep; return mRep;
} }

View File

@ -149,7 +149,7 @@ void rs_nxs_test::NxsTestHub::notifyNewMessages(const RsPeerId& pid,
meta->mChildTs = 0; meta->mChildTs = 0;
meta->recvTS = 0; meta->recvTS = 0;
meta->validated = false; meta->validated = false;
bool ok = meta->deserialise(msg->meta.bin_data, &(msg->meta.bin_len)); meta->deserialise(msg->meta.bin_data, &(msg->meta.bin_len));
toStore.insert(std::make_pair(msg, meta)); toStore.insert(std::make_pair(msg, meta));
} }
@ -168,7 +168,7 @@ void rs_nxs_test::NxsTestHub::notifyNewGroups(const RsPeerId& pid, std::vector<R
{ {
RsNxsGrp* grp = *it; RsNxsGrp* grp = *it;
RsGxsGrpMetaData* meta = new RsGxsGrpMetaData(); RsGxsGrpMetaData* meta = new RsGxsGrpMetaData();
bool ok = meta->deserialise(grp->meta.bin_data, grp->meta.bin_len); meta->deserialise(grp->meta.bin_data, grp->meta.bin_len);
toStore.insert(std::make_pair(grp, meta)); toStore.insert(std::make_pair(grp, meta));
} }

View File

@ -103,9 +103,9 @@ namespace rs_nxs_test
typedef std::map<RsPeerId, RsGxsNetService::pointer > PeerNxsMap ; typedef std::map<RsPeerId, RsGxsNetService::pointer > PeerNxsMap ;
RsMutex mMtx;
PeerNxsMap mPeerNxsMap;
NxsTestScenario::pointer mTestScenario; NxsTestScenario::pointer mTestScenario;
RsMutex mMtx;
PeerNxsMap mPeerNxsMap;
std::queue<PayLoad> mPayLoad; std::queue<PayLoad> mPayLoad;
}; };

View File

@ -40,11 +40,11 @@ TEST(libretroshare_gxs, GxsSecurity)
EXPECT_TRUE(GxsSecurity::generateKeyPair(pub_key,priv_key)) ; EXPECT_TRUE(GxsSecurity::generateKeyPair(pub_key,priv_key)) ;
#ifdef WIN32 #ifdef WIN32
srand(getpid()) ; srand(getpid()) ;
#else #else
srand48(getpid()) ; srand48(getpid()) ;
#endif #endif
EXPECT_TRUE( pub_key.keyId == priv_key.keyId ); EXPECT_TRUE( pub_key.keyId == priv_key.keyId );
EXPECT_TRUE( pub_key.startTS == priv_key.startTS ); EXPECT_TRUE( pub_key.startTS == priv_key.startTS );
@ -93,7 +93,7 @@ TEST(libretroshare_gxs, GxsSecurity)
// Check that decrypted data is equal to original data. // Check that decrypted data is equal to original data.
// //
EXPECT_TRUE((int)data_len == outlen2) ; EXPECT_TRUE(data_len == outlen2) ;
EXPECT_TRUE(!memcmp(data,out2,outlen2)) ; EXPECT_TRUE(!memcmp(data,out2,outlen2)) ;
} }

View File

@ -112,18 +112,18 @@ bool test_StepThroughTlvStack(std::ostream &str, void *data, int size)
{ {
uint32_t offset = 0; uint32_t offset = 0;
uint32_t index = 0; uint32_t index = 0;
while (offset + 4 <= size) while (offset + 4 <= (uint32_t)size)
{ {
uint16_t tlvtype = GetTlvType( &(((uint8_t *) data)[offset]) ); uint16_t tlvtype = GetTlvType( &(((uint8_t *) data)[offset]) );
uint16_t tlvsize = GetTlvSize( &(((uint8_t *) data)[offset]) ); uint16_t tlvsize = GetTlvSize( &(((uint8_t *) data)[offset]) );
str << "Tlv Entry[" << index << "] => Offset: " << offset; str << "Tlv Entry[" << index << "] => Offset: " << offset;
str << " Type: " << tlvtype; str << " Type: " << tlvtype;
str << " Size: " << tlvsize; str << " Size: " << tlvsize;
str << std::endl; str << std::endl;
offset += tlvsize; offset += tlvsize ;
} }
EXPECT_TRUE(offset == size); /* we match up exactly */ EXPECT_TRUE(offset == (uint32_t)size); /* we match up exactly */
return 1; return 1;
} }

View File

@ -141,7 +141,7 @@ TEST(libretroshare_serialiser, test_RsTlvBase)
uint16_t data5[6 + 20]; uint16_t data5[6 + 20];
uint32_t pos =0; uint32_t pos =0;
uint32_t* offset = &pos; uint32_t* offset = &pos;
uint32_t pre_pos = pos; //uint32_t pre_pos = pos;
SetTlvString((void*)data5, sizeof(data5), offset, TLV_TYPE_STR_NAME, teststring); SetTlvString((void*)data5, sizeof(data5), offset, TLV_TYPE_STR_NAME, teststring);
uint32_t tlvsize = GetTlvStringSize(teststring); uint32_t tlvsize = GetTlvStringSize(teststring);
EXPECT_TRUE(tlvsize == *offset); EXPECT_TRUE(tlvsize == *offset);

View File

@ -108,7 +108,7 @@ bool FakePgpAuxUtils::getGPGAllList(std::list<RsPgpId> &ids)
bool FakePgpAuxUtils::askForDeferredSelfSignature(const void* /*data*/, const uint32_t /*len*/, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string /*reason = ""*/ ) bool FakePgpAuxUtils::askForDeferredSelfSignature(const void* /*data*/, const uint32_t /*len*/, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string /*reason = ""*/ )
{ {
for(int i = 0; i < *signlen; i++) for(unsigned int i = 0; i < *signlen; i++)
{ {
sign[i] = 0; sign[i] = 0;
} }

View File

@ -28,11 +28,11 @@ GxsIsolatedServiceTester::GxsIsolatedServiceTester(const RsPeerId &ownId, const
{ {
// extract bits we need. // extract bits we need.
PeerNode *node = getPeerNode(); PeerNode *node = getPeerNode();
p3PeerMgr *peerMgr = node->getPeerMgr(); //p3PeerMgr *peerMgr = node->getPeerMgr();
p3LinkMgr *linkMgr = node->getLinkMgr(); //p3LinkMgr *linkMgr = node->getLinkMgr();
p3NetMgr *netMgr = node->getNetMgr(); //p3NetMgr *netMgr = node->getNetMgr();
RsNxsNetMgr *nxsMgr = node->getNxsNetMgr(); RsNxsNetMgr *nxsMgr = node->getNxsNetMgr();
p3ServiceControl *serviceCtrl = node->getServiceControl(); //p3ServiceControl *serviceCtrl = node->getServiceControl();
// Create Service for Testing. // Create Service for Testing.
// Specific Testing service here. // Specific Testing service here.

View File

@ -104,7 +104,7 @@ void GxsPairServiceTester::PrintCapturedPackets()
std::cerr << "#Packets: " << getPacketCount(); std::cerr << "#Packets: " << getPacketCount();
std::cerr << std::endl; std::cerr << std::endl;
for(int i = 0; i < getPacketCount(); i++) for(uint32_t i = 0; i < getPacketCount(); i++)
{ {
SetPacket &pkt = examinePacket(i); SetPacket &pkt = examinePacket(i);

View File

@ -33,11 +33,11 @@ GxsPeerNode::GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &frien
mTestNs(NULL) mTestNs(NULL)
{ {
// extract bits we need. // extract bits we need.
p3PeerMgr *peerMgr = getPeerMgr(); //p3PeerMgr *peerMgr = getPeerMgr();
p3LinkMgr *linkMgr = getLinkMgr(); //p3LinkMgr *linkMgr = getLinkMgr();
p3NetMgr *netMgr = getNetMgr(); //p3NetMgr *netMgr = getNetMgr();
RsNxsNetMgr *nxsMgr = getNxsNetMgr(); RsNxsNetMgr *nxsMgr = getNxsNetMgr();
p3ServiceControl *serviceCtrl = getServiceControl(); //p3ServiceControl *serviceCtrl = getServiceControl();
// Create Service for Testing. // Create Service for Testing.
// Specific Testing service here. // Specific Testing service here.
@ -165,7 +165,7 @@ GxsPeerNode::~GxsPeerNode()
RsDirUtil::cleanupDirectory(mGxsDir, filesToKeep); RsDirUtil::cleanupDirectory(mGxsDir, filesToKeep);
} }
bool GxsPeerNode::checkTestServiceAllowedGroups(const RsPeerId &peerId) bool GxsPeerNode::checkTestServiceAllowedGroups(const RsPeerId &/*peerId*/)
{ {
#ifdef USER_NETSERVICE_WRAPPER #ifdef USER_NETSERVICE_WRAPPER
std::vector<RsGxsGroupId> groups; std::vector<RsGxsGroupId> groups;
@ -178,7 +178,7 @@ bool GxsPeerNode::checkTestServiceAllowedGroups(const RsPeerId &peerId)
} }
bool GxsPeerNode::checkCircleServiceAllowedGroups(const RsPeerId &peerId) bool GxsPeerNode::checkCircleServiceAllowedGroups(const RsPeerId &/*peerId*/)
{ {
#ifdef USER_NETSERVICE_WRAPPER #ifdef USER_NETSERVICE_WRAPPER
std::vector<RsGxsGroupId> groups; std::vector<RsGxsGroupId> groups;

View File

@ -54,7 +54,7 @@ RsServiceInfo GxsTestService::getServiceInfo()
} }
uint32_t GxsTestService::testAuthenPolicy(uint32_t testMode) uint32_t GxsTestService::testAuthenPolicy(uint32_t /*testMode*/)
{ {
uint32_t policy = 0; uint32_t policy = 0;
uint8_t flag = 0; uint8_t flag = 0;
@ -304,7 +304,7 @@ std::ostream &operator<<(std::ostream &out, const RsTestMsg &msg)
// Overloaded from RsTickEvent for Event callbacks. // Overloaded from RsTickEvent for Event callbacks.
void GxsTestService::handle_event(uint32_t event_type, const std::string &elabel) void GxsTestService::handle_event(uint32_t event_type, const std::string &/*elabel*/)
{ {
std::cerr << "GxsTestService::handle_event(" << event_type << ")"; std::cerr << "GxsTestService::handle_event(" << event_type << ")";
std::cerr << std::endl; std::cerr << std::endl;

View File

@ -45,7 +45,7 @@ uint32_t RsGxsTestSerialiser::size(RsItem *item)
{ {
return sizeGxsTestMsgItem(msg_item); return sizeGxsTestMsgItem(msg_item);
} }
return NULL; return 0;
} }
bool RsGxsTestSerialiser::serialise(RsItem *item, void *data, uint32_t *size) bool RsGxsTestSerialiser::serialise(RsItem *item, void *data, uint32_t *size)

View File

@ -27,9 +27,9 @@ TEST(libretroshare_services, Status_test1)
// extract bits we need. // extract bits we need.
PeerNode *node = tester.getPeerNode(); PeerNode *node = tester.getPeerNode();
p3PeerMgr *peerMgr = node->getPeerMgr(); //p3PeerMgr *peerMgr = node->getPeerMgr();
p3LinkMgr *linkMgr = node->getLinkMgr(); //p3LinkMgr *linkMgr = node->getLinkMgr();
p3NetMgr *netMgr = node->getNetMgr(); //p3NetMgr *netMgr = node->getNetMgr();
p3ServiceControl *serviceCtrl = node->getServiceControl(); p3ServiceControl *serviceCtrl = node->getServiceControl();
// add in service. // add in service.