summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2019-11-20 14:03:57 +0000
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2019-11-20 14:03:57 +0000
commit4300b204f0fc519d3e2dabc7e1296284e5908611 (patch)
tree0a5823bdee6d9379058e359c2a0fc4e21287661a /indra
parenteb6e64ec401382fd2fbbbb27830e828035a6e5af (diff)
SL-10499 - handle package info from benefits service
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llagent.cpp2
-rw-r--r--indra/newview/llagentbenefits.cpp69
-rw-r--r--indra/newview/llagentbenefits.h28
-rw-r--r--indra/newview/llfloaterbvhpreview.cpp2
-rw-r--r--indra/newview/llfloatergroups.cpp4
-rw-r--r--indra/newview/llfloaternamedesc.cpp2
-rw-r--r--indra/newview/lloutfitgallery.cpp2
-rw-r--r--indra/newview/llpanelgroupgeneral.cpp2
-rw-r--r--indra/newview/llpanelmaininventory.cpp12
-rw-r--r--indra/newview/llpanelpeople.cpp39
-rw-r--r--indra/newview/llpanelsnapshotinventory.cpp6
-rw-r--r--indra/newview/llpanelsnapshotoptions.cpp2
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp2
-rw-r--r--indra/newview/llstartup.cpp59
-rw-r--r--indra/newview/llviewermenu.cpp12
-rw-r--r--indra/newview/llviewermenufile.cpp4
-rw-r--r--indra/newview/llviewermessage.cpp2
-rw-r--r--indra/newview/llvoavatar.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml12
19 files changed, 194 insertions, 71 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 1b622de847..1545be3457 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -2985,7 +2985,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
BOOL LLAgent::canJoinGroups() const
{
- return (S32)mGroups.size() < LLAgentBenefits::instance().getGroupMembershipLimit();
+ return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit();
}
LLQuaternion LLAgent::getHeadRotation()
diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp
index eef644ccc0..a7f16b03d2 100644
--- a/indra/newview/llagentbenefits.cpp
+++ b/indra/newview/llagentbenefits.cpp
@@ -130,7 +130,7 @@ S32 LLAgentBenefits::getTextureUploadCost() const
return m_texture_upload_cost;
}
-bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost)
+bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) const
{
bool succ = false;
if (asset_type == LLAssetType::AT_TEXTURE)
@@ -150,3 +150,70 @@ bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost)
}
return succ;
}
+
+LLAgentBenefitsMgr::LLAgentBenefitsMgr()
+{
+}
+
+LLAgentBenefitsMgr::~LLAgentBenefitsMgr()
+{
+}
+
+// static
+const LLAgentBenefits& LLAgentBenefitsMgr::current()
+{
+ return instance().mCurrent;
+}
+
+// static
+const LLAgentBenefits& LLAgentBenefitsMgr::get(const std::string& package)
+{
+ if (instance().mPackageMap.find(package) != instance().mPackageMap.end())
+ {
+ return instance().mPackageMap[package];
+ }
+ else
+ {
+ return instance().mDefault;
+ }
+}
+
+// static
+bool LLAgentBenefitsMgr::init(const std::string& package, const LLSD& benefits_sd)
+{
+ LLAgentBenefits benefits;
+ if (!benefits.init(benefits_sd))
+ {
+ LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL;
+ return false;
+ }
+ else
+ {
+ instance().mPackageMap[package] = benefits;
+ }
+ return true;
+
+}
+
+// static
+bool LLAgentBenefitsMgr::initCurrent(const std::string& package, const LLSD& benefits_sd)
+{
+ LLAgentBenefits benefits;
+ if (!benefits.init(benefits_sd))
+ {
+ LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL;
+ return false;
+ }
+ else
+ {
+ instance().mCurrent = benefits;
+ }
+ return true;
+
+}
+
+// static
+bool LLAgentBenefitsMgr::has(const std::string& package)
+{
+ return instance().mPackageMap.find(package) != instance().mPackageMap.end();
+}
diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h
index 7ed6e169ce..9338bc1c26 100644
--- a/indra/newview/llagentbenefits.h
+++ b/indra/newview/llagentbenefits.h
@@ -30,13 +30,13 @@
#include "llsd.h"
#include "llassettype.h"
-class LLAgentBenefits: public LLSingleton<LLAgentBenefits>
+class LLAgentBenefits
{
- LLSINGLETON(LLAgentBenefits);
+public:
+ LLAgentBenefits();
~LLAgentBenefits();
LOG_CLASS(LLAgentBenefits);
-public:
bool init(const LLSD& benefits_sd);
S32 getAnimatedObjectLimit() const;
@@ -47,7 +47,7 @@ public:
S32 getSoundUploadCost() const;
S32 getTextureUploadCost() const;
- bool findUploadCost(LLAssetType::EType& asset_type, S32& cost);
+ bool findUploadCost(LLAssetType::EType& asset_type, S32& cost) const;
private:
S32 m_animated_object_limit;
@@ -61,4 +61,24 @@ private:
bool m_initalized;
};
+class LLAgentBenefitsMgr: public LLSingleton<LLAgentBenefitsMgr>
+{
+ LLSINGLETON(LLAgentBenefitsMgr);
+ ~LLAgentBenefitsMgr();
+ LOG_CLASS(LLAgentBenefitsMgr);
+
+public:
+ static const LLAgentBenefits& current();
+ static const LLAgentBenefits& get(const std::string& package);
+ static bool init(const std::string& package, const LLSD& benefits_sd);
+ static bool initCurrent(const std::string& package, const LLSD& benefits_sd);
+ static bool has(const std::string& package);
+
+private:
+ LLAgentBenefits mCurrent;
+ LLAgentBenefits mDefault;
+ std::map<std::string, LLAgentBenefits> mPackageMap;
+};
+
+
#endif
diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp
index 6d7d3c8556..1f54b5f838 100644
--- a/indra/newview/llfloaterbvhpreview.cpp
+++ b/indra/newview/llfloaterbvhpreview.cpp
@@ -1004,7 +1004,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata)
{
std::string name = floaterp->getChild<LLUICtrl>("name_form")->getValue().asString();
std::string desc = floaterp->getChild<LLUICtrl>("description_form")->getValue().asString();
- S32 expected_upload_cost = LLAgentBenefits::instance().getAnimationUploadCost();
+ S32 expected_upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost();
LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo(
floaterp->mTransactionID, LLAssetType::AT_ANIMATION,
diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp
index a32b01679a..f341e2ebcb 100644
--- a/indra/newview/llfloatergroups.cpp
+++ b/indra/newview/llfloatergroups.cpp
@@ -173,7 +173,7 @@ void LLPanelGroups::reset()
group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
}
getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
- getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit()));
+ getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit()));
init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID());
enableButtons();
@@ -184,7 +184,7 @@ BOOL LLPanelGroups::postBuild()
childSetCommitCallback("group list", onGroupList, this);
getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size()));
- getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit()));
+ getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit()));
LLScrollListCtrl *list = getChild<LLScrollListCtrl>("group list");
if (list)
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index 937dd60f0f..89e93102dd 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -138,7 +138,7 @@ S32 LLFloaterNameDesc::getExpectedUploadCost() const
S32 upload_cost = -1;
if (LLResourceUploadInfo::findAssetTypeOfExtension(exten, asset_type))
{
- if (!LLAgentBenefits::instance().findUploadCost(asset_type, upload_cost))
+ if (!LLAgentBenefitsMgr::current().findUploadCost(asset_type, upload_cost))
{
LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL;
}
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 35b83880d9..6c3d385811 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -1205,7 +1205,7 @@ void LLOutfitGallery::uploadOutfitImage(const std::vector<std::string>& filename
return;
}
- S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost();
+ S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
void *nruserdata = NULL;
nruserdata = (void *)&outfit_id;
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 2d0a09b469..18f38b0d12 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -341,7 +341,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
}
LLSD args;
- args["COST"] = LLAgentBenefits::instance().getCreateGroupCost();
+ args["COST"] = LLAgentBenefitsMgr::current().getCreateGroupCost();
LLNotificationsUtil::add("CreateGroupCost", args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2));
return false;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index a57ee83285..be31a2ed5d 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -227,9 +227,9 @@ BOOL LLPanelMainInventory::postBuild()
initListCommandsHandlers();
- const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost());
- const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost());
- const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost());
+ const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
+ const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
+ const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
if (menu)
@@ -1507,9 +1507,9 @@ void LLPanelMainInventory::setUploadCostIfNeeded()
LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
if(mNeedUploadCost && menu)
{
- const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost());
- const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost());
- const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost());
+ const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
+ const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
+ const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
menu->getChild<LLView>("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str);
menu->getChild<LLView>("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str);
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 0a41018293..2e991e425d 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -86,10 +86,6 @@ static const std::string RECENT_TAB_NAME = "recent_panel";
static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars
static const std::string COLLAPSED_BY_USER = "collapsed_by_user";
-// FIXME PREMIUM - these should come from package info, once viewer is receiving it all.
-const S32 BASE_MAX_AGENT_GROUPS = 42;
-const S32 PREMIUM_MAX_AGENT_GROUPS = 60;
-
/** Comparator for comparing avatar items by last interaction date */
class LLAvatarItemRecentComparator : public LLAvatarItemComparator
{
@@ -612,24 +608,14 @@ void LLPanelPeople::removePicker()
BOOL LLPanelPeople::postBuild()
{
- // FIXME PREMIUM - need to get premium vs. basic info via BaaS
- S32 max_premium = PREMIUM_MAX_AGENT_GROUPS;
- if (gAgent.getRegion())
- {
- LLSD features;
- gAgent.getRegion()->getSimulatorFeatures(features);
- if (features.has("MaxAgentGroupsPremium"))
- {
- max_premium = features["MaxAgentGroupsPremium"].asInteger();
- }
- }
+ S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- if(LLAgentBenefits::instance().getGroupMembershipLimit() < max_premium)
+ if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium)
{
getChild<LLTextBox>("groupcount")->setText(getString("GroupCountWithInfo"));
getChild<LLTextBox>("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this));
@@ -877,7 +863,7 @@ void LLPanelPeople::updateButtons()
groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected
U32 groups_count = gAgent.mGroups.size();
- S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit();
+ S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0;
groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count));
groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining));
@@ -1093,26 +1079,13 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string)
}
}
-// FIXME PREMIUM this should be coming from LLAgentBenefits info about the various packages.
void LLPanelPeople::onGroupLimitInfo()
{
LLSD args;
- S32 max_basic = BASE_MAX_AGENT_GROUPS;
- S32 max_premium = PREMIUM_MAX_AGENT_GROUPS;
- if (gAgent.getRegion())
- {
- LLSD features;
- gAgent.getRegion()->getSimulatorFeatures(features);
- if (features.has("MaxAgentGroupsBasic"))
- {
- max_basic = features["MaxAgentGroupsBasic"].asInteger();
- }
- if (features.has("MaxAgentGroupsPremium"))
- {
- max_premium = features["MaxAgentGroupsPremium"].asInteger();
- }
- }
+ S32 max_basic = LLAgentBenefitsMgr::get("Base").getGroupMembershipLimit();
+ S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
+
args["MAX_BASIC"] = max_basic;
args["MAX_PREMIUM"] = max_premium;
diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp
index 202f42c53a..594cbed7ad 100644
--- a/indra/newview/llpanelsnapshotinventory.cpp
+++ b/indra/newview/llpanelsnapshotinventory.cpp
@@ -136,7 +136,7 @@ BOOL LLPanelSnapshotInventory::postBuild()
// virtual
void LLPanelSnapshotInventory::onOpen(const LLSD& key)
{
- getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost()));
+ getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost()));
LLPanelSnapshot::onOpen(key);
}
@@ -156,7 +156,7 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
void LLPanelSnapshotInventoryBase::onSend()
{
- S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost();
+ S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
if (can_afford_transaction(expected_upload_cost))
{
if (mSnapshotFloater)
@@ -192,7 +192,7 @@ BOOL LLPanelOutfitSnapshotInventory::postBuild()
// virtual
void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key)
{
- getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost()));
+ getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost()));
LLPanelSnapshot::onOpen(key);
}
diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp
index 7932db8727..6ded46d690 100644
--- a/indra/newview/llpanelsnapshotoptions.cpp
+++ b/indra/newview/llpanelsnapshotoptions.cpp
@@ -94,7 +94,7 @@ void LLPanelSnapshotOptions::onOpen(const LLSD& key)
void LLPanelSnapshotOptions::updateUploadCost()
{
- S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost();
+ S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
getChild<LLUICtrl>("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost));
}
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 430abba543..3c8b405a67 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -1039,7 +1039,7 @@ void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name)
LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL);
std::string who_took_it;
LLAgentUI::buildFullname(who_took_it);
- S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost();
+ S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string;
std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string;
LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index c144ea2f8e..3f65d69719 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -3250,14 +3250,67 @@ void apply_udp_blacklist(const std::string& csv)
}
+void on_benefits_failed_callback(const LLSD& notification, const LLSD& response)
+{
+ LL_WARNS("Benefits") << "Failed to load benefits information" << LL_ENDL;
+}
+
+bool init_benefits(LLSD& response)
+{
+ LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL;
+
+ bool succ = true;
+
+ std::string package_name = response["account_type"].asString();
+ const LLSD& benefits_sd = response["account_level_benefits"];
+ if (!LLAgentBenefitsMgr::init(package_name, benefits_sd) ||
+ !LLAgentBenefitsMgr::initCurrent(package_name, benefits_sd))
+ {
+ succ = false;
+ }
+ else
+ {
+ LL_DEBUGS("Benefits") << "Initialized current benefits, level " << package_name << " from " << benefits_sd << LL_ENDL;
+ }
+ const LLSD& packages_sd = response["premium_packages"];
+ for(LLSD::map_const_iterator package_iter = packages_sd.beginMap();
+ package_iter != packages_sd.endMap();
+ ++package_iter)
+ {
+ std::string package_name = package_iter->first;
+ const LLSD& benefits_sd = package_iter->second["benefits"];
+ if (LLAgentBenefitsMgr::init(package_name, benefits_sd))
+ {
+ LL_DEBUGS("Benefits") << "Initialized benefits for package " << package_name << " from " << benefits_sd << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Benefits") << "Failed init for package " << package_name << " from " << benefits_sd << LL_ENDL;
+ succ = false;
+ }
+ }
+
+ if (!LLAgentBenefitsMgr::has("Base"))
+ {
+ LL_WARNS("Benefits") << "Benefits info did not include required package Base" << LL_ENDL;
+ succ = false;
+ }
+ if (!LLAgentBenefitsMgr::has("Premium"))
+ {
+ LL_WARNS("Benefits") << "Benefits info did not include required package Premium" << LL_ENDL;
+ succ = false;
+ }
+ return succ;
+}
+
bool process_login_success_response()
{
LLSD response = LLLoginInstance::getInstance()->getResponse();
- LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL;
- if (!LLAgentBenefits::instance().init(response["account_level_benefits"]))
+ bool benefits_ok = init_benefits(response);
+ if (!benefits_ok)
{
- LL_ERRS() << "Benefits error" << LL_ENDL;
+ LLNotificationsUtil::add("FailedToGetBenefits", LLSD(), LLSD(), boost::bind(on_benefits_failed_callback, _1, _2));
}
std::string text(response["udp_blacklist"]);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index e88acc2ac4..49a4eb6a4d 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -510,9 +510,9 @@ void init_menus()
LLGridManager::getInstance()->isInProductionGrid());
// *TODO:Also fix cost in llfolderview.cpp for Inventory menus
- const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost());
- const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost());
- const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost());
+ const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
+ const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost());
+ const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost());
gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str);
gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str);
gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str);
@@ -8722,15 +8722,15 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str)
if (asset_type_str == "texture")
{
- upload_cost = LLAgentBenefits::instance().getTextureUploadCost();
+ upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
}
else if (asset_type_str == "animation")
{
- upload_cost = LLAgentBenefits::instance().getAnimationUploadCost();
+ upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost();
}
else if (asset_type_str == "sound")
{
- upload_cost = LLAgentBenefits::instance().getSoundUploadCost();
+ upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost();
}
if (upload_cost < 0)
{
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 90fbbcc8d2..4ce39e715c 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -429,7 +429,7 @@ void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification
U32 codec;
S32 expected_upload_cost;
if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) &&
- LLAgentBenefits::instance().findUploadCost(asset_type, expected_upload_cost))
+ LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost))
{
LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
filename,
@@ -460,7 +460,7 @@ bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S3
S32 cost;
if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) &&
- LLAgentBenefits::instance().findUploadCost(asset_type, cost))
+ LLAgentBenefitsMgr::current().findUploadCost(asset_type, cost))
{
total_cost += cost;
}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 2cde93f471..6e64ccc501 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -903,7 +903,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
if(option == 0 && !group_id.isNull())
{
// check for promotion or demotion.
- S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit();
+ S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
if(gAgent.isInGroup(group_id)) ++max_groups;
if(gAgent.mGroups.size() < max_groups)
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index f8ff71911e..e7ceec40ef 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7061,7 +7061,7 @@ U32 LLVOAvatar::getNumAttachments() const
//-----------------------------------------------------------------------------
S32 LLVOAvatar::getMaxAttachments() const
{
- return LLAgentBenefits::instance().getAttachmentLimit();
+ return LLAgentBenefitsMgr::current().getAttachmentLimit();
}
//-----------------------------------------------------------------------------
@@ -7095,7 +7095,7 @@ U32 LLVOAvatar::getNumAnimatedObjectAttachments() const
//-----------------------------------------------------------------------------
S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const
{
- return LLAgentBenefits::instance().getAnimatedObjectLimit();
+ return LLAgentBenefitsMgr::current().getAnimatedObjectLimit();
}
//-----------------------------------------------------------------------------
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index f93113ebd0..c8db5d24dd 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -8410,7 +8410,17 @@ Your voice has been muted by moderator.
name="okbutton"
yestext="OK"/>
</notification>
-
+
+ <notification
+ icon="alertmodal.tga"
+ name="FailedToGetBenefits"
+ type="alertmodal">
+ Unfortunately, we were unable to get benefits information for this session. This should not happen in a normal production environment. Please contact support. This session will not work normally and we recommend that you restart.
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
<notification
icon="alertmodal.tga"
name="BulkUploadCostConfirmation"