Sunday, April 10, 2011 at 1:07 AM.
radioReallySimpleSuite.newItemCallback
on newItemCallback (adrriveritem, adrfeed, adrxitem) {
<<Changes
<<4/9/11; 12:04:42 PM by DW
<<Respect the enabled boolean at both the top level and the user level.
<<4/2/11; 7:42:06 PM by DW
<<Rewrite, to look for a description, then title, then link -- add a period if there is no punctuation at the end of the text. And keep the whole tweet to 140 chars or less.
<<3/28/11; 10:19:15 PM by DW
<<Created.
local (adrdata = radioreallysimplesuite.init (), now = clock.now ());
if adrdata^.prefs.enabled {
on decode (s) {
return (xml.entitydecode (s, flAlphaEntities:true))};
scratchpad.adrriveritem = adrriveritem; scratchpad.adrfeed = adrfeed; scratchpad.adrxitem = adrxitem;
local (adruser = @adrdata^.users.[nameof (adrfeed^)]);
if defined (adruser^) {
radioReallySimpleSuite.initUser (adruser);
if adruser^.prefs.enabled {
local (s = "");
if defined (adrriveritem^.description) and (sizeof (adrriveritem^.description) > 0) {
s = decode (adrriveritem^.description)}
else {
if defined (adrriveritem^.title) and (sizeof (adrriveritem^.title) > 0) {
s = decode (adrriveritem^.title)}};
if sizeof (s) > 0 {
s = string.addPeriodToSentence (s)};
if defined (adrriveritem^.link) {
if sizeof (s) > 0 {
s = s + " "};
local (link = decode (adrriveritem^.link));
if (sizeof (s) + sizeof (link)) > 140 {
s = string.mid (s, 1, 140 - sizeof (link) - 4) + "... " + link}
else {
s = s + link}};
local (adritem = radioReallySimpleSuite.newPostFromUser (adruser, s));
adritem^.adrriveritem = string.popfilefromaddress (adrriveritem)}}}};
bundle { //test code
newItemCallback (@config.river2.river.["2011"].["03"].["09"].["0070219"], @config.radioReallySimple.users.dave, nil)}
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.