diff options
-rw-r--r-- | indra/llui/llbadge.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.cpp | 64 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 49 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 2 |
4 files changed, 60 insertions, 59 deletions
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 53db226b20..c28a947a7f 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -221,11 +221,11 @@ void LLBadge::draw() F32 badge_x = badge_center_x - badge_width * 0.5f; F32 badge_y = badge_center_y - badge_height * 0.5f; - mImage->drawSolid(badge_x, badge_y, badge_width, badge_height, mImageColor % alpha); + mImage->drawSolid((S32) badge_x, (S32) badge_y, (S32) badge_width, (S32) badge_height, mImageColor % alpha); if (!mBorderImage.isNull()) { - mBorderImage->drawSolid(badge_x, badge_y, badge_width, badge_height, mBorderColor % alpha); + mBorderImage->drawSolid((S32) badge_x, (S32) badge_y, (S32) badge_width, (S32) badge_height, mBorderColor % alpha); } } else diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 1182e5db34..f9e029be19 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -52,7 +52,6 @@ #include "llstring.h" #include "lltabcontainer.h" #include "llviewermedia.h" -#include "llviewernetwork.h" #include "llweb.h" static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_inventory"); @@ -81,37 +80,6 @@ static const char * const MARKETPLACE_INBOX_PANEL = "marketplace_inbox"; // Helpers // -class LLInventoryUserStatusResponder : public LLHTTPClient::Responder -{ -public: - LLInventoryUserStatusResponder(LLSidepanelInventory * sidepanelInventory) - : LLCurl::Responder() - , mSidepanelInventory(sidepanelInventory) - { - } - - void completed(U32 status, const std::string& reason, const LLSD& content) - { - if (isGoodStatus(status)) - { - // Complete success - mSidepanelInventory->enableInbox(true); - } - else if (status == 401) - { - // API is available for use but OpenID authorization failed - mSidepanelInventory->enableInbox(true); - } - else - { - // API in unavailable - llinfos << "Marketplace API is unavailable -- Inbox Disabled" << llendl; - } - } - -private: - LLSidepanelInventory * mSidepanelInventory; -}; // // Implementation @@ -137,6 +105,13 @@ LLSidepanelInventory::~LLSidepanelInventory() delete mCategoriesObserver; } +void handleInventoryDisplayInboxChanged() +{ + LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + + sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); +} + BOOL LLSidepanelInventory::postBuild() { // UI elements from inventory panel @@ -228,35 +203,14 @@ BOOL LLSidepanelInventory::postBuild() LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); } + gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); + return TRUE; } void LLSidepanelInventory::handleLoginComplete() { // - // Hard coding this as a temporary way to determine whether or not to display the inbox - // - - 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(); - url += "/user_status"; - - LLSD headers = LLSD::emptyMap(); - headers["Accept"] = "*/*"; - headers["Cookie"] = LLViewerMedia::getOpenIDCookie(); - headers["User-Agent"] = LLViewerMedia::getCurrentUserAgent(); - - LLHTTPClient::get(url, new LLInventoryUserStatusResponder(this), headers); - - // // Track inbox and outbox folder changes // diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 1e53274cd6..4be39bb88e 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -64,8 +64,10 @@ #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. @@ -1360,6 +1362,34 @@ void LLViewerMedia::removeCookie(const std::string &name, const std::string &dom } +class LLInventoryUserStatusResponder : public LLHTTPClient::Responder +{ +public: + LLInventoryUserStatusResponder() + : LLCurl::Responder() + { + } + + void completed(U32 status, const std::string& reason, const LLSD& content) + { + if (isGoodStatus(status)) + { + // Complete success + gSavedSettings.setBOOL("InventoryDisplayInbox", true); + } + else if (status == 401) + { + // API is available for use but OpenID authorization failed + gSavedSettings.setBOOL("InventoryDisplayInbox", true); + } + else + { + // API in unavailable + llinfos << "Marketplace API is unavailable -- Inbox Disabled" << llendl; + } + } +}; + ///////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerMedia::setOpenIDCookie() @@ -1406,6 +1436,25 @@ void LLViewerMedia::setOpenIDCookie() LLHTTPClient::get(profile_url, new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()), headers); + + 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(); + url += "/user_status"; + + headers = LLSD::emptyMap(); + headers["Accept"] = "*/*"; + headers["Cookie"] = sOpenIDCookie; + headers["User-Agent"] = getCurrentUserAgent(); + + LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), headers); } } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 180e1d5676..a70c6f4887 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -160,8 +160,6 @@ public: static void createSpareBrowserMediaSource(); static LLPluginClassMedia* getSpareBrowserMediaSource(); - - static std::string getOpenIDCookie() { return sOpenIDCookie; } private: static void setOpenIDCookie(); |