// Zoe AIM Away Message RSS Feed Generator // // Seth King and Douglas Thrift // // $Id$ #include "Matcher.hpp" #include "Collector.hpp" #include "Publisher.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 == "-collector") { if (!Zoe::collector) Zoe::collector = true; } else if (arg == "-publisher") { if (!Zoe::publisher) Zoe::publisher = true; } else if (arg == "-D") { if (!Zoe::debug) Zoe::debug = true; } else { cerr << "Usage: " << Zoe::program << " [-config=config] [-collector" << "] [-publisher] [-D]\n"; return 1; } } Zoe zoe; return 0; } Zoe::Zoe() { configure(); if (collector) Collector collector(buddies); if (publisher) Publisher publisher(buddies); } bool Zoe::debug(false), Zoe::collector(false), Zoe::publisher(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")); } if (!collector && !publisher) { collector = true; publisher = true; } }