ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/AwayMessage.cpp
Revision: 69
Committed: 2004-12-15T16:14:13-08:00 (20 years, 6 months ago) by douglas
File size: 1240 byte(s)
Log Message:
Meep! This needs more work.

File Contents

# Content
1 // Zoe AIM Away Message RSS Feed Generator
2 //
3 // Seth King and Douglas Thrift
4 //
5 // $Id$
6
7 #include "Matcher/Matcher.hpp"
8 #include "AwayMessage.hpp"
9
10 ext::String AwayMessage::getLink(const Buddy& buddy) const
11 {
12 return buddy.getLink() + "#z" + stamp.getW3();
13 }
14
15 ext::String AwayMessage::getTag(const Buddy& buddy) const
16 {
17 Matcher matcher("^http://([a-zA-Z.\\-0-9]+)(/.*)$");
18
19 if (buddy.getLink() == matcher)
20 {
21 return "tag:" + matcher[1] + "," + stamp.get8601() + ":" + matcher[2]
22 + "/z" + stamp.getW3();
23 }
24 else
25 {
26 api::Cerr << Zoe::program << ": AwayMessage::getTag(" << buddy << ")\n";
27
28 exit(1);
29 }
30 }
31
32 AwayMessage::operator ext::String() const
33 {
34 std::string message(this->message);
35 std::string::size_type begin(0), found;
36
37 while ((found = message.find('%', begin)) != std::string::npos)
38 {
39 if (message.find_first_of("ndt", found + 1) == found + 1)
40 {
41 switch (message[found + 1])
42 {
43 case 'n':
44 message.replace(found, 2, "Zoe");
45
46 begin = found + 3;
47
48 break;
49 case 'd':
50 message.replace(found, 2, stamp.getDate());
51
52 begin = found + 10;
53
54 break;
55 case 't':
56 message.replace(found, 2, stamp.getTime());
57
58 begin = found + 11;
59 }
60 }
61 else begin = found + 1;
62 }
63
64 return message;
65 }

Properties

Name Value
svn:eol-style native
svn:keywords Id