diff --git a/libretroshare/src/gxs/gxssecurity.cc b/libretroshare/src/gxs/gxssecurity.cc index 33a77ece1..62078f7ae 100644 --- a/libretroshare/src/gxs/gxssecurity.cc +++ b/libretroshare/src/gxs/gxssecurity.cc @@ -162,6 +162,7 @@ bool GxsSecurity::validateNxsMsg(RsNxsMsg& msg, RsTlvKeySignature& sign, RsTlvSe msgMeta.mOrigMsgId = origMsgId; msgMeta.mMsgId = msgId; + msgMeta.signSet = signSet; if (signOk == 1) { diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 251cc7ce7..88686c681 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -101,20 +101,20 @@ void RsGenExchange::tick() publishMsgs(); - processGrpMetaChanges(); + processGrpMetaChanges(); - processMsgMetaChanges(); + processMsgMetaChanges(); - processRecvdData(); + processRecvdData(); - if(!mNotifications.empty()) - { - notifyChanges(mNotifications); - mNotifications.clear(); - } + if(!mNotifications.empty()) + { + notifyChanges(mNotifications); + mNotifications.clear(); + } - // implemented service tick function - service_tick(); + // implemented service tick function + service_tick(); } bool RsGenExchange::acknowledgeTokenMsg(const uint32_t& token, @@ -177,7 +177,7 @@ void RsGenExchange::generateGroupKeys(RsTlvSecurityKeySet& keySet, bool genPubli adminKey.keyId = adminKey.keyId + "_public"; adminKey.startTS = time(NULL); - adminKey.endTS = 0; /* no end */ + adminKey.endTS = adminKey.startTS + 60 * 60 * 24 * 365 * 5; /* approx 5 years */ privAdminKey.startTS = adminKey.startTS; privAdminKey.endTS = 0; /* no end */ @@ -434,7 +434,7 @@ bool RsGenExchange::createMsgSignatures(RsTlvKeySignatureSet& signSet, RsTlvBina // poll immediately but, don't spend more than a second polling while( (mGixs->getPrivateKey(msgMeta.mAuthorId, authorKey) == -1) && - ((now + 1) >> time(NULL)) + ((now + 5) > time(NULL)) ) { #ifndef WINDOWS_SYS @@ -632,7 +632,6 @@ bool RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, RsTlvSec { valid = false; } - } @@ -664,7 +663,7 @@ bool RsGenExchange::validateMsg(RsNxsMsg *msg, const uint32_t& grpFlag, RsTlvSec #endif } - RsTlvKeySignature sign = metaData.signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_PUBLISH]; + RsTlvKeySignature sign = metaData.signSet.keySignSet[GXS_SERV::FLAG_AUTHEN_IDENTITY]; valid &= GxsSecurity::validateNxsMsg(*msg, sign, authorKey); }else { diff --git a/libretroshare/src/gxs/rsgxsifaceimpl.cc b/libretroshare/src/gxs/rsgxsifaceimpl.cc index 8f90d31b2..b31b9d6af 100644 --- a/libretroshare/src/gxs/rsgxsifaceimpl.cc +++ b/libretroshare/src/gxs/rsgxsifaceimpl.cc @@ -52,7 +52,7 @@ void RsGxsIfaceImpl::groupsChanged(std::list &grpIds) } } -bool RsGxsIfaceImpl::updated() +bool RsGxsIfaceImpl::updated(bool willCallGrpChanged, bool willCallMsgChanged) { bool changed = false; { @@ -61,10 +61,18 @@ bool RsGxsIfaceImpl::updated() changed = (!mGroupChange.empty() || !mMsgChange.empty()); } -// std::map > msgs; -// msgsChanged(msgs); -// std::list grpIds; -// groupsChanged(grpIds); + if(!willCallGrpChanged) + { + std::list grpIds; + groupsChanged(grpIds); + } + + if(!willCallMsgChanged) + { + std::map > msgs; + msgsChanged(msgs); + } + return changed; } diff --git a/libretroshare/src/gxs/rsgxsifaceimpl.h b/libretroshare/src/gxs/rsgxsifaceimpl.h index 055876349..93fe0b568 100644 --- a/libretroshare/src/gxs/rsgxsifaceimpl.h +++ b/libretroshare/src/gxs/rsgxsifaceimpl.h @@ -59,9 +59,15 @@ public: /*! * Checks to see if a change has been received for * for a message or group + * @param willCallGrpChanged if this is set to true, group changed function will return list + * groups that have changed, if false, the group changed list is cleared + * @param willCallMsgChanged if this is set to true, msgChanged function will return map + * messages that have changed, if false, the message changed map is cleared * @return true if a change has occured for msg or group + * @see groupsChanged + * @see msgsChanged */ - virtual bool updated(); + virtual bool updated(bool willCallGrpChanged = false, bool willCallMsgChanged = false); /*! * The groups changed. \n @@ -69,7 +75,8 @@ public: * the group actually set for ui notification. * If receivedChanges is not passed RsGxsNotify changes * this function does nothing - * @param grpIds + * @param grpIds returns list of grpIds that have changed + * @see updated */ virtual void groupsChanged(std::list& grpIds); @@ -79,7 +86,8 @@ public: * the msg actually set for ui notification. * If receivedChanges is not passed RsGxsNotify changes * this function does nothing - * @param msgs + * @param msgs returns map of message ids that have changed + * @see updated */ virtual void msgsChanged(std::map >& msgs); diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index c1ca6ad0f..758e34639 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -88,8 +88,7 @@ void RsGxsNetService::syncWithPeers() sendItem(grp); } - -#ifdef GXS_ENABLE_SYNC_MSGS +//#ifdef GXS_ENABLE_SYNC_MSGS std::map grpMeta; mDataStore->retrieveGxsGrpMetaData(grpMeta); @@ -127,7 +126,7 @@ void RsGxsNetService::syncWithPeers() sendItem(msg); } } -#endif +//#endif } bool RsGxsNetService::loadList(std::list& load) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index fe72946b2..721364dfa 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -2280,7 +2280,6 @@ int RsServer::StartupRetroShare() mPluginsManager->registerClientServices(pqih) ; mPluginsManager->registerCacheServices() ; - #ifdef RS_ENABLE_GXS // The idea is that if priorGxsDir is non @@ -2348,9 +2347,9 @@ int RsServer::StartupRetroShare() RsGenExchange::RESTRICTED_GRP_BITS); // Re-enable later, photo not using gixs yet -// flag = GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; -// RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy, -// RsGenExchange::RESTRICTED_GRP_BITS); + flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; // should be GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN for comments + RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy, + RsGenExchange::RESTRICTED_GRP_BITS); flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy, diff --git a/libretroshare/src/serialiser/rsnxsitems.cc b/libretroshare/src/serialiser/rsnxsitems.cc index 5cc92c247..448872b6a 100644 --- a/libretroshare/src/serialiser/rsnxsitems.cc +++ b/libretroshare/src/serialiser/rsnxsitems.cc @@ -1106,9 +1106,9 @@ uint32_t RsNxsSerialiser::sizeNxsExtended(RsNxsExtended *item){ return 0; } - +int RsNxsGrp::refcount = 0; /** print and clear functions **/ - +int RsNxsMsg::refcount = 0; void RsNxsMsg::clear() { diff --git a/libretroshare/src/serialiser/rsnxsitems.h b/libretroshare/src/serialiser/rsnxsitems.h index 1a7f72fcd..968850789 100644 --- a/libretroshare/src/serialiser/rsnxsitems.h +++ b/libretroshare/src/serialiser/rsnxsitems.h @@ -73,6 +73,7 @@ public: setPriorityLevel(QOS_PRIORITY_RS_VOIP_PING); return; } + virtual ~RsNxsItem(){ return; } virtual void clear() = 0; virtual std::ostream &print(std::ostream &out, uint16_t indent = 0) = 0; @@ -188,14 +189,18 @@ class RsNxsGrp : public RsNxsItem public: RsNxsGrp(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP), grp(servtype), meta(servtype), - metaData(NULL) { clear(); return; } - virtual ~RsNxsGrp() { if(metaData) delete metaData; } + metaData(NULL) { clear(); + //std::cout << "\nGrp refcount++ : " << ++refcount << std::endl; + return; } + virtual ~RsNxsGrp() { if(metaData) delete metaData; + //std::cout << "\nGrp refcount-- : " << --refcount << std::endl; + } virtual void clear(); virtual std::ostream &print(std::ostream &out, uint16_t indent); std::string grpId; /// group Id, needed to complete version Id (ncvi) - + static int refcount; RsTlvBinaryData grp; /// actual group data /*! @@ -263,15 +268,25 @@ class RsNxsMsg : public RsNxsItem public: RsNxsMsg(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG), meta(servtype), msg(servtype), - metaData(NULL) { clear(); return; } - ~RsNxsMsg() { if(metaData) delete metaData; } + metaData(NULL) { + // std::cout << "\nrefcount++ : " << ++refcount << std::endl; + clear(); return; + } + virtual ~RsNxsMsg() + { + //std::cout << "\nrefcount-- : " << --refcount << std::endl; + if(metaData){ + //std::cout << "\ndeleted\n"; + delete metaData; + } + } virtual void clear(); virtual std::ostream &print(std::ostream &out, uint16_t indent); std::string grpId; /// group id, forms part of version id std::string msgId; /// msg id - + static int refcount; /*! * This should contains all the data * which is not specific to the Gxs service data diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 147d15d10..0014b420a 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -691,21 +691,24 @@ bool p3IdService::cache_store(const RsGxsIdGroupItem *item) for (kit = keySet.keys.begin(); kit != keySet.keys.end(); kit++) { - if (kit->second.keyFlags | RSTLV_KEY_DISTRIB_ADMIN) + if (kit->second.keyFlags & RSTLV_KEY_DISTRIB_ADMIN) { std::cerr << "p3IdService::cache_store() Found Admin Key"; std::cerr << std::endl; /* save full key - if we have it */ - if (kit->second.keyFlags | RSTLV_KEY_TYPE_FULL) + if (kit->second.keyFlags & RSTLV_KEY_TYPE_FULL) { fullkey = kit->second; full_key_ok = true; } - /* cache public key always */ - pubkey = kit->second; - pub_key_ok = true; + if (kit->second.keyFlags & RSTLV_KEY_TYPE_PUBLIC_ONLY) + { + /* cache public key always */ + pubkey = kit->second; + pub_key_ok = true; + } } } diff --git a/libretroshare/src/services/p3posted.cc b/libretroshare/src/services/p3posted.cc index a207fac04..57937002e 100644 --- a/libretroshare/src/services/p3posted.cc +++ b/libretroshare/src/services/p3posted.cc @@ -68,18 +68,18 @@ void p3Posted::service_tick() generatePosts(); generateVotesAndComments(); - time_t now = time(NULL); - - if((now > (time_t) (VOTE_UPDATE_PERIOD + mLastUpdate)) && - (mUpdatePhase == UPDATE_PHASE_GRP_REQUEST)) - { - mPostUpdate = true; - mLastUpdate = time(NULL); - } - - updateVotes(); - - processRankings(); +// time_t now = time(NULL); +// +// if((now > (time_t) (VOTE_UPDATE_PERIOD + mLastUpdate)) && +// (mUpdatePhase == UPDATE_PHASE_GRP_REQUEST)) +// { +// mPostUpdate = true; +// mLastUpdate = time(NULL); +// } +// +// updateVotes(); +// +// processRankings(); } void p3Posted::generateVotesAndComments() @@ -505,7 +505,6 @@ bool p3Posted::requestPostRankings(uint32_t &token, const RankType &rType, const gp->pubToken = token; gp->rankingResult.rType = gp->rType; gp->rankingResult.grpId = gp->grpId; - gp->grpId = gp->grpId; mPendingPostRanks.push_back(gp); @@ -768,6 +767,7 @@ bool p3Posted::completePostedPostCalc(GxsPostedPostRanking *gpp) break; default: std::cerr << "Unknown ranking tpye: " << gpp->rType << std::endl; + break; } return true; }else diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp index c17034aad..fc8be5a69 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp @@ -24,6 +24,8 @@ PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const RsPhotoPhoto &photo, QW ui->lineEdit_PhotoGrapher->setVisible(false); setUp(); + + ui->idChooser->setVisible(false); } PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget *parent) : @@ -43,6 +45,8 @@ PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget connect(ui->lineEdit_Title, SIGNAL(editingFinished()), this, SLOT(setTitle())); connect(ui->lineEdit_PhotoGrapher, SIGNAL(editingFinished()), this, SLOT(setPhotoGrapher())); + ui->idChooser->loadIds(0, ""); + } void PhotoItem::setSelected(bool selected) @@ -101,6 +105,15 @@ void PhotoItem::setPhotoGrapher() const RsPhotoPhoto& PhotoItem::getPhotoDetails() { + + + if(ui->idChooser->isVisible()) + { + RsGxsId id; + ui->idChooser->getChosenId(id); + mPhotoDetails.mMeta.mAuthorId = id; + } + return mPhotoDetails; } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoItem.ui b/retroshare-gui/src/gui/PhotoShare/PhotoItem.ui index 7162fd137..4073c8393 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoItem.ui +++ b/retroshare-gui/src/gui/PhotoShare/PhotoItem.ui @@ -1,110 +1,131 @@ - - - PhotoItem - - - - 0 - 0 - 253 - 233 - - - - Form - - - - - - QFrame#photoFrame{border: 2px solid #CCCCCC; -background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #EEEEEE, stop: 1 #CCCCCC); -border-radius: 10px} - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - TextLabel - - - - - - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Photo Title :</span></p></body></html> - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Photographer :</span></p></body></html> - - - - - - - - - - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - + + + PhotoItem + + + + 0 + 0 + 253 + 233 + + + + Form + + + + + + QFrame#photoFrame{border: 2px solid #CCCCCC; +background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #EEEEEE, stop: 1 #CCCCCC); +border-radius: 10px} + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + TextLabel + + + + + + + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Photo Title :</span></p></body></html> + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Photographer :</span></p></body></html> + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Author :</span></p></body></html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + GxsIdChooser + QComboBox +
gui/gxs/GxsIdChooser.h
+
+
+ + +
diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp index 922305912..036ecfa2e 100644 --- a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp @@ -223,7 +223,7 @@ void PostedListDialog::updateDisplay() std::map > msgs; - if (rsPosted->updated()) + if (rsPosted->updated(true, true)) { /* update Forums List */