summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterscriptlimits.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterscriptlimits.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llfloaterscriptlimits.cpp240
1 files changed, 140 insertions, 100 deletions
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index e0f646349e..5fbdd75e97 100644..100755
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -3,37 +3,33 @@
* @author Gabriel Lee
* @brief Implementation of the region info and controls floater and panels.
*
- * $LicenseInfo:firstyear=2004&license=viewergpl$
- *
- * Copyright (c) 2004-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 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.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * 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.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * 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 "llfloaterscriptlimits.h"
+// library includes
+#include "llavatarnamecache.h"
#include "llsdutil.h"
#include "llsdutil_math.h"
#include "message.h"
@@ -62,7 +58,7 @@
// debug switches, won't work in release
#ifndef LL_RELEASE_FOR_DOWNLOAD
-// dump responder replies to llinfos for debugging
+// dump responder replies to LL_INFOS() for debugging
//#define DUMP_REPLIES_TO_LLINFOS
#ifdef DUMP_REPLIES_TO_LLINFOS
@@ -110,7 +106,7 @@ BOOL LLFloaterScriptLimits::postBuild()
if(!mTab)
{
- llwarns << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << llendl;
+ LL_WARNS() << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << LL_ENDL;
return FALSE;
}
@@ -121,7 +117,7 @@ BOOL LLFloaterScriptLimits::postBuild()
LLPanelScriptLimitsRegionMemory* panel_memory;
panel_memory = new LLPanelScriptLimitsRegionMemory;
mInfoPanels.push_back(panel_memory);
- LLUICtrlFactory::getInstance()->buildPanel(panel_memory, "panel_script_limits_region_memory.xml");
+ panel_memory->buildFromFile( "panel_script_limits_region_memory.xml");
mTab->addTabPanel(panel_memory);
}
@@ -130,7 +126,7 @@ BOOL LLFloaterScriptLimits::postBuild()
{
LLPanelScriptLimitsAttachment* panel_attachments = new LLPanelScriptLimitsAttachment;
mInfoPanels.push_back(panel_attachments);
- LLUICtrlFactory::getInstance()->buildPanel(panel_attachments, "panel_script_limits_my_avatar.xml");
+ panel_attachments->buildFromFile("panel_script_limits_my_avatar.xml");
mTab->addTabPanel(panel_attachments);
}
@@ -187,8 +183,14 @@ void LLPanelScriptLimitsInfo::updateChild(LLUICtrl* child_ctr)
// Responders
///----------------------------------------------------------------------------
-void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content)
+void fetchScriptLimitsRegionInfoResponder::httpSuccess()
{
+ const LLSD& content = getContent();
+ if (!content.isMap())
+ {
+ failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
+ return;
+ }
//we don't need to test with a fake respose here (shouldn't anyway)
#ifdef DUMP_REPLIES_TO_LLINFOS
@@ -199,7 +201,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content)
OSMessageBox(nice_llsd.str(), "main cap response:", 0);
- llinfos << "main cap response:" << content << llendl;
+ LL_INFOS() << "main cap response:" << content << LL_ENDL;
#endif
@@ -214,7 +216,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content)
LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
if(!instance)
{
- llwarns << "Failed to get llfloaterscriptlimits instance" << llendl;
+ LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
}
}
@@ -225,13 +227,14 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content)
}
}
-void fetchScriptLimitsRegionInfoResponder::error(U32 status, const std::string& reason)
+void fetchScriptLimitsRegionInfoResponder::httpFailure()
{
- llwarns << "Error from responder " << reason << llendl;
+ LL_WARNS() << dumpResponse() << LL_ENDL;
}
-void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref)
+void fetchScriptLimitsRegionSummaryResponder::httpSuccess()
{
+ const LLSD& content_ref = getContent();
#ifdef USE_FAKE_RESPONSES
LLSD fake_content;
@@ -272,6 +275,12 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref)
#endif
+ if (!content.isMap())
+ {
+ failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
+ return;
+ }
+
#ifdef DUMP_REPLIES_TO_LLINFOS
@@ -281,14 +290,14 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref)
OSMessageBox(nice_llsd.str(), "summary response:", 0);
- llwarns << "summary response:" << *content << llendl;
+ LL_WARNS() << "summary response:" << *content << LL_ENDL;
#endif
LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
if(!instance)
{
- llwarns << "Failed to get llfloaterscriptlimits instance" << llendl;
+ LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
}
else
{
@@ -305,20 +314,21 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref)
{
btn->setEnabled(true);
}
-
+
panel_memory->setRegionSummary(content);
}
}
}
}
-void fetchScriptLimitsRegionSummaryResponder::error(U32 status, const std::string& reason)
+void fetchScriptLimitsRegionSummaryResponder::httpFailure()
{
- llwarns << "Error from responder " << reason << llendl;
+ LL_WARNS() << dumpResponse() << LL_ENDL;
}
-void fetchScriptLimitsRegionDetailsResponder::result(const LLSD& content_ref)
+void fetchScriptLimitsRegionDetailsResponder::httpSuccess()
{
+ const LLSD& content_ref = getContent();
#ifdef USE_FAKE_RESPONSES
/*
Updated detail service, ** denotes field added:
@@ -381,6 +391,12 @@ result (map)
#endif
+ if (!content.isMap())
+ {
+ failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
+ return;
+ }
+
#ifdef DUMP_REPLIES_TO_LLINFOS
LLSDNotationStreamer notation_streamer(content);
@@ -389,7 +405,7 @@ result (map)
OSMessageBox(nice_llsd.str(), "details response:", 0);
- llinfos << "details response:" << content << llendl;
+ LL_INFOS() << "details response:" << content << LL_ENDL;
#endif
@@ -397,7 +413,7 @@ result (map)
if(!instance)
{
- llwarns << "Failed to get llfloaterscriptlimits instance" << llendl;
+ LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
}
else
{
@@ -411,23 +427,24 @@ result (map)
}
else
{
- llwarns << "Failed to get scriptlimits memory panel" << llendl;
+ LL_WARNS() << "Failed to get scriptlimits memory panel" << LL_ENDL;
}
}
else
{
- llwarns << "Failed to get scriptlimits_panels" << llendl;
+ LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL;
}
}
}
-void fetchScriptLimitsRegionDetailsResponder::error(U32 status, const std::string& reason)
+void fetchScriptLimitsRegionDetailsResponder::httpFailure()
{
- llwarns << "Error from responder " << reason << llendl;
+ LL_WARNS() << dumpResponse() << LL_ENDL;
}
-void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)
+void fetchScriptLimitsAttachmentInfoResponder::httpSuccess()
{
+ const LLSD& content_ref = getContent();
#ifdef USE_FAKE_RESPONSES
@@ -469,6 +486,12 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)
#endif
+ if (!content.isMap())
+ {
+ failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
+ return;
+ }
+
#ifdef DUMP_REPLIES_TO_LLINFOS
LLSDNotationStreamer notation_streamer(content);
@@ -477,7 +500,7 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)
OSMessageBox(nice_llsd.str(), "attachment response:", 0);
- llinfos << "attachment response:" << content << llendl;
+ LL_INFOS() << "attachment response:" << content << LL_ENDL;
#endif
@@ -485,7 +508,7 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)
if(!instance)
{
- llwarns << "Failed to get llfloaterscriptlimits instance" << llendl;
+ LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
}
else
{
@@ -507,19 +530,19 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)
}
else
{
- llwarns << "Failed to get script_limits_my_avatar_panel" << llendl;
+ LL_WARNS() << "Failed to get script_limits_my_avatar_panel" << LL_ENDL;
}
}
else
{
- llwarns << "Failed to get scriptlimits_panels" << llendl;
+ LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL;
}
}
}
-void fetchScriptLimitsAttachmentInfoResponder::error(U32 status, const std::string& reason)
+void fetchScriptLimitsAttachmentInfoResponder::httpFailure()
{
- llwarns << "Error from responder " << reason << llendl;
+ LL_WARNS() << dumpResponse() << LL_ENDL;
}
///----------------------------------------------------------------------------
@@ -590,25 +613,24 @@ void LLPanelScriptLimitsRegionMemory::setParcelID(const LLUUID& parcel_id)
}
// virtual
-void LLPanelScriptLimitsRegionMemory::setErrorStatus(U32 status, const std::string& reason)
+void LLPanelScriptLimitsRegionMemory::setErrorStatus(S32 status, const std::string& reason)
{
- llwarns << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<llendl;
+ LL_WARNS() << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<LL_ENDL;
}
// callback from the name cache with an owner name to add to the list
void LLPanelScriptLimitsRegionMemory::onNameCache(
const LLUUID& id,
- const std::string& first_name,
- const std::string& last_name)
+ const std::string& full_name)
{
- std::string name = first_name + " " + last_name;
-
LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
if(!list)
{
return;
}
+ std::string name = LLCacheName::buildUsername(full_name);
+
std::vector<LLSD>::iterator id_itor;
for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
{
@@ -632,7 +654,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
if(!list)
{
- llwarns << "Error getting the scripts_list control" << llendl;
+ LL_WARNS() << "Error getting the scripts_list control" << LL_ENDL;
return;
}
@@ -674,6 +696,9 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
std::string name_buf = content["parcels"][i]["objects"][j]["name"].asString();
LLUUID task_id = content["parcels"][i]["objects"][j]["id"].asUUID();
LLUUID owner_id = content["parcels"][i]["objects"][j]["owner_id"].asUUID();
+ // This field may not be sent by all server versions, but it's OK if
+ // it uses the LLSD default of false
+ bool is_group_owned = content["parcels"][i]["objects"][j]["is_group_owned"].asBoolean();
F32 location_x = 0.0f;
F32 location_y = 0.0f;
@@ -699,51 +724,66 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
// ...and if not use the slightly more painful method of disovery:
else
{
- BOOL name_is_cached = gCacheName->getFullName(owner_id, owner_buf);
+ BOOL name_is_cached;
+ if (is_group_owned)
+ {
+ name_is_cached = gCacheName->getGroupName(owner_id, owner_buf);
+ }
+ else
+ {
+ name_is_cached = gCacheName->getFullName(owner_id, owner_buf); // username
+ owner_buf = LLCacheName::buildUsername(owner_buf);
+ }
if(!name_is_cached)
{
if(std::find(names_requested.begin(), names_requested.end(), owner_id) == names_requested.end())
{
names_requested.push_back(owner_id);
- gCacheName->get(owner_id, TRUE,
- boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache,
- this, _1, _2, _3));
+ gCacheName->get(owner_id, is_group_owned, // username
+ boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache,
+ this, _1, _2));
}
}
}
- LLSD element;
+ LLScrollListItem::Params item_params;
+ item_params.value = task_id;
- element["id"] = task_id;
- element["columns"][0]["column"] = "size";
- element["columns"][0]["value"] = llformat("%d", size);
- element["columns"][0]["font"] = "SANSSERIF";
- element["columns"][1]["column"] = "urls";
- element["columns"][1]["value"] = llformat("%d", urls);
- element["columns"][1]["font"] = "SANSSERIF";
- element["columns"][2]["column"] = "name";
- element["columns"][2]["value"] = name_buf;
- element["columns"][2]["font"] = "SANSSERIF";
- element["columns"][3]["column"] = "owner";
- element["columns"][3]["value"] = owner_buf;
- element["columns"][3]["font"] = "SANSSERIF";
- element["columns"][4]["column"] = "parcel";
- element["columns"][4]["value"] = parcel_name;
- element["columns"][4]["font"] = "SANSSERIF";
- element["columns"][5]["column"] = "location";
- if(has_locations)
- {
- element["columns"][5]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z);
- }
- else
- {
- element["columns"][5]["value"] = "";
- }
- element["columns"][5]["font"] = "SANSSERIF";
+ LLScrollListCell::Params cell_params;
+ cell_params.font = LLFontGL::getFontSansSerif();
+
+ cell_params.column = "size";
+ cell_params.value = size;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "urls";
+ cell_params.value = urls;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "name";
+ cell_params.value = name_buf;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "owner";
+ cell_params.value = owner_buf;
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "parcel";
+ cell_params.value = parcel_name;
+ item_params.columns.add(cell_params);
- list->addElement(element, ADD_SORTED);
+ cell_params.column = "location";
+ cell_params.value = has_locations
+ ? llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z)
+ : "";
+ item_params.columns.add(cell_params);
+
+ list->addRow(item_params);
+ LLSD element;
element["owner_id"] = owner_id;
+
+ element["id"] = task_id;
element["local_id"] = local_id;
mObjectListItems.push_back(element);
}
@@ -787,7 +827,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content)
}
else
{
- llwarns << "summary doesn't contain memory info" << llendl;
+ LL_WARNS() << "summary doesn't contain memory info" << LL_ENDL;
return;
}
@@ -805,7 +845,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content)
}
else
{
- llwarns << "summary doesn't contain urls info" << llendl;
+ LL_WARNS() << "summary doesn't contain urls info" << LL_ENDL;
return;
}
@@ -909,9 +949,9 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain()
}
else
{
- llwarns << "Can't get parcel info for script information request" << region_id
+ LL_WARNS() << "Can't get parcel info for script information request" << region_id
<< ". Region: " << region->getName()
- << " does not support RemoteParcelRequest" << llendl;
+ << " does not support RemoteParcelRequest" << LL_ENDL;
std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError");
getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
@@ -977,7 +1017,7 @@ void LLPanelScriptLimitsRegionMemory::onClickRefresh(void* userdata)
}
else
{
- llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << llendl;
+ LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL;
return;
}
}
@@ -1023,7 +1063,7 @@ void LLPanelScriptLimitsRegionMemory::onClickHighlight(void* userdata)
}
else
{
- llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << llendl;
+ LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL;
return;
}
}
@@ -1128,7 +1168,7 @@ void LLPanelScriptLimitsRegionMemory::onClickReturn(void* userdata)
}
else
{
- llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << llendl;
+ LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL;
return;
}
}
@@ -1260,7 +1300,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content)
}
else
{
- llwarns << "attachment details don't contain memory summary info" << llendl;
+ LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL;
return;
}
@@ -1278,7 +1318,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content)
}
else
{
- llwarns << "attachment details don't contain urls summary info" << llendl;
+ LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL;
return;
}
@@ -1309,7 +1349,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content)
// static
void LLPanelScriptLimitsAttachment::onClickRefresh(void* userdata)
-{
+{
LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
if(instance)
{
@@ -1330,7 +1370,7 @@ void LLPanelScriptLimitsAttachment::onClickRefresh(void* userdata)
}
else
{
- llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << llendl;
+ LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL;
return;
}
}