mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-23 22:01:05 -05:00
FeedReader plugin:
- Added check of feed parent id in loadList - Trimmed downloaded xml string to process xml strings with leading spaces git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7359 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7f9fde8c1d
commit
31962ea0c5
@ -1555,26 +1555,39 @@ bool p3FeedReader::loadList(std::list<RsItem *>& load)
|
||||
}
|
||||
}
|
||||
|
||||
/* now sort msgs into feeds */
|
||||
RsStackMutex stack(mFeedReaderMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<std::string, RsFeedReaderMsg*>::iterator it1;
|
||||
for (it1 = msgs.begin(); it1 != msgs.end(); ++it1) {
|
||||
/* check feeds */
|
||||
std::map<std::string, RsFeedReaderFeed*>::iterator feedIt;
|
||||
for (feedIt = mFeeds.begin(); feedIt != mFeeds.end(); ++feedIt) {
|
||||
RsFeedReaderFeed *feed = feedIt->second;
|
||||
if (!feed->parentId.empty()) {
|
||||
/* check parent */
|
||||
if (mFeeds.find(feed->parentId) == mFeeds.end()) {
|
||||
/* parent not found, clear it */
|
||||
feed->parentId.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* now sort msgs into feeds */
|
||||
std::map<std::string, RsFeedReaderMsg*>::iterator msgIt;
|
||||
for (msgIt = msgs.begin(); msgIt != msgs.end(); ++msgIt) {
|
||||
uint32_t msgId = 0;
|
||||
if (sscanf(it1->first.c_str(), "%u", &msgId) == 1) {
|
||||
std::map<std::string, RsFeedReaderFeed*>::iterator it2 = mFeeds.find(it1->second->feedId);
|
||||
if (it2 == mFeeds.end()) {
|
||||
if (sscanf(msgIt->first.c_str(), "%u", &msgId) == 1) {
|
||||
feedIt = mFeeds.find(msgIt->second->feedId);
|
||||
if (feedIt == mFeeds.end()) {
|
||||
/* feed does not exist exists */
|
||||
delete it1->second;
|
||||
delete msgIt->second;
|
||||
continue;
|
||||
}
|
||||
it2->second->msgs[it1->first] = it1->second;
|
||||
feedIt->second->msgs[msgIt->first] = msgIt->second;
|
||||
if (msgId + 1 > mNextMsgId) {
|
||||
mNextMsgId = msgId + 1;
|
||||
}
|
||||
} else {
|
||||
/* invalid msg id */
|
||||
delete(it1->second);
|
||||
delete(msgIt->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,9 @@ void p3FeedReaderThread::run()
|
||||
|
||||
RsFeedReaderErrorState result = download(feed, content, icon, errorString);
|
||||
if (result == RS_FEED_ERRORSTATE_OK) {
|
||||
/* trim */
|
||||
XMLWrapper::trimString(content);
|
||||
|
||||
mFeedReader->onDownloadSuccess(feed.feedId, content, icon);
|
||||
} else {
|
||||
mFeedReader->onDownloadError(feed.feedId, result, errorString);
|
||||
|
Loading…
Reference in New Issue
Block a user