implement RSS;
include "string.m";
str : String;
include "sys.m";
sys : Sys;
include "draw.m";
include "sslsession.m";
include "keyring.m";
include "asn1.m";
include "pkcs.m";
include "x509.m";
include "ssl3.m";
ssl3: SSL3;
Context: import ssl3;
include "httpc.m";
httpc : Httpc;
Connection, Response, Request : import httpc;
include "xmhell.m";
xml : Xml;
Parser : import xml;
include "RSS.m";
rss : RSS;
init()
{
httpc = load Httpc Httpc->PATH;
httpc->init();
xml = load Xml Xml->PATH;
xml->init();
sys = load Sys Sys->PATH;
}
feed(dialstring, host, uri : string, ssl : int) : ref Feed
{
h : ref Connection;
case ssl {
1 =>
h = httpc->new_ssl_connection(dialstring);
* =>
h = httpc->new_connection(dialstring);
}
if(h == nil) raise "connection to " + dialstring + " failed";
f := ref Feed(host, uri, h);
return f;
}
Feed.fetch(f : self ref Feed) : int
{
r := f.httpc.send_request(ref Request(f.host, "GET", f.uri, "1.1", "Inferno: Maht's rss reader", nil, nil));
if(r != nil) {
psr := xml->init_io(r.body_string(), nil, "");
i := psr.next();
while(i != nil) {
pick k := i {
Tag =>
case k.name {
* =>
;
}
}
i = psr.next();
}
}
return 0;
}
|