aboutsummaryrefslogtreecommitdiff
path: root/Src/Winamp/urlmanager.cpp
blob: c034e8ddae870946e09c33799cc39295634f5175 (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
#include "urlmanager.h"

const wchar_t *URLManager::GetURL(const wchar_t *urlid)
{
	for (URLList::iterator itr=urls.begin();itr!=urls.end();itr++)
	{
		if (!_wcsicmp(urlid, itr->urlid))
		{
			return itr->url;
		}
	}
	return 0;
}

void URLManager::AddURL(const wchar_t *urlid, const wchar_t *url)
{
	for (URLList::iterator itr=urls.begin();itr!=urls.end();itr++)
	{
		if (!_wcsicmp(urlid, itr->urlid))
		{
			free(itr->url);
			itr->url=_wcsdup(url);
			return ;
		}
	}
	URLS newUrl;
	newUrl.urlid = _wcsdup(urlid);
	newUrl.url = _wcsdup(url);
	urls.push_back(newUrl);
}

#define CBCLASS URLManager
START_DISPATCH;
CB(API_URLMANAGER_GETURL, GetURL);
END_DISPATCH;
#undef CBCLASS