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

system.verbs.builtins.radio.outliner.menuCommands.subscribeToOutline

<<Changes
	<<3/25/02; 5:50:21 PM by JES
		<<Created.
local (url = "http://");
if dialog.ask ("Enter the URL of an outline to subscribe to:", @url) {
	if not (url beginsWith "http://") {
		url = "http://" + url};
	local (adrdata = radio.outliner.init ());
	local (author = "Anonymous");
	local (adrsubscription = @adrdata^.subscriptions.[url]);
	if defined (adrsubscription^) {
		frontier.bringtofront ();
		radio.outliner.openBuddies (true, true);
		return};
	
	<<bundle //factored code
		<<local (localoutline)
		<<try
			<<try //to get the author from the OPML
				<<local (adrincache = radio.outliner.preCacheUrl (url))
				<<local (xstruct)
				<<xml.compile (adrincache^.xmltext, @xstruct)
				<<local (nomad = xml.getAddress (@xstruct, "opml"))
				<<nomad = xml.getAddress (nomad, "head")
				<<nomad = xml.getAddress (nomad, "ownerName")
				<<author = nomad^
			<<radio.outliner.read (url, @localoutline)
		<<else
			<<scriptError ("Can't subscribe to the outline because there was an error reading it. \"" + tryerror + "\".")
		<<new (tabletype, adrsubscription)
		<<adrsubscription^.author = author
		<<adrsubscription^.outline = localoutline
		<<adrsubscription^.whenCreated = clock.now ()
		<<adrsubscription^.whenLastPoll = date (0)
		<<radio.outliner.openBuddies (true)
	radio.outliner.subscribeUrl (url, author)}



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.