From e3a4e3dc10a96b0822674cea262f41774e55a660 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 9 Oct 2009 19:42:59 -0400 Subject: DEV-40930: Added ["change"] key to login-module status events. Changed existing event calls to use state as "offline" or "online", with "change" indicating the reason for this status event. Changed disconnect() to send state "offline", change "disconnect" -- instead of replaying last auth failure. Changed unit tests accordingly. Changed LLLoginInstance::handleLoginEvent() to use LLEventDispatcher to route calls to handleLoginFailure() et al. Added LLEventDispatcher::get() to allow retrieving Callable by name and testing for empty(). --- indra/llcommon/lleventdispatcher.cpp | 10 ++++++++++ indra/llcommon/lleventdispatcher.h | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp index 2dbd59b156..6b1413d054 100644 --- a/indra/llcommon/lleventdispatcher.cpp +++ b/indra/llcommon/lleventdispatcher.cpp @@ -109,6 +109,16 @@ bool LLEventDispatcher::attemptCall(const std::string& name, const LLSD& event) return true; // tell caller we were able to call } +LLEventDispatcher::Callable LLEventDispatcher::get(const std::string& name) const +{ + DispatchMap::const_iterator found = mDispatch.find(name); + if (found == mDispatch.end()) + { + return Callable(); + } + return found->second.first; +} + LLDispatchListener::LLDispatchListener(const std::string& pumpname, const std::string& key): LLEventDispatcher(pumpname, key), mPump(pumpname, true), // allow tweaking for uniqueness diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index ef83ebabc1..671f2a4d1c 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -80,6 +80,10 @@ public: /// @a required prototype specified at add() time, die with LL_ERRS. void operator()(const LLSD& event) const; + /// Fetch the Callable for the specified name. If no such name was + /// registered, return an empty() Callable. + Callable get(const std::string& name) const; + private: template void addMethod(const std::string& name, const METHOD& method, const LLSD& required) -- cgit v1.2.3