summaryrefslogtreecommitdiff
path: root/indra/newview/llgroupmgr.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-01-28 12:48:48 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2010-01-28 12:48:48 -0800
commit5a34cf1af83314774f11b0d24279794794bc9147 (patch)
tree720b576c642646f27d3e5b4f7ccba91b9e708371 /indra/newview/llgroupmgr.cpp
parent2795661869e3dbbfe1e6becec1d6bb3635eafd3b (diff)
parentfc8e185fafcfea1ead8b9c064ed38d5ac65f81b6 (diff)
Merge from viewer2 trunk.
Diffstat (limited to 'indra/newview/llgroupmgr.cpp')
-rw-r--r--indra/newview/llgroupmgr.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index af58e81ca4..8bd0e520c3 100644
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -762,6 +762,14 @@ void LLGroupMgr::addObserver(LLGroupMgrObserver* observer)
mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer));
}
+void LLGroupMgr::addObserver(const LLUUID& group_id, LLParticularGroupMgrObserver* observer)
+{
+ if(group_id.notNull() && observer)
+ {
+ mParticularObservers[group_id].insert(observer);
+ }
+}
+
void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer)
{
if (!observer)
@@ -784,6 +792,23 @@ void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer)
}
}
+void LLGroupMgr::removeObserver(const LLUUID& group_id, LLParticularGroupMgrObserver* observer)
+{
+ if(group_id.isNull() || !observer)
+ {
+ return;
+ }
+
+ observer_map_t::iterator obs_it = mParticularObservers.find(group_id);
+ if(obs_it == mParticularObservers.end())
+ return;
+
+ obs_it->second.erase(observer);
+
+ if (obs_it->second.size() == 0)
+ mParticularObservers.erase(obs_it);
+}
+
LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id)
{
group_map_t::iterator gi = mGroups.find(id);
@@ -1325,6 +1350,7 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc)
LLUUID group_id = gi->first;
if (gi->second->mChanged)
{
+ // notify LLGroupMgrObserver
// Copy the map because observers may remove themselves on update
observer_multimap_t observers = mObservers;
@@ -1336,6 +1362,18 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc)
oi->second->changed(gc);
}
gi->second->mChanged = FALSE;
+
+
+ // notify LLParticularGroupMgrObserver
+ observer_map_t::iterator obs_it = mParticularObservers.find(group_id);
+ if(obs_it == mParticularObservers.end())
+ return;
+
+ observer_set_t& obs = obs_it->second;
+ for (observer_set_t::iterator ob_it = obs.begin(); ob_it != obs.end(); ++ob_it)
+ {
+ (*ob_it)->changed(group_id, gc);
+ }
}
}
}