Skip to content
Snippets Groups Projects
Commit 10d50d44 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files
parents c71e459b 220b4166
No related branches found
No related tags found
No related merge requests found
...@@ -1189,6 +1189,7 @@ void LLNotificationChannel::connectToChannel( const std::string& channel_name ) ...@@ -1189,6 +1189,7 @@ void LLNotificationChannel::connectToChannel( const std::string& channel_name )
} }
else else
{ {
mParents.push_back(channel_name);
LLNotificationChannelPtr p = LLNotifications::instance().getChannel(channel_name); LLNotificationChannelPtr p = LLNotifications::instance().getChannel(channel_name);
p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1));
} }
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#include <boost/enable_shared_from_this.hpp> #include <boost/enable_shared_from_this.hpp>
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#include <boost/signals2.hpp> #include <boost/signals2.hpp>
#include <boost/range.hpp>
#include "llevents.h" #include "llevents.h"
#include "llfunctorregistry.h" #include "llfunctorregistry.h"
...@@ -839,6 +840,11 @@ class LLNotificationChannel : ...@@ -839,6 +840,11 @@ class LLNotificationChannel :
typedef LLNotificationSet::iterator Iterator; typedef LLNotificationSet::iterator Iterator;
std::string getName() const { return mName; } std::string getName() const { return mName; }
typedef std::vector<std::string>::const_iterator parents_iter;
boost::iterator_range<parents_iter> getParents() const
{
return boost::iterator_range<parents_iter>(mParents);
}
void connectToChannel(const std::string& channel_name); void connectToChannel(const std::string& channel_name);
...@@ -853,7 +859,7 @@ class LLNotificationChannel : ...@@ -853,7 +859,7 @@ class LLNotificationChannel :
private: private:
std::string mName; std::string mName;
std::string mParent; std::vector<std::string> mParents;
}; };
// An interface class to provide a clean linker seam to the LLNotifications class. // An interface class to provide a clean linker seam to the LLNotifications class.
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "llnotificationtemplate.h" #include "llnotificationtemplate.h"
#include "llsd.h" #include "llsd.h"
#include "llui.h" #include "llui.h"
#include <boost/foreach.hpp>
LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) :
LLEventAPI("LLNotifications", LLEventAPI("LLNotifications",
...@@ -42,11 +43,10 @@ LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications ...@@ -42,11 +43,10 @@ LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications
"Add a notification with specified [\"name\"], [\"substitutions\"] and [\"payload\"].\n" "Add a notification with specified [\"name\"], [\"substitutions\"] and [\"payload\"].\n"
"If optional [\"reply\"] specified, arrange to send user response on that LLEventPump.", "If optional [\"reply\"] specified, arrange to send user response on that LLEventPump.",
&LLNotificationsListener::requestAdd); &LLNotificationsListener::requestAdd);
/* add("listChannels", add("listChannels",
"Post to [\"reply\"] a map of info on existing channels", "Post to [\"reply\"] a map of info on existing channels",
&LLNotificationsListener::listChannels, &LLNotificationsListener::listChannels,
LLSD().with("reply", LLSD())); LLSD().with("reply", LLSD()));
*/
add("listChannelNotifications", add("listChannelNotifications",
"Post to [\"reply\"] an array of info on notifications in channel [\"channel\"]", "Post to [\"reply\"] an array of info on notifications in channel [\"channel\"]",
&LLNotificationsListener::listChannelNotifications, &LLNotificationsListener::listChannelNotifications,
...@@ -117,26 +117,27 @@ void LLNotificationsListener::NotificationResponder(const std::string& reply_pum ...@@ -117,26 +117,27 @@ void LLNotificationsListener::NotificationResponder(const std::string& reply_pum
reponse_event["response"] = response; reponse_event["response"] = response;
LLEventPumps::getInstance()->obtain(reply_pump).post(reponse_event); LLEventPumps::getInstance()->obtain(reply_pump).post(reponse_event);
} }
/*
void LLNotificationsListener::listChannels(const LLSD& params) const void LLNotificationsListener::listChannels(const LLSD& params) const
{ {
LLReqID reqID(params); LLReqID reqID(params);
LLSD response(reqID.makeResponse()); LLSD response(reqID.makeResponse());
for (LLNotifications:: for (LLNotificationChannel::instance_iter cmi(LLNotificationChannel::beginInstances()),
cmend(LLNotificationChannel::endInstances());
for (LLNotifications::ChannelMap::const_iterator cmi(mNotifications.mChannels.begin()),
cmend(mNotifications.mChannels.end());
cmi != cmend; ++cmi) cmi != cmend; ++cmi)
{ {
LLSD channelInfo; LLSD channelInfo, parents;
channelInfo["parent"] = cmi->second->getParentChannelName(); BOOST_FOREACH(const std::string& parent, cmi->getParents())
response[cmi->first] = channelInfo; {
parents.append(parent);
}
channelInfo["parents"] = parents;
channelInfo["parent"] = parents.size()? parents[0] : "";
response[cmi->getName()] = channelInfo;
} }
LLEventPumps::instance().obtain(params["reply"]).post(response); LLEventPumps::instance().obtain(params["reply"]).post(response);
} }
*/
void LLNotificationsListener::listChannelNotifications(const LLSD& params) const void LLNotificationsListener::listChannelNotifications(const LLSD& params) const
{ {
LLReqID reqID(params); LLReqID reqID(params);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment