diff --git a/indra/newview/fsareasearch.cpp b/indra/newview/fsareasearch.cpp index e7605a2ede..b3e107eb5e 100644 --- a/indra/newview/fsareasearch.cpp +++ b/indra/newview/fsareasearch.cpp @@ -182,8 +182,8 @@ FSAreaSearch::FSAreaSearch(const LLSD& key) : // Register an idle update callback gIdleCallbacks.addFunction(idle, this); - mParcelChangedObserver = new FSParcelChangeObserver(this); - LLViewerParcelMgr::getInstance()->addObserver(mParcelChangedObserver); + mParcelChangedObserver = std::make_unique(this); + LLViewerParcelMgr::getInstance()->addObserver(mParcelChangedObserver.get()); } FSAreaSearch::~FSAreaSearch() @@ -209,9 +209,8 @@ FSAreaSearch::~FSAreaSearch() if (mParcelChangedObserver) { - LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver); - delete mParcelChangedObserver; - mParcelChangedObserver = NULL; + LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver.get()); + mParcelChangedObserver = nullptr; } } @@ -252,9 +251,7 @@ void FSAreaSearch::draw() for (const auto item : items) { - LLViewerObject* objectp = gObjectList.findObject(item->getUUID()); - - if (objectp) + if (LLViewerObject* objectp = gObjectList.findObject(item->getUUID()); objectp) { const std::string& objectName = mObjectDetails[item->getUUID()].description; gObjectList.addDebugBeacon(objectp->getPositionAgent(), objectName, mBeaconColor, mBeaconTextColor, beacon_line_width); @@ -299,7 +296,7 @@ void* FSAreaSearch::createPanelFilter(void* data) void* FSAreaSearch::createPanelAdvanced(void* data) { FSAreaSearch* self = (FSAreaSearch*)data; - self->mPanelAdvanced = new FSPanelAreaSearchAdvanced(self); + self->mPanelAdvanced = new FSPanelAreaSearchAdvanced(); return self->mPanelAdvanced; } @@ -324,8 +321,7 @@ void FSAreaSearch::checkRegion() if (mActive) { // Check if we changed region, and if we did, clear the object details cache. - LLViewerRegion* region = gAgent.getRegion(); // getRegion can return NULL if disconnected. - if (region && (region != mLastRegion)) + if (LLViewerRegion* region = gAgent.getRegion(); region && (region != mLastRegion)) { if (!mExcludeNeighborRegions) { @@ -459,8 +455,7 @@ void FSAreaSearch::findObjects() if (object_it.second.request == FSObjectProperties::NEED || object_it.second.request == FSObjectProperties::SENT) { const LLUUID& id = object_it.second.id; - LLViewerObject* objectp = gObjectList.findObject(id); - if (!objectp) + if (LLViewerObject* objectp = gObjectList.findObject(id); !objectp) { object_it.second.request = FSObjectProperties::FAILED; mRequested--; @@ -1035,8 +1030,7 @@ void FSAreaSearch::matchObject(FSObjectProperties& details, LLViewerObject* obje row_params.columns.add(cell_params); cell_params.column = "land_impact"; - F32 cost = objectp->getLinksetCost(); - if (cost > F_ALMOST_ZERO) + if (F32 cost = objectp->getLinksetCost(); cost > F_ALMOST_ZERO) { cell_params.value = cost; } @@ -1098,14 +1092,11 @@ void FSAreaSearch::updateObjectCosts(const LLUUID& object_id, F32 object_cost, F return; } - FSScrollListCtrl* result_list = mPanelList->getResultList(); - if (result_list) + if (FSScrollListCtrl* result_list = mPanelList->getResultList(); result_list) { - LLScrollListItem* list_row = result_list->getItem(LLSD(object_id)); - if (list_row) + if (LLScrollListItem* list_row = result_list->getItem(LLSD(object_id)); list_row) { - LLScrollListColumn* list_column = result_list->getColumn("land_impact"); - if (list_column) + if (LLScrollListColumn* list_column = result_list->getColumn("land_impact"); list_column) { LLScrollListCell* linkset_cost_cell = list_row->getColumn(list_column->mIndex); linkset_cost_cell->setValue(LLSD(link_cost)); @@ -1160,8 +1151,7 @@ void FSAreaSearch::avatarNameCacheCallback(const LLUUID& id, const LLAvatarName& void FSAreaSearch::callbackLoadFullName(const LLUUID& id, const std::string& full_name ) { - auto iter = mNameCacheConnections.find(id); - if (iter != mNameCacheConnections.end()) + if (auto iter = mNameCacheConnections.find(id); iter != mNameCacheConnections.end()) { if (iter->second.connected()) { @@ -1444,8 +1434,7 @@ void FSPanelAreaSearchList::onDoubleClick() } const LLUUID& object_id = item->getUUID(); - LLViewerObject* objectp = gObjectList.findObject(object_id); - if (objectp) + if (LLViewerObject* objectp = gObjectList.findObject(object_id); objectp) { FSObjectProperties& details = mFSAreaSearch->mObjectDetails[object_id]; LLTracker::trackLocation(objectp->getPositionGlobal(), details.name, "", LLTracker::LOCATION_ITEM); @@ -2060,10 +2049,6 @@ BOOL FSPanelAreaSearchFind::postBuild() return LLPanel::postBuild(); } -// virtual -FSPanelAreaSearchFind::~FSPanelAreaSearchFind() -{ } - void FSPanelAreaSearchFind::onButtonClickedClear() { mNameLineEditor->clear(); @@ -2180,10 +2165,6 @@ BOOL FSPanelAreaSearchFilter::postBuild() return LLPanel::postBuild(); } -// virtual -FSPanelAreaSearchFilter::~FSPanelAreaSearchFilter() -{ } - void FSPanelAreaSearchFilter::onCommitCheckbox() { mFSAreaSearch->setFilterLocked(mCheckboxLocked->get()); @@ -2280,10 +2261,6 @@ FSPanelAreaSearchOptions::FSPanelAreaSearchOptions(FSAreaSearch* pointer) mEnableCallbackRegistrar.add("AreaSearch.EnableColumn", boost::bind(&FSPanelAreaSearchOptions::onEnableColumnVisibilityChecked, this, _2)); } -// virtual -FSPanelAreaSearchOptions::~FSPanelAreaSearchOptions() -{ } - void FSPanelAreaSearchOptions::onCommitCheckboxDisplayColumn(const LLSD& userdata) { const std::string& column_name = userdata.asStringRef(); @@ -2306,11 +2283,6 @@ bool FSPanelAreaSearchOptions::onEnableColumnVisibilityChecked(const LLSD& userd // Advanced tab //--------------------------------------------------------------------------- -FSPanelAreaSearchAdvanced::FSPanelAreaSearchAdvanced(FSAreaSearch* pointer) -: LLPanel() -{ -} - BOOL FSPanelAreaSearchAdvanced::postBuild() { mCheckboxClickTouch = getChild("double_click_touch"); @@ -2319,7 +2291,3 @@ BOOL FSPanelAreaSearchAdvanced::postBuild() return LLPanel::postBuild(); } - -// virtual -FSPanelAreaSearchAdvanced::~FSPanelAreaSearchAdvanced() -{ } diff --git a/indra/newview/fsareasearch.h b/indra/newview/fsareasearch.h index 8401ec47d1..95939f17d7 100644 --- a/indra/newview/fsareasearch.h +++ b/indra/newview/fsareasearch.h @@ -217,7 +217,7 @@ private: class FSParcelChangeObserver; friend class FSParcelChangeObserver; - FSParcelChangeObserver* mParcelChangedObserver; + std::unique_ptr mParcelChangedObserver; LLTabContainer* mTab; FSPanelAreaSearchList* mPanelList; @@ -332,7 +332,7 @@ class FSPanelAreaSearchFind LOG_CLASS(FSPanelAreaSearchFind); public: FSPanelAreaSearchFind(FSAreaSearch* pointer); - virtual ~FSPanelAreaSearchFind(); + virtual ~FSPanelAreaSearchFind() = default; /*virtual*/ BOOL postBuild(); /*virtual*/ BOOL handleKeyHere(KEY key,MASK mask); @@ -365,7 +365,7 @@ class FSPanelAreaSearchFilter LOG_CLASS(FSPanelAreaSearchFilter); public: FSPanelAreaSearchFilter(FSAreaSearch* pointer); - virtual ~FSPanelAreaSearchFilter(); + virtual ~FSPanelAreaSearchFilter() = default; /*virtual*/ BOOL postBuild(); @@ -410,7 +410,7 @@ class FSPanelAreaSearchOptions LOG_CLASS(FSPanelAreaSearchOptions); public: FSPanelAreaSearchOptions(FSAreaSearch* pointer); - virtual ~FSPanelAreaSearchOptions(); + virtual ~FSPanelAreaSearchOptions() = default; private: void onCommitCheckboxDisplayColumn(const LLSD& userdata); @@ -430,8 +430,8 @@ class FSPanelAreaSearchAdvanced { LOG_CLASS(FSPanelAreaSearchAdvanced); public: - FSPanelAreaSearchAdvanced(FSAreaSearch* pointer); - virtual ~FSPanelAreaSearchAdvanced(); + FSPanelAreaSearchAdvanced() = default; + virtual ~FSPanelAreaSearchAdvanced() = default; /*virtual*/ BOOL postBuild(); diff --git a/indra/newview/fsassetblacklist.cpp b/indra/newview/fsassetblacklist.cpp index 34cde29d65..a993c9aa32 100644 --- a/indra/newview/fsassetblacklist.cpp +++ b/indra/newview/fsassetblacklist.cpp @@ -117,8 +117,7 @@ bool FSAssetBlacklist::removeItem(const LLUUID& id) { gObjectList.removeDerenderedItem(id); - blacklist_data_t::iterator it; - it = mBlacklistData.find(id); + blacklist_data_t::iterator it = mBlacklistData.find(id); if (it == mBlacklistData.end()) { @@ -148,13 +147,13 @@ void FSAssetBlacklist::removeItemsFromBlacklist(const uuid_vec_t& ids) bool need_save = false; LLSD data; - for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (const auto& id : ids) { - if (removeItem(*it)) + if (removeItem(id)) { need_save = true; } - data.append((*it).asString()); + data.append(id.asString()); } if (need_save) diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index 8591ef1879..380d317222 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -80,9 +80,9 @@ #include // FIRE-24133 - Redirect chat channel messages -const F32 ME_TYPING_TIMEOUT = 4.0f; -const F32 OTHER_TYPING_TIMEOUT = 9.0f; -const F32 NAME_REFRESH_TIMEOUT = 300.0f; +constexpr F32 ME_TYPING_TIMEOUT = 4.0f; +constexpr F32 OTHER_TYPING_TIMEOUT = 9.0f; +constexpr F32 NAME_REFRESH_TIMEOUT = 300.0f; floater_showed_signal_t FSFloaterIM::sIMFloaterShowedSignal; @@ -191,7 +191,7 @@ BOOL FSFloaterIM::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) { mInputEditor->setFocus(TRUE); onTabInto(); - if(focus_flash) + if (focus_flash) { gFocusMgr.triggerFocusFlash(); } @@ -201,7 +201,7 @@ BOOL FSFloaterIM::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) void FSFloaterIM::onFocusLost() { LLIMModel::getInstance()->resetActiveSessionID(); - + LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false); } @@ -229,8 +229,8 @@ void FSFloaterIM::onClose(bool app_quitting) // // Last change: // EXT-3516 X Button should end IM session, _ button should hide - - + + // AO: Make sure observers are removed on close mVoiceChannelStateChangeConnection.disconnect(); if(LLVoiceClient::instanceExists()) @@ -249,7 +249,7 @@ void FSFloaterIM::onSnooze() { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); - if (session == NULL) + if (!session) { LL_WARNS("FSFloaterIM") << "Empty session." << LL_ENDL; return; @@ -260,7 +260,7 @@ void FSFloaterIM::onSnooze() LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - if (is_call_with_chat && voice_channel != NULL && voice_channel->isActive()) + if (is_call_with_chat && voice_channel && voice_channel->isActive()) { LLSD payload; payload["session_id"] = mSessionID; @@ -288,8 +288,7 @@ void FSFloaterIM::confirmSnooze() void FSFloaterIM::snoozeDurationCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 == option) + if (S32 option = LLNotificationsUtil::getSelectedOption(notification, response); 0 == option) { std::istringstream duration_str(response["duration"].asString()); S32 duration(-1); @@ -328,7 +327,8 @@ void FSFloaterIM::newIMCallback(const LLSD& data){ LLUUID session_id = data["session_id"].asUUID(); FSFloaterIM* floater = LLFloaterReg::findTypedInstance("fs_impanel", session_id); - if (floater == NULL) return; + if (!floater) + return; // update if visible or max pending messages exceeded, otherwise will be updated when opened static LLCachedControl fsMaxPendingIMMessages(gSavedSettings, "FSMaxPendingIMMessages"); @@ -373,9 +373,9 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type) LLWString text = mInputEditor->getWText(); LLWStringUtil::trim(text); LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. - if(!text.empty()) + if (!text.empty()) { - if(type == CHAT_TYPE_OOC) + if (type == CHAT_TYPE_OOC) { std::string tempText = wstring_to_utf8str( text ); tempText = gSavedSettings.getString("FSOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("FSOOCPostfix"); @@ -420,20 +420,20 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type) skin_indicator = skin_indicator.substr(0, 1); // "FS 4.4.1f os", "FS 4.4.1v", "FS 4.4.1a", "FS 4.4.1s os", "FS 4.4.1m os" etc. } // - + //Address size check #if ADDRESS_SIZE == 32 std::string str_address_size_tag = "32"; #else std::string str_address_size_tag = ""; #endif - + //OpenSim check std::string str_opensim_tag; #ifdef OPENSIM str_opensim_tag = " os"; #endif - + //Operating System check #if LL_WINDOWS std::string str_operating_system_tag = "W"; @@ -442,31 +442,29 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type) #elif LL_DARWIN std::string str_operating_system_tag = "M"; #endif - + //RLV check std::string str_rlv_enabled = ""; - if(RlvHandler::isEnabled()) + if (RlvHandler::isEnabled()) str_rlv_enabled = "*"; - - + // Text mode check std::string str_viewer_mode = ""; - + // Unfortunately, we have to cheat a little here. Ideally we'd have // a method defined to check if the viewer is running in Text Mode. // For now, we will use the same method as used in llappviewer.cpp(LLAppViewer::getViewerInfo()) static LLCachedControl FSViewerMode(gSavedSettings, "SessionSettingsFile"); std::string viewer_mode(FSViewerMode); LLStringUtil::toLower(viewer_mode); - if(viewer_mode == "settings_text.xml") + if (viewer_mode == "settings_text.xml") str_viewer_mode = "T"; - - + //Build it up size_t insert_pos = is_irc_me_prefix(utf8_text) ? 4 : 0; - + //For testing/beta groups, we display the build version since it doesn't speed by and this might change often - if(FSData::getInstance()->isTestingGroup(mSessionID)) + if (FSData::getInstance()->isTestingGroup(mSessionID)) { if(chat_prefix_testing) utf8_text.insert(insert_pos, ("(" + str_address_size_tag + str_operating_system_tag + " " + LLVersionInfo::getInstance()->getBuildVersion() + skin_indicator + str_viewer_mode + str_rlv_enabled + str_opensim_tag + ") ")); @@ -478,7 +476,7 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type) utf8_text.insert(insert_pos, ("(" + str_address_size_tag + str_operating_system_tag + " " + LLVersionInfo::getInstance()->getShortVersion() + skin_indicator + str_viewer_mode + str_rlv_enabled + str_opensim_tag + ") ")); } } - + // Allow user to send system info. if (mDialog == IM_NOTHING_SPECIAL && utf8_text.find("/sysinfo") == 0) { @@ -486,9 +484,9 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type) utf8_text = system_info["Part1"].asString() + system_info["Part2"].asString(); } // - + sendMsg(utf8_text); - + mInputEditor->setText(LLStringUtil::null); } } @@ -514,12 +512,12 @@ void FSFloaterIM::sendMsg(const std::string& msg) //std::string utf8_text = utf8str_truncate(msg, MAX_MSG_BUF_SIZE - 1); std::string utf8_text = msg; // - + if ( (RlvActions::hasBehaviour(RLV_BHVR_SENDIM)) || (RlvActions::hasBehaviour(RLV_BHVR_SENDIMTO)) ) { const LLIMModel::LLIMSession* pIMSession = LLIMModel::instance().findIMSession(mSessionID); RLV_ASSERT(pIMSession); - + bool fRlvFilter = !pIMSession; if (pIMSession) { @@ -538,13 +536,11 @@ void FSFloaterIM::sendMsg(const std::string& msg) fRlvFilter = true; break; } - + LLSpeakerMgr::speaker_list_t speakers; pIMSession->mSpeakers->getSpeakerList(&speakers, TRUE); - for (LLSpeakerMgr::speaker_list_t::const_iterator itSpeaker = speakers.begin(); - itSpeaker != speakers.end(); ++itSpeaker) + for (const auto& pSpeaker : speakers) { - const LLSpeaker* pSpeaker = *itSpeaker; if ( (gAgent.getID() != pSpeaker->mID) && (!RlvActions::canSendIM(pSpeaker->mID)) ) { fRlvFilter = true; @@ -558,14 +554,14 @@ void FSFloaterIM::sendMsg(const std::string& msg) break; } } - + if (fRlvFilter) { utf8_text = RlvStrings::getString(RlvStringKeys::Blocked::SendIm); } } // [/RLVa:KB] - + if (mSessionInitialized) { LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); @@ -575,7 +571,7 @@ void FSFloaterIM::sendMsg(const std::string& msg) //queue up the message to send once the session is initialized mQueuedMsgsForInit.append(utf8_text); } - + updateMessages(); } @@ -587,17 +583,17 @@ FSFloaterIM::~FSFloaterIM() LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, (LLView*)this); mVoiceChannelStateChangeConnection.disconnect(); - if(LLVoiceClient::instanceExists()) + if (LLVoiceClient::instanceExists()) { LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this); } - + LLIMModel::LLIMSession* pIMSession = LLIMModel::instance().findIMSession(mSessionID); if ((pIMSession) && (pIMSession->mSessionType == LLIMModel::LLIMSession::P2P_SESSION)) { LLAvatarTracker::instance().removeParticularFriendObserver(mOtherParticipantUUID, this); } - + // Clean up any stray name cache connections if (mAvatarNameCacheConnection.connected()) { @@ -754,7 +750,7 @@ void FSFloaterIM::onChange(EStatusType status, const std::string &channelURI, bo { return; } - + updateCallButton(); } @@ -763,13 +759,13 @@ void FSFloaterIM::updateCallButton() // hide/show call button bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); - + if (!session) { getChild("call_btn")->setEnabled(FALSE); return; } - + bool session_initialized = session->mSessionInitialized; bool callback_enabled = session->mCallBackEnabled; @@ -792,7 +788,7 @@ void FSFloaterIM::updateButtons(bool is_call_started) void FSFloaterIM::changed(U32 mask) { LL_DEBUGS("FSFloaterIM") << "FSFloaterIM::changed(U32 mask)" << LL_ENDL; - + if(LLAvatarActions::isFriend(mOtherParticipantUUID)) { bool is_online = LLAvatarTracker::instance().isBuddyOnline(mOtherParticipantUUID); @@ -840,7 +836,7 @@ BOOL FSFloaterIM::postBuild() // support sysinfo button -Zi mSysinfoButton = getChild("send_sysinfo_btn"); onSysinfoButtonVisibilityChanged(FALSE); - + // type-specfic controls LLIMModel::LLIMSession* pIMSession = LLIMModel::instance().findIMSession(mSessionID); if (pIMSession) @@ -858,11 +854,11 @@ BOOL FSFloaterIM::postBuild() LL_DEBUGS("FSFloaterIM") << "adding FSFloaterIM removing/adding particularfriendobserver" << LL_ENDL; LLAvatarTracker::instance().removeParticularFriendObserver(mOtherParticipantUUID, this); LLAvatarTracker::instance().addParticularFriendObserver(mOtherParticipantUUID, this); - + // Disable "Add friend" button for friends. LL_DEBUGS("FSFloaterIM") << "add_friend_btn check start" << LL_ENDL; getChild("add_friend_btn")->setEnabled(!LLAvatarActions::isFriend(mOtherParticipantUUID)); - + // Disable "Teleport" button if friend is offline if(LLAvatarActions::isFriend(mOtherParticipantUUID)) { @@ -930,7 +926,7 @@ BOOL FSFloaterIM::postBuild() LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this); // - + mInputEditor = getChild("chat_editor"); mChatHistory = getChild("chat_history"); mChatLayoutPanel = getChild("chat_layout_panel"); @@ -974,7 +970,7 @@ BOOL FSFloaterIM::postBuild() { // if not, give the user a choice, whether to enable the version prefix or not LLSD args; - LLNotificationsUtil::add("FirstJoinSupportGroup2", args, LLSD(),boost::bind(&FSFloaterIM::enableViewerVersionCallback, this, _1, _2)); + LLNotificationsUtil::add("FirstJoinSupportGroup2", args, LLSD(), boost::bind(&FSFloaterIM::enableViewerVersionCallback, this, _1, _2)); } } // Viewer version popup @@ -1006,7 +1002,7 @@ BOOL FSFloaterIM::postBuild() std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name, session_name); } - + //*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla" //see LLFloaterIMPanel for how it is done (IB) @@ -1174,7 +1170,8 @@ FSFloaterIM* FSFloaterIM::show(const LLUUID& session_id) { closeHiddenIMToasts(); - if (!gIMMgr->hasSession(session_id)) return NULL; + if (!gIMMgr->hasSession(session_id)) + return nullptr; if (!isChatMultiTab()) { @@ -1196,7 +1193,7 @@ FSFloaterIM* FSFloaterIM::show(const LLUUID& session_id) FSFloaterIM* floater = getInstance(session_id); if (!floater) { - return NULL; + return nullptr; } if (isChatMultiTab()) @@ -1271,7 +1268,7 @@ void FSFloaterIM::setDocked(bool docked, bool pop_on_undock) LLNotificationsUI::LLScreenChannel* channel = static_cast (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - + if(!isChatMultiTab()) { LLTransientDockableFloater::setDocked(docked, pop_on_undock); @@ -1293,7 +1290,7 @@ void FSFloaterIM::setVisible(BOOL visible) LLTransientDockableFloater::setVisible(visible); // update notification channel state - if(channel) + if (channel) { channel->updateShowToastsState(); channel->redrawToasts(); @@ -1318,10 +1315,9 @@ void FSFloaterIM::setVisible(BOOL visible) } } - if(!visible) + if (!visible) { - LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(mSessionID); - if(chiclet) + if (LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(mSessionID); chiclet) { chiclet->setToggleState(false); } @@ -1347,7 +1343,7 @@ void FSFloaterIM::setMinimized(BOOL b) BOOL FSFloaterIM::getVisible() { - if(isChatMultiTab()) + if (isChatMultiTab()) { FSFloaterIMContainer* im_container = FSFloaterIMContainer::getInstance(); @@ -1372,7 +1368,7 @@ BOOL FSFloaterIM::getVisible() //static bool FSFloaterIM::toggle(const LLUUID& session_id) { - if(!isChatMultiTab()) + if (!isChatMultiTab()) { FSFloaterIM* floater = LLFloaterReg::findTypedInstance("fs_impanel", session_id); if (floater && floater->getVisible() && floater->hasFocus()) @@ -1382,7 +1378,7 @@ bool FSFloaterIM::toggle(const LLUUID& session_id) floater->setVisible(false); return false; } - else if(floater && (!floater->isDocked() || (floater->getVisible() && !floater->hasFocus()))) + else if (floater && (!floater->isDocked() || (floater->getVisible() && !floater->hasFocus()))) { floater->setVisible(TRUE); floater->setFocus(TRUE); @@ -1419,8 +1415,7 @@ void FSFloaterIM::sessionInitReplyReceived(const LLUUID& im_session_id) } // updating "Call" button from group/ad-hoc control panel here to enable it without placing into draw() (EXT-4796) - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(im_session_id); - if (session) + if (LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(im_session_id); session) { if ((session->isGroupSessionType() && gAgent.isInGroup(im_session_id)) || session->isAdHocSessionType()) { @@ -1430,7 +1425,6 @@ void FSFloaterIM::sessionInitReplyReceived(const LLUUID& im_session_id) //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) - //need to send delayed messaged collected while waiting for session initialization if (mQueuedMsgsForInit.size()) { @@ -1451,7 +1445,6 @@ void FSFloaterIM::updateMessages() // FS-1734 seperate name and text styles for moderator bool highlight_mods_chat = gSavedSettings.getBOOL("FSHighlightGroupMods"); - std::list messages; // we shouldn't reset unread message counters if IM floater doesn't have focus @@ -1534,7 +1527,7 @@ void FSFloaterIM::updateMessages() { chat.mText = message; } - + mChatHistory->appendMessage(chat, chat_args); mLastMessageIndex = msg["index"].asInteger(); @@ -1593,8 +1586,7 @@ void FSFloaterIM::onInputEditorFocusLost() void FSFloaterIM::onInputEditorKeystroke() { - std::string text = mInputEditor->getText(); - if (!text.empty()) + if (!mInputEditor->getText().empty()) { setTyping(true); } @@ -1607,13 +1599,13 @@ void FSFloaterIM::onInputEditorKeystroke() void FSFloaterIM::setTyping(bool typing) { - if ( typing ) + if (typing) { // Started or proceeded typing, reset the typing timeout timer mTypingTimeoutTimer.reset(); } - if ( mMeTyping != typing ) + if (mMeTyping != typing) { // Typing state is changed mMeTyping = typing; @@ -1630,7 +1622,7 @@ void FSFloaterIM::setTyping(bool typing) if ( mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL && !(FSData::instance().isSupport(mOtherParticipantUUID) && FSData::instance().isAgentFlag(gAgentID, FSData::NO_SUPPORT))) // { - if ( mMeTyping ) + if (mMeTyping) { if ( mTypingTimer.getElapsedTimeF32() > 1.f ) { @@ -1651,12 +1643,11 @@ void FSFloaterIM::setTyping(bool typing) LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if (speaker_mgr) speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); - } void FSFloaterIM::processIMTyping(const LLUUID& from_id, BOOL typing) { - if ( typing ) + if (typing) { // other user started typing addTypingIndicator(from_id); @@ -1678,7 +1669,7 @@ void FSFloaterIM::processAgentListUpdates(const LLSD& body) if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap()) { LLSD::map_const_iterator update_it; - for(update_it = body["agent_updates"].beginMap(); + for (update_it = body["agent_updates"].beginMap(); update_it != body["agent_updates"].endMap(); ++update_it) { @@ -1721,7 +1712,7 @@ void FSFloaterIM::processAgentListUpdates(const LLSD& body) joined_uuids.begin(), joined_uuids.end(), std::back_inserter(intersection)); - if (intersection.size() > 0) + if (!intersection.empty()) { sendParticipantsAddedNotification(intersection); } @@ -1773,30 +1764,6 @@ void FSFloaterIM::processChatHistoryStyleUpdate(const LLSD& newvalue) } } -void FSFloaterIM::processSessionUpdate(const LLSD& session_update) -{ - // *TODO : verify following code when moderated mode will be implemented - if ( false && session_update.has("moderated_mode") && - session_update["moderated_mode"].has("voice") ) - { - BOOL voice_moderated = session_update["moderated_mode"]["voice"]; - const std::string session_label = LLIMModel::instance().getName(mSessionID); - - if (voice_moderated) - { - setTitle(session_label + std::string(" ") + LLTrans::getString("IM_moderated_chat_label")); - } - else - { - setTitle(session_label); - } - - // *TODO : uncomment this when/if LLPanelActiveSpeakers panel will be added - //update the speakers dropdown too - //mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated); - } -} - BOOL FSFloaterIM::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, @@ -1846,7 +1813,7 @@ BOOL FSFloaterIM::handleDragAndDrop(S32 x, S32 y, MASK mask, bool FSFloaterIM::dropCallingCard(LLInventoryItem* item, bool drop) { bool rv = true; - if(item && item->getCreatorUUID().notNull()) + if (item && item->getCreatorUUID().notNull()) { uuid_vec_t ids; ids.push_back(item->getCreatorUUID()); @@ -1874,7 +1841,7 @@ bool FSFloaterIM::dropCallingCard(LLInventoryItem* item, bool drop) bool FSFloaterIM::dropCategory(LLInventoryCategory* category, bool drop) { bool rv = true; - if(category) + if (category) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -1885,7 +1852,7 @@ bool FSFloaterIM::dropCategory(LLInventoryCategory* category, bool drop) LLInventoryModel::EXCLUDE_TRASH, buddies); S32 count = items.size(); - if(count == 0) + if (count == 0) { rv = false; } @@ -1918,13 +1885,13 @@ bool FSFloaterIM::dropCategory(LLInventoryCategory* category, bool drop) bool FSFloaterIM::dropPerson(LLUUID* person_id, bool drop) { bool res = person_id && person_id->notNull(); - if(res) + if (res) { uuid_vec_t ids; ids.push_back(*person_id); res = canAddSelectedToChat(ids); - if(res && drop) + if (res && drop) { // these people will be added during the next draw() call // (so they can be added all at once) @@ -2064,7 +2031,7 @@ void FSFloaterIM::addTypingIndicator(const LLUUID& from_id) void FSFloaterIM::removeTypingIndicator(const LLUUID& from_id) { - if ( mOtherTyping ) + if (mOtherTyping) { mOtherTyping = false; @@ -2109,7 +2076,7 @@ void FSFloaterIM::closeHiddenIMToasts() }; LLNotificationsUI::LLScreenChannel* channel = LLNotificationsUI::LLChannelManager::getNotificationScreenChannel(); - if (channel != NULL) + if (channel) { channel->closeHiddenToasts(IMToastMatcher()); } @@ -2123,7 +2090,7 @@ void FSFloaterIM::confirmLeaveCallCallback(const LLSD& notification, const LLSD& bool snooze = payload["snooze"].asBoolean(); FSFloaterIM* im_floater = LLFloaterReg::findTypedInstance("fs_impanel", session_id); - if (option == 0 && im_floater != NULL) + if (option == 0 && im_floater) { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id); if (session) @@ -2162,15 +2129,19 @@ void FSFloaterIM::initIMFloater() void FSFloaterIM::sRemoveTypingIndicator(const LLSD& data) { LLUUID session_id = data["session_id"]; - if (session_id.isNull()) return; + if (session_id.isNull()) + return; LLUUID from_id = data["from_id"]; - if (gAgentID == from_id || LLUUID::null == from_id) return; + if (gAgentID == from_id || LLUUID::null == from_id) + return; FSFloaterIM* floater = FSFloaterIM::findInstance(session_id); - if (!floater) return; + if (!floater) + return; - if (IM_NOTHING_SPECIAL != floater->mDialog) return; + if (IM_NOTHING_SPECIAL != floater->mDialog) + return; floater->removeTypingIndicator(); } @@ -2194,7 +2165,7 @@ void FSFloaterIM::onClickCloseBtn(bool app_quitting) LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( mSessionID); - if (session == NULL) + if (!session) { LL_WARNS("FSFloaterIM") << "Empty session." << LL_ENDL; return; @@ -2222,16 +2193,16 @@ void FSFloaterIM::onClickCloseBtn(bool app_quitting) // Viewer version popup BOOL FSFloaterIM::enableViewerVersionCallback(const LLSD& notification,const LLSD& response) { - S32 option=LLNotificationsUtil::getSelectedOption(notification,response); + S32 option = LLNotificationsUtil::getSelectedOption(notification,response); - BOOL result=FALSE; - if(option==0) // "yes" + BOOL result = FALSE; + if (option == 0) // "yes" { - result=TRUE; + result = TRUE; } - gSavedSettings.setBOOL("FSSupportGroupChatPrefix3",result); - gSavedSettings.setBOOL("FSSupportGroupChatPrefixTesting",result); + gSavedSettings.setBOOL("FSSupportGroupChatPrefix3", result); + gSavedSettings.setBOOL("FSSupportGroupChatPrefixTesting", result); return result; } // @@ -2331,45 +2302,14 @@ bool FSFloaterIM::canAddSelectedToChat(const uuid_vec_t& uuids) { // For a P2P session just check if we are not adding the other participant. - for (uuid_vec_t::const_iterator id = uuids.begin(); - id != uuids.end(); ++id) + for (const auto& uuid : uuids) { - if (*id == mOtherParticipantUUID) + if (uuid == mOtherParticipantUUID) { return false; } } } - else - { - // For a conference session we need to check against the list from LLSpeakerMgr, - // because this list may change when participants join or leave the session. - - // Ansariel: Disabled the check because the sim doesn't clear somebody off the - // speaker list if they crash or relog and they can't be re-added in that case. - /* - LLSpeakerMgr::speaker_list_t speaker_list; - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if (speaker_mgr) - { - speaker_mgr->getSpeakerList(&speaker_list, true); - } - - for (uuid_vec_t::const_iterator id = uuids.begin(); - id != uuids.end(); ++id) - { - for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin(); - it != speaker_list.end(); ++it) - { - const LLPointer& speaker = *it; - if (*id == speaker->mID) - { - return false; - } - } - } - */ - } return true; } @@ -2386,7 +2326,7 @@ void FSFloaterIM::addSessionParticipants(const uuid_vec_t& uuids) } else { - if(findInstance(mSessionID)) + if (findInstance(mSessionID)) { // remember whom we have invited, to notify others later, when the invited ones actually join mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end()); @@ -2407,7 +2347,7 @@ void FSFloaterIM::addP2PSessionParticipants(const LLSD& notification, const LLSD LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); // first check whether this is a voice session - bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); + bool is_voice_call = voice_channel && voice_channel->isActive(); uuid_vec_t temp_ids; uuid_vec_t invited_ids; @@ -2419,12 +2359,11 @@ void FSFloaterIM::addP2PSessionParticipants(const LLSD& notification, const LLSD LLUUID session_id = mSessionID; // then we can close the current session - if(findInstance(mSessionID)) + if (findInstance(mSessionID)) { // remember whom we have invited, to notify others later, when the invited ones actually join - mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end()); - - invited_ids.insert(invited_ids.end(), mInvitedParticipants.begin(), mInvitedParticipants.end()); + std::copy(uuids.begin(), uuids.end(), std::back_inserter(mInvitedParticipants)); + std::copy(mInvitedParticipants.begin(), mInvitedParticipants.end(), std::back_inserter(invited_ids)); // Ansariel: This will result in the floater actually being closed as opposed in CHUI! onClose(false); diff --git a/indra/newview/fsfloaterim.h b/indra/newview/fsfloaterim.h index d70bac8155..8c5f88ee2e 100644 --- a/indra/newview/fsfloaterim.h +++ b/indra/newview/fsfloaterim.h @@ -113,7 +113,6 @@ public: void onVisibilityChange(BOOL new_visibility); void processIMTyping(const LLUUID& from_id, BOOL typing); void processAgentListUpdates(const LLSD& body); - void processSessionUpdate(const LLSD& session_update); void updateChatHistoryStyle(); static void processChatHistoryStyleUpdate(const LLSD& newvalue); @@ -173,7 +172,6 @@ protected: // support sysinfo button -Zi BOOL enableViewerVersionCallback(const LLSD& notification,const LLSD& response); // Viewer version popup - void reshapeFloater(bool collapse); void reshapeChatLayoutPanel(); private: // process focus events to set a currently active session @@ -254,7 +252,6 @@ private: LLLayoutStack* mInputPanels; LLLayoutPanel* mUnreadMessagesNotificationPanel; LLTextBox* mUnreadMessagesNotificationTextBox; - // bool mPositioned; // dead code -Zi std::string mSavedTitle; LLUIString mTypingStart; diff --git a/indra/newview/fsfloaterimcontainer.cpp b/indra/newview/fsfloaterimcontainer.cpp index b26ecfcce7..3c1f7d88ff 100644 --- a/indra/newview/fsfloaterimcontainer.cpp +++ b/indra/newview/fsfloaterimcontainer.cpp @@ -40,14 +40,14 @@ #include "lltoolbarview.h" #include "llvoiceclient.h" -static const F32 VOICE_STATUS_UPDATE_INTERVAL = 1.0f; +constexpr F32 VOICE_STATUS_UPDATE_INTERVAL = 1.0f; // // FSFloaterIMContainer // FSFloaterIMContainer::FSFloaterIMContainer(const LLSD& seed) : LLMultiFloater(seed), - mActiveVoiceFloater(NULL), + mActiveVoiceFloater(nullptr), mCurrentVoiceState(VOICE_STATE_NONE), mForceVoiceStateUpdate(false), mIsAddingNewSession(false) @@ -186,7 +186,8 @@ void FSFloaterIMContainer::addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point) { - if(!floaterp) return; + if (!floaterp) + return; // already here if (floaterp->getHost() == this) @@ -385,14 +386,12 @@ void FSFloaterIMContainer::setMinimized(BOOL b) { if (mTabContainer) { - FSFloaterNearbyChat* nearby_floater = dynamic_cast(mTabContainer->getCurrentPanel()); - if (nearby_floater) + if (FSFloaterNearbyChat* nearby_floater = dynamic_cast(mTabContainer->getCurrentPanel()); nearby_floater) { nearby_floater->handleMinimized(b); } - FSFloaterIM* im_floater = dynamic_cast(mTabContainer->getCurrentPanel()); - if (im_floater) + if (FSFloaterIM* im_floater = dynamic_cast(mTabContainer->getCurrentPanel()); im_floater) { im_floater->handleMinimized(b); } @@ -405,7 +404,8 @@ void FSFloaterIMContainer::setMinimized(BOOL b) void FSFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) { LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); - if (!session) return; + if (!session) + return; FSFloaterIM::onNewIMReceived(session_id); } @@ -413,8 +413,7 @@ void FSFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::str //virtual void FSFloaterIMContainer::sessionRemoved(const LLUUID& session_id) { - FSFloaterIM* iMfloater = LLFloaterReg::findTypedInstance("fs_impanel", session_id); - if (iMfloater != NULL) + if (FSFloaterIM* iMfloater = LLFloaterReg::findTypedInstance("fs_impanel", session_id); iMfloater) { iMfloater->closeFloater(); } @@ -535,7 +534,7 @@ LLFloater* FSFloaterIMContainer::getCurrentVoiceFloater() { if (!LLVoiceClient::instance().voiceEnabled()) { - return NULL; + return nullptr; } if (LLVoiceChannelProximal::getInstance() == LLVoiceChannel::getCurrentVoiceChannel()) @@ -551,7 +550,7 @@ LLFloater* FSFloaterIMContainer::getCurrentVoiceFloater() return im_floater; } } - return NULL; + return nullptr; } void FSFloaterIMContainer::addFlashingSession(const LLUUID& session_id) @@ -573,8 +572,7 @@ void FSFloaterIMContainer::checkFlashing() void FSFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) { - avatarID_panel_map_t::iterator found = mSessions.find(old_session_id); - if (found != mSessions.end()) + if (avatarID_panel_map_t::iterator found = mSessions.find(old_session_id); found != mSessions.end()) { LLFloater* floaterp = found->second; mSessions.erase(found); diff --git a/indra/newview/fslslbridgerequest.cpp b/indra/newview/fslslbridgerequest.cpp index 6f92921731..4c4a8ea4cb 100644 --- a/indra/newview/fslslbridgerequest.cpp +++ b/indra/newview/fslslbridgerequest.cpp @@ -51,17 +51,16 @@ void FSLSLBridgeRequest_Failure(LLSD const &aData) void FSLSLBridgeRequestRadarPos_Success(LLSD const &aData) { - FSRadar* radar = FSRadar::getInstance(); LL_DEBUGS("FSLSLBridge") << ll_pretty_print_sd(aData) << LL_ENDL; - if (radar && aData.has(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT)) + if (aData.has(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT)) { std::string strContent = aData[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT].asString(); //LL_INFOS("FSLSLBridge") << "Got info: " << strContent << LL_ENDL; // AO: parse content into pairs of [agent UUID,agent zHeight] , update our radar for each one - + LLUUID targetAv; F32 targetZ; - + typedef boost::tokenizer > tokenizer; boost::char_separator sep(", "); tokenizer tokens(strContent, sep); @@ -69,9 +68,8 @@ void FSLSLBridgeRequestRadarPos_Success(LLSD const &aData) { targetAv = LLUUID(*(tok_iter++)); targetZ = (F32)::atof((*tok_iter).c_str()); - - FSRadarEntry* entry = radar->getEntry(targetAv); - if (entry) + + if (auto entry = FSRadar::getInstance()->getEntry(targetAv); entry) { entry->setZOffset(targetZ); //LL_INFOS("FSLSLBridge") << targetAv << " ::: " << targetZ << LL_ENDL; diff --git a/indra/newview/fsradar.cpp b/indra/newview/fsradar.cpp index ebf3d659d1..db3be003ca 100644 --- a/indra/newview/fsradar.cpp +++ b/indra/newview/fsradar.cpp @@ -60,7 +60,7 @@ #include "rlvactions.h" #include "rlvhandler.h" -static const F32 FS_RADAR_LIST_UPDATE_INTERVAL = 1.f; +constexpr F32 FS_RADAR_LIST_UPDATE_INTERVAL = 1.f; /** * Periodically updates the nearby people list while the Nearby tab is active. @@ -98,7 +98,7 @@ FSRadar::FSRadar() : mNameFormatCallbackConnection(), mAgeAlertCallbackConnection() { - mRadarListUpdater = new FSRadarListUpdater(boost::bind(&FSRadar::updateRadarList, this)); + mRadarListUpdater = std::make_unique(std::bind(&FSRadar::updateRadarList, this)); // Use the callback from LLAvatarNameCache here or we might update the names too early! LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&FSRadar::updateNames, this)); @@ -110,13 +110,6 @@ FSRadar::FSRadar() : FSRadar::~FSRadar() { - delete mRadarListUpdater; - - for (const auto& [av_id, entry] : mEntryList) - { - delete entry; - } - if (mShowUsernamesCallbackConnection.connected()) { mShowUsernamesCallbackConnection.disconnect(); @@ -216,14 +209,13 @@ void FSRadar::updateRadarList() F32 drawRadius(sRenderFarClip); const LLVector3d& posSelf = gAgent.getPositionGlobal(); - LLViewerRegion* own_reg = gAgent.getRegion(); LLUUID regionSelf; - if (own_reg) + if (LLViewerRegion* own_reg = gAgent.getRegion(); own_reg) { regionSelf = own_reg->getRegionID(); } bool alertScripts = mRadarAlertRequest; // save the current value, so it doesn't get changed out from under us by another thread - time_t now = time(NULL); + time_t now = time(nullptr); //STEP 0: Clear model data mRadarEnterAlerts.clear(); @@ -259,10 +251,8 @@ void FSRadar::updateRadarList() // Remove old avatars from our list for (const auto& avid : removed_vec) { - entry_map_t::iterator found = mEntryList.find(avid); - if (found != mEntryList.end()) + if (entry_map_t::iterator found = mEntryList.find(avid); found != mEntryList.end()) { - delete found->second; mEntryList.erase(found); } } @@ -270,18 +260,18 @@ void FSRadar::updateRadarList() // Add new avatars for (const auto& avid : added_vec) { - mEntryList[avid] = new FSRadarEntry(avid); + mEntryList.emplace(avid, std::make_shared(avid)); } speakermgr->update(TRUE); //STEP 2: Transform detected model list data into more flexible multimap data structure; //TS: Count avatars in chat range and in the same region - U32 inChatRange = 0; - U32 inSameRegion = 0; + U32 inChatRange{ 0 }; + U32 inSameRegion{ 0 }; std::vector::const_iterator pos_it = positions.begin(), - pos_end = positions.end(); + pos_end = positions.end(); uuid_vec_t::const_iterator item_it = avatar_ids.begin(), item_end = avatar_ids.end(); @@ -290,7 +280,6 @@ void FSRadar::updateRadarList() // //2a. For each detected av, gather up all data we would want to display or use to drive alerts // - LLUUID avId = static_cast(*item_it); LLVector3d avPos = static_cast(*pos_it); @@ -300,7 +289,7 @@ void FSRadar::updateRadarList() } // Skip modelling this avatar if its basic data is either inaccessible, or it's a dummy placeholder - FSRadarEntry* ent = getEntry(avId); + auto ent = getEntry(avId); LLViewerRegion* reg = world->getRegionFromPosGlobal(avPos); if (!ent) // don't update this radar listing if data is inaccessible { @@ -311,12 +300,9 @@ void FSRadar::updateRadarList() LLVOAvatar* avVo = (LLVOAvatar*)gObjectList.findObject(avId); static LLUICachedControl sFSShowDummyAVsinRadar("FSShowDummyAVsinRadar"); - if (!sFSShowDummyAVsinRadar) + if (!sFSShowDummyAVsinRadar && avVo && avVo->mIsDummy) { - if (avVo && avVo->mIsDummy) - { - continue; - } + continue; } bool is_muted = mutelist->isMuted(avId); @@ -654,7 +640,7 @@ void FSRadar::updateRadarList() if (mRadarOffsetRequests.size() > 0) { static const std::string prefix = "getZOffsets|"; - std::string msg = ""; + std::string msg {}; U32 updatesPerRequest = 0; while (mRadarOffsetRequests.size() > 0) { @@ -666,7 +652,7 @@ void FSRadar::updateRadarList() msg = msg.substr(0, msg.size() - 1); bridge.viewerToLSL(prefix + msg, FSLSLBridgeRequestRadarPos_Success); //LL_INFOS() << " OFFSET REQUEST SEGMENT"<< prefix << msg << LL_ENDL; - msg = ""; + msg.clear(); updatesPerRequest = 0; } } @@ -832,31 +818,27 @@ void FSRadar::updateRadarList() void FSRadar::requestRadarChannelAlertSync() { - F32 timeNow = gFrameTimeSeconds; - if ((timeNow - FSRADAR_CHAT_MIN_SPACING) > mRadarLastRequestTime) + if (F32 timeNow = gFrameTimeSeconds; (timeNow - FSRADAR_CHAT_MIN_SPACING) > mRadarLastRequestTime) { mRadarLastRequestTime = timeNow; mRadarAlertRequest = true; } } -FSRadarEntry* FSRadar::getEntry(const LLUUID& avatar_id) +std::shared_ptr FSRadar::getEntry(const LLUUID& avatar_id) { - entry_map_t::iterator found = mEntryList.find(avatar_id); - if (found == mEntryList.end()) + if (entry_map_t::iterator found = mEntryList.find(avatar_id); found != mEntryList.end()) { - return nullptr; + return found->second; } - return found->second; + return nullptr; } void FSRadar::teleportToAvatar(const LLUUID& targetAv) // Teleports user to last scanned location of nearby avatar // Note: currently teleportViaLocation is disrupted by enforced landing points set on a parcel. { - LLWorld* world = LLWorld::getInstance(); - FSRadarEntry* entry = getEntry(targetAv); - if (entry) + if (auto entry = getEntry(targetAv); entry) { LLVector3d avpos = entry->mGlobalPos; if (avpos.mdV[VZ] == AVATAR_UNKNOWN_Z_OFFSET) @@ -867,7 +849,7 @@ void FSRadar::teleportToAvatar(const LLUUID& targetAv) { // FIRE-20862: Teleport the configured offset toward the center of the region from the // avatar's reported position - LLViewerRegion* avreg = world->getRegionFromPosGlobal(avpos); + LLViewerRegion* avreg = LLWorld::getInstance()->getRegionFromPosGlobal(avpos); if (avreg) { LLVector3d region_center = avreg->getCenterGlobal(); @@ -964,8 +946,7 @@ void FSRadar::onRadarReportToClicked(const LLSD& userdata) bool FSRadar::radarReportToCheck(const LLSD& userdata) { const std::string menu_item = userdata.asString(); - bool report_to = gSavedSettings.getBOOL("FSMilkshakeRadarToasts"); - if (report_to) + if (gSavedSettings.getBOOL("FSMilkshakeRadarToasts")) { return (menu_item == "radar_toasts"); } @@ -1000,8 +981,7 @@ void FSRadar::checkTracking() void FSRadar::updateTracking() { - FSRadarEntry* entry = getEntry(mTrackedAvatarId); - if (entry) + if (auto entry = getEntry(mTrackedAvatarId); entry) { if (LLTracker::getTrackedPositionGlobal() != entry->mGlobalPos) { @@ -1039,8 +1019,7 @@ void FSRadar::updateNames() void FSRadar::updateName(const LLUUID& avatar_id) { - FSRadarEntry* entry = getEntry(avatar_id); - if (entry) + if (auto entry = getEntry(avatar_id); entry) { entry->updateName(); } @@ -1056,8 +1035,7 @@ void FSRadar::updateAgeAlertCheck() void FSRadar::updateNotes(const LLUUID& avatar_id, std::string_view notes) { - FSRadarEntry* entry = getEntry(avatar_id); - if (entry) + if (auto entry = getEntry(avatar_id); entry) { entry->setNotes(notes); } diff --git a/indra/newview/fsradar.h b/indra/newview/fsradar.h index 90ccdcd676..d794aae728 100644 --- a/indra/newview/fsradar.h +++ b/indra/newview/fsradar.h @@ -63,7 +63,7 @@ class FSRadar virtual ~FSRadar(); public: - typedef boost::unordered_map entry_map_t; + typedef std::unordered_map, FSUUIDHash> entry_map_t; entry_map_t getRadarList() { return mEntryList; } void startTracking(const LLUUID& avatar_id); @@ -80,13 +80,13 @@ public: static bool radarReportToCheck(const LLSD& userdata); void getCurrentData(std::vector& entries, LLSD& stats) const { entries = mRadarEntriesData; stats = mAvatarStats; } - FSRadarEntry* getEntry(const LLUUID& avatar_id); + std::shared_ptr getEntry(const LLUUID& avatar_id); // internals class Updater { public: - typedef boost::function callback_t; + typedef std::function callback_t; Updater(callback_t cb) : mCallback(cb) { } @@ -116,7 +116,7 @@ private: void radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name, std::string_view postMsg); void updateAgeAlertCheck(); - Updater* mRadarListUpdater; + std::unique_ptr mRadarListUpdater; struct RadarFields { diff --git a/indra/newview/lggcontactsets.cpp b/indra/newview/lggcontactsets.cpp index 8273fb2d71..e4addd821f 100644 --- a/indra/newview/lggcontactsets.cpp +++ b/indra/newview/lggcontactsets.cpp @@ -418,8 +418,7 @@ LLColor4 LGGContactSets::colorize(const LLUUID& uuid, const LLColor4& cur_color, } else { - FSRadarEntry* entry = FSRadar::getInstance()->getEntry(uuid); - if ( (entry && entry->getIsLinden()) || (!entry && FSCommon::isLinden(uuid)) ) + if (auto entry = FSRadar::getInstance()->getEntry(uuid); (entry && entry->getIsLinden()) || (!entry && FSCommon::isLinden(uuid)) ) { switch (type) { diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index b9f2943a47..c18430d270 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -1862,7 +1862,7 @@ bool LLAvatarActions::canZoomIn(const LLUUID& idAgent) else { // Special case for SL since interest list changes - FSRadarEntry* entry = FSRadar::getInstance()->getEntry(idAgent); + auto entry = FSRadar::getInstance()->getEntry(idAgent); #ifdef OPENSIM if (LLGridManager::getInstance()->isInOpenSim()) { @@ -1871,7 +1871,7 @@ bool LLAvatarActions::canZoomIn(const LLUUID& idAgent) else #endif { - return (entry != NULL); + return (entry != nullptr); } } // @@ -1882,8 +1882,7 @@ void LLAvatarActions::zoomIn(const LLUUID& idAgent) // Firestorm radar support //handle_zoom_to_object(idAgent); - FSRadarEntry* entry = FSRadar::getInstance()->getEntry(idAgent); - if (entry) + if (auto entry = FSRadar::getInstance()->getEntry(idAgent); entry) { handle_zoom_to_object(idAgent, entry->getGlobalPos()); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 4e505557ad..92c084a08f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -4650,7 +4650,7 @@ public: { if ( body.has("session_info") ) { - im_floater->processSessionUpdate(body["session_info"]); + //im_floater->processSessionUpdate(body["session_info"]); // Method does nothing // Send request for chat history, if enabled. if (gSavedPerAccountSettings.getBOOL("FetchGroupChatHistory")) @@ -4747,14 +4747,15 @@ public: const LLSD& input) const { LLUUID session_id = input["body"]["session_id"].asUUID(); - // [FS communication UI] - //LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id); - FSFloaterIM* im_floater = FSFloaterIM::findInstance(session_id); - // [FS communication UI] - if ( im_floater ) - { - im_floater->processSessionUpdate(input["body"]["info"]); - } + // Method does nothing + //// [FS communication UI] + ////LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id); + //FSFloaterIM* im_floater = FSFloaterIM::findInstance(session_id); + //// [FS communication UI] + //if ( im_floater ) + //{ + // im_floater->processSessionUpdate(input["body"]["info"]); + //} LLIMSpeakerMgr* im_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id); if (im_mgr) { diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 9ef304d08e..597c639d57 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -1353,19 +1353,12 @@ BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id) // aka radar when above 1020m. if (isHigher1020mBug) { - FSRadar* radar = FSRadar::getInstance(); - if (radar) + if (auto entry = FSRadar::getInstance()->getEntry(avatar_id); entry) { - FSRadarEntry* entry = radar->getEntry(avatar_id); - if (entry) + if (F32 radar_distance = entry->getRange(); radar_distance > AVATAR_UNKNOWN_RANGE) { - F32 radar_distance = entry->getRange(); - - if (radar_distance > AVATAR_UNKNOWN_RANGE) - { - distance = radar_distance; - isHigher1020mBug = false; - } + distance = radar_distance; + isHigher1020mBug = false; } } }