summaryrefslogtreecommitdiff
path: root/indra/newview/llmarketplacefunctions.cpp
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2012-01-11 11:26:56 -0800
committerLeslie Linden <leslie@lindenlab.com>2012-01-11 11:26:56 -0800
commit0a1cb4f03ee1aeb0cfc9d9bdb837043d0f46f292 (patch)
treeae93a6f045393d7a9d41856bfc31d6280001547f /indra/newview/llmarketplacefunctions.cpp
parent00b767e5a91d9e3379119c867164f9be40f888cc (diff)
EXP-1791 FIX -- Handle case where initialization with SLM fails in the Merchant Outbox floater in the viewer
* Updated marketplace import to properly handle failed cases of authentications and invalid cookies. The import will reset to an uninitialized state and then trigger and initialization followed immediately by an import when appropriate.
Diffstat (limited to 'indra/newview/llmarketplacefunctions.cpp')
-rw-r--r--indra/newview/llmarketplacefunctions.cpp67
1 files changed, 40 insertions, 27 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index ea6634a39e..84cbe3cac2 100644
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -133,6 +133,17 @@ namespace LLMarketplaceImport
llinfos << " SLM POST content: " << content.asString() << llendl;
}
+ if ((status == MarketplaceErrorCodes::IMPORT_REDIRECT) ||
+ (status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR))
+ {
+ if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+ {
+ llinfos << " SLM POST clearing marketplace cookie due to authentication failure" << llendl;
+ }
+
+ sMarketplaceCookie.clear();
+ }
+
sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_DONE);
sImportPostPending = false;
sImportResultStatus = status;
@@ -330,16 +341,6 @@ LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter()
{
}
-void LLMarketplaceInventoryImporter::initialize()
-{
- llassert(!mInitialized);
-
- if (!LLMarketplaceImport::hasSessionCookie())
- {
- LLMarketplaceImport::establishMarketplaceSessionCookie();
- }
-}
-
boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErrorCallback(const status_report_signal_t::slot_type& cb)
{
if (mErrorInitSignal == NULL)
@@ -370,17 +371,32 @@ boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallb
return mStatusReportSignal->connect(cb);
}
+void LLMarketplaceInventoryImporter::initialize()
+{
+ llassert(!mInitialized);
+
+ if (!LLMarketplaceImport::hasSessionCookie())
+ {
+ LLMarketplaceImport::establishMarketplaceSessionCookie();
+ }
+}
+
+void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
+{
+ mInitialized = false;
+
+ initialize();
+
+ mAutoTriggerImport = true;
+}
+
bool LLMarketplaceInventoryImporter::triggerImport()
{
const bool import_triggered = LLMarketplaceImport::triggerImport();
if (!import_triggered)
{
- mInitialized = false;
-
- initialize();
-
- mAutoTriggerImport = true;
+ reinitializeAndTriggerImport();
}
return import_triggered;
@@ -396,23 +412,14 @@ void LLMarketplaceInventoryImporter::updateImport()
if (!polling_status)
{
- mInitialized = false;
-
- initialize();
-
- mAutoTriggerImport = true;
+ reinitializeAndTriggerImport();
}
}
if (mImportInProgress != in_progress)
{
mImportInProgress = in_progress;
-
- if (mStatusChangedSignal)
- {
- (*mStatusChangedSignal)(mImportInProgress);
- }
-
+
// If we are no longer in progress
if (!mImportInProgress)
{
@@ -436,7 +443,7 @@ void LLMarketplaceInventoryImporter::updateImport()
{
mAutoTriggerImport = false;
- triggerImport();
+ mImportInProgress = triggerImport();
}
}
else if (mErrorInitSignal)
@@ -445,6 +452,12 @@ void LLMarketplaceInventoryImporter::updateImport()
}
}
}
+
+ // Make sure we trigger the status change with the final state (in case of auto trigger after initialize)
+ if (mStatusChangedSignal)
+ {
+ (*mStatusChangedSignal)(mImportInProgress);
+ }
}
}