diff --git a/.github/workflows/build_viewer.yml b/.github/workflows/build_viewer.yml index c5e2b1cf26..8adc9171c1 100644 --- a/.github/workflows/build_viewer.yml +++ b/.github/workflows/build_viewer.yml @@ -167,8 +167,8 @@ jobs: path_sep="\\" fi function find_most_recent_bundle() { - local pattern="$1-.*$2-.*" - local most_recent_file=$(ls -t "${{ github.workspace }}" | grep "$pattern" | head -1) + local pattern="$1-.*$2[-_]+.*" + local most_recent_file=$(ls -t "${{ github.workspace }}" | egrep "$pattern" | head -1) if [ -z "$most_recent_file" ]; then echo "" else diff --git a/autobuild.xml b/autobuild.xml index 1a1ee28198..bcb8f8f17e 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1140,11 +1140,11 @@ archive hash - eebbcd0757dd28646ebb4505e7af140e + 9d9f72f50cffe7443e4b58f009ffc1f4 hash_algorithm md5 url - file:///opt/firestorm/fmodstudio-2.02.13-darwin64-6.tar.bz2 + file:///opt/firestorm/fmodstudio-2.02.15-darwin64-9.tar.bz2 name darwin64 @@ -1154,11 +1154,11 @@ archive hash - 5fee0f9587f50531211ff9e1e860692f + 79fb2f09d2c81ed6464e11af36566910 hash_algorithm md5 url - file:///opt/firestorm/fmodstudio-2.02.13-linux64-230861132.tar.bz2 + file:///opt/firestorm/fmodstudio-2.02.15-linux64-231741426.tar.bz2 name linux64 @@ -1168,11 +1168,11 @@ archive hash - 99c928b18a0d2f08b0ee33fca90c4118 + c1bce2b362c31345200297a4010626e9 hash_algorithm md5 url - file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.13-windows-230860911.tar.bz2 + file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.15-windows-231741106.tar.bz2 name windows @@ -1182,18 +1182,18 @@ archive hash - 01946a6427d126570607c02b75560f02 + cd0e8f58fece3eac0b5ebe21f354bf8c hash_algorithm md5 url - file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.13-windows64-230860913.tar.bz2 + file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.15-windows64-231741113.tar.bz2 name windows64 version - 2.02.13 + 2.02.15 fontconfig diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index b94a243fb2..c70d2a44d7 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -49,6 +49,8 @@ #include "httpstats.h" +#include "indra_constants.h" // Clownflare changes + // *DEBUG: "[curl:bugs] #1420" problem and testing. // // A pipelining problem, https://sourceforge.net/p/curl/bugs/1420/, @@ -525,6 +527,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) check_curl_easy_setopt(mCurlHandle, CURLOPT_SEEKDATA, getHandle()); check_curl_easy_setopt(mCurlHandle, CURLOPT_COOKIEFILE, ""); + check_curl_easy_setopt(mCurlHandle, CURLOPT_USERAGENT, APP_NAME.c_str()); // Clownflare changes if (gpolicy.mSslCtxCallback) { diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index f2ecd9f5b0..01ed49d0d9 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -44,7 +44,12 @@ static const char* subdirs = "0123456789abcdef"; LLDiskCache::LLDiskCache(const std::string cache_dir, const uintmax_t max_size_bytes, - const bool enable_cache_debug_info) : + const bool enable_cache_debug_info +// Add High/Low water mark support + ,const F32 highwater_mark_percent + ,const F32 lowwater_mark_percent +// + ) : mCacheDir(cache_dir), mMaxSizeBytes(max_size_bytes), mEnableCacheDebugInfo(enable_cache_debug_info) @@ -113,6 +118,8 @@ void LLDiskCache::purge() #else std::string cache_path(mCacheDir); #endif + uintmax_t file_size_total = 0; // try to make simple cache less naive. + if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) { // Optimize asset simple disk cache @@ -137,6 +144,7 @@ void LLDiskCache::purge() { continue; } + file_size_total += file_size; // try to make simple cache less naive. file_info.push_back(file_info_t(file_time, { file_size, file_path })); } @@ -145,52 +153,106 @@ void LLDiskCache::purge() } } + // add high water/low water thresholds to reduce the churn in the cache. + LL_DEBUGS("LLDiskCache") << "Cache is " << (int)(((F32)file_size_total)/mMaxSizeBytes*100.0) << "% full" << LL_ENDL; + if( file_size_total < mMaxSizeBytes * (mHighPercent/100) ) + { + // Nothing to do here + LL_DEBUGS("LLDiskCache") << "Not exceded high water - do nothing" << LL_ENDL; + return; + } + // If we reach here we are above the trigger level so we must purge until we've removed enough to take us down to the low water mark. + // std::sort(file_info.begin(), file_info.end(), [](file_info_t& x, file_info_t& y) { - return x.first > y.first; + return x.first < y.first; // sort oldest to newest, to we can remove the oldest files first. }); - LL_INFOS() << "Purging cache to a maximum of " << mMaxSizeBytes << " bytes" << LL_ENDL; + + // add high water/low water thresholds to reduce the churn in the cache. + auto target_size = (uintmax_t)(mMaxSizeBytes * (mLowPercent/100)); + LL_INFOS() << "Purging cache to a maximum of " << target_size << " bytes" << LL_ENDL; + // // Extra accounting to track the retention of static assets //std::vector file_removed; - std::vector file_removed; - int keep{0}; - int del{0}; - int skip{0}; + enum class purge_action { delete_file=0, keep_file, skip_file }; + std::map file_removed; + auto keep{file_info.size()}; + auto del{0}; + auto skip{0}; // - if (mEnableCacheDebugInfo) - { - file_removed.reserve(file_info.size()); - } - uintmax_t file_size_total = 0; + // revised purge logic to track amount removed not retained to shortern loop + // uintmax_t file_size_total = 0; + // if (mEnableCacheDebugInfo) + // { + // file_removed.reserve(file_info.size()); + // } + // uintmax_t file_size_total = 0; + // for (file_info_t& entry : file_info) + // { + // file_size_total += entry.second.first; + + // bool should_remove = file_size_total > mMaxSizeBytes; + // // Make sure static assets are not eliminated + // S32 action{ should_remove ? 0 : 1 }; + // if (should_remove) + // { + // auto uuid_as_string = gDirUtilp->getBaseFileName(entry.second.second, true); + // uuid_as_string = uuid_as_string.substr(mCacheFilenamePrefix.size() + 1, 36);// skip "sl_cache_" and trailing "_N" + // // LL_INFOS() << "checking UUID=" < + // if (mEnableCacheDebugInfo) + // { + // // Static asset stuff + // //file_removed.push_back(should_remove); + // file_removed.push_back(action); + // } + uintmax_t deleted_size_total = 0; for (file_info_t& entry : file_info) { - file_size_total += entry.second.first; + // first check if we still need to delete more files + bool should_remove = (file_size_total - deleted_size_total) > target_size; - bool should_remove = file_size_total > mMaxSizeBytes; // Make sure static assets are not eliminated - S32 action{ should_remove ? 0 : 1 }; - if (should_remove) + auto action{ should_remove ? purge_action::delete_file : purge_action::keep_file }; + if (!should_remove) { - auto uuid_as_string = gDirUtilp->getBaseFileName(entry.second.second, true); - uuid_as_string = uuid_as_string.substr(mCacheFilenamePrefix.size() + 1, 36);// skip "sl_cache_" and trailing "_N" - // LL_INFOS() << "checking UUID=" < + + auto this_file_size = entry.second.first; + deleted_size_total += this_file_size; + auto uuid_as_string = gDirUtilp->getBaseFileName(entry.second.second, true); + uuid_as_string = uuid_as_string.substr(mCacheFilenamePrefix.size() + 1, 36);// skip "sl_cache_" and trailing "_N" + // LL_INFOS() << "checking UUID=" < Static asset stuff - //file_removed.push_back(should_remove); - file_removed.push_back(action); + // Static asset stuff + //file_removed.push_back(should_remove); + file_removed.emplace(entry.second.second, action); } + // if (should_remove) { boost::filesystem::remove(entry.second.second, ec); @@ -200,37 +262,52 @@ void LLDiskCache::purge() } } } - +// update the debug logging to be more useful + auto end_time = std::chrono::high_resolution_clock::now(); + auto execute_time = std::chrono::duration_cast(end_time - start_time).count(); +// if (mEnableCacheDebugInfo) { - auto end_time = std::chrono::high_resolution_clock::now(); - auto execute_time = std::chrono::duration_cast(end_time - start_time).count(); + // update the debug logging to be more useful + // auto end_time = std::chrono::high_resolution_clock::now(); + // auto execute_time = std::chrono::duration_cast(end_time - start_time).count(); + // // Log afterward so it doesn't affect the time measurement // Logging thousands of file results can take hundreds of milliseconds + auto deleted_so_far = 0; // update the debug logging to be more useful for (size_t i = 0; i < file_info.size(); ++i) { const file_info_t& entry = file_info[i]; // Static asset stuff + deleted_so_far += entry.second.first; // update the debug logging to be more useful //const bool removed = file_removed[i]; //const std::string action = removed ? "DELETE:" : "KEEP:"; std::string action{}; - switch (file_removed[i]) - { - default: - case 0: - action = "KEEP"; - keep++; - break; - case 1: + + // Check if the file exists in the map + auto& filename{ entry.second.second }; + if (file_removed.find(filename) != file_removed.end()) { + // File found in the map, retrieve the corresponding enum value + switch (file_removed[filename]) { + case purge_action::delete_file: action = "DELETE"; del++; - break; - case 2: + break; + case purge_action::skip_file: action = "STATIC"; skip++; - break; + break; + default: + // Handle any unexpected enum value + action = "UNKNOWN"; + break; } + } + else + { + action = "KEEP"; + } // // have to do this because of LL_INFO/LL_END weirdness @@ -240,14 +317,22 @@ void LLDiskCache::purge() line << entry.first << " "; line << entry.second.first << " "; line << entry.second.second; - line << " (" << file_size_total << "/" << mMaxSizeBytes << ")"; + line << " (" << file_size_total - deleted_so_far << "/" << mMaxSizeBytes << ")"; // update the debug logging to be more useful LL_INFOS() << line.str() << LL_ENDL; } - - LL_INFOS() << "Total dir size after purge is " << dirFileSize(mCacheDir) << LL_ENDL; - LL_INFOS() << "Cache purge took " << execute_time << " ms to execute for " << file_info.size() << " files" << LL_ENDL; - LL_INFOS() << "Deleted: " << del << " Skipped: " << skip << " Kept: " << keep << LL_ENDL; // Extra accounting to track the retention of static assets +// make the summary stats more easily enabled. } + // update the debug logging to be more useful + // LL_INFOS() << "Total dir size after purge is " << dirFileSize(mCacheDir) << LL_ENDL; + // LL_INFOS() << "Cache purge took " << execute_time << " ms to execute for " << file_info.size() << " files" << LL_ENDL; + + auto newCacheSize = updateCacheSize(file_size_total - deleted_size_total); + LL_INFOS("LLDiskCache") << "Total dir size after purge is " << newCacheSize << LL_ENDL; + LL_INFOS("LLDiskCache") << "Cache purge took " << execute_time << " ms to execute for " << file_info.size() << " files" << LL_ENDL; +// + LL_INFOS("LLDiskCache") << "Deleted: " << del << " Skipped: " << skip << " Kept: " << keep << LL_ENDL; // Extra accounting to track the retention of static assets + LL_INFOS("LLDiskCache") << "Total of " << deleted_size_total << " bytes removed." << LL_ENDL; // Extra accounting to track the retention of static assets + // } this bracket was moved up a few lines. } const std::string LLDiskCache::assetTypeToString(LLAssetType::EType at) @@ -534,8 +619,32 @@ void LLDiskCache::removeOldVFSFiles() } } -uintmax_t LLDiskCache::dirFileSize(const std::string& dir) +// Lets not scan every single time if we can avoid it eh? +// uintmax_t LLDiskCache::dirFileSize(const std::string& dir) +// { +uintmax_t LLDiskCache::updateCacheSize(const uintmax_t newsize) { + mStoredCacheSize = newsize; + mLastScanTime = system_clock::now(); + return mStoredCacheSize; +} + +uintmax_t LLDiskCache::dirFileSize(const std::string& dir, bool force ) +{ + using namespace std::chrono; + const seconds cache_duration{ 120 };// A rather arbitrary number. it takes 5 seconds+ on a fast drive to scan 80K+ items. purge runs every minute and will update. so 120 should mean we never need a superfluous cache scan. + + const auto current_time = system_clock::now(); + + const auto time_difference = duration_cast(current_time - mLastScanTime); + + // Check if the cached result can be used + if( !force && time_difference < cache_duration ) + { + LL_DEBUGS("LLDiskCache") << "Using cached result: " << mStoredCacheSize << LL_ENDL; + return mStoredCacheSize; + } +// uintmax_t total_file_size = 0; /** @@ -577,7 +686,10 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir) } } - return total_file_size; +// Lets not scan every single time if we can avoid it eh? + // return total_file_size; + return updateCacheSize(total_file_size); +// } LLPurgeDiskCacheThread::LLPurgeDiskCacheThread() : diff --git a/indra/llfilesystem/lldiskcache.h b/indra/llfilesystem/lldiskcache.h index 4b51b66e1f..fc1be25b9f 100644 --- a/indra/llfilesystem/lldiskcache.h +++ b/indra/llfilesystem/lldiskcache.h @@ -63,6 +63,9 @@ #define _LLDISKCACHE #include "llsingleton.h" +#include +using namespace std::chrono; + class LLDiskCache : public LLParamSingleton @@ -92,7 +95,18 @@ class LLDiskCache : * if there are bugs, we can ask uses to enable this * setting and send us their logs */ - const bool enable_cache_debug_info); + const bool enable_cache_debug_info, + // Add high/low threshold controls for cache purging + /** + * A floating point percentage of the max_size_bytes above which the cache purge will trigger. + */ + const F32 highwater_mark_percent, + /** + * A floating point percentage of the max_size_bytes which the cache purge will aim to reach once triggered. + */ + const F32 lowwater_mark_percent + // + ); virtual ~LLDiskCache() = default; @@ -157,6 +171,10 @@ class LLDiskCache : // Better asset cache size control void setMaxSizeBytes(uintmax_t size) { mMaxSizeBytes = size; } + // High/Low water control + void setHighWaterPercentage(F32 HiPct) { mHighPercent = llclamp(HiPct, mLowPercent, 100.0); }; + void setLowWaterPercentage(F32 LowPct) { mLowPercent = llclamp(LowPct, 0.0, mHighPercent); }; + // private: /** @@ -164,7 +182,8 @@ class LLDiskCache : * directory. Primarily used here to determine the directory size * before and after the cache purge */ - uintmax_t dirFileSize(const std::string& dir); + uintmax_t updateCacheSize(const uintmax_t newsize); // enable time based caching of dirfilesize except when force is true. + uintmax_t dirFileSize(const std::string& dir, bool force=false); // enable time based caching of dirfilesize except when force is true. /** * Utility function to convert an LLAssetType enum into a @@ -172,6 +191,13 @@ class LLDiskCache : */ const std::string assetTypeToString(LLAssetType::EType at); + /** + * cache the directory size cos it takes forever to calculate it + * + */ + uintmax_t mStoredCacheSize{ 0 }; + time_point mLastScanTime{ }; + private: /** * The maximum size of the cache in bytes. After purge is called, the @@ -179,6 +205,10 @@ class LLDiskCache : * less than this value */ uintmax_t mMaxSizeBytes; + // High/Low water control + F32 mHighPercent { 95.0 }; + F32 mLowPercent { 70.0 }; + // /** * The folder that holds the cached files. The consumer of this diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 225993c4af..c29386b040 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -332,6 +332,18 @@ void LLExperienceCache::requestExperiences() std::string urlBase = mCapability("GetExperienceInfo"); if (urlBase.empty()) { +// FIRE-33046 reduce logging of warning in OS grids with no experiences capability +#ifdef OPENSIM + if( LLGridManager::instance().isInOpenSim() ) + { +// In Opensim this can occur if the grid does not have experiences capability. make it a debug + LL_DEBUGS("ExperienceCache") << "No Experience capability." << LL_ENDL; + } + else +// Danger: Dangling 'else' +// In SL, this is a sign of a problem as everything should have experience capability so flag it as a warning still. +#endif +// LL_WARNS("ExperienceCache") << "No Experience capability." << LL_ENDL; return; } diff --git a/indra/llui/llchat.h b/indra/llui/llchat.h index 89ded99f9d..20ff912ecf 100644 --- a/indra/llui/llchat.h +++ b/indra/llui/llchat.h @@ -72,7 +72,11 @@ typedef enum e_chat_style CHAT_STYLE_IRC, CHAT_STYLE_HISTORY, CHAT_STYLE_TELEPORT_SEP, - CHAT_STYLE_MODERATOR + // Add a distinct color for server side group chat replay + // CHAT_STYLE_MODERATOR + CHAT_STYLE_MODERATOR, + CHAT_STYLE_SERVER_HISTORY + // }EChatStyle; // A piece of chat diff --git a/indra/newview/animationexplorer.cpp b/indra/newview/animationexplorer.cpp index fdde7ded88..3fcbbef197 100644 --- a/indra/newview/animationexplorer.cpp +++ b/indra/newview/animationexplorer.cpp @@ -53,6 +53,8 @@ #include "llvoavatarself.h" // for gAgentAvatarp #include "llavatarnamecache.h" +#include "fsassetblacklist.h" + constexpr S32 MAX_ANIMATIONS = 100; // -------------------------------------------------------------------------- @@ -157,13 +159,13 @@ BOOL AnimationExplorer::postBuild() { mAnimationScrollList = getChild("animation_list"); mStopButton = getChild("stop_btn"); - mRevokeButton = getChild("revoke_btn"); + mBlacklistButton = getChild("blacklist_btn"); mStopAndRevokeButton = getChild("stop_and_revoke_btn"); mNoOwnedAnimationsCheckBox = getChild("no_owned_animations_check"); mAnimationScrollList->setCommitCallback(boost::bind(&AnimationExplorer::onSelectAnimation, this)); mStopButton->setCommitCallback(boost::bind(&AnimationExplorer::onStopPressed, this)); - mRevokeButton->setCommitCallback(boost::bind(&AnimationExplorer::onRevokePressed, this)); + mBlacklistButton->setCommitCallback(boost::bind(&AnimationExplorer::onBlacklistPressed, this)); mStopAndRevokeButton->setCommitCallback(boost::bind(&AnimationExplorer::onStopAndRevokePressed, this)); mNoOwnedAnimationsCheckBox->setCommitCallback(boost::bind(&AnimationExplorer::onOwnedCheckToggled, this)); @@ -199,7 +201,7 @@ void AnimationExplorer::onSelectAnimation() S32 column = mAnimationScrollList->getColumn("animation_id")->mIndex; mCurrentAnimationID = item->getColumn(column)->getValue().asUUID(); - column = mAnimationScrollList->getColumn("played_by")->mIndex; + column = mAnimationScrollList->getColumn("object_id")->mIndex; mCurrentObject = item->getColumn(column)->getValue().asUUID(); startMotion(mCurrentAnimationID); @@ -214,23 +216,35 @@ void AnimationExplorer::onStopPressed() } } -void AnimationExplorer::onRevokePressed() +void AnimationExplorer::onBlacklistPressed() { - if (mCurrentObject.notNull()) + onStopPressed(); + LLScrollListItem* item = mAnimationScrollList->getFirstSelected(); + if (!item) { - LLViewerObject* vo = gObjectList.findObject(mCurrentObject); - - if (vo) - { - gAgentAvatarp->revokePermissionsOnObject(vo); - } + return; } + + S32 column = mAnimationScrollList->getColumn("played_by")->mIndex; + std::string region_name{}; + if (gAgent.getRegion()) + { + region_name = gAgent.getRegion()->getName(); + } + FSAssetBlacklist::getInstance()->addNewItemToBlacklist(mCurrentAnimationID, item->getColumn(column)->getValue(), region_name, LLAssetType::AT_ANIMATION); } void AnimationExplorer::onStopAndRevokePressed() { onStopPressed(); - onRevokePressed(); + + if (mCurrentObject.notNull()) + { + if (LLViewerObject* vo = gObjectList.findObject(mCurrentObject); vo) + { + gAgentAvatarp->revokePermissionsOnObject(vo); + } + } } void AnimationExplorer::onOwnedCheckToggled() @@ -316,11 +330,10 @@ void AnimationExplorer::updateList(F64 current_timestamp) // go through the list of playing animations to find out if this animation played by // this object is still running - for (LLVOAvatar::AnimSourceIterator anim_iter = gAgentAvatarp->mAnimationSources.begin(); - anim_iter != gAgentAvatarp->mAnimationSources.end(); ++anim_iter) + for (const auto& [anim_object_id, anim_anim_id] : gAgentAvatarp->mAnimationSources) { // object and animation found - if (anim_iter->first == object_id && anim_iter->second == anim_id) + if (anim_object_id == object_id && anim_anim_id == anim_id) { // set text to "Still playing" and break out of this loop played_text->setText(LLTrans::getString("animation_explorer_still_playing")); @@ -343,8 +356,7 @@ void AnimationExplorer::updateList(F64 current_timestamp) } std::string prio_text = LLTrans::getString("animation_explorer_unknown_priority"); - LLKeyframeMotion* motion = dynamic_cast(gAgentAvatarp->findMotion(anim_id)); - if (motion) + if (LLKeyframeMotion* motion = dynamic_cast(gAgentAvatarp->findMotion(anim_id)); motion) { prio_text = llformat("%d", (S32)motion->getPriority()); } @@ -367,8 +379,7 @@ void AnimationExplorer::addAnimation(const LLUUID& id, const LLUUID& played_by, std::string playedByName = played_by.asString(); // find out if the object is still in reach - LLViewerObject* vo = gObjectList.findObject(played_by); - if (vo) + if (LLViewerObject* vo = gObjectList.findObject(played_by); vo) { // if it was an avatar, get the name here if (vo->isAvatar()) @@ -450,8 +461,7 @@ void AnimationExplorer::addAnimation(const LLUUID& id, const LLUUID& played_by, void AnimationExplorer::onAvatarNameCallback(const LLUUID& id, const LLAvatarName& av_name) { - auto iter = mAvatarNameCacheConnections.find(id); - if (iter != mAvatarNameCacheConnections.end()) + if (auto iter = mAvatarNameCacheConnections.find(id); iter != mAvatarNameCacheConnections.end()) { if (iter->second.connected()) { @@ -478,10 +488,8 @@ void AnimationExplorer::requestNameCallback(LLMessageSystem* msg) LLUUID object_id; msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, object_id, index); - uuid_vec_t::iterator iter; - iter = std::find(mRequestedIDs.begin(), mRequestedIDs.end(), object_id); // if this is one of the objects we were looking for, process the data - if (iter != mRequestedIDs.end()) + if (auto iter = std::find(mRequestedIDs.begin(), mRequestedIDs.end(), object_id); iter != mRequestedIDs.end()) { // get the name of the object std::string object_name; @@ -502,11 +510,9 @@ void AnimationExplorer::updateListEntry(const LLUUID& id, const std::string& nam S32 played_by_column = mAnimationScrollList->getColumn("played_by")->mIndex; // find all scroll list entries with this object UUID and update the names there - std::vector items = mAnimationScrollList->getAllData(); - for (std::vector::iterator list_iter = items.begin(); list_iter != items.end(); ++list_iter) + for (LLScrollListItem* item : mAnimationScrollList->getAllData()) { - LLScrollListItem* item = *list_iter; - LLUUID list_object_id = item->getColumn(object_id_column)->getValue().asUUID(); + const LLUUID& list_object_id = item->getColumn(object_id_column)->getValue().asUUID(); if (id == list_object_id) { diff --git a/indra/newview/animationexplorer.h b/indra/newview/animationexplorer.h index f7e9bd2db2..eec3abe8c7 100644 --- a/indra/newview/animationexplorer.h +++ b/indra/newview/animationexplorer.h @@ -100,7 +100,7 @@ class AnimationExplorer LLScrollListCtrl* mAnimationScrollList; LLButton* mStopButton; - LLButton* mRevokeButton; + LLButton* mBlacklistButton; LLButton* mStopAndRevokeButton; LLCheckBoxCtrl* mNoOwnedAnimationsCheckBox; @@ -126,7 +126,7 @@ class AnimationExplorer void onSelectAnimation(); void onStopPressed(); - void onRevokePressed(); + void onBlacklistPressed(); void onStopAndRevokePressed(); void onOwnedCheckToggled(); }; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 251d65f10e..b551a4a7f8 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2952,6 +2952,28 @@ Value 2048 + FSDiskCacheHighWaterPercent + + Comment + Trigger point above which we should start to clear out older cache entries + Persist + 1 + Type + F32 + Value + 95.0 + + FSDiskCacheLowWaterPercent + + Comment + Level to drain cache to once it goes over the high water limit. + Persist + 1 + Type + F32 + Value + 70.0 + CacheLocation Comment diff --git a/indra/newview/fsareasearch.cpp b/indra/newview/fsareasearch.cpp index e7605a2ede..b81a20454f 100644 --- a/indra/newview/fsareasearch.cpp +++ b/indra/newview/fsareasearch.cpp @@ -173,6 +173,7 @@ FSAreaSearch::FSAreaSearch(const LLSD& key) : mRequestNeedsSent(false), mRlvBehaviorCallbackConnection() { + LLViewerRegion::sFSAreaSearchActive = true; mFactoryMap["area_search_list_panel"] = LLCallbackMap(createPanelList, this); mFactoryMap["area_search_find_panel"] = LLCallbackMap(createPanelFind, this); mFactoryMap["area_search_filter_panel"] = LLCallbackMap(createPanelFilter, this); @@ -182,12 +183,13 @@ 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() { + LLViewerRegion::sFSAreaSearchActive = false; if (!gIdleCallbacks.deleteFunction(idle, this)) { LL_WARNS("FSAreaSearch") << "FSAreaSearch::~FSAreaSearch() failed to delete callback" << LL_ENDL; @@ -209,9 +211,8 @@ FSAreaSearch::~FSAreaSearch() if (mParcelChangedObserver) { - LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver); - delete mParcelChangedObserver; - mParcelChangedObserver = NULL; + LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangedObserver.get()); + mParcelChangedObserver = nullptr; } } @@ -252,9 +253,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 +298,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 +323,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 +457,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 +1032,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 +1094,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 +1153,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 +1436,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 +2051,6 @@ BOOL FSPanelAreaSearchFind::postBuild() return LLPanel::postBuild(); } -// virtual -FSPanelAreaSearchFind::~FSPanelAreaSearchFind() -{ } - void FSPanelAreaSearchFind::onButtonClickedClear() { mNameLineEditor->clear(); @@ -2180,10 +2167,6 @@ BOOL FSPanelAreaSearchFilter::postBuild() return LLPanel::postBuild(); } -// virtual -FSPanelAreaSearchFilter::~FSPanelAreaSearchFilter() -{ } - void FSPanelAreaSearchFilter::onCommitCheckbox() { mFSAreaSearch->setFilterLocked(mCheckboxLocked->get()); @@ -2280,10 +2263,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 +2285,6 @@ bool FSPanelAreaSearchOptions::onEnableColumnVisibilityChecked(const LLSD& userd // Advanced tab //--------------------------------------------------------------------------- -FSPanelAreaSearchAdvanced::FSPanelAreaSearchAdvanced(FSAreaSearch* pointer) -: LLPanel() -{ -} - BOOL FSPanelAreaSearchAdvanced::postBuild() { mCheckboxClickTouch = getChild("double_click_touch"); @@ -2319,7 +2293,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 dbfe4a5210..bd59437e4a 100644 --- a/indra/newview/fsassetblacklist.cpp +++ b/indra/newview/fsassetblacklist.cpp @@ -54,6 +54,9 @@ LLAssetType::EType S32toAssetType(S32 assetindex) case 6: type = LLAssetType::AT_OBJECT; break; + case 20: + type = LLAssetType::AT_ANIMATION; + break; case 45: type = LLAssetType::AT_PERSON; break; @@ -76,8 +79,7 @@ bool FSAssetBlacklist::isBlacklisted(const LLUUID& id, LLAssetType::EType type) return false; } - blacklist_type_map_t::iterator it; - it = mBlacklistTypeContainer.find(type); + blacklist_type_map_t::iterator it = mBlacklistTypeContainer.find(type); if (it == mBlacklistTypeContainer.end()) { @@ -114,8 +116,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()) { @@ -133,9 +134,7 @@ bool FSAssetBlacklist::removeItem(const LLUUID& id) void FSAssetBlacklist::removeItemFromBlacklist(const LLUUID& id) { - uuid_vec_t ids; - ids.push_back(id); - removeItemsFromBlacklist(ids); + removeItemsFromBlacklist({ id }); } void FSAssetBlacklist::removeItemsFromBlacklist(const uuid_vec_t& ids) @@ -145,13 +144,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) @@ -161,7 +160,7 @@ void FSAssetBlacklist::removeItemsFromBlacklist(const uuid_vec_t& ids) if (!mBlacklistChangedCallback.empty()) { - mBlacklistChangedCallback(data, BLACKLIST_REMOVE); + mBlacklistChangedCallback(data, eBlacklistOperation::BLACKLIST_REMOVE); } } } @@ -194,7 +193,7 @@ void FSAssetBlacklist::addNewItemToBlacklistData(const LLUUID& id, const LLSD& d if (!mBlacklistChangedCallback.empty()) { - mBlacklistChangedCallback(LLSD().with(id.asString(), data), BLACKLIST_ADD); + mBlacklistChangedCallback(LLSD().with(id.asString(), data), eBlacklistOperation::BLACKLIST_ADD); } } @@ -205,18 +204,13 @@ bool FSAssetBlacklist::addEntryToBlacklistMap(const LLUUID& id, LLAssetType::ETy return false; } - blacklist_type_map_t::iterator it; - it = mBlacklistTypeContainer.find(type); - - if (it != mBlacklistTypeContainer.end()) + if (auto it = mBlacklistTypeContainer.find(type); it != mBlacklistTypeContainer.end()) { mBlacklistTypeContainer[type].insert(id); } else { - blacklisted_uuid_container_t cont; - cont.insert(id); - mBlacklistTypeContainer[type] = cont; + mBlacklistTypeContainer[type] = blacklisted_uuid_container_t{ id }; } return true; } @@ -233,7 +227,7 @@ void FSAssetBlacklist::loadBlacklist() { for (LLSD::map_const_iterator itr = data.beginMap(); itr != data.endMap(); ++itr) { - LLUUID uid = LLUUID(itr->first); + LLUUID uid{ itr->first }; LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); cipher.decrypt(uid.mData, UUID_BYTES); LLSD entry_data = itr->second; @@ -273,7 +267,7 @@ void FSAssetBlacklist::loadBlacklist() LLSDSerialize::fromXMLDocument(datallsd, oldfile); for (LLSD::map_const_iterator itr = datallsd.beginMap(); itr != datallsd.endMap(); ++itr) { - LLUUID uid = LLUUID(itr->first); + LLUUID uid{ itr->first }; LLSD data = itr->second; if (uid.isNull() || !data.has("entry_name") || !data.has("entry_type") || !data.has("entry_date")) { @@ -310,14 +304,14 @@ void FSAssetBlacklist::saveBlacklist() llofstream save_file(mBlacklistFileName.c_str()); LLSD savedata; - for (blacklist_data_t::const_iterator itr = mBlacklistData.begin(); itr != mBlacklistData.end(); ++itr) + for (const auto& [id, data] : mBlacklistData) { - if (itr->second["asset_permanent"].asBoolean()) + if (data["asset_permanent"].asBoolean()) { - LLUUID shadow_id(itr->first); + LLUUID shadow_id{ id }; LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); cipher.encrypt(shadow_id.mData, UUID_BYTES); - savedata[shadow_id.asString()] = itr->second; + savedata[shadow_id.asString()] = data; } } diff --git a/indra/newview/fsassetblacklist.h b/indra/newview/fsassetblacklist.h index 428ec36930..d7a90b10ff 100644 --- a/indra/newview/fsassetblacklist.h +++ b/indra/newview/fsassetblacklist.h @@ -29,15 +29,15 @@ #ifndef FS_ASSETBLACKLIST_H #define FS_ASSETBLACKLIST_H -#include -#include +#include +#include #include "llsingleton.h" #include "llassettype.h" -typedef boost::unordered_set blacklisted_uuid_container_t; -typedef std::map blacklist_type_map_t; -typedef boost::unordered_map blacklist_data_t; +using blacklisted_uuid_container_t = std::unordered_set; +using blacklist_type_map_t = std::map; +using blacklist_data_t = std::unordered_map; class FSAssetBlacklist : public LLSingleton { @@ -54,7 +54,7 @@ public: blacklist_data_t getBlacklistData() const { return mBlacklistData; }; - enum eBlacklistOperation + enum class eBlacklistOperation { BLACKLIST_ADD, BLACKLIST_REMOVE diff --git a/indra/newview/fschathistory.cpp b/indra/newview/fschathistory.cpp index ec99d3c516..8da9593e06 100644 --- a/indra/newview/fschathistory.cpp +++ b/indra/newview/fschathistory.cpp @@ -803,6 +803,7 @@ public: } else if ((mSourceType == CHAT_SOURCE_AGENT || (mSourceType == CHAT_SOURCE_SYSTEM && mType == CHAT_TYPE_RADAR)) && !mAvatarID.isNull() + && chat.mChatStyle != CHAT_STYLE_SERVER_HISTORY && chat.mChatStyle != CHAT_STYLE_HISTORY) { // ...from a normal user, lookup the name and fill in later. @@ -831,6 +832,7 @@ public: // [/RLVa:KB] } else if (chat.mChatStyle == CHAT_STYLE_HISTORY || + chat.mChatStyle == CHAT_STYLE_SERVER_HISTORY || (mSourceType == CHAT_SOURCE_AGENT || (mSourceType == CHAT_SOURCE_SYSTEM && mType == CHAT_TYPE_RADAR))) { //if it's an avatar name with a username add formatting @@ -1508,12 +1510,19 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL delimiter_style = "BOLD"; } - bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY; + bool message_from_log = (chat.mChatStyle == CHAT_STYLE_HISTORY || chat.mChatStyle == CHAT_STYLE_SERVER_HISTORY); bool teleport_separator = chat.mSourceType == CHAT_SOURCE_TELEPORT; // We graying out chat history by graying out messages that contains full date in a time string if (message_from_log && !is_conversation_log) { - txt_color = LLUIColorTable::instance().getColor("ChatHistoryMessageFromLog"); + if (chat.mChatStyle == CHAT_STYLE_HISTORY) + { + txt_color = LLUIColorTable::instance().getColor("ChatHistoryMessageFromLog"); + } + else if (chat.mChatStyle == CHAT_STYLE_SERVER_HISTORY) + { + txt_color = LLUIColorTable::instance().getColor("ChatHistoryMessageFromServerLog"); + } body_message_params.color(txt_color); body_message_params.readonly_color(txt_color); name_params.color(txt_color); diff --git a/indra/newview/fsdata.cpp b/indra/newview/fsdata.cpp index d99f6363aa..484cb66130 100644 --- a/indra/newview/fsdata.cpp +++ b/indra/newview/fsdata.cpp @@ -1025,7 +1025,7 @@ LLSD FSData::getSystemInfo() sysinfo1 += llformat("%s\n\n", info["SERVER_VERSION"].asString().c_str()); sysinfo1 += llformat("CPU: %s\n", info["CPU"].asString().c_str()); - sysinfo1 += llformat("Memory: %d MB\n", info["MEMORY_MB"].asInteger()); + sysinfo1 += llformat("Memory: %d MB (Used: %d MB)\n", info["MEMORY_MB"].asInteger(), info["USED_RAM"].asInteger()); sysinfo1 += llformat("OS: %s\n", info["OS_VERSION"].asString().c_str()); sysinfo1 += llformat("Graphics Card Vendor: %s\n", info["GRAPHICS_CARD_VENDOR"].asString().c_str()); sysinfo1 += llformat("Graphics Card: %s\n", info["GRAPHICS_CARD"].asString().c_str()); diff --git a/indra/newview/fsfloaterassetblacklist.cpp b/indra/newview/fsfloaterassetblacklist.cpp index 00bb43988c..81d34a2644 100644 --- a/indra/newview/fsfloaterassetblacklist.cpp +++ b/indra/newview/fsfloaterassetblacklist.cpp @@ -100,6 +100,8 @@ std::string FSFloaterAssetBlacklist::getTypeString(S32 type) return getString("asset_sound"); case LLAssetType::AT_OBJECT: return getString("asset_object"); + case LLAssetType::AT_ANIMATION: + return getString("asset_animation"); case LLAssetType::AT_PERSON: return getString("asset_resident"); default: @@ -112,11 +114,9 @@ void FSFloaterAssetBlacklist::buildBlacklist() bool needs_sort = mResultList->isSorted(); mResultList->setNeedsSort(false); - blacklist_data_t data = FSAssetBlacklist::instance().getBlacklistData(); - - for (blacklist_data_t::const_iterator iterator = data.begin(); iterator != data.end(); ++iterator) + for (const auto& [id, data] : FSAssetBlacklist::instance().getBlacklistData()) { - addElementToList(iterator->first, iterator->second); + addElementToList(id, data); } mResultList->setNeedsSort(needs_sort); @@ -166,11 +166,10 @@ void FSFloaterAssetBlacklist::addElementToList(const LLUUID& id, const LLSD& dat void FSFloaterAssetBlacklist::removeElements() { uuid_vec_t items; - std::vector list = mResultList->getAllSelected(); - for (std::vector::const_iterator it = list.begin(); it != list.end(); ++it) + for (auto listitem : mResultList->getAllSelected()) { - items.push_back((*it)->getUUID()); + items.emplace_back(listitem->getUUID()); } FSAssetBlacklist::instance().removeItemsFromBlacklist(items); @@ -178,7 +177,7 @@ void FSFloaterAssetBlacklist::removeElements() void FSFloaterAssetBlacklist::onBlacklistChanged(const LLSD& data, FSAssetBlacklist::eBlacklistOperation op) { - if (op == FSAssetBlacklist::BLACKLIST_ADD) + if (op == FSAssetBlacklist::eBlacklistOperation::BLACKLIST_ADD) { bool need_sort = mResultList->isSorted(); mResultList->setNeedsSort(false); @@ -216,8 +215,7 @@ void FSFloaterAssetBlacklist::onRemoveAllTemporaryBtn() void FSFloaterAssetBlacklist::onSelectionChanged() { bool enabled = false; - size_t num_selected = mResultList->getAllSelected().size(); - if (num_selected == 1) + if (size_t num_selected = mResultList->getAllSelected().size(); num_selected == 1) { const LLScrollListItem* item = mResultList->getFirstSelected(); S32 name_column = mResultList->getColumn("asset_type")->mIndex; @@ -257,8 +255,7 @@ void FSFloaterAssetBlacklist::onStopBtn() return; } - LLAudioSource* audio_source = gAudiop->findAudioSource(mAudioSourceID); - if (audio_source && !audio_source->isDone()) + if (LLAudioSource* audio_source = gAudiop->findAudioSource(mAudioSourceID); audio_source && !audio_source->isDone()) { audio_source->play(LLUUID::null); } @@ -307,8 +304,7 @@ BOOL FSFloaterAssetBlacklist::tick() return FALSE; } - LLAudioSource* audio_source = gAudiop->findAudioSource(mAudioSourceID); - if (!audio_source || audio_source->isDone()) + if (LLAudioSource* audio_source = gAudiop->findAudioSource(mAudioSourceID); !audio_source || audio_source->isDone()) { childSetVisible("play_btn", true); childSetVisible("stop_btn", false); @@ -348,8 +344,7 @@ namespace FSFloaterAssetBlacklistMenu if (command == "remove") { - FSFloaterAssetBlacklist* floater = LLFloaterReg::findTypedInstance("fs_asset_blacklist"); - if (floater) + if (FSFloaterAssetBlacklist* floater = LLFloaterReg::findTypedInstance("fs_asset_blacklist"); floater) { floater->removeElements(); } diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index 71303653d8..916baa4056 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -81,9 +81,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; @@ -192,7 +192,7 @@ BOOL FSFloaterIM::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) { mInputEditor->setFocus(TRUE); onTabInto(); - if(focus_flash) + if (focus_flash) { gFocusMgr.triggerFocusFlash(); } @@ -202,7 +202,7 @@ BOOL FSFloaterIM::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) void FSFloaterIM::onFocusLost() { LLIMModel::getInstance()->resetActiveSessionID(); - + LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false); } @@ -230,8 +230,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()) @@ -250,7 +250,7 @@ void FSFloaterIM::onSnooze() { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); - if (session == NULL) + if (!session) { LL_WARNS("FSFloaterIM") << "Empty session." << LL_ENDL; return; @@ -261,7 +261,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; @@ -289,8 +289,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); @@ -329,7 +328,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"); @@ -374,9 +374,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"); @@ -421,20 +421,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"; @@ -443,31 +443,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 + ") ")); @@ -479,7 +477,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) { @@ -487,9 +485,9 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type) utf8_text = system_info["Part1"].asString() + system_info["Part2"].asString(); } // - + sendMsg(utf8_text); - + mInputEditor->setText(LLStringUtil::null); } } @@ -515,12 +513,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) { @@ -539,13 +537,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; @@ -559,14 +555,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); @@ -576,7 +572,7 @@ void FSFloaterIM::sendMsg(const std::string& msg) //queue up the message to send once the session is initialized mQueuedMsgsForInit.append(utf8_text); } - + updateMessages(); } @@ -588,17 +584,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()) { @@ -755,7 +751,7 @@ void FSFloaterIM::onChange(EStatusType status, const std::string &channelURI, bo { return; } - + updateCallButton(); } @@ -764,13 +760,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; @@ -793,7 +789,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); @@ -841,7 +837,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) @@ -859,11 +855,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)) { @@ -931,7 +927,7 @@ BOOL FSFloaterIM::postBuild() LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this); // - + mInputEditor = getChild("chat_editor"); mChatHistory = getChild("chat_history"); mChatLayoutPanel = getChild("chat_layout_panel"); @@ -977,7 +973,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 @@ -1009,7 +1005,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) @@ -1177,7 +1173,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()) { @@ -1199,7 +1196,7 @@ FSFloaterIM* FSFloaterIM::show(const LLUUID& session_id) FSFloaterIM* floater = getInstance(session_id); if (!floater) { - return NULL; + return nullptr; } if (isChatMultiTab()) @@ -1274,7 +1271,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); @@ -1296,7 +1293,7 @@ void FSFloaterIM::setVisible(BOOL visible) LLTransientDockableFloater::setVisible(visible); // update notification channel state - if(channel) + if (channel) { channel->updateShowToastsState(); channel->redrawToasts(); @@ -1321,10 +1318,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); } @@ -1350,7 +1346,7 @@ void FSFloaterIM::setMinimized(BOOL b) BOOL FSFloaterIM::getVisible() { - if(isChatMultiTab()) + if (isChatMultiTab()) { FSFloaterIMContainer* im_container = FSFloaterIMContainer::getInstance(); @@ -1375,7 +1371,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()) @@ -1385,7 +1381,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); @@ -1422,8 +1418,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()) { @@ -1433,7 +1428,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()) { @@ -1454,7 +1448,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 @@ -1483,7 +1476,7 @@ void FSFloaterIM::updateMessages() LLUUID from_id = msg["from_id"].asUUID(); std::string from = msg["from"].asString(); std::string message = msg["message"].asString(); - bool is_history = msg["is_history"].asBoolean(); + S32 is_history = msg["is_history"].asInteger(); bool is_region_msg = msg["is_region_msg"].asBoolean(); LLChat chat; @@ -1491,7 +1484,10 @@ void FSFloaterIM::updateMessages() chat.mSessionID = mSessionID; chat.mFromName = from; chat.mTimeStr = time; - chat.mChatStyle = is_history ? CHAT_STYLE_HISTORY : chat.mChatStyle; + if (is_history) + { + chat.mChatStyle = (EChatStyle) is_history; + } if (is_region_msg) { chat.mSourceType = CHAT_SOURCE_REGION; @@ -1537,7 +1533,7 @@ void FSFloaterIM::updateMessages() { chat.mText = message; } - + mChatHistory->appendMessage(chat, chat_args); mLastMessageIndex = msg["index"].asInteger(); @@ -1596,8 +1592,7 @@ void FSFloaterIM::onInputEditorFocusLost() void FSFloaterIM::onInputEditorKeystroke() { - std::string text = mInputEditor->getText(); - if (!text.empty()) + if (!mInputEditor->getText().empty()) { setTyping(true); } @@ -1610,13 +1605,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; @@ -1633,7 +1628,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 ) { @@ -1654,12 +1649,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); @@ -1681,7 +1675,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) { @@ -1724,7 +1718,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); } @@ -1776,30 +1770,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, @@ -1849,7 +1819,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()); @@ -1877,7 +1847,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; @@ -1888,7 +1858,7 @@ bool FSFloaterIM::dropCategory(LLInventoryCategory* category, bool drop) LLInventoryModel::EXCLUDE_TRASH, buddies); S32 count = items.size(); - if(count == 0) + if (count == 0) { rv = false; } @@ -1921,13 +1891,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) @@ -2067,7 +2037,7 @@ void FSFloaterIM::addTypingIndicator(const LLUUID& from_id) void FSFloaterIM::removeTypingIndicator(const LLUUID& from_id) { - if ( mOtherTyping ) + if (mOtherTyping) { mOtherTyping = false; @@ -2112,7 +2082,7 @@ void FSFloaterIM::closeHiddenIMToasts() }; LLNotificationsUI::LLScreenChannel* channel = LLNotificationsUI::LLChannelManager::getNotificationScreenChannel(); - if (channel != NULL) + if (channel) { channel->closeHiddenToasts(IMToastMatcher()); } @@ -2126,7 +2096,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) @@ -2165,15 +2135,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(); } @@ -2197,7 +2171,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; @@ -2225,16 +2199,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; } // @@ -2334,45 +2308,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; } @@ -2389,7 +2332,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()); @@ -2410,7 +2353,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; @@ -2422,12 +2365,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 42012e2d68..0dd4977734 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); 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/fsfloaterstreamtitle.cpp b/indra/newview/fsfloaterstreamtitle.cpp index b99f586387..84513c09bb 100644 --- a/indra/newview/fsfloaterstreamtitle.cpp +++ b/indra/newview/fsfloaterstreamtitle.cpp @@ -183,25 +183,35 @@ BOOL FSFloaterStreamTitle::postBuild() mUpdateConnection = instance.setUpdateCallback([this](std::string_view streamtitle) { updateStreamTitle(streamtitle); }); updateStreamTitle(instance.getCurrentStreamTitle()); - mHistoryBtn->setCommitCallback(std::bind(&FSFloaterStreamTitle::openHistory, this)); + mHistoryBtn->setCommitCallback(std::bind(&FSFloaterStreamTitle::toggleHistory, this)); + mHistoryBtn->setIsToggledCallback([](LLUICtrl*, const LLSD&) { return LLFloaterReg::instanceVisible("fs_streamtitlehistory"); }); + setVisibleCallback(boost::bind(&FSFloaterStreamTitle::closeHistory, this)); return TRUE; } -void FSFloaterStreamTitle::openHistory() noexcept +void FSFloaterStreamTitle::toggleHistory() noexcept { LLFloater* root_floater = gFloaterView->getParentFloater(this); - FSFloaterStreamTitleHistory* history_floater = LLFloaterReg::showTypedInstance("fs_streamtitlehistory"); + FSFloaterStreamTitleHistory* history_floater = LLFloaterReg::findTypedInstance("fs_streamtitlehistory"); - if (root_floater) + if (!history_floater) { - root_floater->addDependentFloater(history_floater); - history_floater->setOwnerOrigin(root_floater); + history_floater = LLFloaterReg::showTypedInstance("fs_streamtitlehistory"); + if (root_floater && history_floater) + { + root_floater->addDependentFloater(history_floater); + history_floater->setOwnerOrigin(root_floater); + mHistory = history_floater->getHandle(); + } + } + else + { + closeHistory(); } - mHistory = history_floater->getHandle(); } void FSFloaterStreamTitle::closeHistory() noexcept diff --git a/indra/newview/fsfloaterstreamtitle.h b/indra/newview/fsfloaterstreamtitle.h index ac656e23f7..0319710113 100644 --- a/indra/newview/fsfloaterstreamtitle.h +++ b/indra/newview/fsfloaterstreamtitle.h @@ -108,7 +108,7 @@ private: BOOL tick() override; void updateStreamTitle(std::string_view streamtitle) noexcept; - void openHistory() noexcept; + void toggleHistory() noexcept; void closeHistory() noexcept; void checkTitleWidth() noexcept; 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..8fbb20e5ed 100644 --- a/indra/newview/fsradar.h +++ b/indra/newview/fsradar.h @@ -30,14 +30,14 @@ #include "llsingleton.h" #include "fsradarentry.h" -#include +#include class LLAvatarName; -const U32 FSRADAR_MAX_AVATARS_PER_ALERT = 6; // maximum number of UUIDs we can cram into a single channel radar alert message -const U32 FSRADAR_COARSE_OFFSET_INTERVAL = 7; // seconds after which we query the bridge for a coarse location adjustment -const U32 FSRADAR_MAX_OFFSET_REQUESTS = 60; // 2048 / UUID size, leaving overhead space -const U32 FSRADAR_CHAT_MIN_SPACING = 6; // minimum delay between radar chat messages +constexpr U32 FSRADAR_MAX_AVATARS_PER_ALERT{ 6 }; // maximum number of UUIDs we can cram into a single channel radar alert message +constexpr U32 FSRADAR_COARSE_OFFSET_INTERVAL{ 7 }; // seconds after which we query the bridge for a coarse location adjustment +constexpr U32 FSRADAR_MAX_OFFSET_REQUESTS{ 60 }; // 2048 / UUID size, leaving overhead space +constexpr U32 FSRADAR_CHAT_MIN_SPACING{ 6 }; // minimum delay between radar chat messages typedef enum e_radar_name_format { @@ -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) { } @@ -100,7 +100,7 @@ public: mCallback(); } - callback_t mCallback; + callback_t mCallback; }; typedef boost::signals2::signal& entries, const LLSD& stats)> radar_update_callback_t; @@ -110,13 +110,13 @@ public: } private: - void updateRadarList(); - void updateTracking(); - void checkTracking(); - void radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name, std::string_view postMsg); - void updateAgeAlertCheck(); + void updateRadarList(); + void updateTracking(); + void checkTracking(); + void radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name, std::string_view postMsg); + void updateAgeAlertCheck(); - Updater* mRadarListUpdater; + std::unique_ptr mRadarListUpdater; struct RadarFields { @@ -125,7 +125,7 @@ private: bool lastIgnore; }; - typedef boost::unordered_map radarfields_map_t; + typedef std::unordered_map radarfields_map_t; radarfields_map_t mLastRadarSweep; entry_map_t mEntryList; 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/llappviewer.cpp b/indra/newview/llappviewer.cpp index 486ead0f37..c71bf15dde 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3892,8 +3892,10 @@ LLSD LLAppViewer::getViewerInfo() const } // CPU + LLMemory::updateMemoryInfo(); info["CPU"] = gSysCPU.getCPUString(); info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits()); + info["USED_RAM"] = LLSD::Real(LLMemory::getAllocatedMemKB().valueInUnits()); info["CONCURRENCY"] = LLSD::Integer((S32)boost::thread::hardware_concurrency()); // Add hardware concurrency to info // Moved hack adjustment to Windows memory size into llsys.cpp info["OS_VERSION"] = LLOSInfo::instance().getOSString(); @@ -5195,7 +5197,10 @@ bool LLAppViewer::initCache() // const std::string cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name); - LLDiskCache::initParamSingleton(cache_dir, disk_cache_size, enable_cache_debug_info); + // Improve cache purge triggering + // LLDiskCache::initParamSingleton(cache_dir, disk_cache_size, enable_cache_debug_info); + LLDiskCache::initParamSingleton(cache_dir, disk_cache_size, enable_cache_debug_info, gSavedSettings.getF32("FSDiskCacheHighWaterPercent"), gSavedSettings.getF32("FSDiskCacheLowWaterPercent")); + // if (!read_only) { diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index f3b43244c4..26c0a04254 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -1196,7 +1196,7 @@ DWORD WINAPI purgeThread( LPVOID lpParameter ) for( auto dir : vctDirs ) { - LL_INFOS("CachePurge") << "Removing an old cache" << LL_ENDL; + LL_INFOS("LLDiskCache") << "Removing an old cache" << LL_ENDL; // consistent tagging to help searching log files deleteCacheDirectory( dir ); } @@ -1214,7 +1214,7 @@ void LLAppViewerWin32::startCachePurge() if( !hThread ) { - LL_WARNS("CachePurge") << "CreateThread failed: " << GetLastError() << LL_ENDL; + LL_WARNS("LLDiskCache") << "CreateThread failed: " << GetLastError() << LL_ENDL; // consistent tagging to help searching log files } else SetThreadPriority( hThread, THREAD_MODE_BACKGROUND_BEGIN ); 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/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 84c01c4848..9214d29e55 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -444,6 +444,7 @@ void inventory_offer_handler(LLOfferInfo* info) } report_to_nearby_chat(LLTrans::getString(message_type, chat_args)); + make_ui_sound("UISndInventoryOffer"); } // diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 4e505557ad..e12390a2fa 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1032,7 +1032,9 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time, - const bool is_history, // comes from a history file or chat server + // Add a distinct color for server side group chat replay + // const bool is_history, // comes from a history file or chat server + const S32 is_history, // comes from a history file or chat server const bool is_region_msg, const U32 timestamp) // may be zero { @@ -1101,7 +1103,9 @@ void LLIMModel::LLIMSession::addMessagesFromHistoryCache(const chat_message_list LL_DEBUGS("ChatHistory") << mSessionID << ": Adding history cache message: " << msg << LL_ENDL; // Add message from history cache to the display - addMessage(from, from_id, msg[LL_IM_TEXT], msg[LL_IM_TIME], true, false, 0); // from history data, not region message, no timestamp + // Add a distinct color for server side group chat replay + // addMessage(from, from_id, msg[LL_IM_TEXT], msg[LL_IM_TIME], true, false, 0); // from history data, not region message, no timestamp + addMessage(from, from_id, msg[LL_IM_TEXT], msg[LL_IM_TIME], CHAT_STYLE_HISTORY, false, 0); // from history data, not region message, no timestamp } } @@ -1309,7 +1313,9 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history, message["time"] = chat_time_str; message["timestamp"] = (S32)history_msg_timestamp; message["index"] = (LLSD::Integer)mMsgs.size(); - message["is_history"] = true; + // Add a distinct color for server side group chat replay + // message["is_history"] = true; + message["is_history"] = CHAT_STYLE_SERVER_HISTORY; mMsgs.push_front(message); LL_DEBUGS("ChatHistory") << mSessionID << ": push_front() adding group chat history message " << message << LL_ENDL; @@ -1356,12 +1362,16 @@ void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const if (type == LLLogChat::LOG_LINE) { LL_DEBUGS("ChatHistory") << "chatFromLogFile() adding LOG_LINE message from " << msg << LL_ENDL; - self->addMessage("", LLSD(), msg["message"].asString(), "", true, false, 0); // from history data, not region message, no timestamp + // Add a distinct color for server side group chat replay + // self->addMessage("", LLSD(), msg["message"].asString(), "", true, false, 0); // from history data, not region message, no timestamp + self->addMessage("", LLSD(), msg["message"].asString(), "", CHAT_STYLE_HISTORY, false, 0); // from history data, not region message, no timestamp } else if (type == LLLogChat::LOG_LLSD) { LL_DEBUGS("ChatHistory") << "chatFromLogFile() adding LOG_LLSD message from " << msg << LL_ENDL; - self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString(), true, false, 0); // from history data, not region message, no timestamp + // Add a distinct color for server side group chat replay + // self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString(), true, false, 0); // from history data, not region message, no timestamp + self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString(), CHAT_STYLE_HISTORY, false, 0); // from history data, not region message, no timestamp } } @@ -1717,7 +1727,9 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, // Forward IM to nearby chat if wanted std::string timestr = LLLogChat::timestamp2LogString(timestamp, false); - session->addMessage(from, from_id, utf8_text, timestr, false, is_region_msg, timestamp); //might want to add date separately + // Add a distinct color for server side group chat replay + // session->addMessage(from, from_id, utf8_text, timestr, false, is_region_msg, timestamp); //might want to add date separately + session->addMessage(from, from_id, utf8_text, timestr, CHAT_STYLE_NORMAL, is_region_msg, timestamp); //might want to add date separately static LLCachedControl show_im_in_chat(gSavedSettings, "FSShowIMInChatHistory"); if (show_im_in_chat && !is_announcement) @@ -4650,7 +4662,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 +4759,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/llimview.h b/indra/newview/llimview.h index aad96ba442..1833e8c44e 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -99,7 +99,9 @@ public: const LLUUID& from_id, const std::string& utf8_text, const std::string& time, - const bool is_history, + // Add a distinct color for server side group chat replay + // const bool is_history, + const S32 is_history, const bool is_region_msg, U32 timestamp); 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; } } } diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index a5124c6350..e9086ba828 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1176,6 +1176,13 @@ void LLPanelProfileSecondLife::apply(LLAvatarData* data) void LLPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorType type) { + // discard UDP replies for profile data if profile capability is available + // otherwise we will truncate profile descriptions to the old UDP limits + if (!gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP).empty()) + { + return; + } + if (APT_PROPERTIES == type) { const LLAvatarData* avatar_data = static_cast(data); @@ -2990,6 +2997,13 @@ void LLPanelProfileFirstLife::onDiscardDescriptionChanges() // Restore UDP profiles void LLPanelProfileFirstLife::processProperties(void * data, EAvatarProcessorType type) { + // discard UDP replies for profile data if profile capability is available + // otherwise we will truncate profile first life descriptions to the old UDP limits + if (!gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP).empty()) + { + return; + } + if (APT_PROPERTIES == type) { const LLAvatarData* avatar_data = static_cast(data); @@ -3204,6 +3218,13 @@ void LLPanelProfileNotes::processProperties(LLAvatarNotes* avatar_notes) // Restore UDP profiles void LLPanelProfileNotes::processProperties(void * data, EAvatarProcessorType type) { + // discard UDP replies for profile data if profile capability is available + // otherwise we will truncate profile notes to the old UDP limits + if (!gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP).empty()) + { + return; + } + if (APT_NOTES == type) { LLAvatarNotes* avatar_notes = static_cast(data); diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index bcf5041530..51ddbe1c41 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -76,6 +76,7 @@ static LLPanelInjector t_inventory("sidepanel_inventory"); static const char * const INBOX_BUTTON_NAME = "inbox_btn"; static const char * const INBOX_LAYOUT_PANEL_NAME = "inbox_layout_panel"; +static const char * const INBOX_RELOAD_BUTTON_NAME = "reload_received_items_btn"; // Add reload button to inventory inbox static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack"; static const char * const MARKETPLACE_INBOX_PANEL = "marketplace_inbox"; @@ -198,6 +199,12 @@ BOOL LLSidepanelInventory::postBuild() LLTabContainer* tabs = mPanelMainInventory->getChild("inventory filter tabs"); tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this)); + // Add reload button to inventory inbox + if (LLButton* reload_inbox_btn = getChild(INBOX_RELOAD_BUTTON_NAME) ; reload_inbox_btn) + { + reload_inbox_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onReloadInboxClicked, this)); + } + // /* EXT-4846 : "Can we suppress the "Landmarks" and "My Favorites" folder since they have their own Task Panel?" Deferring this until 2.1. @@ -834,3 +841,16 @@ void LLSidepanelInventory::cleanup() } // } + +// Add reload button to inventory inbox +void LLSidepanelInventory::onReloadInboxClicked() +{ + const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, true); + + if (LLViewerInventoryCategory* cat = gInventory.getCategory(inbox_id); cat) + { + cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN); + cat->fetch(); + } +} +// diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index e34c00d553..bf6113267c 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -117,6 +117,7 @@ protected: void onWearButtonClicked(); void onPlayButtonClicked(); void onTeleportButtonClicked(); + void onReloadInboxClicked(); // Add reload button to inventory inbox public: void onBackButtonClicked(); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 85203f2503..b535fe2f6c 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -1087,6 +1087,20 @@ void handleDiskCacheSizeChanged(const LLSD& newValue) } // +// Better asset cache purge control +void handleDiskCacheHighWaterPctChanged(const LLSD& newValue) +{ + const auto new_high = newValue.asReal(); + LLDiskCache::getInstance()->setHighWaterPercentage(new_high); +} + +void handleDiskCacheLowWaterPctChanged(const LLSD& newValue) +{ + const auto new_low = newValue.asReal(); + LLDiskCache::getInstance()->setLowWaterPercentage(new_low); +} +// + void handleTargetFPSChanged(const LLSD& newValue) { const auto targetFPS = gSavedSettings.getU32("TargetFPS"); @@ -1464,7 +1478,10 @@ void settings_setup_listeners() // Better asset cache size control setting_setup_signal_listener(gSavedSettings, "FSDiskCacheSize", handleDiskCacheSizeChanged); - + // Better asset cache purge control + setting_setup_signal_listener(gSavedSettings, "FSDiskCacheHighWaterPercent", handleDiskCacheHighWaterPctChanged); + setting_setup_signal_listener(gSavedSettings, "FSDiskCacheLowWaterPercent", handleDiskCacheLowWaterPctChanged); + // // Handle IME text input getting enabled or disabled #if LL_SDL2 diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 42a2dd0d99..2cdca20243 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5220,6 +5220,16 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); + // Asset blacklist + if (FSAssetBlacklist::getInstance()->isBlacklisted(animation_id, LLAssetType::AT_ANIMATION)) + { + // stop animation for onlookers; this won't help with deformers, but at least the + // user themselves doesn't see it, and everyone who comes in after this won't either + gAgent.sendAnimationRequest(animation_id, ANIM_REQUEST_STOP); + continue; + } + // + avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; // *HACK: Disabling flying mode if it has been enabled shortly before the agent diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a719294007..5fd65c3405 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -106,6 +106,7 @@ const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; +bool LLViewerRegion::sFSAreaSearchActive = false; // FIRE-32688 Area Search improvements BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; S32 LLViewerRegion::sLastCameraUpdated = 0; S32 LLViewerRegion::sNewObjectCreationThrottle = -1; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 312b792b4f..786b530ab9 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -478,6 +478,7 @@ public: std::vector mMapAvatars; std::vector mMapAvatarIDs; + static bool sFSAreaSearchActive; // FIRE-32688 Area Search improvements static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. static S32 sLastCameraUpdated; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 2a2bbd09a9..be7b2b1453 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -432,6 +432,7 @@ F32 LLVOCacheEntry::getSquaredPixelThreshold(bool is_front) bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold) { + if( LLViewerRegion::sFSAreaSearchActive ) { return true; } // FIRE-32688 Area Search improvements LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup(); if(!group) { @@ -928,7 +929,10 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) //process back objects selection selectBackObjects(camera, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), - do_occlusion && use_object_cache_occlusion); + // FIRE-32688 Area Search improvements + // do_occlusion && use_object_cache_occlusion); + do_occlusion && use_object_cache_occlusion && !LLViewerRegion::sFSAreaSearchActive); + // return 0; //nothing changed, reduce frequency of culling } } @@ -942,7 +946,10 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) camera.calcRegionFrustumPlanes(region_agent, gAgentCamera.mDrawDistance); mFrontCull = TRUE; - LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, + // FIRE-32688 Area Search improvements + // LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, + LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion && !LLViewerRegion::sFSAreaSearchActive, + // LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), this); culler.traverse(mOctree); diff --git a/indra/newview/skins/ansastorm/xui/en/sidepanel_inventory.xml b/indra/newview/skins/ansastorm/xui/en/sidepanel_inventory.xml index 9e9f89fcf5..75d7ecd6fb 100644 --- a/indra/newview/skins/ansastorm/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/ansastorm/xui/en/sidepanel_inventory.xml @@ -77,7 +77,7 @@ font="SansSerifMedium" name="inbox_btn" height="35" - width="308" + width="270" image_unselected="MarketplaceBtn_Off" image_selected="MarketplaceBtn_Selected" halign="left" @@ -88,6 +88,14 @@ pad_left="35" top="0" left="10" /> +