Monday, November 08, 2010 at 12:00 AM.
river2Suite.renewOneSubscription
on renewOneSubscription (adrfeed, adrhtmltext=nil) {
<<Changes
<<9/17/09; 7:34:43 AM by DW
<<Created. Why didn't I factor this out a long time ago? Would have helped with testing.
local (startticksthisrenew = clock.ticks (), urlfeed = nameof (adrfeed^), now = clock.now ());
local (linkfeed = "<a href=\"" + urlfeed + "\">" + adrfeed^.feedinfo.title + "</a>");
with adrfeed^.feedinfo.cloud {
try {
if protocol == "xml-rpc" {
local (server = "xmlrpc://" + domain + ":" + port + path);
[server].[registerProcedure] ("river2.feedUpdated", 5337, "/RPC2", "xml-rpc", {urlfeed})}
<<local (params = {"river2.feedUpdated", 5337, "/RPC2", "xml-rpc", {urlfeed}})
<<betty.rpc.client (domain, port, registerProcedure, @params, rpcPath: path)
else {
if protocol == "http-post" { //7/21/09 by DW
bundle { //request notification via to http-post, 9/7/09 by DW
local (apiurl = "http://" + domain + ":" + port + path, params);
new (tabletype, @params);
params.notifyProcedure = "";
params.port = 5337;
params.path = "/river2/notify";
params.protocol = "http-post";
params.url1 = urlfeed;
local (xmltext = tcp.httppost (apiurl, @params), xstruct);
xml.compile (xmltext, @xstruct);
local (adrnotifyresult = xml.getaddress (@xstruct, "notifyResult"));
local (flsuccess = xml.getattributevalue (adrnotifyresult, "success"));
if not flsuccess {
scripterror (xml.getattributevalue (adrnotifyresult, "msg"))}}}};
<<bundle //old code -- request notification via XML-RPC, switch to http-post, 9/7/09 by DW
<<local (apiurl = "http://" + domain + ":" + port + path, params)
<<new (tabletype, @params)
<<params.notifyProcedure = "river2.feedUpdated"
<<params.port = 5337
<<params.path = "/RPC2"
<<params.protocol = "xml-rpc"
<<params.url1 = urlfeed
<<local (xmltext = tcp.httppost (apiurl, @params), xstruct)
<<xml.compile (xmltext, @xstruct)
<<local (adrnotifyresult = xml.getaddress (@xstruct, "notifyResult"))
<<local (flsuccess = xml.getattributevalue (adrnotifyresult, "success"))
<<if not flsuccess
<<scripterror (xml.getattributevalue (adrnotifyresult, "msg"))
<<if protocol == "soap"
<<local (params = {"channelChanged", user.inetd.config.http.port, "/aggregator", "soap", {urlfeed}})
<<soap.rpc.client (path, registerProcedure, @params, domain, port)
if adrhtmltext != nil {
adrhtmltext^ = adrhtmltext^ + linkfeed + ", "}}
else {
adrfeed^.stats.lastCloudRenewError = tryerror; //7/19/09 by DW
adrfeed^.stats.ctCloudRenewErrors++; //8/16/09 by DW
log2.add (river2Info.name, "Notify", "Error renewing " + linkfeed + ": \"" + tryerror + ".\"", startticksthisrenew)}};
adrfeed^.stats.whenLastCloudRenew = now;
adrfeed^.stats.ctCloudRenew++};
bundle { //test code
renewOneSubscription (@config.river2.feeds.["http://www.inberkeley.com/feed/"])}
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.