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


	<<8/14/01; 9:07:56 AM by DW
		<<Runs in a separate thread, watching a mail account you specify. When a message appears, if its subject is the secret subject, post the contents of the message to your Blogger blog.
		<<This script is derived from Radio's mail-to-weblog feature,

blogger.init ();
if user.blogger.mailToBlog.enabled {
	msg ("blogger.mailToBlog.checkMail.script");
	try {
		local (msgtable, adrmsg);
		with user.blogger.mailToBlog {
			tcp.getmail (server, account, password, @msgtable, deleteMessages:true, flMessages: false);
		for adrmsg in @msgtable {
			bundle { //process the text first, allow callbacks to change it
				local (s = adrmsg^.text);
				s = string.quotedPrintableDecode (s);
				s = string.replaceAll (s, "\n", "");
				s = string.trimWhitespace (s);
				adrmsg^.blogPostText = s};
			bundle { //run msg through callbacks
				try {
					if defined (user.blogger.callbacks.mailToBlog) {
						local (adrcallback);
						for adrcallback in @user.blogger.callbacks.mailToBlog {
							while typeOf (adrcallback^) == addressType {
								adrcallback = adrcallback^};
							try {adrcallback^ (adrmsg)}}}}};
			if adrmsg^.subject == string (user.blogger.mailToBlog.secretSubject) {
				blogger.newPost (adrmsg^.blogPostText);
	msg ("")};
bundle { //schedule wakeup for next whole minute
	local (day, month, year, hour, minute, second);
	date.get ( (), @day, @month, @year, @hour, @minute, @second);
	thread.sleepFor (60 - second)} //wake up once a minute, on the minute

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.