Support SimulatorFeature god_names, used for identifying those the Sim reveals to be gods.
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
#include "lluistring.h"
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llenvmanager.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -253,6 +254,9 @@ void LLMuteList::loadUserVolumes()
|
||||
{
|
||||
mUserVolumeSettings.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal()));
|
||||
}
|
||||
|
||||
LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLMuteList::checkNewRegion, this));
|
||||
checkNewRegion();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -289,6 +293,9 @@ bool LLMuteList::isLinden(const LLUUID& id) const
|
||||
|
||||
BOOL LLMuteList::isLinden(const std::string& name) const
|
||||
{
|
||||
if (mGodFullNames.find(name) != mGodFullNames.end()) return true;
|
||||
if (mGodLastNames.empty()) return false;
|
||||
|
||||
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
|
||||
boost::char_separator<char> sep(" ");
|
||||
tokenizer tokens(name, sep);
|
||||
@@ -299,7 +306,7 @@ BOOL LLMuteList::isLinden(const std::string& name) const
|
||||
if (token_iter == tokens.end()) return FALSE;
|
||||
|
||||
std::string last_name = *token_iter;
|
||||
return last_name == "Linden";
|
||||
return mGodLastNames.find(last_name) != mGodLastNames.end();
|
||||
}
|
||||
|
||||
static LLVOAvatar* find_avatar(const LLUUID& id)
|
||||
@@ -549,7 +556,7 @@ void notify_automute_callback(const LLUUID& agent_id, const std::string& full_na
|
||||
|
||||
LLSD args;
|
||||
args["NAME"] = full_name;
|
||||
|
||||
|
||||
LLNotificationPtr notif_ptr = LLNotifications::instance().add(notif_name, args);
|
||||
if (notif_ptr)
|
||||
{
|
||||
@@ -885,3 +892,53 @@ void LLMuteList::notifyObservers()
|
||||
it = mObservers.upper_bound(observer);
|
||||
}
|
||||
}
|
||||
|
||||
void LLMuteList::checkNewRegion()
|
||||
{
|
||||
LLViewerRegion* regionp = gAgent.getRegion();
|
||||
if (!regionp) return;
|
||||
|
||||
if (regionp->getFeaturesReceived())
|
||||
{
|
||||
parseSimulatorFeatures();
|
||||
}
|
||||
else
|
||||
{
|
||||
regionp->setFeaturesReceivedCallback(boost::bind(&LLMuteList::parseSimulatorFeatures, this));
|
||||
}
|
||||
}
|
||||
|
||||
void LLMuteList::parseSimulatorFeatures()
|
||||
{
|
||||
LLViewerRegion* regionp = gAgent.getRegion();
|
||||
if (!regionp) return;
|
||||
|
||||
LLSD info;
|
||||
regionp->getSimulatorFeatures(info);
|
||||
|
||||
mGodLastNames.clear();
|
||||
mGodFullNames.clear();
|
||||
|
||||
if (info.has("god_names"))
|
||||
{
|
||||
if (info["god_names"].has("last_names"))
|
||||
{
|
||||
LLSD godNames = info["god_names"]["last_names"];
|
||||
|
||||
for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); godNames_it++)
|
||||
mGodLastNames.insert((*godNames_it).asString());
|
||||
}
|
||||
|
||||
if (info["god_names"].has("full_names"))
|
||||
{
|
||||
LLSD godNames = info["god_names"]["full_names"];
|
||||
|
||||
for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); godNames_it++)
|
||||
mGodFullNames.insert((*godNames_it).asString());
|
||||
}
|
||||
}
|
||||
else // Just use Linden
|
||||
{
|
||||
mGodLastNames.insert("Linden");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +149,9 @@ private:
|
||||
|
||||
static void onFileMuteList(void** user_data, S32 code, LLExtStat ext_status);
|
||||
|
||||
void checkNewRegion();
|
||||
void parseSimulatorFeatures();
|
||||
|
||||
private:
|
||||
struct compare_by_name
|
||||
{
|
||||
@@ -186,6 +189,9 @@ private:
|
||||
|
||||
typedef std::map<LLUUID, F32> user_volume_map_t;
|
||||
user_volume_map_t mUserVolumeSettings;
|
||||
|
||||
std::set<std::string> mGodLastNames;
|
||||
std::set<std::string> mGodFullNames;
|
||||
};
|
||||
|
||||
class LLMuteListObserver
|
||||
|
||||
Reference in New Issue
Block a user