// Zoe AIM Away Message RSS Feed Generator // // Seth King and Douglas Thrift // // $Id$ #include "Zoe.hpp" #include "Matcher.hpp" int main(int argc, char* argv[]) { Zoe::program = argv[0]; for (int index(1); index < argc; ++index) { ext::String arg(argv[index]); Matcher matcher; if (arg == matcher("^-config=(.*)$")) { Zoe::config = matcher[1]; } else if (arg == "-D") { if (!Zoe::debug) Zoe::debug = true; } else { cerr << "Usage: " << Zoe::program << " [-config=config] [-D]\n"; return 1; } } Zoe zoe; return 0; } Zoe::Zoe() : rss("zoe.rss") { configure(); // This is just to figure out Jay's XML output, seems to have worked! // It should really go in Rss.cpp later api::FileOutputStream fout; if (this->rss != "-") fout.Open(this->rss); // need to ask Jay "Why?" xml::TextWriter rss(this->rss != "-" ? /*api::FileOutputStream(this->rss)*/ fout : api::Cout.GetStream()); xml::ScopeElement root(rss, "rss"); rss.SetAttribute("version", "2.0"); xml::ScopeElement channel(rss, "channel"); rss.OpenElement("title"); rss.OutputText("Zoe's Away Messages"); rss.CloseElement(); rss.OpenElement("link"); rss.OutputText("http://computers.douglasthrift.net/zoe.xml"); rss.CloseElement(); } bool Zoe::debug(false); ext::String Zoe::program, Zoe::config("zoe.xml"); void Zoe::configure() { ext::Handle document(xml::Parse(config)); ext::Handle zoe(*document/"zoe"); login = *zoe/"login"; password = *zoe/"password"; if (!(*zoe/"rss").IsEmpty()) rss = *zoe/"rss"; }