When someone accepts your friend request while you are online, besides the notification, the status in the friendlist gets also updated.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13536 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-08-22 00:43:53 +00:00
parent 1f45958323
commit c3c1e1b054
3 changed files with 17 additions and 7 deletions

View File

@ -429,8 +429,8 @@ namespace Online{
for(unsigned int i = 0; i < parts.size(); ++i)
{
online_friends.push_back(atoi(parts[i].c_str()));
Log::info("online friend", "%d", online_friends[i]);
}
bool went_offline = false;
std::vector<uint32_t> friends = CurrentUser::get()->getProfile()->getFriends();
std::vector<irr::core::stringw> to_notify;
for(unsigned int i = 0; i < friends.size(); ++i)
@ -440,7 +440,6 @@ namespace Online{
{
if (*iter == friends[i])
{
Log::info("found online friend", "%d", *iter);
online_friends.erase(iter--);
break;
}
@ -451,7 +450,6 @@ namespace Online{
if(iter != online_friends.end())
{
now_online = true;
Log::info("now online", "%d", *iter);
}
Profile * profile = ProfileManager::get()->getProfileByID(friends[i]);
@ -459,7 +457,10 @@ namespace Online{
if( relation_info->isOnline() )
{
if (!now_online)
{
relation_info->setOnline(false);
went_offline = true;
}
}
else
{
@ -467,7 +468,6 @@ namespace Online{
{
relation_info->setOnline(true);
to_notify.push_back(profile->getUserName());
Log::info("adding", "%d", friends[i]);
}
}
@ -495,8 +495,13 @@ namespace Online{
GUIEngine::DialogQueue::get()->pushDialog( new MessageDialog(message, true), false);
OnlineProfileFriends::getInstance()->refreshFriendsList();
}
else if(went_offline)
{
OnlineProfileFriends::getInstance()->refreshFriendsList();
}
}
// FIXME show connection error?
// FIXME show connection error??
// after 2 misses I'll show something
}

View File

@ -44,6 +44,12 @@ namespace Online{
m_is_asker = is_asker;
}
// ============================================================================
void Profile::RelationInfo::setOnline(bool online)
{
m_is_online = online;
m_is_pending = false;
}
// ============================================================================
Profile::Profile( const uint32_t & userid,
@ -176,7 +182,6 @@ namespace Online{
++iter;
}
}
// ============================================================================
void Profile::addFriend( const uint32_t id)

View File

@ -58,7 +58,7 @@ namespace Online{
bool isAsker(){return m_is_asker;}
const irr::core::stringw & getDate() { return m_date; }
bool isOnline() const { return m_is_online; }
void setOnline(bool online) { m_is_online = online; }
void setOnline(bool online);
};
class FriendsListRequest : public XMLRequest
{