Muting Objects and Agents
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
- The viewer requests the agent's mute list by calling LLMuteList::requestFromServer() in llmutelist.cpp
- The viewer sends a MuteListRequest message to the service
- 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
- The viewer recevies a MuteListUpdate message from the serice
- The mute list file specified in the message is requested by the viewer
- Upon receipt of the mute list file, the callback LLMuteList::onFileMuteList() is invoked
- The viewer opens the received file, and invokes LLMuteList::loadFromFile() to parse it
Loading a cached Mute List
- The viewer receives a UseCachedMuteList message from the service
- The viewer opens the cached file, and invokes LLMuteList::loadFromFile() to parse it
Populating the Global Mute List
- The mute list file, whether new or cached, is opened by LLMuteList::loadFromFile()
- Each mute entry in the pipe-delimited list is parsed
- 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 |
|
UseCachedMuteList | service | viewer | Tells the viewer to use its cached copy of the mute list |
|