Thursday, April 14, 2011 at 1:07 AM.

radioReallySimpleSuite.newPostFromUser

on newPostFromUser (adruser, s) {
	<<Changes
		<<4/10/11; 6:39:11 PM by DW
			<<Set up stats table. 
		<<4/2/11; 7:33:03 PM by DW
			<<Ask that the response from Twitter be stored in the calendar item.
		<<3/26/11; 11:01:54 AM by DW
			<<Created. 
	local (now = clock.now ());
	radioReallySimpleSuite.initUser (adruser);
	local (adrday = mainresponder.calendar.getdayaddress (@adruser^.calendar, now));
	local (adritem = @adrday^.[string.padwithzeros (adruser^.stats.serialnum++, 5)]);
	new (tabletype, adritem);
	adritem^.status = s;
	adritem^.when = now;
	twitter.newpost (s, adruser:adruser, adrResponse:@adritem^.xstruct);
	
	bundle { //set up stats table, 4/10/11 by DW
		new (tabletype, @adritem^.stats);
		try {
			local (adrstatus = xml.getaddress (@adritem^.xstruct, "status"));
			adritem^.stats.flGood = true;
			adritem^.stats.id= xml.getvalue (adrstatus, "id")}
		else {
			adritem^.stats.flGood = false;
			adritem^.stats.ctErrors = 1;
			adritem^.stats.whenNextRetry = now + (10 * 60)}}; //ten minutes
	
	return (adritem)};
bundle { //test code
	newPostFromUser (@config.radioReallySimple.users.["http://static.reallysimple.org/users/dave/linkblog.xml"], "Amazon courting Apple's iOS developers to port apps to Kindle. http://r2.ly/8rcz")}



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.