diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llmutelist.cpp | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/linden/indra/newview/llmutelist.cpp b/linden/indra/newview/llmutelist.cpp index d00a8c8..a9bf4b3 100644 --- a/linden/indra/newview/llmutelist.cpp +++ b/linden/indra/newview/llmutelist.cpp | |||
@@ -71,6 +71,24 @@ | |||
71 | #include "llviewerobject.h" | 71 | #include "llviewerobject.h" |
72 | #include "llviewerobjectlist.h" | 72 | #include "llviewerobjectlist.h" |
73 | 73 | ||
74 | namespace | ||
75 | { | ||
76 | // This method is used to return an object to mute given an object id. | ||
77 | // Its used by the LLMute constructor and LLMuteList::isMuted. | ||
78 | LLViewerObject* get_object_to_mute_from_id(LLUUID object_id) | ||
79 | { | ||
80 | LLViewerObject *objectp = gObjectList.findObject(object_id); | ||
81 | if ((objectp) && (!objectp->isAvatar())) | ||
82 | { | ||
83 | LLViewerObject *parentp = (LLViewerObject *)objectp->getParent(); | ||
84 | if (parentp && parentp->getID() != gAgent.getID()) | ||
85 | { | ||
86 | objectp = parentp; | ||
87 | } | ||
88 | } | ||
89 | return objectp; | ||
90 | } | ||
91 | } | ||
74 | 92 | ||
75 | // "emptymutelist" | 93 | // "emptymutelist" |
76 | class LLDispatchEmptyMuteList : public LLDispatchHandler | 94 | class LLDispatchEmptyMuteList : public LLDispatchHandler |
@@ -105,15 +123,21 @@ LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags) | |||
105 | mFlags(flags) | 123 | mFlags(flags) |
106 | { | 124 | { |
107 | // muting is done by root objects only - try to find this objects root | 125 | // muting is done by root objects only - try to find this objects root |
108 | LLViewerObject *objectp = gObjectList.findObject(mID); | 126 | LLViewerObject* mute_object = get_object_to_mute_from_id(id); |
109 | if ((objectp) && (!objectp->isAvatar())) | 127 | if(mute_object && mute_object->getID() != id) |
110 | { | 128 | { |
111 | LLViewerObject *parentp = (LLViewerObject *)objectp->getParent(); | 129 | mID = mute_object->getID(); |
112 | if (parentp) | 130 | LLNameValue* firstname = mute_object->getNVPair("FirstName"); |
131 | LLNameValue* lastname = mute_object->getNVPair("LastName"); | ||
132 | if (firstname && lastname) | ||
113 | { | 133 | { |
114 | mID = parentp->getID(); | 134 | mName.assign( firstname->getString() ); |
135 | mName.append(" "); | ||
136 | mName.append( lastname->getString() ); | ||
115 | } | 137 | } |
138 | mType = mute_object->isAvatar() ? AGENT : OBJECT; | ||
116 | } | 139 | } |
140 | |||
117 | } | 141 | } |
118 | 142 | ||
119 | 143 | ||
@@ -662,19 +686,10 @@ BOOL LLMuteList::saveToFile(const std::string& filename) | |||
662 | 686 | ||
663 | BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) const | 687 | BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) const |
664 | { | 688 | { |
665 | LLUUID id_to_check = id; | ||
666 | |||
667 | // for objects, check for muting on their parent prim | 689 | // for objects, check for muting on their parent prim |
668 | LLViewerObject *objectp = gObjectList.findObject(id); | 690 | LLViewerObject* mute_object = get_object_to_mute_from_id(id); |
669 | if ((objectp) && (!objectp->isAvatar())) | 691 | LLUUID id_to_check = (mute_object) ? mute_object->getID() : id; |
670 | { | 692 | |
671 | LLViewerObject *parentp = (LLViewerObject *)objectp->getParent(); | ||
672 | if (parentp) | ||
673 | { | ||
674 | id_to_check = parentp->getID(); | ||
675 | } | ||
676 | } | ||
677 | |||
678 | // don't need name or type for lookup | 693 | // don't need name or type for lookup |
679 | LLMute mute(id_to_check); | 694 | LLMute mute(id_to_check); |
680 | mute_set_t::const_iterator mute_it = mMutes.find(mute); | 695 | mute_set_t::const_iterator mute_it = mMutes.find(mute); |