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

	<<8/18/03; 11:56:06 AM by JES
		<<Unsubscribe through a call to xml.aggregator.unsubscribeService instead of doing the work here. Fixes a bug where callbacks at aggregatorData.callbacks.unsubscribeService were not being called.
	<<12/25/01; 10:22:43 PM by JES
		<<Call radio.string.decodeEntities on the channel name and description. Gets rid of ''s in the text.
	<<11/28/01; 11:24:15 PM by JES
	<<10/19/01; 10:41:40 PM by JES
		<<Ported from myUserLandWebsite.unsubscribe. Rewrote post handling -- it's much simpler now. It also handles preservation of the menu searchArg.
		<<3/4/01; 5:31:01 PM by JES
			<<Toss the HotList cache if the user confirms unsubscribing from a channel.
		<<3/4/01; 6:20:31 PM by JES
			<<Toss the homepage cache when unsubscribing from a channel.
local (pta = html.getpagetableaddress ());
pta^.title = radio.string.getlocalizedstring ("unsubscribe.title");
<< = pta^; edit (
local (adrdata = xml.aggregator.init ());
local (adrservices = @adrdata^.services);
local (adrtrash = @adrdata^.trash);
local (adrargs);
bundle { //set adrargs
	adrargs = @pta^.radioResponder.getArgs;
	if not defined (adrargs^) {
		new (tableType, adrargs)}};
bundle { //watch for confirmation
	if defined (adrargs^.xmlUrl) {
		if defined (adrargs^.flconfirmed) {
			<<workspace.args = adrargs^; edit (@workspace.args)
			<<bundle //old code
				<<local (adrservice = @adrservices^.[adrargs^.xmlUrl])
				<<adrtrash^.[nameof (adrservice^)] = adrservice^
				<<delete (adrservice)
			xml.aggregator.unsubscribeService (adrargs^.xmlUrl, adrdata);
			adrdata^.settings.flSubscriptionsChanged = true;
			radio.hotlist.clearCache ();
			<<xml.aggregator.clearCache ()
			local (menustring = "");
			if defined (adrargs^.menu) {
				menustring = "?menu=" + adrargs^.menu};
			radio.webserver.redirect ("/system/pages/news" + menustring);
			return ("")}}};
local (xmlUrl = adrargs^.xmlUrl);
local (adrservice = @adrservices^.[adrargs^.xmlUrl]);
local (htmltext = "\r", indentlevel = 0);
on add (s) {
	htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n"};
bundle { //explanatory text
	local (t); new (tableType, @t);
	t.channellink = "<a href=\"" + adrservice^.compilation.channellink + "\" title=\"" + string.replaceAll (radio.string.decodeEntities (adrservice^.compilation.channeldescription), "\"", "\\\"") + "\">" + radio.string.decodeEntities (adrservice^.compilation.channeltitle) + "</a>";
	add (radio.string.getlocalizedstring ("unsubscribe.confirm", @t))};
add ("<blockquote>"); indentlevel++;
add ("<form>"); indentlevel++;
add ("<input type=\"submit\" name=\"flconfirmed\" value=\"" + radio.string.getlocalizedstring ("unsubscribe.unsubscribeButton") + "\">");
add ("<input type=\"hidden\" name=\"xmlUrl\" value=\"" + xmlUrl + "\">");
if defined (adrargs^.menu) { //get args for the current page
	add ("<input type=\"hidden\" name=\"menu\" value=\"" + adrargs^.menu + "\">")};
add ("</form>"); indentlevel--;
add ("</blockquote>"); indentlevel--;
return (htmltext)

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.