mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 07:35:12 -04:00
Merge pull request #1831 from drbob/thewire_fix_message_display
TheWire fixup up display of messages
This commit is contained in:
commit
25467dda9f
33 changed files with 928 additions and 304 deletions
|
@ -4412,7 +4412,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
|
|||
if(details.mReputation.mOverallReputationLevel < minReputationForForwardingMessages(grpMeta->mSignFlags, details.mFlags))
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
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 " << (int) details.mReputation.mOverallReputationLevel << std::endl;
|
||||
#endif
|
||||
continue ;
|
||||
}
|
||||
|
|
|
@ -62,13 +62,10 @@ public:
|
|||
#define RSPHOTO_SHAREMODE_DUP_200K (4)
|
||||
#define RSPHOTO_SHAREMODE_DUP_1M (5)
|
||||
|
||||
class RsPhotoAlbum
|
||||
struct RsPhotoAlbum: RsGxsGenericGroupData
|
||||
{
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// V2 Album - keep it simple.
|
||||
// mMeta.mTitle.
|
||||
uint32_t mShareMode;
|
||||
|
@ -221,7 +218,29 @@ public:
|
|||
*/
|
||||
virtual bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId) = 0;
|
||||
|
||||
// Blocking versions.
|
||||
/*!
|
||||
* request to create a new album. Blocks until process completes.
|
||||
* @param album album to be submitted
|
||||
* @return true if created false otherwise
|
||||
*/
|
||||
virtual bool createAlbum(RsPhotoAlbum &album) = 0;
|
||||
|
||||
/*!
|
||||
* request to update an existing album. Blocks until process completes.
|
||||
* @param album album to be submitted
|
||||
* @return true if created false otherwise
|
||||
*/
|
||||
virtual bool updateAlbum(const RsPhotoAlbum &album) = 0;
|
||||
|
||||
/*!
|
||||
* retrieve albums based in groupIds.
|
||||
* @param groupIds the ids to fetch.
|
||||
* @param albums vector to be filled by request.
|
||||
* @return true is successful, false otherwise.
|
||||
*/
|
||||
virtual bool getAlbums(const std::list<RsGxsGroupId> &groupIds,
|
||||
std::vector<RsPhotoAlbum> &albums) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -69,22 +69,17 @@ class CollectionRef
|
|||
std::string CollectionId;
|
||||
};
|
||||
|
||||
|
||||
class RsWikiCollection
|
||||
struct RsWikiCollection: RsGxsGenericGroupData
|
||||
{
|
||||
public:
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
std::string mDescription;
|
||||
std::string mCategory;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
//std::map<std::string, CollectionRef> linkReferences;
|
||||
// std::map<std::string, CollectionRef> linkReferences;
|
||||
};
|
||||
|
||||
|
||||
class RsWikiSnapshot
|
||||
{
|
||||
public:
|
||||
|
@ -129,6 +124,11 @@ virtual bool submitComment(uint32_t &token, RsWikiComment &comment) = 0;
|
|||
|
||||
virtual bool updateCollection(uint32_t &token, RsWikiCollection &collection) = 0;
|
||||
|
||||
// Blocking Interfaces.
|
||||
virtual bool createCollection(RsWikiCollection &collection) = 0;
|
||||
virtual bool updateCollection(const RsWikiCollection &collection) = 0;
|
||||
virtual bool getCollections(const std::list<RsGxsGroupId> groupIds, std::vector<RsWikiCollection> &groups) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,16 +34,13 @@
|
|||
class RsWire;
|
||||
extern RsWire *rsWire;
|
||||
|
||||
class RsWireGroup
|
||||
struct RsWireGroup: RsGxsGenericGroupData
|
||||
{
|
||||
public:
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
std::string mDescription;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RsWire - is intended to be a Twitter clone - but fully decentralised.
|
||||
*
|
||||
|
@ -154,6 +151,11 @@ virtual bool getPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulse
|
|||
virtual bool createGroup(uint32_t &token, RsWireGroup &group) = 0;
|
||||
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) = 0;
|
||||
|
||||
// Blocking Interfaces.
|
||||
virtual bool createGroup(RsWireGroup &group) = 0;
|
||||
virtual bool updateGroup(const RsWireGroup &group) = 0;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1376,6 +1376,8 @@ int RsServer::StartupRetroShare()
|
|||
mPhoto, mPhoto->getServiceInfo(),
|
||||
mReputations, mGxsCircles,mGxsIdService,
|
||||
pgpAuxUtils);
|
||||
|
||||
mPhoto->setNetworkExchangeService(photo_ns);
|
||||
#endif
|
||||
|
||||
#ifdef RS_USE_WIRE
|
||||
|
@ -1391,6 +1393,8 @@ int RsServer::StartupRetroShare()
|
|||
mWire, mWire->getServiceInfo(),
|
||||
mReputations, mGxsCircles,mGxsIdService,
|
||||
pgpAuxUtils);
|
||||
|
||||
mWire->setNetworkExchangeService(wire_ns);
|
||||
#endif
|
||||
// now add to p3service
|
||||
pqih->addService(gxsid_ns, true);
|
||||
|
|
|
@ -317,3 +317,38 @@ bool p3PhotoService::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId
|
|||
return true;
|
||||
}
|
||||
|
||||
// Blocking versions =============================================================
|
||||
|
||||
bool p3PhotoService::createAlbum(RsPhotoAlbum &album)
|
||||
{
|
||||
uint32_t token;
|
||||
return submitAlbumDetails(token, album) && waitToken(token) == RsTokenService::COMPLETE;
|
||||
}
|
||||
|
||||
bool p3PhotoService::updateAlbum(const RsPhotoAlbum &album)
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3PhotoService::getAlbums(const std::list<RsGxsGroupId> &groupIds,
|
||||
std::vector<RsPhotoAlbum> &albums)
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
if (groupIds.empty())
|
||||
{
|
||||
if (!requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!requestGroupInfo(token, opts, groupIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
|
||||
return getAlbum(token, albums) && !albums.empty();
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,13 @@ public:
|
|||
return acknowledgeMsg(token, msgId);
|
||||
}
|
||||
|
||||
// Blocking versions.
|
||||
virtual bool createComment(RsGxsComment &msg) override
|
||||
{
|
||||
uint32_t token;
|
||||
return mCommentService->createGxsComment(token, msg) && waitToken(token) == RsTokenService::COMPLETE;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/** Modifications **/
|
||||
|
@ -165,6 +172,29 @@ public:
|
|||
*/
|
||||
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
|
||||
|
||||
// Blocking versions.
|
||||
/*!
|
||||
* request to create a new album. Blocks until process completes.
|
||||
* @param album album to be submitted
|
||||
* @return true if created false otherwise
|
||||
*/
|
||||
virtual bool createAlbum(RsPhotoAlbum &album) override;
|
||||
|
||||
/*!
|
||||
* request to update an existing album. Blocks until process completes.
|
||||
* @param album album to be submitted
|
||||
* @return true if created false otherwise
|
||||
*/
|
||||
virtual bool updateAlbum(const RsPhotoAlbum &album) override;
|
||||
|
||||
/*!
|
||||
* retrieve albums based in groupIds.
|
||||
* @param groupIds the ids to fetch.
|
||||
* @param albums vector to be filled by request.
|
||||
* @return true is successful, false otherwise.
|
||||
*/
|
||||
virtual bool getAlbums(const std::list<RsGxsGroupId> &groupIds,
|
||||
std::vector<RsPhotoAlbum> &albums) override;
|
||||
private:
|
||||
p3GxsCommentService* mCommentService;
|
||||
|
||||
|
|
|
@ -323,6 +323,38 @@ bool p3Wiki::updateCollection(uint32_t &token, RsWikiCollection &group)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Blocking Interfaces.
|
||||
bool p3Wiki::createCollection(RsWikiCollection &group)
|
||||
{
|
||||
uint32_t token;
|
||||
return submitCollection(token, group) && waitToken(token) == RsTokenService::COMPLETE;
|
||||
}
|
||||
|
||||
bool p3Wiki::updateCollection(const RsWikiCollection &group)
|
||||
{
|
||||
uint32_t token;
|
||||
RsWikiCollection update(group);
|
||||
return updateCollection(token, update) && waitToken(token) == RsTokenService::COMPLETE;
|
||||
}
|
||||
|
||||
bool p3Wiki::getCollections(const std::list<RsGxsGroupId> groupIds, std::vector<RsWikiCollection> &groups)
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
if (groupIds.empty())
|
||||
{
|
||||
if (!requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!requestGroupInfo(token, opts, groupIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
return getCollections(token, groups) && !groups.empty();
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsWikiCollection &group)
|
||||
{
|
||||
|
|
|
@ -56,17 +56,22 @@ public:
|
|||
virtual void service_tick();
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getCollections(const uint32_t &token, std::vector<RsWikiCollection> &collections);
|
||||
virtual bool getSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots);
|
||||
virtual bool getComments(const uint32_t &token, std::vector<RsWikiComment> &comments);
|
||||
virtual bool getCollections(const uint32_t &token, std::vector<RsWikiCollection> &collections) override;
|
||||
virtual bool getSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots) override;
|
||||
virtual bool getComments(const uint32_t &token, std::vector<RsWikiComment> &comments) override;
|
||||
|
||||
virtual bool getRelatedSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots);
|
||||
virtual bool getRelatedSnapshots(const uint32_t &token, std::vector<RsWikiSnapshot> &snapshots) override;
|
||||
|
||||
virtual bool submitCollection(uint32_t &token, RsWikiCollection &collection);
|
||||
virtual bool submitSnapshot(uint32_t &token, RsWikiSnapshot &snapshot);
|
||||
virtual bool submitComment(uint32_t &token, RsWikiComment &comment);
|
||||
virtual bool submitCollection(uint32_t &token, RsWikiCollection &collection) override;
|
||||
virtual bool submitSnapshot(uint32_t &token, RsWikiSnapshot &snapshot) override;
|
||||
virtual bool submitComment(uint32_t &token, RsWikiComment &comment) override;
|
||||
|
||||
virtual bool updateCollection(uint32_t &token, RsWikiCollection &collection);
|
||||
virtual bool updateCollection(uint32_t &token, RsWikiCollection &collection) override;
|
||||
|
||||
// Blocking Interfaces.
|
||||
virtual bool createCollection(RsWikiCollection &collection) override;
|
||||
virtual bool updateCollection(const RsWikiCollection &collection) override;
|
||||
virtual bool getCollections(const std::list<RsGxsGroupId> groupIds, std::vector<RsWikiCollection> &groups) override;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -64,11 +64,14 @@ uint32_t p3Wire::wireAuthenPolicy()
|
|||
|
||||
// Edits generally need an authors signature.
|
||||
|
||||
// Wire requires all TopLevel (Orig/Reply) msgs to be signed with both PUBLISH & AUTHOR.
|
||||
// Reply References need to be signed by Author.
|
||||
flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN;
|
||||
flag |= GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN;
|
||||
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS);
|
||||
|
||||
flag |= GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN;
|
||||
flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN;
|
||||
// expect the requirements to be the same for RESTRICTED / PRIVATE groups too.
|
||||
// This needs to be worked through / fully evaluated.
|
||||
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS);
|
||||
RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS);
|
||||
|
||||
|
@ -205,6 +208,38 @@ bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Blocking Interfaces.
|
||||
bool p3Wire::createGroup(RsWireGroup &group)
|
||||
{
|
||||
uint32_t token;
|
||||
return createGroup(token, group) && waitToken(token) == RsTokenService::COMPLETE;
|
||||
}
|
||||
|
||||
bool p3Wire::updateGroup(const RsWireGroup &group)
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3Wire::getGroups(const std::list<RsGxsGroupId> groupIds, std::vector<RsWireGroup> &groups)
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
if (groupIds.empty())
|
||||
{
|
||||
if (!requestGroupInfo(token, opts) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!requestGroupInfo(token, opts, groupIds) || waitToken(token) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
}
|
||||
return getGroupData(token, groups) && !groups.empty();
|
||||
}
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsWireGroup &group)
|
||||
{
|
||||
|
|
|
@ -50,11 +50,16 @@ public:
|
|||
virtual RsTokenService* getTokenService();
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsWireGroup> &groups);
|
||||
virtual bool getPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulses);
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsWireGroup> &groups) override;
|
||||
virtual bool getPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulses) override;
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsWireGroup &group);
|
||||
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse);
|
||||
virtual bool createGroup(uint32_t &token, RsWireGroup &group) override;
|
||||
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||
|
||||
// Blocking Interfaces.
|
||||
virtual bool createGroup(RsWireGroup &group) override;
|
||||
virtual bool updateGroup(const RsWireGroup &group) override;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) override;
|
||||
|
||||
private:
|
||||
virtual void generateDummyData();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue