ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/Zoe.cpp
Revision: 8
Committed: 2004-07-09T18:13:27-07:00 (20 years, 11 months ago) by douglas
File size: 1342 byte(s)
Log Message:
Did stuff.

File Contents

# Content
1 // Zoe AIM Away Message RSS Feed Generator
2 //
3 // Seth King and Douglas Thrift
4 //
5 // $Id$
6
7 #include "Zoe.hpp"
8 #include "Matcher.hpp"
9
10 int main(int argc, char* argv[])
11 {
12 Zoe::program = argv[0];
13
14 for (int index(1); index < argc; ++index)
15 {
16 ext::String arg(argv[index]);
17 Matcher matcher;
18
19 if (arg == matcher("^-config=(.*)$"))
20 {
21 Zoe::config = matcher[1];
22 }
23 else if (arg == "-D")
24 {
25 if (!Zoe::debug) Zoe::debug = true;
26 }
27 else
28 {
29 cerr << "Usage: " << Zoe::program << " [-config=config] [-D]\n";
30 }
31 }
32
33 Zoe zoe;
34
35 return 0;
36 }
37
38 Zoe::Zoe() : rss("zoe.rss")
39 {
40 configure();
41
42 // This is just to figure out Jay's XML output, seems to have worked!
43 xml::TextWriter rss(api::Cout.GetStream());
44 xml::ScopeElement root(rss, "rss");
45
46 rss.SetAttribute("version", "2.0");
47
48 xml::ScopeElement channel(rss, "channel");
49
50 rss.OpenElement("title");
51 rss.OutputText("Zoe's Away Messages");
52 rss.CloseElement();
53 rss.OpenElement("link");
54 rss.OutputText("http://computers.douglasthrift.net/zoe.xml");
55 rss.CloseElement();
56 }
57
58 bool Zoe::debug(false);
59 ext::String Zoe::program, Zoe::config("zoe.xml");
60
61 void Zoe::configure()
62 {
63 ext::Handle<xml::Document> document(xml::Parse(config));
64 ext::Handle<xml::Node> zoe(*document/"zoe");
65
66 login = *zoe/"login";
67 password = *zoe/"password";
68
69 if (!(*zoe/"rss").IsEmpty()) rss = *zoe/"rss";
70 }

Properties

Name Value
svn:eol-style native
svn:keywords Id