summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2013-11-07 16:27:38 -0500
committerJonathan Yap <none@none>2013-11-07 16:27:38 -0500
commite988fffbca2199156ed656a091409394246f929d (patch)
tree53546b8edf2660e8ca70e0ba410748f94772947a /indra
parentc817166ebe67cefd02f8c9e3bb9195a6a86fa199 (diff)
STORM-68 Add initial support to use a capability for setting default object
permissions on the server.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterperms.cpp45
-rw-r--r--indra/newview/llfloaterperms.h1
-rw-r--r--indra/newview/llviewerregion.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml11
4 files changed, 58 insertions, 3 deletions
diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp
index 4e9acfc780..c167c03c30 100644
--- a/indra/newview/llfloaterperms.cpp
+++ b/indra/newview/llfloaterperms.cpp
@@ -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()
diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h
index bb4a6f9702..5fe39a2c1b 100644
--- a/indra/newview/llfloaterperms.h
+++ b/indra/newview/llfloaterperms.h
@@ -59,6 +59,7 @@ public:
void onClickOK();
void onClickCancel();
void onCommitCopy(const LLSD& user_data);
+ static void updateCap();
enum Categories
{
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index e3cb985ddb..7b5721cb39 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -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");
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index afc5b916e7..a46cce996b 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -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>