summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterexperiences.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterexperiences.cpp')
-rw-r--r--indra/newview/llfloaterexperiences.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp
index fbe00beddd..fdc1b47334 100644
--- a/indra/newview/llfloaterexperiences.cpp
+++ b/indra/newview/llfloaterexperiences.cpp
@@ -243,6 +243,32 @@ void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LL
LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab");
}
+void LLFloaterExperiences::checkAndOpen(LLPanelExperiences* panel, const LLSD& content) const
+{
+ checkPurchaseInfo(panel, content);
+
+ // determine new item
+ const LLSD& response_ids = content["experience_ids"];
+
+ if (mPrepurchaseIds.size() + 1 == response_ids.size())
+ {
+ // we have a new element
+ for (LLSD::array_const_iterator it = response_ids.beginArray(); it != response_ids.endArray(); ++it)
+ {
+ LLUUID experience_id = it->asUUID();
+ if (std::find(mPrepurchaseIds.begin(), mPrepurchaseIds.end(), experience_id) == mPrepurchaseIds.end())
+ {
+ // new element found, open it
+ LLSD args;
+ args["experience_id"] = experience_id;
+ args["edit_experience"] = true;
+ LLFloaterReg::showInstance("experience_profile", args, true);
+ break;
+ }
+ }
+ }
+}
+
void LLFloaterExperiences::updateInfo(std::string experienceCap, std::string tab)
{
LLViewerRegion* region = gAgent.getRegion();
@@ -264,12 +290,22 @@ void LLFloaterExperiences::sendPurchaseRequest()
if (region)
{
NameMap_t tabMap;
+ const std::string tab_owned_name = "Owned_Experiences_Tab";
LLHandle<LLFloaterExperiences> handle = getDerivedHandle<LLFloaterExperiences>();
- tabMap["experience_ids"] = "Owned_Experiences_Tab";
+ tabMap["experience_ids"] = tab_owned_name;
+
+ // extract ids for experiences that we already have
+ LLTabContainer* tabs = getChild<LLTabContainer>("xp_tabs");
+ LLPanelExperiences* tab_owned = (LLPanelExperiences*)tabs->getPanelByName(tab_owned_name);
+ mPrepurchaseIds.clear();
+ if (tab_owned)
+ {
+ tab_owned->getExperienceIdsList(mPrepurchaseIds);
+ }
requestNewExperience(region->getCapability("AgentExperiences"), handle, tabMap, "ExperienceAcquireFailed",
- boost::bind(&LLFloaterExperiences::checkPurchaseInfo, this, _1, _2));
+ boost::bind(&LLFloaterExperiences::checkAndOpen, this, _1, _2));
}
}