mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 17:04:58 -04:00
FeedReader: Message of a local feed can be added as forum and board message
This commit is contained in:
parent
bcb4e52768
commit
b14fecfc2a
7 changed files with 237 additions and 7 deletions
|
@ -2532,3 +2532,85 @@ bool p3FeedReader::waitForToken(RsGxsIfaceHelper *interface, uint32_t token)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3FeedReader::getForumGroups(std::vector<RsGxsForumGroup> &groups, bool onlyOwn)
|
||||
{
|
||||
if (!mForums) {
|
||||
std::cerr << "p3FeedReader::getForumGroups - can't get groups, member mForums is not set" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
uint32_t token;
|
||||
if (!mForums->requestGroupInfo(token, opts)) {
|
||||
std::cerr << "p3FeedReader::getForumGroups - can't get group list" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!waitForToken(mForums, token)) {
|
||||
std::cerr << "p3FeedReader::getForumGroups - waitForToken for list failed" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mForums->getGroupData(token, groups)) {
|
||||
std::cerr << "p3FeedReader::getForumGroups - getGroupData failed" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (onlyOwn) {
|
||||
// filter groups
|
||||
for (std::vector<RsGxsForumGroup>::iterator it = groups.begin(); it != groups.end(); ) {
|
||||
const RsGxsForumGroup &group = *it;
|
||||
if (IS_GROUP_PUBLISHER(group.mMeta.mSubscribeFlags) && IS_GROUP_ADMIN(group.mMeta.mSubscribeFlags)) {
|
||||
++it;
|
||||
} else {
|
||||
it = groups.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3FeedReader::getPostedGroups(std::vector<RsPostedGroup> &groups, bool onlyOwn)
|
||||
{
|
||||
if (!mPosted) {
|
||||
std::cerr << "p3FeedReader::getPostedGroups - can't get groups, member mPosted is not set" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
uint32_t token;
|
||||
if (!mPosted->requestGroupInfo(token, opts)) {
|
||||
std::cerr << "p3FeedReader::getPostedGroups - can't get group list" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!waitForToken(mPosted, token)) {
|
||||
std::cerr << "p3FeedReader::getPostedGroups - waitForToken for list failed" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mPosted->getGroupData(token, groups)) {
|
||||
std::cerr << "p3FeedReader::getForumGroups - getGroupData failed" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (onlyOwn) {
|
||||
// filter groups
|
||||
for (std::vector<RsPostedGroup>::iterator it = groups.begin(); it != groups.end(); ) {
|
||||
const RsPostedGroup &group = *it;
|
||||
if (IS_GROUP_PUBLISHER(group.mMeta.mSubscribeFlags) && IS_GROUP_ADMIN(group.mMeta.mSubscribeFlags)) {
|
||||
++it;
|
||||
} else {
|
||||
it = groups.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,11 @@ public:
|
|||
virtual bool retransformMsg(uint32_t feedId, const std::string &msgId);
|
||||
virtual bool clearMessageCache(uint32_t feedId);
|
||||
|
||||
virtual RsGxsForums* forums() { return mForums; }
|
||||
virtual RsPosted* posted() { return mPosted; }
|
||||
virtual bool getForumGroups(std::vector<RsGxsForumGroup> &groups, bool onlyOwn);
|
||||
virtual bool getPostedGroups(std::vector<RsPostedGroup> &groups, bool onlyOwn);
|
||||
|
||||
virtual RsFeedReaderErrorState processXPath(const std::list<std::string> &xpathsToUse, const std::list<std::string> &xpathsToRemove, std::string &description, std::string &errorString);
|
||||
virtual RsFeedReaderErrorState processXslt(const std::string &xslt, std::string &description, std::string &errorString);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue