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

system.verbs.builtins.radio.weblog.post

on post (posttext, adrblog=radio.weblog.init (), when = clock.now (), adrpost=nil) {
	<<Changes:
		<<2/12/02; 3:32:54 AM by JES
			<<Create an entry in weblogData.stats.unpublishedPosts, for the post, to be picked up by radio.weblog.publishAllUnpublishedPosts.
		<<1/14/02; 8:47:22 PM by DW
			<<Add callback support.
		<<8/14/01; 6:40:05 PM by JES
			<<New optional parameter, adrpost -- the address of a pre-existing post's table. If specified, then the text of the post is replaced with the new text.
		<<3/5/01; 5:58:06 PM by JES
			<<Added optional parameter, when, which defaults to now. This is needed for workspace.userlandSamples.manilaToBlog.
		<<2/22/01; 11:24:58 PM by JES
			<<If this is a Mac, convert Latin text to Mac.
	if adrpost == nil {
		adrpost = @adrblog^.posts.[string.padwithzeros (adrblog^.prefs.nextPostNum++, 8)]};
	if not defined (adrpost^) {
		new (tabletype, adrpost)};
	if system.environment.isMac {
		posttext = latinToMac.convert (posttext)};
	wp.newtextobject (posttext, @adrpost^.text);
	if not defined (adrpost^.when) { //only set the date/time for new posts
		adrpost^.when = when};
	adrblog^.stats.unpublishedPosts.[nameOf (adrpost^)] = true;
	bundle { //call the callbacks -- 1/14/02; 8:47:22 PM by DW
		try {
			if not defined (user.radio.callbacks.postItem) {
				new (tabletype, @user.radio.callbacks.postItem)};
			local (adrcallback);
			for adrcallback in @user.radio.callbacks.postItem {
				try {
					while typeOf (adrcallback^) == addressType {
						adrcallback = adrcallback^};
					adrcallback^ (adrpost)}}}};
	return (adrpost)}
<<bundle //test code
	<<for i = 1 to 10
		<<msg (post ("Hello at " + clock.now () + "."))
		<<clock.waitseconds (2)



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.