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 |
|
|
ext::String login, rss; |
16 |
douglas |
21 |
ext::Uuid id; |
17 |
douglas |
12 |
public: |
18 |
douglas |
20 |
Buddy(const ext::String& login, const ext::String& rss = "") : |
19 |
douglas |
21 |
login(net::Oscar::collapse(login)), rss(rss.IsEmpty() ? login + ".rss" : |
20 |
|
|
rss) {} |
21 |
douglas |
22 |
Buddy(const net::Oscar::UserInfo& user) : |
22 |
|
|
login(net::Oscar::collapse(user.screenname)) {} |
23 |
douglas |
25 |
const ext::String& getRss() const { return rss; } |
24 |
douglas |
21 |
const ext::Uuid& getId() const { return id; } |
25 |
|
|
void setId(const ext::Uuid& id) { this->id = id; } |
26 |
douglas |
15 |
bool operator==(const Buddy& buddy) const { return login == buddy.login; } |
27 |
douglas |
12 |
bool operator<(const Buddy& buddy) const { return login < buddy.login; } |
28 |
douglas |
15 |
operator const ext::String&() const { return login; } |
29 |
douglas |
21 |
// friends: |
30 |
|
|
friend std::ostream& operator<<(std::ostream& sout, const Buddy& buddy); |
31 |
douglas |
12 |
}; |
32 |
|
|
|
33 |
douglas |
30 |
inline ext::String operator+(const Buddy& buddy, const ext::String& string) |
34 |
|
|
{ |
35 |
|
|
return ext::String(buddy) + string; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
inline ext::String operator+(const ext::String& string, const Buddy& buddy) |
39 |
|
|
{ |
40 |
|
|
return string + ext::String(buddy); |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
inline ext::String operator+(const ext::Uuid& uuid, const ext::String& string) |
44 |
|
|
{ |
45 |
|
|
return lexical_cast<ext::String>(uuid) + string; |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
inline ext::String operator+(const ext::String& string, const ext::Uuid& uuid) |
49 |
|
|
{ |
50 |
|
|
return string + lexical_cast<ext::String>(uuid); |
51 |
|
|
} |
52 |
|
|
|
53 |
douglas |
12 |
#endif // _Buddy_hpp_ |