Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.upstream.getServerCapabilities

on getServerCapabilities (adrspec, flAlwaysGetCapabilities = false) {
	<<Changes:
		<<11/20/01; 2:36:51 AM by JES
			<<Get the password from user.radio.prefs.passwords.[passwordName] instead of from the upstream spec cache.
		<<10/23/01; 10:32:54 AM by JES
			<<Changed <account> to <usernum>.
		<<8/15/01; 1:33:08 AM by JES
			<<Display our own message in the About window, instead of the message displayed by tcp.httpClient.
		<<7/24/01; 1:51:32 AM by JES
			<<New parameter, adrspec, is the address of a server specification table.
			<<New optional parameter: flAlwaysGetCapabilities. If true, always make the RPC call. Default is false.
			<<New return values: if successful, the address of the server capabilities table is returned. If not successful, false is returned.
	local (data = adrspec^);
	if not defined (data.fldebug) {
		data.fldebug = false};
	with data {
		local (adrServerData = @user.radio.prefs.upstream.servers.[server]);
		if not defined (adrServerData^) {
			new (tableType, adrServerData)};
		local (adrServerCapabilities = @adrServerData^.serverCapabilities);
		if not defined (adrServerData^.timeLastServerCapabilities) {
			adrServerData^.timeLastServerCapabilities = date (0)};
		if not flAlwaysGetCapabilities {
			local (now = clock.now ());
			local (flGotWithinLast24Hrs = (now - adrServerData^.timeLastServerCapabilities) > (60 * 60 * 24));
			if not flGotWithinLast24Hrs { //ask again, once a day
				if defined (adrServerCapabilities^) {
					return (adrServerCapabilities)}}};
		msg ("Getting server info: " + data.server);
		if not xmlStorageSystem.getServerCapabilities (usernum, user.radio.prefs.passwords.[passwordName], adrServerCapabilities, adrdata:@data, flMessages:false) {
			msg ("");
			return (false)};
		adrServerData^.timeLastServerCapabilities = clock.now ();
		msg ("");
		return (adrServerCapabilities)}}
<<bundle //debugging
	<<local (adrTable)
	<<adrTable = getServerCapabilities (@system.temp.radio.upstreamSpecCache.["Backup:Radio UserLand:www:system:upstream:#upstream.xml"], true)
	<<edit (adrTable)



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.