Wednesday, February 02, 2011 at 1:05 AM.

river2Suite.menuCommands.newUser

on newUser () {
	<<Changes
		<<1/31/11; 4:31:44 PM by DW
			<<Example feed for tutorial.
				<<http://dl.dropbox.com/u/1006496/readingLists/example.opml
		<<1/23/11; 3:33:38 PM by DW
			<<Created. 
	local (adrdata = river2suite.init ());
	if dialog.ask ("Name of new user?", @adrdata^.stats.lastNewUserName) {
		local (username = adrdata^.stats.lastNewUserName, flnotified = false, password = "");
		if dialog.getpassword ("Password for new user \"" + username + "\":", @password) {
			local (adruser = @adrdata^.users.[username]);
			river2suite.inituser (adruser);
			adruser^.prefs.password = password;
			if dialog.yesNo ("Do you have an OPML subscription list for user \"" + username + "\"?") {
				if dialog.ask ("URL of OPML subscription list?", @adrdata^.stats.lastNewOPMLUrl) {
					local (opmltext = tcp.httpreadurl (adrdata^.stats.lastNewOPMLUrl), feeds, adr);
					xml.rss.getOpmlFeeds (opmltext, @feeds);
					for adr in @feeds {
						local (url = nameof (adr^));
						<<scratchpad.url = url
						try {river2suite.subscribefeed (url)};
						new (tabletype, @adruser^.feeds.[url])};
					river2suite.inituser (username);
					dialog.notify ("All feeds subscribed to, new user \"" + username + "\" has been created.");
					flnotified = true}};
			if not flnotified {
				dialog.notify ("New user \"" + username + "\" has been created.")}}}};
bundle { //test code
	newUser ()}



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.