diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d3d888cc5d0c85c175a98b48d37a7b9894fa4b2f..f6efc865efbc04df54add295827d784559af7656 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -141,6 +141,7 @@ set(viewer_SOURCE_FILES alviewermenu.cpp groupchatlistener.cpp llaccountingcostmanager.cpp + lladdgridhandler.cpp llaisapi.cpp llagent.cpp llagentaccess.cpp @@ -816,6 +817,7 @@ set(viewer_HEADER_FILES groupchatlistener.h llaccountingcost.h llaccountingcostmanager.h + lladdgridhandler.h llaisapi.h llagent.h llagentaccess.h diff --git a/indra/newview/lladdgridhandler.cpp b/indra/newview/lladdgridhandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ff9270737d3f173173c67abe71af8b2492aefbed --- /dev/null +++ b/indra/newview/lladdgridhandler.cpp @@ -0,0 +1,47 @@ +/** + * @file lladdgridhandler.cpp + * @brief Handles adding a grid in response to an addgrid slapp + * + * Copyright (c) 2016, Cinder Roxley <cinder@sdf.org> + * + * Permission is hereby granted, free of charge, to any person or organization + * obtaining a copy of the software and accompanying documentation covered by + * this license (the "Software") to use, reproduce, display, distribute, + * execute, and transmit the Software, and to prepare derivative works of the + * Software, and to permit third-parties to whom the Software is furnished to + * do so, all subject to the following: + * + * The copyright notices in the Software and this entire statement, including + * the above license grant, this restriction and the following disclaimer, + * must be included in all copies of the Software, in whole or in part, and + * all derivative works of the Software, unless such copies or derivative + * works are solely in the form of machine-executable object code generated by + * a source language processor. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#include "llviewerprecompiledheaders.h" +#include "lladdgridhandler.h" + +#include "llviewernetwork.h" + +// Must have an instance to auto-register with LLCommandDispatcher +LLAddGridHandler gAddGridHandler; + +bool LLAddGridHandler::handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) +{ + if (query_map.has("grid")) + { + LLGridManager::getInstance()->setGridChoice(query_map["grid"].asString(), false); + } + + return true; +} diff --git a/indra/newview/lladdgridhandler.h b/indra/newview/lladdgridhandler.h new file mode 100644 index 0000000000000000000000000000000000000000..b8370aa00ead5fd15cace2dee81a4c94ce9ef852 --- /dev/null +++ b/indra/newview/lladdgridhandler.h @@ -0,0 +1,46 @@ +/** + * @file lladdgridhandler.h + * @brief Handles adding a grid in response to an addgrid slapp + * + * Copyright (c) 2016, Cinder Roxley <cinder@sdf.org> + * + * Permission is hereby granted, free of charge, to any person or organization + * obtaining a copy of the software and accompanying documentation covered by + * this license (the "Software") to use, reproduce, display, distribute, + * execute, and transmit the Software, and to prepare derivative works of the + * Software, and to permit third-parties to whom the Software is furnished to + * do so, all subject to the following: + * + * The copyright notices in the Software and this entire statement, including + * the above license grant, this restriction and the following disclaimer, + * must be included in all copies of the Software, in whole or in part, and + * all derivative works of the Software, unless such copies or derivative + * works are solely in the form of machine-executable object code generated by + * a source language processor. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef LL_ADDGRIDHANDLER_H +#define LL_ADDGRIDHANDLER_H + +#include "llcommandhandler.h" + +class LLAddGridHandler : public LLCommandHandler +{ +public: + LLAddGridHandler() : LLCommandHandler("addgrid", UNTRUSTED_ALLOW) { } + + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) override; +}; + +extern LLAddGridHandler gAddGridHandler; + +#endif // LL_ADDGRIDHANDLER_H