STORM-68 Add initial support to use a capability for setting default object

permissions on the server.
meow-7.2.2
Jonathan Yap 2013-11-07 16:27:38 -05:00
parent c817166ebe
commit e988fffbca
4 changed files with 58 additions and 3 deletions

View File

@ -32,7 +32,9 @@
#include "llviewerwindow.h"
#include "lluictrlfactory.h"
#include "llpermissions.h"
#include "llagent.h"
#include "llviewerregion.h"
#include "llnotificationsutil.h"
LLFloaterPerms::LLFloaterPerms(const LLSD& seed)
: LLFloater(seed)
@ -96,7 +98,7 @@ U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix)
}
LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed)
: LLFloater(seed)
: LLFloater(seed)
{
mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2));
mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this));
@ -145,9 +147,46 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data)
xfer->setEnabled(copyable);
}
class LLFloaterPermsResponder : public LLHTTPClient::Responder
{
public:
LLFloaterPermsResponder(): LLHTTPClient::Responder() {}
void error(U32 status, const std::string& reason)
{
LLSD args;
args["REASON"] = reason;
LLNotificationsUtil::add("DefaultObjectPermissions", args);
}
void result(const LLSD& content)
{
LL_INFOS("FloaterPermsResponder") << "Set new values" << LL_ENDL;
}
};
void LLFloaterPermsDefault::updateCap()
{
std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions");
if(!object_url.empty())
{
LLSD report = LLSD::emptyMap();
report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms("Objects");
report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms("Objects");
report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms("Objects");
LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder());
}
}
void LLFloaterPermsDefault::ok()
{
refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official.
// Changes were already applied automatically to saved settings.
// Refreshing internal values makes it official.
refresh();
// We know some setting has changed but not which one. Just in case it was a setting for
// object permissions tell the server what the values are.
updateCap();
}
void LLFloaterPermsDefault::cancel()

View File

@ -59,6 +59,7 @@ public:
void onClickOK();
void onClickCancel();
void onCommitCopy(const LLSD& user_data);
static void updateCap();
enum Categories
{

View File

@ -70,6 +70,7 @@
#include "stringize.h"
#include "llviewercontrol.h"
#include "llsdserialize.h"
#include "llfloaterperms.h"
#ifdef LL_WINDOWS
#pragma warning(disable:4355)
@ -1485,6 +1486,8 @@ void LLViewerRegion::unpackRegionHandshake()
msg->nextBlock("RegionInfo");
msg->addU32("Flags", 0x0 );
msg->sendReliable(host);
LLFloaterPermsDefault::updateCap();
}
void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
@ -1494,6 +1497,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("ChatSessionRequest");
capabilityNames.append("CopyInventoryFromNotecard");
capabilityNames.append("CreateInventoryCategory");
capabilityNames.append("DefaultObjectPermissions");
capabilityNames.append("DispatchRegionInfo");
capabilityNames.append("EstateChangeInfo");
capabilityNames.append("EventQueueGet");

View File

@ -7722,5 +7722,16 @@ Disabling future updates for this file.
Attempted to add an invalid or unreadable image file [FNAME] which could not be opened or decoded.
Attempt cancelled.
</notification>
<notification
icon="alertmodal.tga"
name="DefaultObjectPermissions"
type="alert">
There was a problem saving the default permissions due to the following reason: [REASON]. Please try setting the default permissions later.
<tag>fail</tag>
<usetemplate
name="okbutton"
yestext="OK"/>
</notification>
</notifications>