aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmutelist.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:27 -0500
committerJacek Antonelli2008-08-15 23:45:27 -0500
commita8a62201ba762e98dff92cf49033e577fc34d8d4 (patch)
tree11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/newview/llmutelist.cpp
parentSecond Life viewer sources 1.18.6.4-RC (diff)
downloadmeta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/newview/llmutelist.cpp')
-rw-r--r--linden/indra/newview/llmutelist.cpp75
1 files changed, 71 insertions, 4 deletions
diff --git a/linden/indra/newview/llmutelist.cpp b/linden/indra/newview/llmutelist.cpp
index 84c3c75..9b645a6 100644
--- a/linden/indra/newview/llmutelist.cpp
+++ b/linden/indra/newview/llmutelist.cpp
@@ -13,12 +13,12 @@
13 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlife.com/developers/opensource/gplv2 16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 * 17 *
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlife.com/developers/opensource/flossexception 21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 22 *
23 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -52,19 +52,25 @@
52#include <boost/tokenizer.hpp> 52#include <boost/tokenizer.hpp>
53 53
54#include "llcrc.h" 54#include "llcrc.h"
55#include "lldir.h"
55#include "lldispatcher.h" 56#include "lldispatcher.h"
57#include "llsdserialize.h"
56#include "llxfermanager.h" 58#include "llxfermanager.h"
57#include "message.h" 59#include "message.h"
58#include "lldir.h"
59 60
60#include "llagent.h" 61#include "llagent.h"
61#include "llfloatermute.h" 62#include "llfloatermute.h"
62#include "llviewergenericmessage.h" // for gGenericDispatcher 63#include "llviewergenericmessage.h" // for gGenericDispatcher
63#include "llviewerwindow.h" 64#include "llviewerwindow.h"
64#include "llworld.h" //for particle system banning 65#include "llworld.h" //for particle system banning
66#include "llviewerobject.h"
67#include "llviewerobjectlist.h"
65 68
66LLMuteList* gMuteListp = NULL; 69LLMuteList* gMuteListp = NULL;
67 70
71std::map<LLUUID, F32> LLMuteList::sUserVolumeSettings;
72
73
68// "emptymutelist" 74// "emptymutelist"
69class LLDispatchEmptyMuteList : public LLDispatchHandler 75class LLDispatchEmptyMuteList : public LLDispatchHandler
70{ 76{
@@ -166,6 +172,24 @@ LLMuteList::LLMuteList() :
166 msg->setHandlerFuncFast(_PREHASH_UseCachedMuteList, processUseCachedMuteList); 172 msg->setHandlerFuncFast(_PREHASH_UseCachedMuteList, processUseCachedMuteList);
167 173
168 gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); 174 gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList);
175
176 // load per-resident voice volume information
177 // conceptually, this is part of the mute list information, although it is only stored locally
178 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml");
179
180 LLSD settings_llsd;
181 llifstream file;
182 file.open(filename.c_str());
183 if (file.is_open())
184 {
185 LLSDSerialize::fromXML(settings_llsd, file);
186 }
187
188 for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
189 iter != settings_llsd.endMap(); ++iter)
190 {
191 sUserVolumeSettings.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal()));
192 }
169} 193}
170 194
171//----------------------------------------------------------------------------- 195//-----------------------------------------------------------------------------
@@ -173,6 +197,17 @@ LLMuteList::LLMuteList() :
173//----------------------------------------------------------------------------- 197//-----------------------------------------------------------------------------
174LLMuteList::~LLMuteList() 198LLMuteList::~LLMuteList()
175{ 199{
200 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml");
201 LLSD settings_llsd;
202
203 for(user_volume_map_t::iterator iter = sUserVolumeSettings.begin(); iter != sUserVolumeSettings.end(); ++iter)
204 {
205 settings_llsd[iter->first.asString()] = iter->second;
206 }
207
208 llofstream file;
209 file.open(filename.c_str());
210 LLSDSerialize::toPrettyXML(settings_llsd, file);
176} 211}
177 212
178BOOL LLMuteList::isLinden(const LLString& name) const 213BOOL LLMuteList::isLinden(const LLString& name) const
@@ -513,8 +548,21 @@ BOOL LLMuteList::saveToFile(const LLString& filename)
513 548
514BOOL LLMuteList::isMuted(const LLUUID& id, const LLString& name, U32 flags) const 549BOOL LLMuteList::isMuted(const LLUUID& id, const LLString& name, U32 flags) const
515{ 550{
551 LLUUID id_to_check = id;
552
553 // for objects, check for muting on their parent prim
554 LLViewerObject *objectp = gObjectList.findObject(id);
555 if ((objectp) && (!objectp->isAvatar()))
556 {
557 LLViewerObject *parentp = (LLViewerObject *)objectp->getParent();
558 if (parentp)
559 {
560 id_to_check = parentp->getID();
561 }
562 }
563
516 // don't need name or type for lookup 564 // don't need name or type for lookup
517 LLMute mute(id); 565 LLMute mute(id_to_check);
518 mute_set_t::const_iterator mute_it = mMutes.find(mute); 566 mute_set_t::const_iterator mute_it = mMutes.find(mute);
519 if (mute_it != mMutes.end()) 567 if (mute_it != mMutes.end())
520 { 568 {
@@ -573,6 +621,25 @@ void LLMuteList::cache(const LLUUID& agent_id)
573 } 621 }
574} 622}
575 623
624void LLMuteList::setSavedResidentVolume(const LLUUID& id, F32 volume)
625{
626 // store new value in volume settings file
627 sUserVolumeSettings[id] = volume;
628}
629
630F32 LLMuteList::getSavedResidentVolume(const LLUUID& id)
631{
632 const F32 DEFAULT_VOLUME = 0.5f;
633
634 user_volume_map_t::iterator found_it = sUserVolumeSettings.find(id);
635 if (found_it != sUserVolumeSettings.end())
636 {
637 return found_it->second;
638 }
639 //FIXME: assumes default, should get this from somewhere
640 return DEFAULT_VOLUME;
641}
642
576 643
577//----------------------------------------------------------------------------- 644//-----------------------------------------------------------------------------
578// Static message handlers 645// Static message handlers