void LLCurrencyUIManager::Impl::updateCurrencyInfo() { clearEstimate(); mBought = false; mCurrencyChanged = false; if (mUserCurrencyBuy == 0) { mLocalCurrencyEstimated = true; return; } LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendString("language", LLUI::getLanguage()); keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy); keywordArgs.appendString("viewerChannel", gSavedSettings.getString("VersionChannelName")); keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::getMajor()); keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::getMinor()); keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::getPatch()); keywordArgs.appendInt("viewerBuildVersion", LLVersionInfo::getBuild()); LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionCurrency, "getCurrencyQuote", params); }
void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCValue& params) { mTransactionType = type; // Select a URI and method appropriate for the transaction type. static std::string transaction_uri; if (transaction_uri.empty()) { transaction_uri = LLViewerLogin::getInstance()->getHelperURI() + "landtool.php"; } const char* method; switch (mTransactionType) { case TransactionPreflight: method = "preflightBuyLandPrep"; break; case TransactionBuy: method = "buyLandPrep"; break; default: llwarns << "LLFloaterBuyLandUI: Unknown transaction type!" << llendl; return; } mResponder = new XMLRPCResponder; LLHTTPClient::postXMLRPC(transaction_uri, method, params.getValue(), mResponder); }
void LLFloaterBuyLandUI::finishWebSiteInfo() { LLXMLRPCValue result = mTransaction->responseValue(); mSiteValid = result["success"].asBool(); if (!mSiteValid) { tellUserError( result["errorMessage"].asString(), result["errorURI"].asString() ); return; } LLXMLRPCValue membership = result["membership"]; mSiteMembershipUpgrade = membership["upgrade"].asBool(); mSiteMembershipAction = membership["action"].asString(); mSiteMembershipPlanIDs.clear(); mSiteMembershipPlanNames.clear(); LLXMLRPCValue levels = membership["levels"]; for (LLXMLRPCValue level = levels.rewind(); level.isValid(); level = levels.next()) { mSiteMembershipPlanIDs.push_back(level["id"].asString()); mSiteMembershipPlanNames.push_back(level["description"].asString()); } mUserPlanChoice = 0; LLXMLRPCValue landUse = result["landUse"]; mSiteLandUseUpgrade = landUse["upgrade"].asBool(); mSiteLandUseAction = landUse["action"].asString(); LLXMLRPCValue currency = result["currency"]; if (currency["estimatedCost"].isValid()) { mCurrency.setUSDEstimate(currency["estimatedCost"].asInt()); } if (currency["estimatedLocalCost"].isValid()) { mCurrency.setLocalEstimate(currency["estimatedLocalCost"].asString()); } mSiteConfirm = result["confirm"].asString(); }
void LLCurrencyUIManager::Impl::updateCurrencyInfo() { mSiteCurrencyEstimated = false; mSiteCurrencyEstimatedCost = 0; mBought = false; mCurrencyChanged = false; if (mUserCurrencyBuy == 0) { mSiteCurrencyEstimated = true; return; } LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy); LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionCurrency, "getCurrencyQuote", params); }
LLXMLRPCTransaction::Impl::Impl(const std::string& uri, const std::string& method, LLXMLRPCValue params, bool useGzip) : mCurlEasyRequestStateMachinePtr(NULL), mStatus(LLXMLRPCTransaction::StatusNotStarted), mURI(uri), mResponse(0) { XMLRPC_REQUEST request = XMLRPC_RequestNew(); XMLRPC_RequestSetMethodName(request, method.c_str()); XMLRPC_RequestSetRequestType(request, xmlrpc_request_call); XMLRPC_RequestSetData(request, params.getValue()); init(request, useGzip); }
void LLCurrencyUIManager::Impl::startTransaction(TransactionType type, const char* method, LLXMLRPCValue params) { static std::string transactionURI; if (transactionURI.empty()) { transactionURI = LLViewerLogin::getInstance()->getHelperURI() + "currency.php"; } mTransactionType = type; mResponder = new XMLRPCResponder; LLHTTPClient::postXMLRPC(transactionURI, method, params.getValue(), mResponder); clearError(); }
void LLFloaterBuyLandUI::updateWebSiteInfo() { S32 askBillableArea = mIsForGroup ? 0 : mParcelBillableArea; S32 askCurrencyBuy = mCurrency.getAmount(); if (mTransaction && mTransactionType == TransactionPreflight && mPreflightAskBillableArea == askBillableArea && mPreflightAskCurrencyBuy == askCurrencyBuy) { return; } mPreflightAskBillableArea = askBillableArea; mPreflightAskCurrencyBuy = askCurrencyBuy; #if 0 // enable this code if you want the details to blank while we're talking // to the web site... it's kind of jarring mSiteValid = false; mSiteMembershipUpgrade = false; mSiteMembershipAction = "(waiting)"; mSiteMembershipPlanIDs.clear(); mSiteMembershipPlanNames.clear(); mSiteLandUseUpgrade = false; mSiteLandUseAction = "(waiting)"; mSiteCurrencyEstimated = false; mSiteCurrencyEstimatedCost = 0; #endif LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendString("language", LLUI::getLanguage()); keywordArgs.appendInt("billableArea", mPreflightAskBillableArea); keywordArgs.appendInt("currencyBuy", mPreflightAskCurrencyBuy); LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionPreflight, params); }
void LLCurrencyUIManager::Impl::startCurrencyBuy(const std::string& password) { mSiteCurrencyEstimated = false; mSiteCurrencyEstimatedCost = 0; mCurrencyChanged = false; LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy); keywordArgs.appendInt("estimatedCost", mSiteCurrencyEstimatedCost); keywordArgs.appendString("confirm", mSiteConfirm); if (!password.empty()) { keywordArgs.appendString("password", password); } LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionBuy, "buyCurrency", params); }
LLXMLRPCTransaction::Impl::Impl(const std::string& uri, const std::string& method, LLXMLRPCValue params, bool useGzip) : mCurlRequest(0), mStatus(LLXMLRPCTransaction::StatusNotStarted), mURI(uri), mRequestText(0), mResponse(0) { XMLRPC_REQUEST request = XMLRPC_RequestNew(); XMLRPC_RequestSetMethodName(request, method.c_str()); XMLRPC_RequestSetRequestType(request, xmlrpc_request_call); XMLRPC_RequestSetData(request, params.getValue()); init(request, useGzip); // DEV-28398: without this XMLRPC_RequestFree() call, it looks as though // the 'request' object is simply leaked. It's less clear to me whether we // should also ask to free request value data (second param 1), since the // data come from 'params'. XMLRPC_RequestFree(request, 1); }
void LLFloaterBuyLandUI::runWebSitePrep(const std::string& password) { if (!mCanBuy) { return; } BOOL remove_contribution = getChild<LLUICtrl>("remove_contribution")->getValue().asBoolean(); mParcelBuyInfo = LLViewerParcelMgr::getInstance()->setupParcelBuy(gAgent.getID(), gAgent.getSessionID(), gAgent.getGroupID(), mIsForGroup, mIsClaim, remove_contribution); if (mParcelBuyInfo && !mSiteMembershipUpgrade && !mSiteLandUseUpgrade && mCurrency.getAmount() == 0 && mSiteConfirm != "password") { sendBuyLand(); return; } std::string newLevel = "noChange"; if (mSiteMembershipUpgrade) { LLComboBox* levels = getChild<LLComboBox>( "account_level"); if (levels) { mUserPlanChoice = levels->getCurrentIndex(); newLevel = mSiteMembershipPlanIDs[mUserPlanChoice]; } } LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendString("language", LLUI::getLanguage()); keywordArgs.appendString("levelId", newLevel); keywordArgs.appendInt("billableArea", mIsForGroup ? 0 : mParcelBillableArea); keywordArgs.appendInt("currencyBuy", mCurrency.getAmount()); keywordArgs.appendInt("estimatedCost", mCurrency.getUSDEstimate()); keywordArgs.appendString("estimatedLocalCost", mCurrency.getLocalEstimate()); keywordArgs.appendString("confirm", mSiteConfirm); if (!password.empty()) { keywordArgs.appendString("password", password); } LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionBuy, params); }
void LLCurrencyUIManager::Impl::startCurrencyBuy(const std::string& password) { LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendInt("currencyBuy", mUserCurrencyBuy); if (mUSDCurrencyEstimated) { keywordArgs.appendInt("estimatedCost", mUSDCurrencyEstimatedCost); } if (mLocalCurrencyEstimated) { keywordArgs.appendString("estimatedLocalCost", mLocalCurrencyEstimatedCost); } keywordArgs.appendString("confirm", mSiteConfirm); if (!password.empty()) { keywordArgs.appendString("password", password); } keywordArgs.appendString("viewerChannel", gSavedSettings.getString("VersionChannelName")); keywordArgs.appendInt("viewerMajorVersion", LLVersionInfo::getMajor()); keywordArgs.appendInt("viewerMinorVersion", LLVersionInfo::getMinor()); keywordArgs.appendInt("viewerPatchVersion", LLVersionInfo::getPatch()); keywordArgs.appendInt("viewerBuildVersion", LLVersionInfo::getBuild()); LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionBuy, "buyCurrency", params); clearEstimate(); mCurrencyChanged = false; }