diff options
Diffstat (limited to 'Src/Plugins/Library/ml_wire/FeedUtil.cpp')
-rw-r--r-- | Src/Plugins/Library/ml_wire/FeedUtil.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_wire/FeedUtil.cpp b/Src/Plugins/Library/ml_wire/FeedUtil.cpp new file mode 100644 index 00000000..bf5b5ae8 --- /dev/null +++ b/Src/Plugins/Library/ml_wire/FeedUtil.cpp @@ -0,0 +1,37 @@ +#include "main.h" +#include "FeedUtil.h" +#include "ChannelCheck.h" +#include "FeedParse.h" +#include "errors.h" +#include "./defaults.h" + + +int DownloadFeedInformation(Channel &newFeed) +{ + ChannelCheck check; + FeedParse downloader(&check, false); + + int ret = downloader.DownloadURL(newFeed.url); + if (ret != DOWNLOAD_SUCCESS) + return ret; + + if (!check.channel.title || !check.channel.title[0]) + return DOWNLOAD_NOTRSS; + + newFeed.SetTitle(check.channel.title); + if (check.channel.ttl) + { + newFeed.updateTime = check.channel.ttl * 60; + newFeed.autoUpdate = true; + } + else + { + newFeed.updateTime = ::updateTime; + newFeed.autoUpdate = ::autoUpdate; + } + + if (check.channel.url && check.channel.url[0]) + newFeed.SetURL(check.channel.url); + + return DOWNLOAD_SUCCESS; +}
\ No newline at end of file |