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

system.verbs.builtins.radio.weblog.bloggerApi.rpcHandlers.getRecentPosts

on getRecentPosts (appkey, blogid, username, password, numberOfPosts) {
	<<Changes
		<<11/20/02; 4:57:31 PM by JES
			<<On MacOS, convert content to Latin text before returning. Entity-encode high-ascii characters.
		<<1/29/02; 1:30:00 PM by DW
			<<The postid must be a string according to the Blogger API spec.
		<<1/24/02; 7:37:02 AM by DW
			<<Don't fail if there aren't numberOfPosts posts.
		<<1/22/02; 5:50:14 PM by DW
			<<Created.
	radio.weblog.bloggerApi.checkUser (client, false, username, password);
	radio.weblog.bloggerApi.checkBlogid (blogid);
	local (adrblog = radio.weblog.init (), adrposts = @adrblog^.posts, sizeposts = sizeof (adrposts^), i, adrpost, returnArray = {}, t);
	
	on encode (s) {
		s = xml.entityEncode (s, false);
		return (s)};
	
	new (tabletype, @t);
	t.userid = user.radio.prefs.usernum;
	for i = sizeposts downto sizeposts - numberOfPosts + 1 {
		if i < 1 {
			break};
		adrpost = @adrposts^ [i];
		t.dateCreated = adrpost^.when;
		t.content = string (adrpost^.text);
		if system.environment.isMac {
			t.content = latinToMac.macToLatin (t.content)};
		t.content = encode (t.content);
		t.postid = string (number (nameof (adrpost^)));
		returnArray = returnArray + {t}};
	return (returnArray)}



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.