From 89e3959cf393ce9eeb058304264d4f55f4fe9ca2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Jun 2013 12:58:04 -0400 Subject: SH-4216 WIP - moved AISv3 commands and responders to llaisapi.* files --- indra/newview/llaisapi.h | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100755 indra/newview/llaisapi.h (limited to 'indra/newview/llaisapi.h') diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h new file mode 100755 index 0000000000..1f9555f004 --- /dev/null +++ b/indra/newview/llaisapi.h @@ -0,0 +1,143 @@ +/** + * @file llaisapi.h + * @brief classes and functions for interfacing with the v3+ ais inventory service. + * + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLAISAPI_H +#define LL_LLAISAPI_H + +#include "lluuid.h" +#include +#include +#include +#include +#include "llcurl.h" +#include "llhttpclient.h" +#include "llhttpretrypolicy.h" +#include "llviewerinventory.h" + +class AISCommand: public LLHTTPClient::Responder +{ +public: + typedef boost::function command_func_type; + + AISCommand(LLPointer callback); + + virtual ~AISCommand() {} + + void run_command(); + + void setCommandFunc(command_func_type command_func); + + // Need to do command-specific parsing to get an id here, for + // LLInventoryCallback::fire(). May or may not need to bother, + // since most LLInventoryCallbacks do their work in the + // destructor. + virtual bool getResponseUUID(const LLSD& content, LLUUID& id); + + /* virtual */ void httpSuccess(); + + /*virtual*/ void httpFailure(); + + static bool getCap(std::string& cap); + +private: + command_func_type mCommandFunc; + LLPointer mRetryPolicy; + LLPointer mCallback; +}; + +class RemoveItemCommand: public AISCommand +{ +public: + RemoveItemCommand(const LLUUID& item_id, + LLPointer callback); +}; + +class RemoveCategoryCommand: public AISCommand +{ +public: + RemoveCategoryCommand(const LLUUID& item_id, + LLPointer callback); +}; + +class PurgeDescendentsCommand: public AISCommand +{ +public: + PurgeDescendentsCommand(const LLUUID& item_id, + LLPointer callback); +}; + +class UpdateItemCommand: public AISCommand +{ +public: + UpdateItemCommand(const LLUUID& item_id, + const LLSD& updates, + LLPointer callback); +private: + LLSD mUpdates; +}; + +class UpdateCategoryCommand: public AISCommand +{ +public: + UpdateCategoryCommand(const LLUUID& item_id, + const LLSD& updates, + LLPointer callback); +private: + LLSD mUpdates; +}; + +class SlamFolderCommand: public AISCommand +{ +public: + SlamFolderCommand(const LLUUID& folder_id, const LLSD& contents, LLPointer callback); + +private: + LLSD mContents; +}; + +class AISUpdate +{ +public: + AISUpdate(const LLSD& update); + void parseUpdate(const LLSD& update); + void parseUUIDArray(const LLSD& content, const std::string& name, uuid_vec_t& ids); + void parseLink(const LLUUID& link_id, const LLSD& link_map); + void parseCreatedLinks(const LLSD& links); + void doUpdate(); +private: + typedef std::map uuid_int_map_t; + uuid_int_map_t mCatDeltas; + uuid_int_map_t mCatVersions; + + typedef std::map > deferred_item_map_t; + deferred_item_map_t mItemsCreated; + deferred_item_map_t mItemsUpdated; + + std::set mObjectsDeleted; + uuid_vec_t mItemsCreatedIds; +}; + +#endif -- cgit v1.2.3 From a85fa3b10a406218cabfecc0d592e816f8dfdb53 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 11 Jul 2013 15:15:04 -0700 Subject: Adding support for COPY methods to httpclient. Implementing viewer-side use of AISv3 COPY library folder operation. (SH-4304) --- indra/newview/llaisapi.h | 55 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'indra/newview/llaisapi.h') diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 1f9555f004..f4e219e9e6 100755 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -31,7 +31,6 @@ #include #include #include -#include #include "llcurl.h" #include "llhttpclient.h" #include "llhttpretrypolicy.h" @@ -46,7 +45,7 @@ public: virtual ~AISCommand() {} - void run_command(); + bool run_command(); void setCommandFunc(command_func_type command_func); @@ -54,13 +53,17 @@ public: // LLInventoryCallback::fire(). May or may not need to bother, // since most LLInventoryCallbacks do their work in the // destructor. - virtual bool getResponseUUID(const LLSD& content, LLUUID& id); /* virtual */ void httpSuccess(); + /* virtual */ void httpFailure(); - /*virtual*/ void httpFailure(); + static bool isAPIAvailable(); + static bool getInvCap(std::string& cap); + static bool getLibCap(std::string& cap); + static void getCapabilityNames(LLSD& capabilityNames); - static bool getCap(std::string& cap); +protected: + virtual bool getResponseUUID(const LLSD& content, LLUUID& id); private: command_func_type mCommandFunc; @@ -118,26 +121,52 @@ private: LLSD mContents; }; +class CopyLibraryCategoryCommand: public AISCommand +{ +public: + CopyLibraryCategoryCommand(const LLUUID& source_id, const LLUUID& dest_id, LLPointer callback); + +protected: + /* virtual */ bool getResponseUUID(const LLSD& content, LLUUID& id); +}; + class AISUpdate { public: AISUpdate(const LLSD& update); void parseUpdate(const LLSD& update); - void parseUUIDArray(const LLSD& content, const std::string& name, uuid_vec_t& ids); - void parseLink(const LLUUID& link_id, const LLSD& link_map); - void parseCreatedLinks(const LLSD& links); + void parseMeta(const LLSD& update); + void parseContent(const LLSD& update); + void parseUUIDArray(const LLSD& content, const std::string& name, uuid_list_t& ids); + void parseLink(const LLSD& link_map); + void parseItem(const LLSD& link_map); + void parseCategory(const LLSD& link_map); + void parseDescendentCount(const LLUUID& category_id, const LLSD& embedded); + void parseEmbedded(const LLSD& embedded); + void parseEmbeddedLinks(const LLSD& links); + void parseEmbeddedItems(const LLSD& links); + void parseEmbeddedCategories(const LLSD& links); void doUpdate(); private: + void clearParseResults(); + typedef std::map uuid_int_map_t; - uuid_int_map_t mCatDeltas; - uuid_int_map_t mCatVersions; + uuid_int_map_t mCatDescendentDeltas; + uuid_int_map_t mCatDescendentsKnown; + uuid_int_map_t mCatVersionsUpdated; typedef std::map > deferred_item_map_t; deferred_item_map_t mItemsCreated; deferred_item_map_t mItemsUpdated; - - std::set mObjectsDeleted; - uuid_vec_t mItemsCreatedIds; + typedef std::map > deferred_category_map_t; + deferred_category_map_t mCategoriesCreated; + deferred_category_map_t mCategoriesUpdated; + + // These keep track of uuid's mentioned in meta values. + // Useful for filtering out which content we are interested in. + uuid_list_t mObjectsDeletedIds; + uuid_list_t mItemIds; + uuid_list_t mCategoryIds; }; #endif -- cgit v1.2.3 From c1af1a692a6bd0f3cdfb3f49cc2451717481b685 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 9 Aug 2013 14:52:54 -0700 Subject: Routing link creating through AISv3 when available. --- indra/newview/llaisapi.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llaisapi.h') diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index f4e219e9e6..5d31129a16 100755 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -130,6 +130,15 @@ protected: /* virtual */ bool getResponseUUID(const LLSD& content, LLUUID& id); }; +class CreateInventoryCommand: public AISCommand +{ +public: + CreateInventoryCommand(const LLUUID& parent_id, const LLSD& new_inventory, LLPointer callback); + +private: + LLSD mNewInventory; +}; + class AISUpdate { public: -- cgit v1.2.3 From f878b032e8c96c4e4ae752864d7641bba2ea4102 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 9 Sep 2013 13:13:22 -0700 Subject: Using transaction_id instead of raw asset_id during aisv3 patch --- indra/newview/llaisapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llaisapi.h') diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 5d31129a16..f3a662c280 100755 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -105,7 +105,7 @@ private: class UpdateCategoryCommand: public AISCommand { public: - UpdateCategoryCommand(const LLUUID& item_id, + UpdateCategoryCommand(const LLUUID& cat_id, const LLSD& updates, LLPointer callback); private: -- cgit v1.2.3 From c2ddc68afe0d9f122ee846ec1de1b4394f04998f Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 17 Sep 2013 22:30:02 -0700 Subject: Updating AISv3 api to match recent changes --- indra/newview/llaisapi.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llaisapi.h') diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index f3a662c280..5a2ec94af9 100755 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -153,8 +153,10 @@ public: void parseDescendentCount(const LLUUID& category_id, const LLSD& embedded); void parseEmbedded(const LLSD& embedded); void parseEmbeddedLinks(const LLSD& links); - void parseEmbeddedItems(const LLSD& links); - void parseEmbeddedCategories(const LLSD& links); + void parseEmbeddedItems(const LLSD& items); + void parseEmbeddedCategories(const LLSD& categories); + void parseEmbeddedItem(const LLSD& item); + void parseEmbeddedCategory(const LLSD& category); void doUpdate(); private: void clearParseResults(); -- cgit v1.2.3