From 9ec7c9e8afaadbe91d888e588ebfcf7cba44dfdc Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 7 Nov 2013 00:24:51 +0000 Subject: STORM-1831 Adding "LSLSyntax" to list of capabilities the region keeps track of. --- indra/newview/llviewerregion.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 678f24fb3c..854f05f116 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1614,6 +1614,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("GroupProposalBallot"); capabilityNames.append("HomeLocation"); capabilityNames.append("LandResources"); + capabilityNames.append("LSLSyntax"); capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); capabilityNames.append("MeshUploadFlag"); -- cgit v1.3 From e988fffbca2199156ed656a091409394246f929d Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 7 Nov 2013 16:27:38 -0500 Subject: STORM-68 Add initial support to use a capability for setting default object permissions on the server. --- indra/newview/llfloaterperms.cpp | 45 ++++++++++++++++++++-- indra/newview/llfloaterperms.h | 1 + indra/newview/llviewerregion.cpp | 4 ++ .../newview/skins/default/xui/en/notifications.xml | 11 ++++++ 4 files changed, 58 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') 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. + + + There was a problem saving the default permissions due to the following reason: [REASON]. Please try setting the default permissions later. + fail + + -- cgit v1.3 From 56b1b35a18c21f6dad4147df35ba4594f31b67e3 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 11 Nov 2013 13:21:12 -0500 Subject: STORM-68 Send default permissions to simulator just once after logging in --- indra/newview/llfloaterperms.cpp | 19 ++++++++++++++++--- indra/newview/llfloaterperms.h | 3 ++- indra/newview/llviewerregion.cpp | 5 ++++- 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index c167c03c30..f5a9bc7bb5 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -97,6 +97,8 @@ U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) return flags; } +static bool mCapSent = false; + LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) : LLFloater(seed) { @@ -160,12 +162,18 @@ public: } void result(const LLSD& content) { - LL_INFOS("FloaterPermsResponder") << "Set new values" << LL_ENDL; + LLFloaterPermsDefault::setCapSent(true); + LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; -void LLFloaterPermsDefault::updateCap() +void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) { + if(!alwaysUpdate && mCapSent) + { + return; + } + std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); if(!object_url.empty()) @@ -178,6 +186,11 @@ void LLFloaterPermsDefault::updateCap() } } +void LLFloaterPermsDefault::setCapSent(bool cap_sent) +{ + mCapSent = cap_sent; +} + void LLFloaterPermsDefault::ok() { // Changes were already applied automatically to saved settings. @@ -186,7 +199,7 @@ void LLFloaterPermsDefault::ok() // 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(); + updateCap(true); } void LLFloaterPermsDefault::cancel() diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 5fe39a2c1b..a31d034ec8 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -59,7 +59,8 @@ public: void onClickOK(); void onClickCancel(); void onCommitCopy(const LLSD& user_data); - static void updateCap(); + static void updateCap(bool alwaysUpdate); + static void setCapSent(bool cap_sent); enum Categories { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7b5721cb39..68db98580f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1487,7 +1487,10 @@ void LLViewerRegion::unpackRegionHandshake() msg->addU32("Flags", 0x0 ); msg->sendReliable(host); - LLFloaterPermsDefault::updateCap(); + // Supplying false in this call means only send the default permissions to the simulator if + // it has never been sent. Once this data is sent the simulator will pass this data to new + // simulators as the agent moves around. + LLFloaterPermsDefault::updateCap(false); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.3 From b7edc965bc77ab21e9a1e3f6b424299a50053529 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 19 Nov 2013 16:32:41 -0500 Subject: STORM-68 Place initial call to send cap in new, better location. Make processing of debug setting names a little more elegant. --- indra/newview/llagent.cpp | 3 +++ indra/newview/llfloaterperms.cpp | 50 ++++++++++++++++++++++------------------ indra/newview/llfloaterperms.h | 5 ++-- indra/newview/llviewerregion.cpp | 1 - 4 files changed, 34 insertions(+), 25 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3870a3be2e..f9301b61a1 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -737,6 +737,9 @@ void LLAgent::setRegion(LLViewerRegion *regionp) // Update all of the regions. LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal); + + // Send default object permissions to simulator + LLFloaterPermsDefault::updateCap(false); } // Pass new region along to metrics components that care about this level of detail. diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index f5a9bc7bb5..dc4969f5e6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -1,7 +1,7 @@ /** * @file llfloaterperms.cpp * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -43,7 +43,7 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) BOOL LLFloaterPerms::postBuild() { - return true; + return TRUE; } //static @@ -107,17 +107,23 @@ LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } + +// String equivalents of enum Categories - initialization order must match enum order! +const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = +{ + "Objects", + "Uploads", + "Scripts", + "Notecards", + "Gestures", + "Wearables" +}; + + BOOL LLFloaterPermsDefault::postBuild() { mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this)); - category_names[CAT_OBJECTS] = "Objects"; - category_names[CAT_UPLOADS] = "Uploads"; - category_names[CAT_SCRIPTS] = "Scripts"; - category_names[CAT_NOTECARDS] = "Notecards"; - category_names[CAT_GESTURES] = "Gestures"; - category_names[CAT_WEARABLES] = "Wearables"; - refresh(); return true; @@ -179,9 +185,9 @@ void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) 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"); + report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } @@ -206,11 +212,11 @@ void LLFloaterPermsDefault::cancel() { for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerModify", mNextOwnerModify[iter]); - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); - gSavedSettings.setBOOL(category_names[iter]+"ShareWithGroup", mShareWithGroup[iter]); - gSavedSettings.setBOOL(category_names[iter]+"EveryoneCopy", mEveryoneCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerModify", mNextOwnerModify[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"ShareWithGroup", mShareWithGroup[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"EveryoneCopy", mEveryoneCopy[iter]); } } @@ -218,10 +224,10 @@ void LLFloaterPermsDefault::refresh() { for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - mShareWithGroup[iter] = gSavedSettings.getBOOL(category_names[iter]+"ShareWithGroup"); - mEveryoneCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"EveryoneCopy"); - mNextOwnerCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerCopy"); - mNextOwnerModify[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerModify"); - mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerTransfer"); + mShareWithGroup[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"ShareWithGroup"); + mEveryoneCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"EveryoneCopy"); + mNextOwnerCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerCopy"); + mNextOwnerModify[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerModify"); + mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerTransfer"); } } diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index a31d034ec8..b4b5d58aa5 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -1,7 +1,7 @@ /** * @file llfloaterperms.h * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code @@ -62,6 +62,7 @@ public: static void updateCap(bool alwaysUpdate); static void setCapSent(bool cap_sent); +// Update instantiation of sCategoryNames in the .cpp file to match if you change this! enum Categories { CAT_OBJECTS, @@ -77,7 +78,7 @@ private: LLFloaterPermsDefault(const LLSD& seed); void refresh(); - std::string category_names[CAT_LAST]; + static const std::string sCategoryNames[CAT_LAST]; // cached values only for implementing cancel. bool mShareWithGroup[CAT_LAST]; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 68db98580f..21e0db46c9 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1490,7 +1490,6 @@ void LLViewerRegion::unpackRegionHandshake() // Supplying false in this call means only send the default permissions to the simulator if // it has never been sent. Once this data is sent the simulator will pass this data to new // simulators as the agent moves around. - LLFloaterPermsDefault::updateCap(false); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.3 From 176901422f0122dad8d1e4e423d0bc19e9e4ad8a Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 20 Nov 2013 10:21:41 -0500 Subject: STORM-68 Reapply changes to inventory processing lost in the merge. Move call to updateCap back to where it was. The place it was moved to was too early in the login sequence and was causing a crash. --- indra/newview/llagent.cpp | 3 -- indra/newview/llfloaterperms.cpp | 3 ++ indra/newview/llviewerinventory.cpp | 99 ++++++++++++++++++++++++++++++------- indra/newview/llviewerinventory.h | 2 + indra/newview/llviewerregion.cpp | 1 + 5 files changed, 88 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 7d2b4f6269..d210456993 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -898,9 +898,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp) // Update all of the regions. LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal); - - // Send default object permissions to simulator - LLFloaterPermsDefault::updateCap(false); } // Pass new region along to metrics components that care about this level of detail. diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index dc4969f5e6..4923420a3e 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -175,15 +175,18 @@ public: void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) { +llwarns << "DBG start" << llendl; if(!alwaysUpdate && mCapSent) { return; } +llwarns << "DBG getRegion" << llendl; std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); if(!object_url.empty()) { +llwarns << "DBG post" << llendl; LLSD report = LLSD::emptyMap(); report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index fff9821e86..5e3df16c38 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -65,6 +65,7 @@ #include "llavataractions.h" #include "lllogininstance.h" #include "llfavoritesbar.h" +#include "llfloaterperms.h" // Two do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} @@ -989,6 +990,24 @@ void activate_gesture_cb(const LLUUID& inv_item) LLGestureMgr::instance().activateGesture(inv_item); } +void create_script_cb(const LLUUID& inv_item) +{ + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); + + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); +} + void create_gesture_cb(const LLUUID& inv_item) { if (inv_item.isNull()) @@ -998,6 +1017,13 @@ void create_gesture_cb(const LLUUID& inv_item) LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + + item->setPermissions(perm); + gInventory.updateItem(item); gInventory.notifyObservers(); @@ -1007,6 +1033,24 @@ void create_gesture_cb(const LLUUID& inv_item) } +void create_notecard_cb(const LLUUID& inv_item) +{ + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards")); + + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); +} + LLInventoryCallbackManager gInventoryCallbacks; void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, @@ -1260,22 +1304,43 @@ void create_new_item(const std::string& name, LLViewerAssetType::generateDescriptionFor(asset_type, desc); next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; - - if (inv_type == LLInventoryType::IT_GESTURE) - { - LLPointer cb = new LLBoostFuncInventoryCallback(create_gesture_cb); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); - } - else + LLPointer cb = NULL; + + switch (inv_type) { - LLPointer cb = NULL; - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); + case LLInventoryType::IT_LSL: + { + cb = new LLBoostFuncInventoryCallback(create_script_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts"); + break; + } + + case LLInventoryType::IT_GESTURE: + { + cb = new LLBoostFuncInventoryCallback(create_gesture_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures"); + break; + } + + case LLInventoryType::IT_NOTECARD: + { + cb = new LLBoostFuncInventoryCallback(create_notecard_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); + break; + } } - + + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + parent_id, + LLTransactionID::tnull, + name, + desc, + asset_type, + inv_type, + NOT_WEARABLE, + next_owner_perm, + cb); } const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) @@ -1316,7 +1381,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - PERM_MOVE | PERM_TRANSFER); + PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item } else if ("notecard" == type_name) { @@ -1325,7 +1390,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else if ("gesture" == type_name) { @@ -1334,7 +1399,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else { diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index ab19a12014..dc2fdb8c8d 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -249,7 +249,9 @@ void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachme void activate_gesture_cb(const LLUUID& inv_item); +void create_script_cb(const LLUUID& inv_item); void create_gesture_cb(const LLUUID& inv_item); +void create_notecard_cb(const LLUUID& inv_item); class AddFavoriteLandmarkCallback : public LLInventoryCallback { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c6e67355c3..dd88c5b846 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1577,6 +1577,7 @@ void LLViewerRegion::unpackRegionHandshake() // Supplying false in this call means only send the default permissions to the simulator if // it has never been sent. Once this data is sent the simulator will pass this data to new // simulators as the agent moves around. + LLFloaterPermsDefault::updateCap(false); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.3 From 9e8a7869ce4e51d5caeb46118972509a0110f766 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 3 Dec 2013 10:44:44 -0500 Subject: STORM-68 Change CAP name to AgentPreferences and adjust LLSD format to mesh with server changes --- indra/newview/llfloaterperms.cpp | 13 ++++++++----- indra/newview/llviewerregion.cpp | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 4923420a3e..b03a4e9013 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -182,15 +182,18 @@ llwarns << "DBG start" << llendl; } llwarns << "DBG getRegion" << llendl; - std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); + std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); if(!object_url.empty()) { -llwarns << "DBG post" << llendl; LLSD report = LLSD::emptyMap(); - report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); - report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); - report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Group"] = + (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Everyone"] = + (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["NextOwner"] = + (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); +llwarns << "DBG post:" << report << llendl; LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dd88c5b846..4cd9f9769a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1582,6 +1582,7 @@ void LLViewerRegion::unpackRegionHandshake() void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) { + capabilityNames.append("AgentPreferences"); capabilityNames.append("AgentState"); capabilityNames.append("AttachmentResources"); capabilityNames.append("AvatarPickerSearch"); @@ -1589,7 +1590,6 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("ChatSessionRequest"); capabilityNames.append("CopyInventoryFromNotecard"); capabilityNames.append("CreateInventoryCategory"); - capabilityNames.append("DefaultObjectPermissions"); capabilityNames.append("DispatchRegionInfo"); capabilityNames.append("EnvironmentSettings"); capabilityNames.append("EstateChangeInfo"); -- cgit v1.3 From 944840c8b164aa0f254d3d0eb38292a49b0dcae6 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 5 Dec 2013 13:26:43 -0500 Subject: STORM-68 Code cleanup/function renaming --- indra/newview/llfloaterperms.cpp | 34 +++++++++++++++++++++++----------- indra/newview/llfloaterperms.h | 3 ++- indra/newview/llviewerregion.cpp | 5 +---- 3 files changed, 26 insertions(+), 16 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index b03a4e9013..28fb76160a 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -158,30 +158,42 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) class LLFloaterPermsResponder : public LLHTTPClient::Responder { public: - LLFloaterPermsResponder(): LLHTTPClient::Responder() {} + LLFloaterPermsResponder(): LLHTTPClient::Responder() {} +private: + std::string mPreviousReason; void error(U32 status, const std::string& reason) { - LLSD args; - args["REASON"] = reason; - LLNotificationsUtil::add("DefaultObjectPermissions", args); +llwarns << "DBG !" << mPreviousReason << "!" << llendl; + // Do not display the same error more than once in a row + if (reason != mPreviousReason) + { + mPreviousReason = reason; + LLSD args; + args["REASON"] = reason; + LLNotificationsUtil::add("DefaultObjectPermissions", args); + } } void result(const LLSD& content) { + // Since we have had a successful POST call be sure to display the next error message + // even if it is the same as a previous one. + mPreviousReason = ""; LLFloaterPermsDefault::setCapSent(true); LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; -void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) +void LLFloaterPermsDefault::sendInitialPerms() { -llwarns << "DBG start" << llendl; - if(!alwaysUpdate && mCapSent) + if(!mCapSent) { - return; + updateCap(); } +} -llwarns << "DBG getRegion" << llendl; +void LLFloaterPermsDefault::updateCap() +{ std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); if(!object_url.empty()) @@ -193,7 +205,7 @@ llwarns << "DBG getRegion" << llendl; (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); report["default_object_perm_masks"]["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); -llwarns << "DBG post:" << report << llendl; + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } @@ -211,7 +223,7 @@ void LLFloaterPermsDefault::ok() // 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(true); + updateCap(); } void LLFloaterPermsDefault::cancel() diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index b4b5d58aa5..2bb0a19dc1 100755 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -59,7 +59,8 @@ public: void onClickOK(); void onClickCancel(); void onCommitCopy(const LLSD& user_data); - static void updateCap(bool alwaysUpdate); + static void sendInitialPerms(); + static void updateCap(); static void setCapSent(bool cap_sent); // Update instantiation of sCategoryNames in the .cpp file to match if you change this! diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4cd9f9769a..dcecddece5 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1574,10 +1574,7 @@ void LLViewerRegion::unpackRegionHandshake() msg->addU32("Flags", 0x0 ); msg->sendReliable(host); - // Supplying false in this call means only send the default permissions to the simulator if - // it has never been sent. Once this data is sent the simulator will pass this data to new - // simulators as the agent moves around. - LLFloaterPermsDefault::updateCap(false); + LLFloaterPermsDefault::sendInitialPerms(); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.3 From b562de469a04c5b267e46c0a0bbf4d898e36d3f7 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 10 Dec 2013 16:25:57 -0500 Subject: STORM-68 Move initial call to POST default permissions to a better location. --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dcecddece5..e3df09022c 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1573,8 +1573,6 @@ void LLViewerRegion::unpackRegionHandshake() msg->nextBlock("RegionInfo"); msg->addU32("Flags", 0x0 ); msg->sendReliable(host); - - LLFloaterPermsDefault::sendInitialPerms(); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) @@ -1847,6 +1845,8 @@ void LLViewerRegion::setCapabilitiesReceived(bool received) { mCapabilitiesReceivedSignal(getRegionID()); + LLFloaterPermsDefault::sendInitialPerms(); + // This is a single-shot signal. Forget callbacks to save resources. mCapabilitiesReceivedSignal.disconnect_all_slots(); } -- cgit v1.3