// Zoe AIM Away Message RSS Feed Generator // // Seth King and Douglas Thrift // // $Id$ #include "Matcher.hpp" #include "Buddy.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() { 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(this->rss != "-" ? this->rss : "/dev/null"); xml::TextWriter rss(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 = std::string(*zoe/"login"); password = std::string(*zoe/"password"); xml::NodeSet buddies(*zoe/"buddy"); for (xml::NodeSet::Iterator buddy(buddies.Begin()); buddy != buddies.End(); ++buddy) { this->buddies.insert(Buddy(**buddy/"login", **buddy/"rss")); } }