示例#1
0
void PhoenixViewerLink::downloadClientTags()
{
	if(gSavedSettings.getBOOL("PhoenixDownloadClientTags"))
	{
		//url = "http://viewertags.com/app/client_list.xml";
		std::string url("http://viewertags.com/app/client_list.xml");
		if(gSavedSettings.getBOOL("PhoenixDontUseMultipleColorTags"))
		{
			url="http://viewertags.com/app/client_list_unified_colours.xml";
		}
		LLSD headers;
		LLHTTPClient::get(url,new ModularSystemsDownloader( PhoenixViewerLink::updateClientTags),headers);
		LL_INFOS("CLIENTTAGS DOWNLOADER") << "Getting new tags" << LL_ENDL;
	}
	else
	{
		updateClientTagsLocal();
	}
	
}
示例#2
0
void FSData::processData(const LLSD& fsData)
{
	// Set Message Of The Day if present
	if(fsData.has("MOTD"))
	{
		gAgent.mMOTD.assign(fsData["MOTD"]);
	}

	bool local_file = false;
	if (!(fsData["Releases"].asInteger() == 0))
	{
		const std::string releases_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "releases.xml");
		llifstream releases_file(releases_filename);
		LLSD releases;
		if(releases_file.is_open())
		{
			if(LLSDSerialize::fromXML(releases, releases_file) >= 1)
			{
				if(releases.has("ReleaseVersion"))
				{
					if (fsData["Releases"].asInteger() <= releases["ReleaseVersion"].asInteger())
					{
						processReleasesLLSD(releases);
						local_file = true;
					}
				}
			}
			releases_file.close();
		}
	}

	if (!local_file)
	{
		LL_INFOS("Data") << "Downloading " << releases_url << LL_ENDL;
		LLHTTPClient::get(releases_url,new FSDownloader(releases_url));
	}


	local_file = false;
	if (!(fsData["Agents"].asInteger() == 0))
	{
		const std::string agents_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "agents.xml");
		llifstream agents_file(agents_filename);
		LLSD agents;
		if(agents_file.is_open())
		{
			if(LLSDSerialize::fromXML(agents, agents_file) >= 1)
			{
				if(agents.has("AgentsVersion"))
				{
					if (fsData["Agents"].asInteger() <= agents["AgentsVersion"].asInteger())
					{
						processAgentsLLSD(agents);
						local_file = true;
					}
				}
			}
			agents_file.close();
		}
	}

	if (!local_file)
	{
		LL_INFOS("Data") << "Downloading " << agents_url << LL_ENDL;
		LLHTTPClient::get(agents_url,new FSDownloader(agents_url));
	}

	//TODO: add blacklist support
// 	LL_INFOS("Blacklist") << "Downloading blacklist.xml" << LL_ENDL;
// 	LLHTTPClient::get(url,new FSDownloader( FSData::msblacklist ),headers);

	// FSUseLegacyClienttags: 0=Off, 1=Local Clienttags, 2=Download Clienttags
	if(gSavedSettings.getU32("FSUseLegacyClienttags") > 1)
	{
		LLSD headers;
		headers.insert("User-Agent", LLViewerMedia::getCurrentUserAgent());
		headers.insert("viewer-version", versionid);
		LLHTTPClient::get(legacy_client_list,new FSDownloader(legacy_client_list),headers);
		LL_INFOS("CLIENTTAGS DOWNLOADER") << "Getting new tags" << LL_ENDL;
	}
	else if(gSavedSettings.getU32("FSUseLegacyClienttags") > 0)
	{
		updateClientTagsLocal();
	}
}
void FSData::processResponder(const LLSD& content, const std::string& url, bool save_to_file, const LLDate& last_modified)
{
	if (url == mFSDataURL)
	{
		if (!save_to_file)
		{
			LLSD data;
			LL_DEBUGS("fsdata") << "Loading fsdata.xml from  " << mFSdataFilename << LL_ENDL;
			if (loadFromFile(data, mFSdataFilename))
			{
				processData(data);
			}
			else
			{
				LL_WARNS("fsdata") << "Unable to download or load fsdata.xml" << LL_ENDL;
			}
		}
		else
		{
			processData(content);
			saveLLSD(content , mFSdataFilename, last_modified);
		}
		mFSDataDone = true;
	}
	else if (url == mAssetsURL)
	{
		if (!save_to_file)
		{
			LLSD data;
			LL_DEBUGS("fsdata") << "Loading assets.xml from  " << mAssestsFilename << LL_ENDL;
			if (loadFromFile(data, mAssestsFilename))
			{
				processAssets(data);
			}
			else
			{
				LL_WARNS("fsdata") << "Unable to download or load assets.xml" << LL_ENDL;
			}
		}
		else
		{
			processAssets(content);
			saveLLSD(content , mAssestsFilename, last_modified);
		}
	}
	else if (url == mAgentsURL)
	{
		if (!save_to_file)
		{
			LLSD data;
			LL_DEBUGS("fsdata") << "Loading agents.xml from  " << mAgentsFilename << LL_ENDL;
			if (loadFromFile(data, mAgentsFilename))
			{
				processAgents(data);
			}
			else
			{
				LL_WARNS("fsdata") << "Unable to download or load agents.xml" << LL_ENDL;
			}
		}
		else
		{
			processAgents(content);
			saveLLSD(content , mAgentsFilename, last_modified);
		}
		mAgentsDone = true;
		addAgents();
	}
	else if (url == LEGACY_CLIENT_LIST_URL)
	{
		if (!save_to_file)
		{
			updateClientTagsLocal();
		}
		else
		{
			processClientTags(content);
			saveLLSD(content , mClientTagsFilename, last_modified);
		}
	}
	else if (url == mFSdataDefaultsUrl)
	{
		if (!save_to_file)
		{
			// do nothing as this file is loaded during app startup.
		}
		else
		{
			saveLLSD(content , mFSdataDefaultsFilename, last_modified);
		}
	}
}