diff options
author | rider <rider@lindenlab.com> | 2015-12-17 09:06:19 -0800 |
---|---|---|
committer | rider <rider@lindenlab.com> | 2015-12-17 09:06:19 -0800 |
commit | 83c9c6df07ab602bdbd2487e587956d0e67993e2 (patch) | |
tree | aa6d63f2bf8812035508f8b3119e68a2a48aacc9 | |
parent | f4b6a89ab0050b7926c47f6c59e0493391d4452b (diff) |
MAINT-5976: Adding MailDrop type event Queue
-rwxr-xr-x | indra/llcommon/llevents.cpp | 31 | ||||
-rwxr-xr-x | indra/llcommon/llevents.h | 37 |
2 files changed, 64 insertions, 4 deletions
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index bb3a137815..080830a134 100755 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -508,6 +508,37 @@ bool LLEventStream::post(const LLSD& event) } /***************************************************************************** + * LLEventMailDrop + *****************************************************************************/ +bool LLEventMailDrop::post(const LLSD& event) +{ + bool posted = LLEventPump::post(event); + + if (!posted) + { + mEventHistory.push_back(event); + } + + return posted; +} + +LLBoundListener LLEventMailDrop::listen_impl(const std::string& name, + const LLEventListener& listener, + const NameList& after, + const NameList& before) +{ + LLBoundListener bndlistener = LLEventPump::listen_impl(name, listener, after, before); + + return bndlistener; +} + +// typedef std::list<LLSD> EventList; +// EventList mEventHistory; + + + + +/***************************************************************************** * LLEventQueue *****************************************************************************/ bool LLEventQueue::post(const LLSD& event) diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 8d4fa68350..b07db889c0 100755 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -554,12 +554,13 @@ private: virtual void reset(); private: - virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, - const NameList& after, - const NameList& before); std::string mName; protected: + virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, + const NameList& after, + const NameList& before); + /// implement the dispatching boost::shared_ptr<LLStandardSignal> mSignal; @@ -598,10 +599,38 @@ public: }; /***************************************************************************** + * LLEventMailDrop + *****************************************************************************/ +/** + * LLEventMailDrop is a specialization of LLEventStream. Events are posted normally, + * however if no listeners return that they have handled the event it is placed in + * a list. Subsequent attaching listeners will recieve stored events until a + * listener indicates that the event has been handled. + */ +class LL_COMMON_API LLEventMailDrop: public LLEventPump +{ +public: + LLEventMailDrop(const std::string& name, bool tweak=false): LLEventPump(name, tweak) {} + virtual ~LLEventMailDrop() {} + + /// Post an event to all listeners + virtual bool post(const LLSD& event); + +protected: + virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, + const NameList& after, + const NameList& before); + +private: + typedef std::list<LLSD> EventList; + EventList mEventHistory; +}; + +/***************************************************************************** * LLEventQueue *****************************************************************************/ /** - * LLEventQueue isa LLEventPump whose post() method defers calling registered + * LLEventQueue is a LLEventPump whose post() method defers calling registered * listeners until flush() is called. */ class LL_COMMON_API LLEventQueue: public LLEventPump |