void GotPromptEnd(struct connection *c, char type, char *job, char *d) { Prompt = type; switch (type) { case 'I': case '<': SendNextCommand(); break; case 'U': SendUsername(Username); break; case 'P': SendPassword(Password); break; } TryQuit(); }
void Connection::Connect() { assert(!m_connection); try { m_connection.reset(mpd_connection_new(m_host.c_str(), m_port, m_timeout * 1000)); checkErrors(); if (!m_password.empty()) SendPassword(); m_fd = mpd_connection_get_fd(m_connection.get()); checkErrors(); } catch (MPD::ClientError &e) { Disconnect(); throw e; } }