// Zoe AIM Away Message RSS Feed Generator // // Seth King and Douglas Thrift // // $Id$ #include "Collector.hpp" #include #include #ifndef PASS_MAX #if defined (_PASSWORD_LEN) const unsigned PASS_MAX(_PASSWORD_LEN); #elif defined (_SC_PASS_MAX) const unsigned PASS_MAX(_SC_PASS_MAX); #else #error PASS_MAX unknown #endif #endif // PASS_MAX Collector::Collector(const ext::String& login, ext::String& password, const std::set& buddies, bool start) : login(login), password(password), start(start) { if (start) { if (password.IsEmpty()) prompt(); collector.Spawn(etl::BindAll(&Collector::collect, this, buddies)); } } int Collector::collect(const std::set& buddies) { cerr << "Collector::collect()\n"; net::Oscar::Session session; net::Oscar::AuthTool auth(session); net::Oscar::BuddyTool buddy(session); net::Oscar::ChatTool chat(session); net::Oscar::IcbmTool icbm(session); net::Oscar::InfoTool info(session); auth.Login(login, password); password.Clear(); net::Oscar::StringSet buddies_; for (std::set::const_iterator buddy(buddies.begin()); buddy != buddies.end(); ++buddy) buddies_.Insert(*buddy); buddy.Insert(buddies_); icbm.RequestParams(); net::Oscar::Capabilities capabilities; capabilities.Insert(net::Oscar::ChatCapability); info.SetProfile("I am Zoe. :-*", "", capabilities); // figure out whether or not we logged in while (true) { sleep(60); // collect } } void Collector::prompt() { char* password(getpass("Password: ")); this->password = password; for (size_t index(0); index < PASS_MAX; ++index) password[index] = '\0'; }