summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-09-16 11:46:37 -0700
committerLeslie Linden <leslie@lindenlab.com>2011-09-16 11:46:37 -0700
commit5af39ea28be1a76ec0c3042a0bf34e7d64835c18 (patch)
treedb55a3bfb7d93477b414ab295c13f3878b31f394 /indra/newview
parent10d92237adca8bffc82c887dbd37b988602b2d59 (diff)
EXP-1169 FIX -- No synch error icon given on Outbox on Agni where API does not exist
* Moved marketplace URL related functions into a new file llmarketplacefunctions.cpp/h. This will the future home of more marketplace-related functions. * Disabled sync button when the marketplace API is unavailable.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llmarketplacefunctions.cpp80
-rw-r--r--indra/newview/llmarketplacefunctions.h42
-rw-r--r--indra/newview/llpanelmarketplaceoutbox.cpp22
-rw-r--r--indra/newview/llviewermedia.cpp81
5 files changed, 165 insertions, 62 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 11b19ca4fe..8c1f98979b 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -310,6 +310,7 @@ set(viewer_SOURCE_FILES
llmaniprotate.cpp
llmanipscale.cpp
llmaniptranslate.cpp
+ llmarketplacefunctions.cpp
llmediactrl.cpp
llmediadataclient.cpp
llmemoryview.cpp
@@ -873,6 +874,7 @@ set(viewer_HEADER_FILES
llmaniprotate.h
llmanipscale.h
llmaniptranslate.h
+ llmarketplacefunctions.h
llmediactrl.h
llmediadataclient.h
llmemoryview.h
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
new file mode 100644
index 0000000000..599731a641
--- /dev/null
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -0,0 +1,80 @@
+/**
+ * @file llmarketplacefunctions.cpp
+ * @brief Implementation of assorted functions related to the marketplace
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llmarketplacefunctions.h"
+
+#include "llagent.h"
+#include "llviewernetwork.h"
+
+
+std::string getMarketplaceBaseURL()
+{
+ std::string url = "https://marketplace.secondlife.com/";
+
+ if (!LLGridManager::getInstance()->isInProductionGrid())
+ {
+ std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
+ url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
+ }
+
+ url += "api/1/users/";
+ url += gAgent.getID().getString();
+
+ return url;
+}
+
+std::string getMarketplaceURL_InventoryImport()
+{
+ std::string url = getMarketplaceBaseURL();
+
+ url += "/inventory_import";
+
+ return url;
+}
+
+std::string getMarketplaceURL_UserStatus()
+{
+ std::string url = getMarketplaceBaseURL();
+
+ url += "/user_status";
+
+ return url;
+}
+
+
+static bool gMarketplaceSyncEnabled = false;
+
+bool getMarketplaceSyncEnabled()
+{
+ return gMarketplaceSyncEnabled;
+}
+
+void setMarketplaceSyncEnabled(bool syncEnabled)
+{
+ gMarketplaceSyncEnabled = syncEnabled;
+}
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
new file mode 100644
index 0000000000..e80e6a471c
--- /dev/null
+++ b/indra/newview/llmarketplacefunctions.h
@@ -0,0 +1,42 @@
+/**
+ * @file llmarketplacefunctions.h
+ * @brief Miscellaneous marketplace-related functions and classes
+ * class definition
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLMARKETPLACEFUNCTIONS_H
+#define LL_LLMARKETPLACEFUNCTIONS_H
+
+
+std::string getMarketplaceURL_InventoryImport();
+std::string getMarketplaceURL_UserStatus();
+
+bool getMarketplaceSyncEnabled();
+void setMarketplaceSyncEnabled(bool syncEnabled);
+
+
+#endif // LL_LLMARKETPLACEFUNCTIONS_H
+
+
+
diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp
index 73fb92ff72..2764527c44 100644
--- a/indra/newview/llpanelmarketplaceoutbox.cpp
+++ b/indra/newview/llpanelmarketplaceoutbox.cpp
@@ -35,6 +35,7 @@
#include "lleventcoro.h"
#include "llinventorypanel.h"
#include "llloadingindicator.h"
+#include "llmarketplacefunctions.h"
#include "llnotificationsutil.h"
#include "llpanelmarketplaceinbox.h"
#include "llsdutil.h"
@@ -82,7 +83,7 @@ void LLPanelMarketplaceOutbox::handleLoginComplete()
{
mSyncButton = getChild<LLButton>("outbox_sync_btn");
mSyncButton->setCommitCallback(boost::bind(&LLPanelMarketplaceOutbox::onSyncButtonClicked, this));
- mSyncButton->setEnabled(!isOutboxEmpty());
+ mSyncButton->setEnabled(getMarketplaceSyncEnabled() && !isOutboxEmpty());
mSyncIndicator = getChild<LLLoadingIndicator>("outbox_sync_indicator");
}
@@ -223,20 +224,7 @@ void LLPanelMarketplaceOutbox::onSyncButtonClicked()
updateSyncButtonStatus();
// Make the url for the inventory import request
- std::string url = "https://marketplace.secondlife.com/";
-
- if (!LLGridManager::getInstance()->isInProductionGrid())
- {
- std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
- url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
-
- // TEMP for Jim's pdp
- //url = "http://pdp24.lindenlab.com:3000/";
- }
-
- url += "api/1/users/";
- url += gAgent.getID().getString();
- url += "/inventory_import";
+ std::string url = getMarketplaceURL_InventoryImport();
llinfos << "http get: " << url << llendl;
LLHTTPClient::get(url, new LLInventorySyncResponder(this), LLViewerMedia::getHeaders());
@@ -311,7 +299,7 @@ void LLPanelMarketplaceOutbox::updateSyncButtonStatus()
mSyncIndicator->setVisible(false);
mSyncButton->setVisible(true);
- mSyncButton->setEnabled(!isOutboxEmpty());
+ mSyncButton->setEnabled(getMarketplaceSyncEnabled() && !isOutboxEmpty());
}
}
@@ -352,7 +340,7 @@ void LLPanelMarketplaceOutbox::draw()
if (!isSyncInProgress())
{
- mSyncButton->setEnabled(not_empty);
+ mSyncButton->setEnabled(getMarketplaceSyncEnabled() && not_empty);
}
LLPanel::draw();
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index e7f05dcaa3..b60881b5f1 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -26,51 +26,49 @@
#include "llviewerprecompiledheaders.h"
+#include "llviewermedia.h"
+
#include "llagent.h"
#include "llagentcamera.h"
-#include "llviewermedia.h"
-#include "llviewermediafocus.h"
-#include "llmimetypes.h"
+#include "llappviewer.h"
+#include "llaudioengine.h" // for gAudiop
+#include "llcallbacklist.h"
+#include "lldir.h"
+#include "lldiriterator.h"
+#include "llevent.h" // LLSimpleListener
+#include "llfilepicker.h"
+#include "llfloatermediabrowser.h" // for handling window close requests and geometry change requests in media browser windows.
+#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows.
+#include "llfocusmgr.h"
+#include "llkeyboard.h"
+#include "lllogininstance.h"
+#include "llmarketplacefunctions.h"
#include "llmediaentry.h"
+#include "llmimetypes.h"
+#include "llmutelist.h"
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
+#include "llpanelprofile.h"
+#include "llparcel.h"
+#include "llpluginclassmedia.h"
+#include "llplugincookiestore.h"
+#include "llurldispatcher.h"
+#include "lluuid.h"
#include "llversioninfo.h"
#include "llviewercontrol.h"
-#include "llviewertexture.h"
+#include "llviewermediafocus.h"
#include "llviewerparcelmedia.h"
#include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
+#include "llviewertexture.h"
#include "llviewertexturelist.h"
-#include "llvovolume.h"
-#include "llpluginclassmedia.h"
-#include "llplugincookiestore.h"
#include "llviewerwindow.h"
-#include "llfocusmgr.h"
-#include "llcallbacklist.h"
-#include "llparcel.h"
-#include "llaudioengine.h" // for gAudiop
-#include "llurldispatcher.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
-#include "llviewerregion.h"
+#include "llvovolume.h"
#include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this!
-#include "llfilepicker.h"
-#include "llnotifications.h"
-#include "lldir.h"
-#include "lldiriterator.h"
-#include "llevent.h" // LLSimpleListener
-#include "llnotificationsutil.h"
-#include "lluuid.h"
-#include "llkeyboard.h"
-#include "llmutelist.h"
-#include "llpanelprofile.h"
-#include "llappviewer.h"
-#include "lllogininstance.h"
-//#include "llfirstuse.h"
-#include "llviewernetwork.h"
#include "llwindow.h"
-
-#include "llfloatermediabrowser.h" // for handling window close requests and geometry change requests in media browser windows.
-#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows.
-
#include <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
@@ -1394,14 +1392,20 @@ public:
#if ENABLE_INVENTORY_DISPLAY_OUTBOX
gSavedSettings.setBOOL("InventoryDisplayOutbox", true);
#endif
+
+ setMarketplaceSyncEnabled(true);
}
else if (status == 401)
{
// API is available for use but OpenID authorization failed
gSavedSettings.setBOOL("InventoryDisplayInbox", true);
+
+ setMarketplaceSyncEnabled(false);
}
else
{
+ setMarketplaceSyncEnabled(false);
+
// API in unavailable
llinfos << "Marketplace API is unavailable -- Inbox may be disabled, status = " << status << ", reason = " << reason << llendl;
}
@@ -1411,20 +1415,7 @@ public:
void doOnetimeEarlyHTTPRequests()
{
- std::string url = "https://marketplace.secondlife.com/";
-
- if (!LLGridManager::getInstance()->isInProductionGrid())
- {
- std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
- url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
-
- // TEMP for Jim's pdp
- //url = "http://pdp24.lindenlab.com:3000/";
- }
-
- url += "api/1/users/";
- url += gAgent.getID().getString();
- url += "/user_status";
+ std::string url = getMarketplaceURL_UserStatus();
llinfos << "http get: " << url << llendl;
LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), LLViewerMedia::getHeaders());