diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llmutelist.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llmutelist.cpp')
-rw-r--r-- | linden/indra/newview/llmutelist.cpp | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/linden/indra/newview/llmutelist.cpp b/linden/indra/newview/llmutelist.cpp index 9b645a6..c411ffe 100644 --- a/linden/indra/newview/llmutelist.cpp +++ b/linden/indra/newview/llmutelist.cpp | |||
@@ -59,14 +59,12 @@ | |||
59 | #include "message.h" | 59 | #include "message.h" |
60 | 60 | ||
61 | #include "llagent.h" | 61 | #include "llagent.h" |
62 | #include "llfloatermute.h" | ||
63 | #include "llviewergenericmessage.h" // for gGenericDispatcher | 62 | #include "llviewergenericmessage.h" // for gGenericDispatcher |
64 | #include "llviewerwindow.h" | 63 | #include "llviewerwindow.h" |
65 | #include "llworld.h" //for particle system banning | 64 | #include "llworld.h" //for particle system banning |
66 | #include "llviewerobject.h" | 65 | #include "llviewerobject.h" |
67 | #include "llviewerobjectlist.h" | 66 | #include "llviewerobjectlist.h" |
68 | 67 | ||
69 | LLMuteList* gMuteListp = NULL; | ||
70 | 68 | ||
71 | std::map<LLUUID, F32> LLMuteList::sUserVolumeSettings; | 69 | std::map<LLUUID, F32> LLMuteList::sUserVolumeSettings; |
72 | 70 | ||
@@ -81,7 +79,7 @@ public: | |||
81 | const LLUUID& invoice, | 79 | const LLUUID& invoice, |
82 | const sparam_t& strings) | 80 | const sparam_t& strings) |
83 | { | 81 | { |
84 | gMuteListp->setLoaded(); | 82 | LLMuteList::getInstance()->setLoaded(); |
85 | return true; | 83 | return true; |
86 | } | 84 | } |
87 | }; | 85 | }; |
@@ -159,18 +157,27 @@ void LLMute::setFromDisplayName(const LLString& display_name) | |||
159 | return; | 157 | return; |
160 | } | 158 | } |
161 | 159 | ||
160 | /* static */ | ||
161 | LLMuteList* LLMuteList::getInstance() | ||
162 | { | ||
163 | // Register callbacks at the first time that we find that the message system has been created. | ||
164 | static BOOL registered = FALSE; | ||
165 | if( !registered && gMessageSystem != NULL) | ||
166 | { | ||
167 | registered = TRUE; | ||
168 | // Register our various callbacks | ||
169 | gMessageSystem->setHandlerFuncFast(_PREHASH_MuteListUpdate, processMuteListUpdate); | ||
170 | gMessageSystem->setHandlerFuncFast(_PREHASH_UseCachedMuteList, processUseCachedMuteList); | ||
171 | } | ||
172 | return LLSingleton<LLMuteList>::getInstance(); // Call the "base" implementation. | ||
173 | } | ||
174 | |||
162 | //----------------------------------------------------------------------------- | 175 | //----------------------------------------------------------------------------- |
163 | // LLMuteList() | 176 | // LLMuteList() |
164 | //----------------------------------------------------------------------------- | 177 | //----------------------------------------------------------------------------- |
165 | LLMuteList::LLMuteList() : | 178 | LLMuteList::LLMuteList() : |
166 | mIsLoaded(FALSE) | 179 | mIsLoaded(FALSE) |
167 | { | 180 | { |
168 | LLMessageSystem* msg = gMessageSystem; | ||
169 | |||
170 | // Register our various callbacks | ||
171 | msg->setHandlerFuncFast(_PREHASH_MuteListUpdate, processMuteListUpdate); | ||
172 | msg->setHandlerFuncFast(_PREHASH_UseCachedMuteList, processUseCachedMuteList); | ||
173 | |||
174 | gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); | 181 | gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); |
175 | 182 | ||
176 | // load per-resident voice volume information | 183 | // load per-resident voice volume information |
@@ -318,7 +325,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) | |||
318 | //Kill all particle systems owned by muted task | 325 | //Kill all particle systems owned by muted task |
319 | if(localmute.mType == LLMute::AGENT || localmute.mType == LLMute::OBJECT) | 326 | if(localmute.mType == LLMute::AGENT || localmute.mType == LLMute::OBJECT) |
320 | { | 327 | { |
321 | gWorldPointer->mPartSim.clearParticlesByOwnerID(localmute.mID); | 328 | LLViewerPartSim::getInstance()->clearParticlesByOwnerID(localmute.mID); |
322 | } | 329 | } |
323 | } | 330 | } |
324 | return TRUE; | 331 | return TRUE; |
@@ -345,7 +352,7 @@ void LLMuteList::updateAdd(const LLMute& mute) | |||
345 | msg->addU32("MuteFlags", mute.mFlags); | 352 | msg->addU32("MuteFlags", mute.mFlags); |
346 | gAgent.sendReliableMessage(); | 353 | gAgent.sendReliableMessage(); |
347 | 354 | ||
348 | mIsLoaded = TRUE; | 355 | mIsLoaded = TRUE; // why is this here? -MG |
349 | } | 356 | } |
350 | 357 | ||
351 | 358 | ||
@@ -398,8 +405,7 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags) | |||
398 | } | 405 | } |
399 | 406 | ||
400 | // Must be after erase. | 407 | // Must be after erase. |
401 | notifyObservers(); | 408 | setLoaded(); // why is this here? -MG |
402 | found = TRUE; | ||
403 | } | 409 | } |
404 | 410 | ||
405 | // Clean up any legacy mutes | 411 | // Clean up any legacy mutes |
@@ -411,8 +417,7 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags) | |||
411 | updateRemove(mute); | 417 | updateRemove(mute); |
412 | mLegacyMutes.erase(legacy_it); | 418 | mLegacyMutes.erase(legacy_it); |
413 | // Must be after erase. | 419 | // Must be after erase. |
414 | notifyObservers(); | 420 | setLoaded(); // why is this here? -MG |
415 | found = TRUE; | ||
416 | } | 421 | } |
417 | 422 | ||
418 | return found; | 423 | return found; |
@@ -502,8 +507,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) | |||
502 | } | 507 | } |
503 | } | 508 | } |
504 | fclose(fp); | 509 | fclose(fp); |
505 | mIsLoaded = TRUE; | 510 | setLoaded(); |
506 | notifyObservers(); | ||
507 | return TRUE; | 511 | return TRUE; |
508 | } | 512 | } |
509 | 513 | ||
@@ -673,24 +677,22 @@ void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**) | |||
673 | void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**) | 677 | void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**) |
674 | { | 678 | { |
675 | llinfos << "LLMuteList::processUseCachedMuteList()" << llendl; | 679 | llinfos << "LLMuteList::processUseCachedMuteList()" << llendl; |
676 | if (!gMuteListp) return; | ||
677 | 680 | ||
678 | char agent_id_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ | 681 | char agent_id_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ |
679 | gAgent.getID().toString(agent_id_string); | 682 | gAgent.getID().toString(agent_id_string); |
680 | char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ | 683 | char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ |
681 | snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); /* Flawfinder: ignore */ | 684 | snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); /* Flawfinder: ignore */ |
682 | gMuteListp->loadFromFile(filename); | 685 | LLMuteList::getInstance()->loadFromFile(filename); |
683 | } | 686 | } |
684 | 687 | ||
685 | void LLMuteList::onFileMuteList(void** user_data, S32 error_code, LLExtStat ext_status) | 688 | void LLMuteList::onFileMuteList(void** user_data, S32 error_code, LLExtStat ext_status) |
686 | { | 689 | { |
687 | llinfos << "LLMuteList::processMuteListFile()" << llendl; | 690 | llinfos << "LLMuteList::processMuteListFile()" << llendl; |
688 | if (!gMuteListp) return; | ||
689 | 691 | ||
690 | std::string *local_filename_and_path = (std::string*)user_data; | 692 | std::string *local_filename_and_path = (std::string*)user_data; |
691 | if(local_filename_and_path && !local_filename_and_path->empty() && (error_code == 0)) | 693 | if(local_filename_and_path && !local_filename_and_path->empty() && (error_code == 0)) |
692 | { | 694 | { |
693 | gMuteListp->loadFromFile(local_filename_and_path->c_str()); | 695 | LLMuteList::getInstance()->loadFromFile(local_filename_and_path->c_str()); |
694 | LLFile::remove(local_filename_and_path->c_str()); | 696 | LLFile::remove(local_filename_and_path->c_str()); |
695 | } | 697 | } |
696 | delete local_filename_and_path; | 698 | delete local_filename_and_path; |
@@ -714,14 +716,6 @@ void LLMuteList::setLoaded() | |||
714 | 716 | ||
715 | void LLMuteList::notifyObservers() | 717 | void LLMuteList::notifyObservers() |
716 | { | 718 | { |
717 | // HACK: LLFloaterMute is constructed before LLMuteList, | ||
718 | // so it can't easily observe it. Changing this requires | ||
719 | // much reshuffling of the startup process. JC | ||
720 | if (gFloaterMute) | ||
721 | { | ||
722 | gFloaterMute->refreshMuteList(); | ||
723 | } | ||
724 | |||
725 | for (observer_set_t::iterator it = mObservers.begin(); | 719 | for (observer_set_t::iterator it = mObservers.begin(); |
726 | it != mObservers.end(); | 720 | it != mObservers.end(); |
727 | ) | 721 | ) |