virtual bool Run(P4Task& task, const CommandArgs& args) { if (!task.IsConnected()) // Cannot login without being connected { Conn().Log().Info() << "Cannot login when not connected" << Endl; return false; } ClearStatus(); m_LoggedIn = false; m_Password = task.GetP4Password(); m_CheckingForLoggedIn = args.size() > 1; const string cmd = string("login") + (m_CheckingForLoggedIn ? string(" " ) + args[1] : string()); if (!task.CommandRun(cmd, this) && !m_CheckingForLoggedIn) { string errorMessage = GetStatusMessage(); Conn().Log().Notice() << "ERROR: " << errorMessage << Endl; } if (m_CheckingForLoggedIn) Conn().Log().Debug() << "Is logged in: " << (m_LoggedIn ? "yes" : "no") << Endl; else Conn().Log().Info() << "Login " << (m_LoggedIn ? "succeeded" : "failed") << Endl; m_CheckingForLoggedIn = false; return m_LoggedIn; }
virtual bool Run(P4Task& task, const CommandArgs& args) { if (!task.IsConnected()) // Cannot logout without being connected { Pipe().Log().Info() << "Cannot logout when not connected" << unityplugin::Endl; return false; } ClearStatus(); if (!task.CommandRun("logout", this)) { string errorMessage = GetStatusMessage(); Pipe().Log().Notice() << errorMessage << unityplugin::Endl; } return true; }