mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 23:45:49 -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
|
@ -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