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

on copyFromStruct (adrstruct, adrpost) {
		<<4/6/02; 6:41:48 PM by DW
			<<If the struct has a title, create a shortcut for it.
		<<3/15/02; 12:36:35 PM by DW
			<<Add support for callbacks.
		<<3/15/02; 8:39:20 AM by DW
			<<If the struct contains a boolean flNotOnHomePage, copy that into the post table.
		<<3/13/02; 8:13:12 PM by DW
	local (idpost = number (nameof (adrpost^)));
	on neuter (s) {
		return (radio.weblog.bloggerApi.neuterMacros (s))};
	bundle { //call callbacks
		local (adrblog = radio.weblog.init ());
		local (adrcallbacks = @adrblog^.callbacks.metaWeblogCopyFromStruct);
		if not defined (adrcallbacks^) {
			new (tabletype, adrcallbacks)};
		local (adrcallback);
		for adrcallback in adrcallbacks {
			while typeOf (adrcallback^) == addressType {
				adrcallback = adrcallback^};
			try {adrcallback^ (adrstruct, adrpost)}}};
	if defined (adrstruct^.link) {
		adrpost^.link = neuter (adrstruct^.link)};
	if defined (adrstruct^.title) {
		local (newtitle = neuter (adrstruct^.title));
		radio.shortcuts.addTitledPost (adrpost, newtitle);
		adrpost^.title = newtitle};
	if defined (adrstruct^.enclosure) {
		new (tabletype, @adrpost^.enclosure);
		adrpost^.enclosure.length = number (adrstruct^.enclosure.length);
		adrpost^.enclosure.type = neuter (adrstruct^.enclosure.type);
		adrpost^.enclosure.url = neuter (adrstruct^.enclosure.url)};
	if defined (adrstruct^.source) {
		adrpost^.sourceName = neuter (adrstruct^;
		adrpost^.sourceUrl = neuter (adrstruct^.source.url);
		adrpost^.sourceTime = ()};
	if defined (adrstruct^.categories) {
		local (adrblog = radio.weblog.init ());
		bundle { //first remove the post from any categories it's already in
			local (adrcat);
			for adrcat in @adrblog^.categories {
				if adrcat^.storyList contains idpost {
					adrcat^.fldirty = true;
					adrcat^.storyList = adrcat^.storyList - idpost}}};
		local (s);
		new (tabletype, @adrpost^.categories);
		for s in adrstruct^.categories {
			local (adrblogcat = @adrblog^.categories.[s]);
			if defined (adrblogcat^) {
				adrpost^.categories.[s] = true;
				adrblogcat^.storyList = adrblogcat^.storyList + {idpost};
				adrblogcat^.fldirty = true}}};
	if defined (adrstruct^.flNotOnHomePage) {
		adrpost^.flNotOnHomePage = adrstruct^.flNotOnHomePage}}

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.