1 |
// 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 |
ext::String login, rss, atom; |
16 |
ext::Uuid id; |
17 |
public: |
18 |
Buddy(const ext::String& login, const ext::String& rss = "", const ext::String& atom = "") : |
19 |
login(net::Oscar::collapse(login)), |
20 |
rss(rss.IsEmpty() ? login + ".rss" : rss), |
21 |
atom(atom.IsEmpty() ? login + ".atom" : atom) {} |
22 |
Buddy(const net::Oscar::UserInfo& user) : login(net::Oscar::collapse(user.screenname)) {} |
23 |
const ext::String& getRss() const { return rss; } |
24 |
const ext::String& getAtom() const { return atom; } |
25 |
const ext::Uuid& getId() const { return id; } |
26 |
void setRss(const ext::String& rss) { this->rss = rss; } |
27 |
void setAtom(const ext::String& atom) { this->atom = atom; } |
28 |
void setId(const ext::Uuid& id) { this->id = id; } |
29 |
bool operator==(const Buddy& buddy) const { return login == buddy.login; } |
30 |
bool operator<(const Buddy& buddy) const { return login < buddy.login; } |
31 |
operator const ext::String&() const { return login; } |
32 |
}; |
33 |
|
34 |
inline std::ostream& operator<<(std::ostream& sout, const Buddy& buddy) |
35 |
{ |
36 |
return sout << ext::String(buddy); |
37 |
} |
38 |
|
39 |
#endif // _Buddy_hpp_ |