1 |
douglas |
12 |
// Zoe AIM Away Message RSS Feed Generator |
2 |
|
|
// |
3 |
|
|
// Seth King and Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _Buddy_hpp_ |
8 |
|
|
#define _Buddy_hpp_ |
9 |
|
|
|
10 |
|
|
#include "Zoe.hpp" |
11 |
|
|
|
12 |
|
|
class Buddy |
13 |
|
|
{ |
14 |
|
|
private: |
15 |
douglas |
39 |
ext::String login, rss, atom, link; |
16 |
douglas |
21 |
ext::Uuid id; |
17 |
douglas |
12 |
public: |
18 |
douglas |
39 |
Buddy(const ext::String& login, const ext::String& rss = "", |
19 |
|
|
const ext::String& atom = "", const ext::String& link = "") : |
20 |
douglas |
35 |
login(net::Oscar::collapse(login)), |
21 |
|
|
rss(rss.IsEmpty() ? login + ".rss" : rss), |
22 |
douglas |
39 |
atom(atom.IsEmpty() ? login + ".atom" : atom), link(link) {} |
23 |
|
|
Buddy(const net::Oscar::UserInfo& user) : |
24 |
|
|
login(net::Oscar::collapse(user.screenname)) {} |
25 |
douglas |
25 |
const ext::String& getRss() const { return rss; } |
26 |
douglas |
35 |
const ext::String& getAtom() const { return atom; } |
27 |
douglas |
39 |
const ext::String& getLink() const { return link; } |
28 |
douglas |
21 |
const ext::Uuid& getId() const { return id; } |
29 |
douglas |
46 |
ext::String getRssLink() const; |
30 |
|
|
ext::String getAtomLink() const; |
31 |
douglas |
49 |
ext::String getDisplay(const Database& database) const; |
32 |
douglas |
21 |
void setId(const ext::Uuid& id) { this->id = id; } |
33 |
douglas |
49 |
void setDisplay(const ext::String& display, const Database& database) const; |
34 |
douglas |
15 |
bool operator==(const Buddy& buddy) const { return login == buddy.login; } |
35 |
douglas |
39 |
bool operator<(const Buddy& buddy) const { return std::string(login) < std::string(buddy.login); } |
36 |
douglas |
15 |
operator const ext::String&() const { return login; } |
37 |
douglas |
12 |
}; |
38 |
|
|
|
39 |
douglas |
60 |
inline ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Buddy& buddy) |
40 |
douglas |
31 |
{ |
41 |
douglas |
60 |
return pout << ext::String(buddy); |
42 |
douglas |
31 |
} |
43 |
|
|
|
44 |
douglas |
12 |
#endif // _Buddy_hpp_ |