summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2013-09-17 22:30:02 -0700
committerDon Kjer <don@lindenlab.com>2013-09-17 22:30:02 -0700
commitc2ddc68afe0d9f122ee846ec1de1b4394f04998f (patch)
tree0484a0b4ded0fb03cd21c43bf381e3ab8524b456
parent25b078f9688a42d3ef01c63ebb9d9dcc9844df21 (diff)
Updating AISv3 api to match recent changes
-rwxr-xr-xindra/newview/llaisapi.cpp60
-rwxr-xr-xindra/newview/llaisapi.h6
2 files changed, 46 insertions, 20 deletions
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index 6f6e6ebb35..14978662f6 100755
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -602,29 +602,37 @@ void AISUpdate::parseCategory(const LLSD& category_map)
void AISUpdate::parseDescendentCount(const LLUUID& category_id, const LLSD& embedded)
{
// We can only determine true descendent count if this contains all descendent types.
- if (embedded.has("category") &&
- embedded.has("link") &&
- embedded.has("item"))
+ if (embedded.has("categories") &&
+ embedded.has("links") &&
+ embedded.has("items"))
{
- mCatDescendentsKnown[category_id] = embedded["category"].size();
- mCatDescendentsKnown[category_id] += embedded["link"].size();
- mCatDescendentsKnown[category_id] += embedded["item"].size();
+ mCatDescendentsKnown[category_id] = embedded["categories"].size();
+ mCatDescendentsKnown[category_id] += embedded["links"].size();
+ mCatDescendentsKnown[category_id] += embedded["items"].size();
}
}
void AISUpdate::parseEmbedded(const LLSD& embedded)
{
- if (embedded.has("link"))
+ if (embedded.has("links")) // _embedded in a category
{
- parseEmbeddedLinks(embedded["link"]);
+ parseEmbeddedLinks(embedded["links"]);
}
- if (embedded.has("item"))
+ if (embedded.has("items")) // _embedded in a category
{
- parseEmbeddedItems(embedded["item"]);
+ parseEmbeddedItems(embedded["items"]);
}
- if (embedded.has("category"))
+ if (embedded.has("item")) // _embedded in a link
{
- parseEmbeddedCategories(embedded["category"]);
+ parseEmbeddedItem(embedded["item"]);
+ }
+ if (embedded.has("categories")) // _embedded in a category
+ {
+ parseEmbeddedCategories(embedded["categories"]);
+ }
+ if (embedded.has("category")) // _embedded in a link
+ {
+ parseEmbeddedCategory(embedded["category"]);
}
}
@@ -660,18 +668,21 @@ void AISUpdate::parseEmbeddedLinks(const LLSD& links)
}
}
-void AISUpdate::parseEmbeddedItems(const LLSD& items)
+void AISUpdate::parseEmbeddedItem(const LLSD& item)
{
- // Special case: this may be a single item (_embedded in a link)
- if (items.has("item_id"))
+ // a single item (_embedded in a link)
+ if (item.has("item_id"))
{
- if (mItemIds.end() != mItemIds.find(items["item_id"].asUUID()))
+ if (mItemIds.end() != mItemIds.find(item["item_id"].asUUID()))
{
- parseContent(items);
+ parseItem(item);
}
- return;
}
+}
+void AISUpdate::parseEmbeddedItems(const LLSD& items)
+{
+ // a map of items (_embedded in a category)
for(LLSD::map_const_iterator itemit = items.beginMap(),
itemend = items.endMap();
itemit != itemend; ++itemit)
@@ -689,8 +700,21 @@ void AISUpdate::parseEmbeddedItems(const LLSD& items)
}
}
+void AISUpdate::parseEmbeddedCategory(const LLSD& category)
+{
+ // a single category (_embedded in a link)
+ if (category.has("category_id"))
+ {
+ if (mCategoryIds.end() != mCategoryIds.find(category["category_id"].asUUID()))
+ {
+ parseCategory(category);
+ }
+ }
+}
+
void AISUpdate::parseEmbeddedCategories(const LLSD& categories)
{
+ // a map of categories (_embedded in a category)
for(LLSD::map_const_iterator categoryit = categories.beginMap(),
categoryend = categories.endMap();
categoryit != categoryend; ++categoryit)
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();