1 |
// Zoe AIM Away Message RSS Feed Generator |
2 |
// |
3 |
// Seth King and Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#include "AwayMessage.hpp" |
8 |
|
9 |
AwayMessage::operator ext::String() const |
10 |
{ |
11 |
std::string message(this->message); |
12 |
std::string::size_type begin(0), found; |
13 |
|
14 |
while ((found = message.find('%', begin)) != std::string::npos) |
15 |
{ |
16 |
if (message.find_first_of("ndt", found + 1) == found + 1) |
17 |
{ |
18 |
switch (message[found + 1]) |
19 |
{ |
20 |
case 'n': |
21 |
message.replace(found, 2, "Zoe"); |
22 |
|
23 |
begin = found + 3; |
24 |
|
25 |
break; |
26 |
case 'd': |
27 |
message.replace(found, 2, stamp.getDate()); |
28 |
|
29 |
begin = found + 10; |
30 |
|
31 |
break; |
32 |
case 't': |
33 |
message.replace(found, 2, stamp.getTime()); |
34 |
|
35 |
begin = found + 11; |
36 |
} |
37 |
} |
38 |
else begin = found + 1; |
39 |
} |
40 |
|
41 |
return message; |
42 |
} |