Renamed CurrentUser to OnlinePlayerProfile.

This commit is contained in:
hiker 2014-04-17 15:39:51 +10:00
parent 22b599d257
commit a8bf73633f
4 changed files with 31 additions and 31 deletions

View File

@ -23,7 +23,7 @@
#include "io/file_manager.hpp"
#include "io/utf_writer.hpp"
#include "io/xml_node.hpp"
#include "online/current_user.hpp"
#include "online/online_player_profile.hpp"
#include "utils/log.hpp"
#include "utils/translation.hpp"
@ -201,7 +201,7 @@ void PlayerManager::load()
for(unsigned int i=0; i<m_player_data->getNumNodes(); i++)
{
const XMLNode *player_xml = m_player_data->getNode(i);
PlayerProfile *player = new Online::CurrentUser(player_xml);
PlayerProfile *player = new Online::OnlinePlayerProfile(player_xml);
m_all_players.push_back(player);
if(player->isDefault())
m_current_player = player;
@ -272,7 +272,7 @@ void PlayerManager::save()
*/
void PlayerManager::addNewPlayer(const core::stringw& name)
{
m_all_players.push_back( new Online::CurrentUser(name) );
m_all_players.push_back( new Online::OnlinePlayerProfile(name) );
} // addNewPlayer
// ----------------------------------------------------------------------------
@ -344,10 +344,10 @@ void PlayerManager::addDefaultPlayer()
// Set the name as the default name, but don't mark it as 'default'
// yet, since not having a default player forces the player selection
// screen to be shown.
m_all_players.push_back(new Online::CurrentUser(username.c_str()) );
m_all_players.push_back(new Online::OnlinePlayerProfile(username.c_str()) );
// add default guest player
m_all_players.push_back(new Online::CurrentUser(_LTR("Guest"), /*guest*/true));
m_all_players.push_back(new Online::OnlinePlayerProfile(_LTR("Guest"), /*guest*/true));
} // addDefaultPlayer
// ----------------------------------------------------------------------------

View File

