Muting Objects and Agents

From Second Life Wiki
Jump to navigation Jump to search

The viewer is responsible for implementing the muting of agents and objects. When the viewer initiates a new session, it requests the Mute List from the Second Life service. Once this list has been received and processed, each chat message that the viewer receives is compared against a list of muted items. If a chat message originates from a muted item, it is suppressed.

Mute List Classes

There are two primary classes that are used to implement and manage the viewer's mute list:

  • LLMute -- each muted object or agent is represented by an instance of this class
  • LLMuteList -- a single global instance of this class is used to manage the list of object and agents that are muted

Both of these classes are declared in llmutelist.h and implemented in llmutelist.cpp.

There are two classes that are used to manage the UI related to the mute list:

  • LLObjectMute -- handles the "Mute" menu items in the Object and Avatar pie menus (implemented in llviewermenu.cpp)
  • LLFloaterMute -- manages the display of the "Muted Residents & Objects" floater (declared in llfloatermute.h, implemented in llfloatermute.cpp and in floater_mute.xml)

Managing the Mute List

The viewer's mute list is internally represented by the global LLMuteList* gMuteListp. For more information about the format of the mute list file, see Mute List.

Requesting the Mute List from the service

  1. The viewer requests the agent's mute list by calling LLMuteList::requestFromServer() in llmutelist.cpp
  2. The viewer sends a MuteListRequest message to the service
  3. The service replies with either:
    • A MuteListUpdate message, indicating that the viewer should request a new mute list file from the service, or
    • A UseCachedMuteList message, indicating that the viewer should use its cached copy of the mute list file

Loading a new Mute List

  1. The viewer recevies a MuteListUpdate message from the serice
  2. The mute list file specified in the message is requested by the viewer
  3. Upon receipt of the mute list file, the callback LLMuteList::onFileMuteList() is invoked
  4. The viewer opens the received file, and invokes LLMuteList::loadFromFile() to parse it

Loading a cached Mute List

  1. The viewer receives a UseCachedMuteList message from the service
  2. The viewer opens the cached file, and invokes LLMuteList::loadFromFile() to parse it

Populating the Global Mute List

  1. The mute list file, whether new or cached, is opened by LLMuteList::loadFromFile()
  2. Each mute entry in the pipe-delimited list is parsed
  3. A new LLMute instance is created for each entry, and this instance is added to gMuteListp.

Updating the Mute List

  • When a new agent or object is added to the mute list, the viewer sends an UpdateMuteListEntry message to the service by LLMuteList::updateAdd()
  • When an agent or object is removed from the mute list, the viewer sends a RemoveMuteListEntry message to the service by LLMuteList::updateRemove()

Mute List UI

  • The "Muted Residents & Objects" floater is managed by the LLFloaterMute class, implemented in llfloatermute.cpp. This floater is displayed by the "Mute List" entry on the "Tools" menu, as well as by the "Mute" menu items on the object and agent pie menus.
  • The "Mute List" entry on the "Tools" menu is handled by LLShowFloater::handleEvent() (implemented in llviewermenu.cpp), which shows the mute list floater.
  • The "Mute" (or "Unmute") entries in both the agent and object pie menus are handled by LLObjectMute::handleEvent() (implemented in llviewermenu.cpp)
    • The handler creates a new LLMute instance based on the agent or object that was selected
    • If the agent or object is already muted, the mute is removed from the mute list
    • If the agent or object is not muted, the mute is added to the mute list and the mute list floater is shown

Mute List Messages

Message From To Description Handler / Sender
MuteListRequest viewer service Requests a mute list for the current agent sent by LLMuteList::requestFromServer()
UpdateMuteListEntry viewer service Adds a new mute entry to the mute list sent by LLMuteList::updateAdd()
RemoveMuteListEntry viewer service Removes a mute entry from the mute list sent by LLMuteList::updateRemove()
MuteListUpdate service viewer Tells the viewer the filename of the mute list to request
  • hooked up by the LLMuteList constructor
  • handled handled by LLMuteList::processMuteListUpdate()
UseCachedMuteList service viewer Tells the viewer to use its cached copy of the mute list
  • hooked up by the LLMuteList' constructor
  • handled by LLMuteList::processUseCachedMuteList()

Effects of Muting

Muting objects and agents currently (as of 1.16.0.5, at least) has the following effects:

Agents

  • LLVOAvatar::idleUpdate() in llvoavatar.cpp
    • adds "(muted)" to name bubble for muted agents
  • LLVOAvatar::updateCharacter()
    • doesn't trigger sounds from muted avatars
  • LLVOAvatar::processSingleAnimationStateChange()
    • doesn't trigger animation sounds from muted avatars

Objects

  • callback_load_url_name() in llviewermessage.cpp;'
    • doesn't display URL prompts for URLs from muted objects
  • process_load_url() in llviewermessage.cpp
    • doesn't load URLs from muted objects
    • doesn't load URLs from objects owned by muted agents
  • LLViewerObject::unpackParticleSource() in llviewerobject.cpp
    • doesn't create particle systems for muted objects
    • doesn't create particle systems for objects owned by muted agents

Inventory

  • inventory_offer_handler() in llviewermessage.cpp
    • declines inventory offers from muted agents
    • logs an IM message saying the inventory offer was declined
  • process_offer_callingcard() in llviewermessage.cpp
    • declines calling card offers from muted agents

Sounds

  • LLAudioSourceVO::updateGain() in llaudiosourcevo.cpp
    • always mutes audio for muted objects
    • muted audio has gain set to 0.0
  • process_sound_trigger() in llviewermessage.cpp
    • doesn't trigger sounds from muted objects or avatars
  • process_preload_sound() in llviewermessage.cpp
    • doesn't preload sounds from muted objects
    • doesn't preload sounds owned by muted agents
  • process_attached_sound() in llviewermessage.cpp
    • doesn't play attached sounds from muted objects

Chat

  • process_chat_from_simulator() in llviewermessage.cpp
    • doesn't look at muted avatars when they chat
    • doesn't show chat messages from muted avatars