Commit 66a2d995 authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Fix a few bugs with opensim grid god names not always working

parent 30843129
......@@ -1300,7 +1300,7 @@ bool LLAvatarActions::canBlock(const LLUUID& id)
LLAvatarNameCache::get(id, &av_name);
std::string full_name = av_name.getUserName();
bool is_linden = (full_name.find("Linden") != std::string::npos);
bool is_linden = LLMuteList::instance().isLinden(full_name);
bool is_self = id == gAgentID;
return !is_self && !is_linden;
}
......
......@@ -188,6 +188,13 @@ LLMuteList::~LLMuteList()
}
BOOL LLMuteList::isLinden(const LLUUID& id) const
{
std::string name;
gCacheName->getFullName(id, name);
return isLinden(name);
}
BOOL LLMuteList::isLinden(const std::string& name) const
{
std::string username = boost::replace_all_copy(name, ".", " ");
......@@ -200,20 +207,19 @@ BOOL LLMuteList::isLinden(const std::string& name) const
++token_iter;
if (token_iter == tokens.end()) return FALSE;
std::string last_name = *token_iter;
LLStringUtil::toLower(last_name);
if (LLGridManager::getInstance()->isInSecondlife())
{
// Simple!
return last_name == "linden";
return last_name == "Linden" || last_name == "ProductEngine";
}
else if (LLGridManager::getInstance()->isInOpenSim())
{
LLViewerRegion* region = gAgent.getRegion();
if (!region) return FALSE;
std::set<std::string> gods = region->getGods();
const auto& gods = region->getGods();
if (gods.empty()) return FALSE;
return (gods.find(name) != gods.end() || gods.find(last_name) != gods.end());
return (gods.find(name) != gods.cend() || gods.find(last_name) != gods.cend());
}
return FALSE;
}
......
......@@ -100,6 +100,7 @@ public:
// Alternate (convenience) form for places we don't need to pass the name, but do need flags
BOOL isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLStringUtil::null, flags); };
BOOL isLinden(const LLUUID& id) const;
BOOL isLinden(const std::string& name) const;
BOOL isLoaded() const { return mIsLoaded; }
......
......@@ -3062,9 +3062,7 @@ bool enable_object_mute()
if (avatar)
{
// It's an avatar
LLNameValue *lastname = avatar->getNVPair("LastName");
bool is_linden =
lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
bool is_linden = LLMuteList::instance().isLinden(avatar->getID());
bool is_self = avatar->isSelf();
// return !is_linden && !is_self;
// [RLVa:KB] - Checked: RLVa-1.2.1
......@@ -3088,9 +3086,7 @@ bool enable_object_unmute()
if (avatar)
{
// It's an avatar
LLNameValue *lastname = avatar->getNVPair("LastName");
bool is_linden =
lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
bool is_linden = LLMuteList::instance().isLinden(avatar->getID());
bool is_self = avatar->isSelf();
return !is_linden && !is_self;
}
......
......@@ -38,6 +38,7 @@
#include "llframetimer.h"
#include "lleasymessagesender.h"
#include <unordered_map>
#include "absl/container/flat_hash_set.h"
// Surface id's
#define LAND 1
......@@ -420,7 +421,7 @@ public:
U32 getWhisperRange() const;
/// "God names" surname and full account names map
std::set<std::string> getGods() const { return mGodNames; };
const auto& getGods() const { return mGodNames; };
//@}
typedef std::vector<LLPointer<LLViewerTexture> > tex_matrix_t;
......@@ -594,7 +595,7 @@ private:
LLFrameTimer mRenderInfoReportTimer;
mutable tex_matrix_t mWorldMapTiles;
std::set<std::string> mGodNames;
absl::flat_hash_set<std::string> mGodNames;
LLEasyMessageSender mMessageSender;
using url_mapping_t = std::unordered_multimap<std::string, std::string>;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment