Tuesday, August 18, 2009 at 7:33 PM.
newsRiverSuite.readingList.opmlSubscribe
on opmlSubscribe (url, adrtitle, adradrnewservice, adrerrorstring) { <<Changes <<5/24/08; 2:10:01 PM by DW <<Add optional param to tcp.httpreadurl call to redirect 5 times if necessary. <<1/17/06; 6:50:57 PM by DW <<Created. <<Code factored from newsRiverSuite.viewSubscriptions. <<Return true if it was an OPML subscription. local (flopmlsub = false); bundle { //set flopmlsub local (xmltext = tcp.httpreadurl (url, ctFollowRedirects:5), xstruct); xml.compile (xmltext, @xstruct); try { xml.getaddress (@xstruct, "opml"); adrtitle^ = string.nthfield (url, "/", string.countfields (url, "/")); flopmlsub = true}}; if flopmlsub { try { local (adrdata = xml.aggregator.init ()); local (adrlist = @adrdata^.newsRiver.readingLists.[url]); if defined (adrlist^) { adrerrorstring^ = "Can't subscribe because you are already subscribed to the list."} else { new (tabletype, adrlist); newsRiverSuite.readingList.beforeScan (); adradrnewservice^ = adrlist}} else { adrerrorstring^ = tryerror}; return (true)}; return (false)}; bundle { //test code local (title, adrnewservice, errorstring); opmlSubscribe ("http://homepage.mac.com/ptorrone/philliptorrone_gadgets.opml", @title, @adrnewservice, @errorstring)}
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.