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

system.verbs.builtins.radio.upstream.builtinDrivers.ftp.saveUpstreamSpec

on saveUpstreamSpec (f, username, passwordName, server, path, url, flPassiveMode = true) {
	<<Changes
		<<2/1/02; 12:59:49 PM by JES
			<<Added optional parameter, flPassiveMode, which determines whether to add <mode>passive</mode> or <mode>active</mode> to the spec.
		<<12/20/01; 1:19:17 AM by JES
			<<Use file.writeTextFile instead of file.writeWholeFile to write the file.
		<<12/14/01; 3:44:46 PM by JES
			<<Added version attribute on the <upstream> element. Put the elements in a sensible order.
	
	local (t); new (tableType, @t);
	new (tableType, @t.upstream);
	
	bundle { //set upstream element atts
		local (adratts = @t.upstream.["/atts"]);
		new (tableType, adratts);
		adratts^.type = "ftp";
		adratts^.version = "1.0"};
	
	t.upstream.["1\tusername"] = username;
	t.upstream.["2\tpasswordName"] = passwordName;
	t.upstream.["3\tserver"] = server;
	t.upstream.["4\tpath"] = path;
	t.upstream.["5\turl"] = url;
	local (mode);
	if flPassiveMode {
		mode = "passive"}
	else {
		mode = "active"};
	t.upstream.["6\tmode"] = mode;
	
	local (xtext = xml.decompile (@t));
	file.writeTextFile (f, xtext);
	
	return (true)}
<<bundle //testing
	<<saveUpstreamSpec (user.radio.prefs.wwwFolder + "#test_spec.xml", "bmancuso", "ftp", "ftp.mancuso.com", "~/", "http://www.mancuso.com/")



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.