aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_wire/FeedUtil.cpp
blob: bf5b5ae866b641f67a221cd220a8928960c289ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
}