Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.weblog.checkMail
<<Changes
<<11/23/01; 3:09:57 PM by JES
<<Save the adrpost returned by radio.weblog.post, and pass it to radio.weblog.updatePagesForPost, to update all of the pages that the post appears in.
<<10/19/01; 4:16:56 PM by DW
<<Testing, debugging, fixing for 7.1.
<<string.trimwhitespace the posts. No need for trailing carriage returns on the posts.
<<Add pref to control how often mail is checked. Initialized in radio.weblog.init.
<<10/19/01; 4:16:42 PM by DW
<<Check out for Radio 7.1.
<<3/25/01; 9:53:05 AM by DW
<<Add callback support. Loop over all the scripts in myUserLandData.callbacks.blogCheckMail passing the address of each message. Ignore any returned value or script error.
<<Comment out assignment to scratchpad.emailText.
<<3/1/01; 5:53:14 PM by JES
<<Convert quoted printable text to ASCII. Untaint text before posting. Remove linefeeds.
<<2/24/01; 7:30:49 AM by DW
<<This is the My.UserLand.On.The.Blackberry feature that Scott Loftesness asked for.
<<If enabled, we check a mail address and see if there are any posts available for us.
<<The subject must match the "secret subject", the body contains the post.
local (adrblog = radio.weblog.init ());
if adrblog^.prefs.mailPosting.enabled {
if not defined (system.temp.radio.misc.lastMailPostingCheck) {
system.temp.radio.misc.lastMailPostingCheck = date (0)};
if clock.now () > (system.temp.radio.misc.lastMailPostingCheck + adrblog^.prefs.mailPosting.ctSecondsBetweenChecks) {
system.temp.radio.misc.lastMailPostingCheck = clock.now ();
local (msgtable, adrmsg);
with adrblog^.prefs.mailPosting {
tcp.getmail (server, account, password, @msgtable, deleteMessages:true, flMessages: false);
adrblog^.stats.ctMailToBlogChecks++};
for adrmsg in @msgtable {
bundle { //run msg through callbacks
try {
if defined (adrblog^.callbacks.weblogCheckMail) {
local (adrcallback);
for adrcallback in @adrblog^.callbacks.weblogCheckMail {
while typeOf (adrcallback^) == addressType {
adrcallback = adrcallback^};
try {adrcallback^ (adrmsg)}}}}};
if adrmsg^.subject == string (adrblog^.prefs.mailPosting.secretSubject) {
local (s = adrmsg^.text);
s = string.trimWhitespace (s);
s = string.quotedPrintableDecode (s);
s = string.replaceAll (s, "\r\n", "\r");
s = radio.string.untaint (s);
local (adrpost = radio.weblog.post (s, adrblog));
radio.weblog.updatePagesForPost (adrpost);
adrblog^.stats.ctMailToBlogPosts++}}}}
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.