ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/Zoe.cpp
(Generate patch)

Comparing trunk/Zoe.cpp (file contents):
Revision 8 by douglas, 2004-07-09T18:13:27-07:00 vs.
Revision 13 by douglas, 2004-07-11T23:49:09-07:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 #include "Zoe.hpp"
7   #include "Matcher.hpp"
8 + #include "Collector.hpp"
9 + #include "Publisher.hpp"
10  
11   int main(int argc, char* argv[])
12   {
# Line 20 | Line 21 | int main(int argc, char* argv[])
21                  {
22                          Zoe::config = matcher[1];
23                  }
24 +                else if (arg == "-collector")
25 +                {
26 +                        if (!Zoe::collector) Zoe::collector = true;
27 +                }
28 +                else if (arg == "-publisher")
29 +                {
30 +                        if (!Zoe::publisher) Zoe::publisher = true;
31 +                }
32                  else if (arg == "-D")
33                  {
34                          if (!Zoe::debug) Zoe::debug = true;
35                  }
36                  else
37                  {
38 <                        cerr << "Usage: " << Zoe::program << " [-config=config] [-D]\n";
38 >                        cerr << "Usage: " << Zoe::program << " [-config=config] [-collector"
39 >                           << "] [-publisher] [-D]\n";
40 >
41 >                        return 1;
42                  }
43          }
44  
# Line 35 | Line 47 | int main(int argc, char* argv[])
47          return 0;
48   }
49  
50 < Zoe::Zoe() : rss("zoe.rss")
50 > Zoe::Zoe()
51   {
52          configure();
53  
54 <        // This is just to figure out Jay's XML output, seems to have worked!
55 <        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();
54 >        if (collector) Collector collector(buddies);
55 >        if (publisher) Publisher publisher(buddies);
56   }
57  
58 < bool Zoe::debug(false);
58 > bool Zoe::debug(false), Zoe::collector(false), Zoe::publisher(false);
59   ext::String Zoe::program, Zoe::config("zoe.xml");
60  
61   void Zoe::configure()
# Line 63 | Line 63 | void Zoe::configure()
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";
66 >        login = std::string(*zoe/"login");
67 >        password = std::string(*zoe/"password");
68 >
69 >        xml::NodeSet buddies(*zoe/"buddy");
70  
71 <        if (!(*zoe/"rss").IsEmpty()) rss = *zoe/"rss";
71 >        for (xml::NodeSet::Iterator buddy(buddies.Begin()); buddy != buddies.End();
72 >                ++buddy)
73 >        {
74 >                this->buddies.insert(Buddy(**buddy/"login", **buddy/"rss"));
75 >        }
76 >
77 >        if (!collector && !publisher)
78 >        {
79 >                collector = true;
80 >                publisher = true;
81 >        }
82   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines