Merge from dd repo

meow-7.2.2
Leslie Linden 2011-10-26 13:59:22 -07:00
commit f01aa16298
7 changed files with 173 additions and 70 deletions

View File

@ -314,6 +314,7 @@ set(viewer_SOURCE_FILES
llmaniprotate.cpp
llmanipscale.cpp
llmaniptranslate.cpp
llmarketplacefunctions.cpp
llmediactrl.cpp
llmediadataclient.cpp
llmemoryview.cpp
@ -880,6 +881,7 @@ set(viewer_HEADER_FILES
llmaniprotate.h
llmanipscale.h
llmaniptranslate.h
llmarketplacefunctions.h
llmediactrl.h
llmediadataclient.h
llmemoryview.h

View File

@ -71,7 +71,7 @@
#include "llwearablelist.h"
// Marketplace outbox current disabled
#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 0 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_PANEL
#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_PANEL
typedef std::pair<LLUUID, LLUUID> two_uuids_t;
typedef std::list<two_uuids_t> two_uuids_list_t;

View File

@ -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;
}

View File

@ -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

View File

@ -36,6 +36,7 @@
#include "llfloatersidepanelcontainer.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");
}
@ -227,20 +228,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());
@ -315,7 +303,7 @@ void LLPanelMarketplaceOutbox::updateSyncButtonStatus()
mSyncIndicator->setVisible(false);
mSyncButton->setVisible(true);
mSyncButton->setEnabled(!isOutboxEmpty());
mSyncButton->setEnabled(getMarketplaceSyncEnabled() && !isOutboxEmpty());
}
}
@ -356,7 +344,7 @@ void LLPanelMarketplaceOutbox::draw()
if (!isSyncInProgress())
{
mSyncButton->setEnabled(not_empty);
mSyncButton->setEnabled(getMarketplaceSyncEnabled() && not_empty);
}
LLPanel::draw();

View File

@ -69,7 +69,7 @@ static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_
#define AUTO_EXPAND_INBOX 0
// Temporarily disabling the outbox until we straighten out the API
#define ENABLE_MERCHANT_OUTBOX_PANEL 0 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
#define ENABLE_MERCHANT_OUTBOX_PANEL 1 // keep in sync with ENABLE_INVENTORY_DISPLAY_OUTBOX, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
static const char * const INBOX_BUTTON_NAME = "inbox_btn";
static const char * const OUTBOX_BUTTON_NAME = "outbox_btn";

View File

@ -26,50 +26,48 @@
#include "llviewerprecompiledheaders.h"
#include "llviewermedia.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llviewermedia.h"
#include "llviewermediafocus.h"
#include "llmimetypes.h"
#include "llmediaentry.h"
#include "llversioninfo.h"
#include "llviewercontrol.h"
#include "llviewertexture.h"
#include "llviewerparcelmedia.h"
#include "llviewerparcelmgr.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 "llappviewer.h"
#include "llaudioengine.h" // for gAudiop
#include "llurldispatcher.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llviewerregion.h"
#include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this!
#include "llfilepicker.h"
#include "llnotifications.h"
#include "llcallbacklist.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 "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 "llviewermediafocus.h"
#include "llviewerparcelmedia.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewertexture.h"
#include "llviewertexturelist.h"
#include "llviewerwindow.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llvovolume.h"
#include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this!
#include "llwindow.h"
#include <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
@ -1368,7 +1366,7 @@ void LLViewerMedia::removeCookie(const std::string &name, const std::string &dom
// This is defined in two files but I don't want to create a dependence between this and llsidepanelinventory
// just to be able to temporarily disable the outbox.
#define ENABLE_INVENTORY_DISPLAY_OUTBOX 0 // keep in sync with ENABLE_MERCHANT_OUTBOX_PANEL, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
#define ENABLE_INVENTORY_DISPLAY_OUTBOX 1 // keep in sync with ENABLE_MERCHANT_OUTBOX_PANEL, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
class LLInventoryUserStatusResponder : public LLHTTPClient::Responder
{
@ -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());