Accept and respect Opensim's login response with "classified_fee" (otherwise assume 0 for opensim)

This commit is contained in:
Inusaito Sayori
2015-06-10 13:47:06 -04:00
parent aad24fa5c5
commit b35d1b7005
4 changed files with 13 additions and 11 deletions

View File

@@ -33,6 +33,7 @@ HippoGridInfo HippoGridInfo::FALLBACK_GRIDINFO("");
// ******************************************************************** // ********************************************************************
// ******************************************************************** // ********************************************************************
const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$
// ******************************************************************** // ********************************************************************
// Initialize // Initialize
@@ -62,6 +63,7 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) :
mCurrencySymbol("OS$"), mCurrencySymbol("OS$"),
mCurrencyText("OS Dollars"), mCurrencyText("OS Dollars"),
mRealCurrencySymbol("US$"), mRealCurrencySymbol("US$"),
mClassifiedFee(MINIMUM_PRICE_FOR_LISTING),
mDirectoryFee(30), mDirectoryFee(30),
mUPCSupported(false) mUPCSupported(false)
{ {
@@ -237,7 +239,7 @@ void HippoGridInfo::setRenderCompat(bool compat)
void HippoGridInfo::setCurrencySymbol(const std::string& sym) void HippoGridInfo::setCurrencySymbol(const std::string& sym)
{ {
mCurrencySymbol = sym.substr(0, 3); mCurrencySymbol = sym;
} }
void HippoGridInfo::setCurrencyText(const std::string& text) void HippoGridInfo::setCurrencyText(const std::string& text)
@@ -250,11 +252,6 @@ void HippoGridInfo::setRealCurrencySymbol(const std::string& sym)
mRealCurrencySymbol = sym.substr(0, 3); mRealCurrencySymbol = sym.substr(0, 3);
} }
void HippoGridInfo::setDirectoryFee(int fee)
{
mDirectoryFee = fee;
}
// ******************************************************************** // ********************************************************************

View File

@@ -62,6 +62,7 @@ public:
const std::string& getRealCurrencySymbol() const { return mRealCurrencySymbol; } const std::string& getRealCurrencySymbol() const { return mRealCurrencySymbol; }
std::string getUploadFee() const; std::string getUploadFee() const;
std::string getGroupCreationFee() const; std::string getGroupCreationFee() const;
const int& getClassifiedFee() const { return mClassifiedFee; }
std::string getDirectoryFee() const; std::string getDirectoryFee() const;
void setPlatform (const std::string& platform); void setPlatform (const std::string& platform);
@@ -87,7 +88,8 @@ public:
void setCurrencySymbol(const std::string& sym); void setCurrencySymbol(const std::string& sym);
void setCurrencyText(const std::string& text); void setCurrencyText(const std::string& text);
void setRealCurrencySymbol(const std::string& sym); void setRealCurrencySymbol(const std::string& sym);
void setDirectoryFee(int fee); void setClassifiedFee(int fee) { mClassifiedFee = fee; }
void setDirectoryFee(int fee) { mDirectoryFee = fee; }
bool supportsInvLinks(); bool supportsInvLinks();
void setSupportsInvLinks(bool b); void setSupportsInvLinks(bool b);
bool getAutoUpdate(); bool getAutoUpdate();
@@ -126,6 +128,7 @@ private:
std::string mCurrencySymbol; std::string mCurrencySymbol;
std::string mCurrencyText; std::string mCurrencyText;
std::string mRealCurrencySymbol; std::string mRealCurrencySymbol;
int mClassifiedFee;
int mDirectoryFee; int mDirectoryFee;
std::string mGridMessage; std::string mGridMessage;

View File

@@ -75,7 +75,6 @@
#include "rlvhandler.h" #include "rlvhandler.h"
// [/RLVa:KB] // [/RLVa:KB]
const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$
const S32 MATURE_UNDEFINED = -1; const S32 MATURE_UNDEFINED = -1;
const S32 MATURE_CONTENT = 1; const S32 MATURE_CONTENT = 1;
const S32 PG_CONTENT = 2; const S32 PG_CONTENT = 2;
@@ -774,10 +773,11 @@ void LLPanelClassifiedInfo::callbackGotPriceForListing(const std::string& text)
{ {
S32 price_for_listing = strtol(text.c_str(), NULL, 10); S32 price_for_listing = strtol(text.c_str(), NULL, 10);
const HippoGridInfo& grid(*gHippoGridManager->getConnectedGrid()); const HippoGridInfo& grid(*gHippoGridManager->getConnectedGrid());
if (grid.isSecondLife() && price_for_listing < MINIMUM_PRICE_FOR_LISTING) const int& min_fee(grid.getClassifiedFee());
if (price_for_listing < min_fee)
{ {
LLSD args; LLSD args;
args["MIN_PRICE"] = llformat("%d", MINIMUM_PRICE_FOR_LISTING); args["MIN_PRICE"] = llformat("%d", min_fee);
LLNotificationsUtil::add("MinClassifiedPrice", args); LLNotificationsUtil::add("MinClassifiedPrice", args);
return; return;
} }
@@ -972,7 +972,7 @@ BOOL LLFloaterPriceForListing::postBuild()
if (edit) if (edit)
{ {
edit->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); edit->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32);
std::string min_price = llformat("%d", MINIMUM_PRICE_FOR_LISTING); std::string min_price = llformat("%d", gHippoGridManager->getConnectedGrid()->getClassifiedFee());
edit->setText(min_price); edit->setText(min_price);
edit->selectAll(); edit->selectAll();
edit->setFocus(TRUE); edit->setFocus(TRUE);

View File

@@ -4214,6 +4214,8 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x
gSavedSettings.setString("AvatarPickerURL", tmp); gSavedSettings.setString("AvatarPickerURL", tmp);
gMenuBarView->getChildView("Avatar Picker")->setVisible(!tmp.empty()); gMenuBarView->getChildView("Avatar Picker")->setVisible(!tmp.empty());
gSavedSettings.setString("DestinationGuideURL", response["destination_guide_url"].asString()); gSavedSettings.setString("DestinationGuideURL", response["destination_guide_url"].asString());
tmp = response["classified_fee"].asString();
gHippoGridManager->getConnectedGrid()->setClassifiedFee(tmp.empty() ? 0 : atoi(tmp.c_str()));
} }
tmp = response["currency"].asString(); tmp = response["currency"].asString();
if (!tmp.empty()) if (!tmp.empty())