Friendslist gets automatically fetched after signing in. And some general bugfixes.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13507 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-08-19 00:19:18 +00:00
parent c758ecbe43
commit ea7d42c1b8
6 changed files with 10 additions and 28 deletions

View File

@ -147,7 +147,9 @@ namespace Online{
UserConfigParams::m_saved_token = getToken();
UserConfigParams::m_saved_session = true;
}
ProfileManager::get()->addToCache(new Profile(CurrentUser::get()->getID(), CurrentUser::get()->getUserName(), false));
ProfileManager::get()->addToCache(m_profile);
m_profile->fetchFriends();
HTTPManager::get()->startPolling();
}
else
setUserState (US_SIGNED_OUT);
@ -211,6 +213,7 @@ namespace Online{
UserConfigParams::m_saved_user = 0;
UserConfigParams::m_saved_token = "";
UserConfigParams::m_saved_session = false;
HTTPManager::get()->startPolling();
}
void CurrentUser::SignOutRequest::callback()

View File

@ -80,6 +80,7 @@ namespace Online{
pthread_cond_init(&m_cond_request, NULL);
m_abort.setAtomic(false);
m_time_since_poll = 0.0f;
m_polling = false;
}
// ============================================================================
@ -206,7 +207,6 @@ namespace Online{
me->m_request_queue.getData().pop();
me->m_request_queue.unlock();
me->m_current_request->execute();
me->m_current_request->callback();
me->addResult(me->m_current_request);
me->m_request_queue.lock();
} // while

View File

@ -49,6 +49,7 @@ namespace Online{
protected:
float m_time_since_poll;
bool m_polling;
/** The current requested being worked on. */
Online::Request * m_current_request;
@ -88,6 +89,9 @@ namespace Online{
static void deallocate();
static bool isRunning();
void startPolling(){ m_polling = true; }
void stopPolling(){ m_polling = false; }
//Execute
std::string getPage(Online::Request * request);
XMLNode * getXMLFromPage(Online::Request * request);

View File

@ -104,7 +104,7 @@ namespace Online{
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER, chunk);
curl_easy_setopt(m_curl_session, CURLOPT_CAINFO, (file_manager->getDataDir() + "web.tuxfamily.org.pem").c_str());
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(m_curl_session, CURLOPT_VERBOSE, 1L);
//curl_easy_setopt(m_curl_session, CURLOPT_VERBOSE, 1L);
}
void HTTPRequest::operation()

View File

@ -63,7 +63,6 @@ OnlineScreen::OnlineScreen() : Screen("online/main.stkgui")
OnlineScreen::~OnlineScreen()
{
m_requests.clearAndDeleteAll();
}
// ----------------------------------------------------------------------------
@ -166,28 +165,6 @@ void OnlineScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
{
m_online_status_widget->setText(Messages::signingOut(), false);
}
for(int i = m_requests.size()-1; i>=0; --i)
{
if(m_requests[i].isDone())
{
if(m_requests[i].getType() == CurrentUser::RT_SIGN_IN)
{
if(m_requests[i].isSuccess())
{
new MessageDialog(_("Signed in."));
}
else
{
sfx_manager->quickSound( "anvil" );
new MessageDialog(m_requests[i].getInfo());
}
}else if(m_requests[i].getType() == CurrentUser::RT_SIGN_OUT)
{
new MessageDialog(_("Signed out successfully."));
}
m_requests.erase(i);
}
}
} // onUpdate
// ----------------------------------------------------------------------------

View File

@ -55,8 +55,6 @@ private:
Online::CurrentUser::UserState m_recorded_state;
PtrVector<const Online::XMLRequest> m_requests;
/** \brief Checks if the recorded state differs from the actual state and sets it. */
bool hasStateChanged();
/** \brief Sets which widget has to be focused. Depends on the user state. */