--- trunk/Collector.cpp 2004/07/17 23:29:02 25 +++ trunk/Collector.cpp 2004/07/20 07:11:56 31 @@ -62,11 +62,14 @@ int Collector::collect() net::Oscar::Capabilities capabilities; capabilities.Insert(net::Oscar::ChatCapability); - info.SetProfile("I am Zoe. :-*", "Mommy told me not to talk to strangers. O:-)", capabilities); + info.SetProfile(ext::String("I am Zoe. :-*", "<" + + ext::String("font face=\"Tahoma\" size=3>Mommy told me not to talk t") + + "o strangers. O:-)", capabilities); // figure out whether or not we logged in - while (true) sleep(60); + while (true) sleep(Minute(1)); } void Collector::prompt() @@ -84,15 +87,28 @@ void Collector::prompt() void Collector::status(const net::Oscar::UserInfo& user) { - Stamp stamp; Buddy buddy(*buddies.find(user)); + AwayMessage message(buddy, *info); - cerr << red << ext::String(stamp) << ' ' << blue << ext::String(buddy) - << '\n' << reset; + if (!ext::String(message).IsEmpty()) // XXX + { + cerr << bright << red << "Collector::status(" << blue << buddy << red + << ", " << reset << message << bright << red << ")\n" << reset; + + ext::Handle db(dbi::Connect(database.driver, + database.host, database.user, database.password, database.db)); + + db->Execute("INSERT INTO messages (stamp, message, id) VALUES ('" + + message.getStamp() + "', '" + db->Escape(message) + "', '" + + buddy.getId() + "')"); + } } void Collector::receive(const ext::String& buddy, const ext::String& message) { + cerr << bright << red << "Collector::receive(" << blue << Buddy(buddy) + << red << ", " << reset << message << bright << red << ")\n" << reset; + if (buddies.find(buddy) != buddies.end()) { Stamp stamp; @@ -105,6 +121,7 @@ void Collector::receive(const ext::Strin { sleep(1); - icbm->Simple(buddy, "Mommy told me not to talk to strangers. O:-)"); + icbm->Simple(buddy, ext::String("Mommy to") + + "ld me not to talk to strangers. O:-)"); } }