BOOL LLMuteList::add(const LLMute& mute, U32 flags) { // Can't mute text from Lindens if ((mute.mType == LLMute::AGENT) && isLinden(mute.mName) && (flags & LLMute::flagTextChat || flags == 0)) { gViewerWindow->alertXml("MuteLinden"); return FALSE; } // Can't mute self. if (mute.mType == LLMute::AGENT && mute.mID == gAgent.getID()) { return FALSE; } if (mute.mType == LLMute::BY_NAME) { // Can't mute empty string by name if (mute.mName.empty()) { llwarns << "Trying to mute empty string by-name" << llendl; return FALSE; } // Null mutes must have uuid null if (mute.mID.notNull()) { llwarns << "Trying to add by-name mute with non-null id" << llendl; return FALSE; } std::pair<string_set_t::iterator, bool> result = mLegacyMutes.insert(mute.mName); if (result.second) { llinfos << "Muting by name " << mute.mName << llendl; updateAdd(mute); notifyObservers(); return TRUE; } else { // was duplicate return FALSE; } } else { // Need a local (non-const) copy to set up flags properly. LLMute localmute = mute; // If an entry for the same entity is already in the list, remove it, saving flags as necessary. mute_set_t::iterator it = mMutes.find(localmute); if (it != mMutes.end()) { // This mute is already in the list. Save the existing entry's flags if that's warranted. localmute.mFlags = it->mFlags; mMutes.erase(it); // Don't need to call notifyObservers() here, since it will happen after the entry has been re-added below. } else { // There was no entry in the list previously. Fake things up by making it look like the previous entry had all properties unmuted. localmute.mFlags = LLMute::flagAll; } if(flags) { // The user passed some combination of flags. Make sure those flag bits are turned off (i.e. those properties will be muted). localmute.mFlags &= (~flags); } else { // The user passed 0. Make sure all flag bits are turned off (i.e. all properties will be muted). localmute.mFlags = 0; } // (re)add the mute entry. { std::pair<mute_set_t::iterator, bool> result = mMutes.insert(localmute); if (result.second) { llinfos << "Muting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << llendl; updateAdd(localmute); notifyObservers(); if(!(localmute.mFlags & LLMute::flagParticles)) { //Kill all particle systems owned by muted task if(localmute.mType == LLMute::AGENT || localmute.mType == LLMute::OBJECT) { LLViewerPartSim::getInstance()->clearParticlesByOwnerID(localmute.mID); } } return TRUE; } } } // If we were going to return success, we'd have done it by now. return FALSE; }
bool LLMuteList::isLinden(const LLUUID& id) const { std::string name; gCacheName->getFullName(id, name); return isLinden(name); }