summaryrefslogtreecommitdiff
path: root/indra/newview/llmutelist.cpp
diff options
context:
space:
mode:
authorJon Wolk <jwolk@lindenlab.com>2007-12-19 00:56:59 +0000
committerJon Wolk <jwolk@lindenlab.com>2007-12-19 00:56:59 +0000
commit7dd08303a3ebf9718c2c60a4d94b81d5d7845f8c (patch)
tree6195a8585cc7998647afcaec2167e728e4abd3c1 /indra/newview/llmutelist.cpp
parent4d87303e78c1accde85b217b325e0c08930b0c4c (diff)
svn merge -r 75354:76103 svn+ssh://svn.lindenlab.com/svn/linden/branches/voice-group-moderation-3 -> release. Finished product of QAR-134
Diffstat (limited to 'indra/newview/llmutelist.cpp')
-rw-r--r--indra/newview/llmutelist.cpp54
1 files changed, 53 insertions, 1 deletions
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 <boost/tokenizer.hpp>
#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<LLUUID, F32> 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