5 |
|
// $Id$ |
6 |
|
|
7 |
|
#include "Matcher.hpp" |
8 |
< |
#include "Buddy.hpp" |
8 |
> |
#include "Collector.hpp" |
9 |
> |
#include "Publisher.hpp" |
10 |
|
|
11 |
|
int main(int argc, char* argv[]) |
12 |
|
{ |
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 |
|
} |
51 |
|
{ |
52 |
|
configure(); |
53 |
|
|
54 |
< |
// This is just to figure out Jay's XML output, seems to have worked! |
55 |
< |
// It should really go in Rss.cpp later |
46 |
< |
/* api::FileOutputStream fout(this->rss != "-" ? this->rss : "/dev/null"); |
47 |
< |
xml::TextWriter rss(this->rss != "-" ? fout : api::Cout.GetStream()); |
48 |
< |
xml::ScopeElement root(rss, "rss"); |
49 |
< |
|
50 |
< |
rss.SetAttribute("version", "2.0"); |
51 |
< |
|
52 |
< |
xml::ScopeElement channel(rss, "channel"); |
53 |
< |
|
54 |
< |
rss.OpenElement("title"); |
55 |
< |
rss.OutputText("Zoe's Away Messages"); |
56 |
< |
rss.CloseElement(); |
57 |
< |
rss.OpenElement("link"); |
58 |
< |
rss.OutputText("http://computers.douglasthrift.net/zoe.xml"); |
59 |
< |
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() |
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 |
|
} |