Stage one of the new "change clothing" function. Introcuce an easy way to add generic packet handlers.

This commit is contained in:
Melanie
2013-04-22 15:02:23 +02:00
parent c216e75d23
commit 1b15b5bf5d
4 changed files with 98 additions and 0 deletions

View File

@@ -90,6 +90,7 @@ set(viewer_SOURCE_FILES
floaterao.cpp
floaterlocalassetbrowse.cpp
floatervoicelicense.cpp
generichandlers.cpp
hbfloatergrouptitles.cpp
hippofloaterxml.cpp
hippogridmanager.cpp
@@ -591,6 +592,7 @@ set(viewer_HEADER_FILES
floaterao.h
floaterlocalassetbrowse.h
floatervoicelicense.h
generichandlers.h
hbfloatergrouptitles.h
hippofloaterxml.h
hippogridmanager.h

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) The Singularity dev Team and Melanie Thielker
* Refer to the singularity project for a full lst of copyright holders
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Neither the name of the Singularity Viewwer Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "llviewerprecompiledheaders.h"
#include "generichandlers.h"
#include "llviewergenericmessage.h"
#include "llviewerinventory.h"
#include "llappearancemgr.h"
GenericHandlers *gGenericHandlers = NULL;
class DispatchReplaceOutfit : public LLDispatchHandler
{
public:
virtual bool operator()(
const LLDispatcher* dispatcher,
const std::string& key,
const LLUUID& invoice,
const sparam_t& strings)
{
if (strings.size() != 2) return false;
LLUUID folder_id(strings[0]);
bool success = false;
LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id);
if (cat != NULL)
{
LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, FALSE);
success = true;
}
return true;
}
};
static DispatchReplaceOutfit sDispatchReplaceOutfit;
GenericHandlers::GenericHandlers()
{
gGenericDispatcher.addHandler("replaceoutfit", &sDispatchReplaceOutfit);
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) The Singularity dev Team and Melanie Thielker
* Refer to the singularity project for a full lst of copyright holders
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Neither the name of the Singularity Viewwer Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class GenericHandlers
{
public:
GenericHandlers();
};
extern GenericHandlers *gGenericHandlers;

View File

@@ -212,6 +212,7 @@
#include "llinventorybridge.h"
#include "llappearancemgr.h"
#include "jcfloaterareasearch.h"
#include "generichandlers.h"
// <edit>
#include "llpanellogin.h"
@@ -843,6 +844,8 @@ bool idle_startup()
// *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance().
gGenericHandlers = new GenericHandlers();
// Initialize UI
if (!gNoRender)
{