@ -21,7 +21,7 @@
#include "achievements/achievements_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "online/current_user.hpp"
#include "online/online_player_profile.hpp"
#include "io/xml_node.hpp"
#include "io/utf_writer.hpp"
#include "utils/string_utils.hpp"

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "online/current_user.hpp"
#include "online/online_player_profile.hpp"
#include "achievements/achievements_manager.hpp"
#include "config/player_manager.hpp"
@ -51,7 +51,7 @@ namespace Online
* \param request The http request.
* \param action If not empty, the action to be set.
*/
void CurrentUser::setUserDetails(HTTPRequest *request,
void OnlinePlayerProfile::setUserDetails(HTTPRequest *request,
const std::string &action,
const std::string &php_script)
{
@ -69,17 +69,17 @@ namespace Online
} // setUserDetails
// ========================================================================
CurrentUser::CurrentUser(const XMLNode *player)
OnlinePlayerProfile::OnlinePlayerProfile(const XMLNode *player)
: PlayerProfile(player)
{
m_online_state = OS_SIGNED_OUT;
m_token = "";
m_save_session = false;
m_profile = NULL;
} // CurrentUser
} // OnlinePlayerProfile
// ------------------------------------------------------------------------
CurrentUser::CurrentUser(const core::stringw &name, bool is_guest)
OnlinePlayerProfile::OnlinePlayerProfile(const core::stringw &name, bool is_guest)
: PlayerProfile(name, is_guest)
{
m_online_state = OS_SIGNED_OUT;
@ -87,11 +87,11 @@ namespace Online
m_save_session = false;
m_profile = NULL;
} // CurrentUser
} // OnlinePlayerProfile
// ------------------------------------------------------------------------
/** Request a login using the saved credentials of the user.
*/
void CurrentUser::requestSavedSession()
void OnlinePlayerProfile::requestSavedSession()
{
SignInRequest * request = NULL;
if (m_online_state == OS_SIGNED_OUT && hasSavedSession() )
@ -115,8 +115,8 @@ namespace Online
* \param request_now Immediately submit this request to the
* RequestManager.
*/
CurrentUser::SignInRequest*
CurrentUser::requestSignIn(const core::stringw &username,
OnlinePlayerProfile::SignInRequest*
OnlinePlayerProfile::requestSignIn(const core::stringw &username,
const core::stringw &password,
bool save_session, bool request_now)
{
@ -139,7 +139,7 @@ namespace Online
// ------------------------------------------------------------------------
/** Called when the signin request is finished.
*/
void CurrentUser::SignInRequest::callback()
void OnlinePlayerProfile::SignInRequest::callback()
{
PlayerManager::getCurrentPlayer()->signIn(isSuccess(), getXMLData());
GUIEngine::Screen *screen = GUIEngine::getCurrentScreen();
@ -161,7 +161,7 @@ namespace Online
* successful login attemp.
* \param input Xml tree with the complete server response.
*/
void CurrentUser::signIn(bool success, const XMLNode * input)
void OnlinePlayerProfile::signIn(bool success, const XMLNode * input)
{
if (success)
{
@ -194,7 +194,7 @@ namespace Online
} // signIn
// ------------------------------------------------------------------------
void CurrentUser::requestSignOut()
void OnlinePlayerProfile::requestSignOut()
{
assert(m_online_state == OS_SIGNED_IN || m_online_state == OS_GUEST);
SignOutRequest * request = new SignOutRequest();
@ -207,17 +207,17 @@ namespace Online
} // requestSignOut
// --------------------------------------------------------------------
void CurrentUser::SignOutRequest::callback()
void OnlinePlayerProfile::SignOutRequest::callback()
{
PlayerManager::getCurrentPlayer()->signOut(isSuccess(), getXMLData());
} // SignOutRequest::callback
// ------------------------------------------------------------------------
void CurrentUser::signOut(bool success, const XMLNode * input)
void OnlinePlayerProfile::signOut(bool success, const XMLNode * input)
{
if(!success)
{
Log::warn("CurrentUser::signOut", "%s",
Log::warn("OnlinePlayerProfile::signOut", "%s",
"There were some connection issues while signing out. "
"Report a bug if this caused issues.");
}
@ -232,10 +232,10 @@ namespace Online
/** Sends a request to the server to see if any new information is
* available. (online friends, notifications, etc.).
*/
void CurrentUser::requestPoll() const
void OnlinePlayerProfile::requestPoll() const
{
assert(m_online_state == OS_SIGNED_IN);
CurrentUser::PollRequest * request = new CurrentUser::PollRequest();
OnlinePlayerProfile::PollRequest * request = new OnlinePlayerProfile::PollRequest();
request->setServerURL("client-user.php");
request->addParameter("action", "poll");
request->addParameter("token", getToken());
@ -247,7 +247,7 @@ namespace Online
/** Callback for the poll request. Parses the information and spawns
* notifications accordingly.
*/
void CurrentUser::PollRequest::callback()
void OnlinePlayerProfile::PollRequest::callback()
{
if(isSuccess())
{
@ -383,7 +383,7 @@ namespace Online
/** Sends a message to the server that the client has been closed, if a
* user is signed in.
*/
void CurrentUser::onSTKQuit() const
void OnlinePlayerProfile::onSTKQuit() const
{
if(isLoggedIn())
{
@ -400,7 +400,7 @@ namespace Online
// ------------------------------------------------------------------------
/** \return the online id, or 0 if the user is not signed in.
*/
uint32_t CurrentUser::getOnlineId() const
uint32_t OnlinePlayerProfile::getOnlineId() const
{
if((m_online_state == OS_SIGNED_IN ))
{

View File

@ -46,7 +46,7 @@ namespace Online
* \brief Class that represents an online registered user
* \ingroup online
*/
class CurrentUser : public PlayerProfile
class OnlinePlayerProfile : public PlayerProfile
{
public:
// ----------------------------------------------------------------
@ -136,12 +136,12 @@ namespace Online
bool request_now = true);
public:
CurrentUser(const XMLNode *player);
CurrentUser(const core::stringw &name, bool is_guest = false);
virtual ~CurrentUser() {};
OnlinePlayerProfile(const XMLNode *player);
OnlinePlayerProfile(const core::stringw &name, bool is_guest = false);
virtual ~OnlinePlayerProfile() {};
// ----------------------------------------------------------------
}; // class CurrentUser
}; // class OnlinePlayerProfile
} // namespace Online