mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Complete channel API with comment and vote creation
This commit is contained in:
parent
ba58eba34e
commit
e311b28870
@ -107,6 +107,14 @@ public:
|
||||
*/
|
||||
virtual bool createChannel(RsGxsChannelGroup& channel) = 0;
|
||||
|
||||
/**
|
||||
* @brief Add a comment on a post or on another comment
|
||||
* @jsonapi{development}
|
||||
* @param[inout] comment
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool createComment(RsGxsComment& comment) = 0;
|
||||
|
||||
/**
|
||||
* @brief Create channel post. Blocking API.
|
||||
* @jsonapi{development}
|
||||
@ -115,6 +123,14 @@ public:
|
||||
*/
|
||||
virtual bool createPost(RsGxsChannelPost& post) = 0;
|
||||
|
||||
/**
|
||||
* @brief createVote
|
||||
* @jsonapi{development}
|
||||
* @param[inout] vote
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool createVote(RsGxsVote& vote) = 0;
|
||||
|
||||
/**
|
||||
* @brief Edit channel details.
|
||||
* @jsonapi{development}
|
||||
|
@ -1059,6 +1059,60 @@ bool p3GxsChannels::createChannel(RsGxsChannelGroup& channel)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsChannels::createComment(RsGxsComment& comment)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!createComment(token, comment))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed creating comment."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!RsGenExchange::getPublishedMsgMeta(token, comment.mMeta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting generated "
|
||||
<< " comment data." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsChannels::createVote(RsGxsVote& vote)
|
||||
{
|
||||
uint32_t token;
|
||||
if(!createVote(token, vote))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed creating vote."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!RsGenExchange::getPublishedMsgMeta(token, vote.mMeta))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting generated "
|
||||
<< " vote data." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsChannels::editChannel(RsGxsChannelGroup& channel)
|
||||
{
|
||||
uint32_t token;
|
||||
|
@ -189,12 +189,18 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
/// Implementation of @see RsGxsChannels::createChannel
|
||||
virtual bool createChannel(RsGxsChannelGroup& channel);
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createComment
|
||||
virtual bool createComment(RsGxsComment& comment);
|
||||
|
||||
/// Implementation of @see RsGxsChannels::editChannel
|
||||
virtual bool editChannel(RsGxsChannelGroup& channel);
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createPost
|
||||
virtual bool createPost(RsGxsChannelPost& post);
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createVote
|
||||
virtual bool createVote(RsGxsVote& vote);
|
||||
|
||||
/// Implementation of @see RsGxsChannels::subscribeToChannel
|
||||
virtual bool subscribeToChannel( const RsGxsGroupId &groupId,
|
||||
bool subscribe );
|
||||
|
Loading…
Reference in New Issue
Block a user