From 485c7ee0e2ebc2223c35fbb59a569ed889a1193c Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 1 Feb 2008 22:10:40 +0000 Subject: merge Branch_1-19-0-Viewer -r 78432:78989 -> release QA'd in QAR-186: DEV-9179: Commit translated and reviewed strings from 1.19 frozen branch pull DEV-8792 Place information teleport button hidden behind chat bar. DEV-9374: Remove "New Account..." and "Preferences" buttons from login screen for 1.19.0 DEV-9411 -- Update required version of Quicktime library to 7.4 for 1.19.0 Viewer DEV-9430 Viewer auth failed login screen is shown in the loginxui 1.19 viewer on failure to retrieve normal login screen - changed wording of error page DEV-8537 Chat console appearing underneath status buttons DEV-9283 Chatbar cant be open while in mouselook DEV-9226 Some Dazzle? icons have sneaked into the release branch DEV-9520 Menus and Other items minimise behind onscreen buttons DEV-9521 Unable to ctrl and click to select in the friends list DEV-9530 SEC-20 Exploit to force users to teleport to a location on profile open. DEV-6833 - Mature events icon and checkbox is missing from map legend Also: Added vc9 project files (+ minor changes for vc9) (steve) Modified vc project files to not include the path for flex / bison (steve) Added marker file deletion to crash logger to stop double reporting. (cube) --- indra/newview/llcommandhandler.cpp | 45 +++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'indra/newview/llcommandhandler.cpp') diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp index 95a30e8903..8b86b1be5d 100644 --- a/indra/newview/llcommandhandler.cpp +++ b/indra/newview/llcommandhandler.cpp @@ -40,16 +40,21 @@ //--------------------------------------------------------------------------- // Underlying registry for command handlers, not directly accessible. //--------------------------------------------------------------------------- +struct LLCommandHandlerInfo +{ + bool mAllowFromExternalBrowser; + LLCommandHandler* mHandler; // safe, all of these are static objects +}; class LLCommandHandlerRegistry { public: static LLCommandHandlerRegistry& instance(); - void add(const char* cmd, LLCommandHandler* handler); - bool dispatch(const std::string& cmd, const LLSD& params, const LLSD& queryMap); + void add(const char* cmd, bool allow_from_external_browser, LLCommandHandler* handler); + bool dispatch(const std::string& cmd, bool from_external_browser, const LLSD& params, const LLSD& queryMap); private: - std::map mMap; + std::map mMap; }; // static @@ -62,29 +67,40 @@ LLCommandHandlerRegistry& LLCommandHandlerRegistry::instance() return instance; } -void LLCommandHandlerRegistry::add(const char* cmd, LLCommandHandler* handler) +void LLCommandHandlerRegistry::add(const char* cmd, bool allow_from_external_browser, LLCommandHandler* handler) { - mMap[cmd] = handler; + LLCommandHandlerInfo info; + info.mAllowFromExternalBrowser = allow_from_external_browser; + info.mHandler = handler; + + mMap[cmd] = info; } bool LLCommandHandlerRegistry::dispatch(const std::string& cmd, + bool from_external_browser, const LLSD& params, const LLSD& queryMap) { - std::map::iterator it = mMap.find(cmd); + std::map::iterator it = mMap.find(cmd); if (it == mMap.end()) return false; - LLCommandHandler* handler = it->second; - if (!handler) return false; - return handler->handle(params, queryMap); + const LLCommandHandlerInfo& info = it->second; + if (from_external_browser && !info.mAllowFromExternalBrowser) + { + // block request from external browser, but report as + // "handled" because it was well formatted. + return true; + } + if (!info.mHandler) return false; + return info.mHandler->handle(params, queryMap); } //--------------------------------------------------------------------------- // Automatic registration of commands, runs before main() //--------------------------------------------------------------------------- -LLCommandHandler::LLCommandHandler(const char* cmd) +LLCommandHandler::LLCommandHandler(const char* cmd, bool allow_from_external_browser) { - LLCommandHandlerRegistry::instance().add(cmd, this); + LLCommandHandlerRegistry::instance().add(cmd, allow_from_external_browser, this); } LLCommandHandler::~LLCommandHandler() @@ -98,7 +114,10 @@ LLCommandHandler::~LLCommandHandler() //--------------------------------------------------------------------------- // static -bool LLCommandDispatcher::dispatch(const std::string& cmd, const LLSD& params, const LLSD& queryMap) +bool LLCommandDispatcher::dispatch(const std::string& cmd, + bool from_external_browser, + const LLSD& params, const LLSD& queryMap) { - return LLCommandHandlerRegistry::instance().dispatch(cmd, params, queryMap); + return LLCommandHandlerRegistry::instance().dispatch( + cmd, from_external_browser, params, queryMap); } -- cgit v1.2.3