From 7dd08303a3ebf9718c2c60a4d94b81d5d7845f8c Mon Sep 17 00:00:00 2001 From: Jon Wolk Date: Wed, 19 Dec 2007 00:56:59 +0000 Subject: svn merge -r 75354:76103 svn+ssh://svn.lindenlab.com/svn/linden/branches/voice-group-moderation-3 -> release. Finished product of QAR-134 --- indra/newview/llmutelist.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmutelist.cpp') diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 4d02af8fae..60d39b62bd 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -52,10 +52,11 @@ #include #include "llcrc.h" +#include "lldir.h" #include "lldispatcher.h" +#include "llsdserialize.h" #include "llxfermanager.h" #include "message.h" -#include "lldir.h" #include "llagent.h" #include "llfloatermute.h" @@ -67,6 +68,9 @@ LLMuteList* gMuteListp = NULL; +std::map LLMuteList::sUserVolumeSettings; + + // "emptymutelist" class LLDispatchEmptyMuteList : public LLDispatchHandler { @@ -168,6 +172,24 @@ LLMuteList::LLMuteList() : msg->setHandlerFuncFast(_PREHASH_UseCachedMuteList, processUseCachedMuteList); gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); + + // load per-resident voice volume information + // conceptually, this is part of the mute list information, although it is only stored locally + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); + + LLSD settings_llsd; + llifstream file; + file.open(filename.c_str()); + if (file.is_open()) + { + LLSDSerialize::fromXML(settings_llsd, file); + } + + for (LLSD::map_const_iterator iter = settings_llsd.beginMap(); + iter != settings_llsd.endMap(); ++iter) + { + sUserVolumeSettings.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal())); + } } //----------------------------------------------------------------------------- @@ -175,6 +197,17 @@ LLMuteList::LLMuteList() : //----------------------------------------------------------------------------- LLMuteList::~LLMuteList() { + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); + LLSD settings_llsd; + + for(user_volume_map_t::iterator iter = sUserVolumeSettings.begin(); iter != sUserVolumeSettings.end(); ++iter) + { + settings_llsd[iter->first.asString()] = iter->second; + } + + llofstream file; + file.open(filename.c_str()); + LLSDSerialize::toPrettyXML(settings_llsd, file); } BOOL LLMuteList::isLinden(const LLString& name) const @@ -588,6 +621,25 @@ void LLMuteList::cache(const LLUUID& agent_id) } } +void LLMuteList::setSavedResidentVolume(const LLUUID& id, F32 volume) +{ + // store new value in volume settings file + sUserVolumeSettings[id] = volume; +} + +F32 LLMuteList::getSavedResidentVolume(const LLUUID& id) +{ + const F32 DEFAULT_VOLUME = 0.5f; + + user_volume_map_t::iterator found_it = sUserVolumeSettings.find(id); + if (found_it != sUserVolumeSettings.end()) + { + return found_it->second; + } + //FIXME: assumes default, should get this from somewhere + return DEFAULT_VOLUME; +} + //----------------------------------------------------------------------------- // Static message handlers -- cgit v1.2.3