1 |
// Zoe AIM Away Message RSS Feed Generator |
2 |
// |
3 |
// Seth King and Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#include "Atom.hpp" |
8 |
|
9 |
Atom::Atom(const Buddy& buddy, const std::vector<AwayMessage>& messages, const Stamp& stamp) |
10 |
{ |
11 |
api::FileOutputStream fout(buddy.getAtom() != "-" ? buddy.getAtom() : "/dev/null"); |
12 |
xml::TextWriter atom(buddy.getAtom() != "-" ? fout : api::Cout.GetStream()); |
13 |
xml::ScopeElement feed(atom, "feed"); |
14 |
|
15 |
atom.SetAttribute("version", "0.3"); |
16 |
atom.OpenElement("title"); |
17 |
atom.SetAttribute("mode", "escaped"); |
18 |
atom.OutputText(ext::String(buddy) + "'s Away Messages"); |
19 |
atom.CloseElement(); |
20 |
atom.OpenElement("link"); |
21 |
atom.SetAttribute("rel", "alternate"); |
22 |
atom.SetAttribute("type", "text/html"); // XXX |
23 |
atom.SetAttribute("href", "http://computers.douglasthrift.net/zoe.xml"); |
24 |
atom.CloseElement(); |
25 |
atom.OpenElement("author"); |
26 |
atom.OpenElement("name"); |
27 |
atom.OutputText(buddy); |
28 |
atom.CloseElement(); |
29 |
atom.CloseElement(); |
30 |
atom.OpenElement("tagline"); |
31 |
atom.SetAttribute("mode", "escaped"); |
32 |
atom.OutputText(ext::String(buddy) + "'s AIM Away Messages from the past 30 days."); |
33 |
atom.CloseElement(); |
34 |
atom.OpenElement("generator"); |
35 |
atom.SetAttribute("url", "http://computers.douglasthrift.net/zoe.xml"); |
36 |
atom.SetAttribute("version", "0.9"); |
37 |
atom.OutputText(Zoe::generator()); |
38 |
atom.CloseElement(); |
39 |
} |