From 529c61fabee0a1a010bc4b441ac0ecf179278c12 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 15 Oct 2014 01:20:01 -0400 Subject: [PATCH] Fix friends list online count being wrong This patch changes from always updating online count with cells, to checking the indicator cell's previous value before changing it, maintaining the count instead of always modifying it during updates.. Removes commented out OnlineSIP bits, as it's just easier not to upkeep them. --- indra/newview/llfloaterfriends.cpp | 48 +++++++++++------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 403e06d09..ac2f5c1cc 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -54,7 +54,6 @@ #include "lltextbox.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" -//#include "llvoiceclient.h" #include "statemachine/aifilepicker.h" @@ -75,12 +74,9 @@ public: { mEventTimer.stop(); LLAvatarTracker::instance().addObserver(this); - // For notification when SIP online status changes. - //LLVoiceClient::getInstance()->addObserver(this); } /*virtual*/ ~LLLocalFriendsObserver() { - //LLVoiceClient::getInstance()->removeObserver(this); LLAvatarTracker::instance().removeObserver(this); } /*virtual*/ void changed(U32 mask) @@ -344,7 +340,6 @@ void LLPanelFriends::addFriend(const LLUUID& agent_id) const LLRelationship* relation_info = LLAvatarTracker::instance().getBuddyInfo(agent_id); if (!relation_info) return; - //bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(agent_id); bool isOnline = relation_info->isOnline(); std::string fullname; @@ -369,12 +364,6 @@ void LLPanelFriends::addFriend(const LLUUID& agent_id) friend_column.font_style("BOLD"); cell.value("icon_avatar_online.tga"); } - /*else if(isOnlineSIP) - { - ++mNumOnline; - friend_column.font_style("BOLD"); - cell.value("slim_icon_16_viewer.tga"); - }*/ // Add the online indicator, then the names element.columns.add(cell); @@ -425,7 +414,6 @@ void LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh LLScrollListItem* itemp = mFriendsList->getItem(agent_id); if (!itemp) return; - //bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(itemp->getUUID()); bool isOnline = info->isOnline(); std::string fullname; @@ -440,29 +428,29 @@ void LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(-1); } - // Name of the status icon to use - std::string statusIcon; + if (LLScrollListCell* cell = itemp->getColumn(LIST_ONLINE_STATUS)) + { + if (cell->getValue().asString().empty() == isOnline) + { + // Name of the status icon to use + std::string statusIcon; - if (isOnline) - { - ++mNumOnline; - statusIcon = "icon_avatar_online.tga"; + if (isOnline) + { + ++mNumOnline; + statusIcon = "icon_avatar_online.tga"; + } + else + { + --mNumOnline; + } + cell->setValue(statusIcon); + } } - /*else if (isOnlineSIP) - { - ++mNumOnline; - statusIcon = "slim_icon_16_viewer.tga"; - }*/ - else - { - --mNumOnline; - } - - itemp->getColumn(LIST_ONLINE_STATUS)->setValue(statusIcon); itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text - static_cast(itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle(isOnline /*|| isOnlineSIP*/ ? LLFontGL::BOLD : LLFontGL::NORMAL); + static_cast(itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle(isOnline ? LLFontGL::BOLD : LLFontGL::NORMAL); itemp->getColumn(LIST_VISIBLE_ONLINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); itemp->getColumn(LIST_VISIBLE_MAP)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_MINE)->setValue(info->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS));