diff options
author | Cinder <cinder@sdf.org> | 2015-02-08 12:53:39 -0700 |
---|---|---|
committer | Cinder <cinder@sdf.org> | 2015-02-08 12:53:39 -0700 |
commit | ca08bd5aba5e69fce3b0f5b4f861ffec9fe4d2e5 (patch) | |
tree | 16bdd84d4a0911c80d95d5dc04a3bdd342506e55 /indra/newview/llviewermessage.cpp | |
parent | ae6440eecc4d6c018a3634c2c06052757bde962f (diff) |
OPEN-292 - Remove lscript from project,
Remove legacy udp script upload methods,
Refactor script runtime perms from three arrays to one struct array so we don't have to juggle array order anymore.
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rwxr-xr-x | indra/newview/llviewermessage.cpp | 69 |
1 files changed, 15 insertions, 54 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 762f75edd4..edefdff3c9 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -33,7 +33,6 @@ #include "llaudioengine.h" #include "llavataractions.h" #include "llavatarnamecache.h" // IDEVO HACK -#include "lscript_byteformat.h" #include "lleconomy.h" #include "lleventtimer.h" #include "llfloaterreg.h" @@ -76,6 +75,7 @@ #include "llpanelgrouplandmoney.h" #include "llrecentpeople.h" #include "llscriptfloater.h" +#include "llscriptruntimeperms.h" #include "llselectmgr.h" #include "llstartup.h" #include "llsky.h" @@ -115,6 +115,7 @@ #include <boost/algorithm/string/split.hpp> // #include <boost/regex.hpp> +#include <boost/foreach.hpp> #include "llnotificationmanager.h" // @@ -153,47 +154,6 @@ const U8 AU_FLAGS_NONE = 0x00; const U8 AU_FLAGS_HIDETITLE = 0x01; const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02; -//script permissions -const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = - { - "ScriptTakeMoney", - "ActOnControlInputs", - "RemapControlInputs", - "AnimateYourAvatar", - "AttachToYourAvatar", - "ReleaseOwnership", - "LinkAndDelink", - "AddAndRemoveJoints", - "ChangePermissions", - "TrackYourCamera", - "ControlYourCamera", - "TeleportYourAgent", - "JoinAnExperience", - "SilentlyManageEstateAccess", - "OverrideYourAnimations", - "ScriptReturnObjects" - }; - -const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = -{ - TRUE, // ScriptTakeMoney, - FALSE, // ActOnControlInputs - FALSE, // RemapControlInputs - FALSE, // AnimateYourAvatar - FALSE, // AttachToYourAvatar - FALSE, // ReleaseOwnership, - FALSE, // LinkAndDelink, - FALSE, // AddAndRemoveJoints - FALSE, // ChangePermissions - FALSE, // TrackYourCamera, - FALSE, // ControlYourCamera - FALSE, // TeleportYourAgent - FALSE, // JoinAnExperience - FALSE, // SilentlyManageEstateAccess - FALSE, // OverrideYourAnimations - FALSE, // ScriptReturnObjects -}; - bool friendship_offer_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -6284,21 +6244,22 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp BOOL caution = FALSE; S32 count = 0; std::string perms; - for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) + BOOST_FOREACH(script_perm_t script_perm, SCRIPT_PERMISSIONS) { - if ((orig_questions & LSCRIPTRunTimePermissionBits[i]) && SCRIPT_QUESTION_IS_CAUTION[i]) + if ((orig_questions & script_perm.permbit) + && script_perm.caution) { count++; caution = TRUE; // add a comma before the permission description if it is not the first permission // added to the list or the last permission to check - if ((count > 1) && (i < SCRIPT_PERMISSION_EOF)) + if (count > 1) { perms.append(", "); } - perms.append(LLTrans::getString(SCRIPT_QUESTIONS[i])); + perms.append(LLTrans::getString(script_perm.question)); } } @@ -6472,27 +6433,27 @@ void process_script_question(LLMessageSystem *msg, void **user_data) std::string script_question; if (questions) { - BOOL caution = FALSE; + bool caution = false; S32 count = 0; LLSD args; args["OBJECTNAME"] = object_name; args["NAME"] = LLCacheName::cleanFullName(owner_name); S32 known_questions = 0; - BOOL has_not_only_debit = questions ^ LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_DEBIT]; + bool has_not_only_debit = questions ^ SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_DEBIT].permbit; // check the received permission flags against each permission - for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) + BOOST_FOREACH(script_perm_t script_perm, SCRIPT_PERMISSIONS) { - if (questions & LSCRIPTRunTimePermissionBits[i]) + if (questions & script_perm.permbit) { count++; - known_questions |= LSCRIPTRunTimePermissionBits[i]; + known_questions |= script_perm.permbit; // check whether permission question should cause special caution dialog - caution |= (SCRIPT_QUESTION_IS_CAUTION[i]); + caution |= (script_perm.caution); - if (("ScriptTakeMoney" == SCRIPT_QUESTIONS[i]) && has_not_only_debit) + if (("ScriptTakeMoney" == script_perm.question) && has_not_only_debit) continue; - script_question += " " + LLTrans::getString(SCRIPT_QUESTIONS[i]) + "\n"; + script_question += " " + LLTrans::getString(script_perm.question) + "\n"; } } |