summaryrefslogtreecommitdiff
path: root/indra/llui/llnotificationslistener.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2014-03-28 10:30:03 -0400
committerNat Goodspeed <nat@lindenlab.com>2014-03-28 10:30:03 -0400
commitba892274b393550be3cc7a25ff0e8f86cc1344a9 (patch)
tree1b4db1b8b2470ecd438be38dbef30dafbf72adb4 /indra/llui/llnotificationslistener.cpp
parent0fddf9656b5ff704859f590eac9df522cbe39ef0 (diff)
DRTVWR-363: Fix LLNotificationsListener::listChannels() channel walk.
LLNotifications::ChannelMap went away when LLNotificationChannel became an LLInstanceTracker subclass. Iterate the universe of channels using LLNotificationChannel::beginInstances(), endInstances() instead. More troubling is that LLNotificationChannel::getParentChannelName() went away too. When LLNotificationChannel acquired a Params block and corresponding constructor, it acquired the ability to listen on multiple upstream sources. That meant that a single mParent string became inapplicable, and its access method was removed. (Curiously, mParent was not itself removed, but it was left unused.) Change mParent to mParents, a vector<string>, built by connectToChannel(). Introduce getParents(), an accessor returning an iterator_range over that vector. Change LLNotificationsListener::listChannels() to collect a "parents" key in the map returned for each channel, and -- for backwards compatibility -- capture the first entry in the "parents" array as "parent".
Diffstat (limited to 'indra/llui/llnotificationslistener.cpp')
-rw-r--r--indra/llui/llnotificationslistener.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp
index 3bbeb3a778..b6a32a0e78 100644
--- a/indra/llui/llnotificationslistener.cpp
+++ b/indra/llui/llnotificationslistener.cpp
@@ -32,6 +32,7 @@
#include "llnotificationtemplate.h"
#include "llsd.h"
#include "llui.h"
+#include <boost/foreach.hpp>
LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) :
LLEventAPI("LLNotifications",
@@ -121,13 +122,18 @@ void LLNotificationsListener::listChannels(const LLSD& params) const
{
LLReqID reqID(params);
LLSD response(reqID.makeResponse());
- for (LLNotifications::ChannelMap::const_iterator cmi(mNotifications.mChannels.begin()),
- cmend(mNotifications.mChannels.end());
+ for (LLNotificationChannel::instance_iter cmi(LLNotificationChannel::beginInstances()),
+ cmend(LLNotificationChannel::endInstances());
cmi != cmend; ++cmi)
{
- LLSD channelInfo;
- channelInfo["parent"] = cmi->second->getParentChannelName();
- response[cmi->first] = channelInfo;
+ LLSD channelInfo, parents;
+ BOOST_FOREACH(const std::string& parent, cmi->getParents())
+ {
+ parents.append(parent);
+ }
+ channelInfo["parents"] = parents;
+ channelInfo["parent"] = parents.size()? parents[0] : "";
+ response[cmi->getName()] = channelInfo;
}
LLEventPumps::instance().obtain(params["reply"]).post(response);
}