62 |
|
net::Oscar::Capabilities capabilities; |
63 |
|
|
64 |
|
capabilities.Insert(net::Oscar::ChatCapability); |
65 |
< |
info.SetProfile("<font size=3>I am <a href=\"http://computers.douglasthrift.net/zoe.xml\">Zoe</a>.</font> :-*", "<font size=3>Mommy told me not to talk to strangers.</font> O:-)", capabilities); |
65 |
> |
info.SetProfile(ext::String("<font face=\"Tahoma\" size=2>I am <a href=\"h") |
66 |
> |
+ "ttp://computers.douglasthrift.net/zoe.xml\">Zoe</a>.</font> :-*", "<" |
67 |
> |
+ ext::String("font face=\"Tahoma\" size=3>Mommy told me not to talk t") |
68 |
> |
+ "o strangers.</font> O:-)", capabilities); |
69 |
|
|
70 |
|
// figure out whether or not we logged in |
71 |
|
|
72 |
< |
while (true) sleep(60); |
72 |
> |
while (true) sleep(Minute(1)); |
73 |
|
} |
74 |
|
|
75 |
|
void Collector::prompt() |
87 |
|
|
88 |
|
void Collector::status(const net::Oscar::UserInfo& user) |
89 |
|
{ |
90 |
< |
Stamp stamp; |
91 |
< |
Buddy buddy(user); |
90 |
> |
Buddy buddy(*buddies.find(user)); |
91 |
> |
AwayMessage message(buddy, *info); |
92 |
|
|
93 |
< |
cerr << red << ext::String(stamp) << ' ' << blue << ext::String(buddy) |
94 |
< |
<< '\n' << reset; |
93 |
> |
if (!ext::String(message).IsEmpty()) // XXX |
94 |
> |
{ |
95 |
> |
cerr << bright << red << "Collector::status(" << blue << buddy << red |
96 |
> |
<< ", " << reset << message << bright << red << ")\n" << reset; |
97 |
> |
|
98 |
> |
ext::Handle<dbi::Connection> db(dbi::Connect(database.driver, |
99 |
> |
database.host, database.user, database.password, database.db)); |
100 |
> |
|
101 |
> |
db->Execute("INSERT INTO messages (stamp, message, id) VALUES ('" + |
102 |
> |
message.getStamp() + "', '" + db->Escape(message) + "', '" + |
103 |
> |
buddy.getId() + "')"); |
104 |
> |
} |
105 |
|
} |
106 |
|
|
107 |
|
void Collector::receive(const ext::String& buddy, const ext::String& message) |
108 |
|
{ |
109 |
+ |
cerr << bright << red << "Collector::receive(" << blue << Buddy(buddy) |
110 |
+ |
<< red << ", " << reset << message << bright << red << ")\n" << reset; |
111 |
+ |
|
112 |
|
if (buddies.find(buddy) != buddies.end()) |
113 |
|
{ |
114 |
|
Stamp stamp; |
121 |
|
{ |
122 |
|
sleep(1); |
123 |
|
|
124 |
< |
icbm->Simple(buddy, "<font size=3>Mommy told me not to talk to strangers. O:-)"); |
124 |
> |
icbm->Simple(buddy, ext::String("<font face=\"Tahoma\" size=2>Mommy to") |
125 |
> |
+ "ld me not to talk to strangers. O:-)"); |
126 |
|
} |
127 |
|
} |