From 72020169ab05f7f396be8f44a41dfccc53910376 Mon Sep 17 00:00:00 2001 From: NikkiLacrima <111503035+NikkiLacrima@users.noreply.github.com> Date: Sun, 19 Nov 2023 11:09:54 +0100 Subject: [PATCH 1/6] runaway handling, issue #1001 --- src/collar/oc_api.lsl | 122 ++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 75 deletions(-) diff --git a/src/collar/oc_api.lsl b/src/collar/oc_api.lsl index 0c466a2af..3053847c6 100644 --- a/src/collar/oc_api.lsl +++ b/src/collar/oc_api.lsl @@ -21,7 +21,12 @@ Medea (Medea Destiny) - Prefix reset now works, and notifications sent when changing prefix. Yosty7b3 *Oct 2021 - Remove unused StrideOfList() function. - *Feb 2022 - Only reset when needed (part of boot speedup project). + *Feb 2022 - Only reset when needed (part of boot speedup project). +Nikki Lacrima + *Nov 2023 - Only wearer can initiate and confirm runaway, add link message "runaway_confirmed" and + remove the g_iRunawayMode. + - Add "#" prefix wildcard, issue #897 + - Remove g_lMenuIDs, similar tp pr #963 et al. Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar @@ -45,16 +50,10 @@ integer ACTION_OWNER = 8; integer ACTION_TRUST = 16; integer ACTION_BLOCK = 32; -//integer g_iLastGranted; -//key g_kLastGranted; -//string g_sLastGranted; - //integer TIMEOUT_READY = 30497; integer TIMEOUT_REGISTER = 30498; integer TIMEOUT_FIRED = 30499; - - //integer RLV_CMD = 6000; integer RLV_REFRESH = 6001;//RLV plugins should reinstate their restrictions upon receiving this message. @@ -100,12 +99,7 @@ integer LM_SETTING_DELETE = 2003;//delete token from settings //integer LM_SETTING_EMPTY = 2004;//sent when a token has no value Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { - key kMenuID = llGenerateKey(); - llMessageLinked(LINK_SET, DIALOG, (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, kMenuID); - - integer iIndex = llListFindList(g_lMenuIDs, [kID]); - if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [kID, kMenuID, sName], iIndex, iIndex + g_iMenuStride - 1); - else g_lMenuIDs += [kID, kMenuID, sName]; + llMessageLinked(LINK_SET, DIALOG, (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, sName+"~"+llGetScriptName() ); } string SLURL(key kID){ return "secondlife:///app/agent/"+(string)kID+"/about"; @@ -144,9 +138,6 @@ integer CalcAuth(key kID) { return CMD_NOACCESS; } -list g_lMenuIDs; -integer g_iMenuStride; - integer NOTIFY = 1002; integer NOTIFY_OWNERS=1003; integer g_iPublic; @@ -194,25 +185,28 @@ DoListeners(){ integer g_iRunaway=TRUE; key g_kDenyRunawayRequester; + RunawayMenu(key kID, integer iAuth){ - if(iAuth == CMD_OWNER || kID == g_kWearer){ - string sPrompt = "\n[Runaway]\n\nAre you sure you want to runaway from all owners?\n\n* This action will reset your owners list, trusted list, and your blocked avatars list."; - list lButtons = ["Yes", "No"]; - + if(iAuth == CMD_OWNER || ( (kID == g_kWearer) && g_iRunaway ) ){ + string sPrompt; + list lButtons = []; + + if (kID == g_kWearer){ + sPrompt += "[Runaway]\n\nAre you sure you want to runaway from all owners?\n\n* This action will reset your owners list, trusted list, and your blocked avatars list."; + lButtons += ["Yes", "No"]; + } if(iAuth == CMD_OWNER){ sPrompt+="\n\nAs the owner you have the ability to disable or enable runaway."; - if(g_iRunaway)lButtons+=["Disable"]; + if(g_iRunaway)lButtons += ["Disable"]; else lButtons += ["Enable"]; - } else if(kID == g_kWearer){ - if(g_iRunaway){ - sPrompt += "\n\nAs the wearer, you can choose to disable your ability to runaway, this action cannot be reversed by you"; - lButtons += ["Disable"]; - } + } + else if (kID == g_kWearer) { + sPrompt += "\n\nAs the wearer, you can choose to disable your ability to runaway, this action cannot be reversed by you"; + lButtons += ["Disable"]; } Dialog(kID, sPrompt, lButtons, [], 0, iAuth, "RunawayMenu"); } else { llMessageLinked(LINK_SET,NOTIFY,"0%NOACCESS% to runaway, or the runaway settings menu", kID); - //llMessageLinked(LINK_SET,iAuth,"menu Access", kID); } } @@ -225,7 +219,6 @@ WearerConfirmListUpdate(key kID, string sReason) } integer g_iAllowWearerSetTrusted=FALSE; integer g_iGrantedConsent=FALSE; -integer g_iRunawayMode = -1; UpdateLists(key kID, key kIssuer){ //llOwnerSay(llDumpList2String([kID, kIssuer, g_kMenuUser, g_iMode, g_iGrantedConsent], ", ")); integer iMode = g_iMode; @@ -328,8 +321,7 @@ UserCommand(integer iAuth, string sCmd, key kID){ llLoadURL(kID, "Want to open our website for further help?", "https://opencollar.cc"); } } - if((llToLower(sCmd) == "menu runaway" || llToLower(sCmd) == "runaway") && g_iRunawayMode!=2){ - g_iRunawayMode=0; + if((llToLower(sCmd) == "menu runaway") || (llToLower(sCmd) == "runaway")){ RunawayMenu(kID,iAuth); } @@ -388,22 +380,8 @@ UserCommand(integer iAuth, string sCmd, key kID){ } } if (iAuth CMD_EVERYONE) return; - if (iAuth == CMD_OWNER && sCmd == "runaway") { - // trigger runaway sequence if approval was given - if(g_iRunawayMode == 2){ - g_iRunawayMode=-1; - llMessageLinked(LINK_SET, NOTIFY_OWNERS, "Runaway completed on %WEARERNAME%'s collar", kID); - llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_owner","origin"); - llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_trust","origin"); - llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_block","origin"); - llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_group","origin"); - llMessageLinked(LINK_SET, NOTIFY, "0Runaway complete", g_kWearer); - return; - } - - } - if(sCmd == "print auth"){ + if(sCmd == "print auth"){ if(iAuth == CMD_OWNER || iAuth == CMD_TRUSTED || iAuth == CMD_WEARER) PrintAccess(kID); else @@ -489,7 +467,6 @@ state active } } - run_time_permissions(integer iPerm) { if (iPerm & PERMISSION_ATTACH) { llOwnerSay("@detach=yes"); @@ -516,32 +493,29 @@ state active return; } } - - - + + string CMD=""; if(llToLower(llGetSubString(m,0,llStringLength(g_sPrefix)-1))==llToLower(g_sPrefix)){ - string CMD=llGetSubString(m,llStringLength(g_sPrefix),-1); - if(llGetSubString(CMD,0,0)==" ")CMD=llDumpList2String(llParseString2List(CMD,[" "],[]), " "); - llMessageLinked(LINK_SET, CMD_ZERO, CMD, llGetOwnerKey(i)); - } else if(llGetSubString(m,0,0) == "*"){ - string CMD = llGetSubString(m,1,-1); - if(llGetSubString(CMD,0,0)==" ")CMD=llDumpList2String(llParseString2List(CMD,[" "],[])," "); - llMessageLinked(LINK_SET, CMD_ZERO, CMD, llGetOwnerKey(i)); + CMD = llGetSubString(m,llStringLength(g_sPrefix),-1); + } else if ((llGetSubString(m,0,0) == "*") || (llGetSubString(m,0,0) == "#" && i != g_kWearer) ){ + CMD = llGetSubString(m,1,-1); } else { list lTmp = llParseString2List(m,[" ","(",")"],[]); - string sDump = llToLower(llDumpList2String(lTmp, "")); - + string sDump = llToLower(llDumpList2String(lTmp, "")); if(sDump == llToLower(g_sSafeword) && !g_iSafewordDisable && i == g_kWearer){ llMessageLinked(LINK_SET, CMD_SAFEWORD, "",""); SW(); } } + if (CMD != "") { + if(llGetSubString(CMD,0,0)==" ")CMD=llDumpList2String(llParseString2List(CMD,[" "],[])," "); + if (CMD == "runaway_confirmed") return; + llMessageLinked(LINK_SET, CMD_ZERO, CMD, llGetOwnerKey(i)); + } } link_message(integer iSender, integer iNum, string sStr, key kID){ - - //if(iNum>=CMD_OWNER && iNum <= CMD_NOACCESS) llOwnerSay(llDumpList2String([iSender, iNum, sStr, kID], " ^ ")); if(iNum == CMD_ZERO){ if(sStr == "initialize")return; @@ -553,11 +527,6 @@ state active //llOwnerSay("{API} Calculate auth for "+(string)kID+"="+(string)iAuth+";"+sStr); llMessageLinked(LINK_SET, AUTH_REPLY, "AuthReply|"+(string)kID+"|"+(string)iAuth,sStr); } else if(iNum >= CMD_OWNER && iNum <= CMD_NOACCESS) UserCommand(iNum, sStr, kID); - - else if (iNum == DIALOG_TIMEOUT) { - integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex +3); //remove stride from g_lMenuIDs - } else if(iNum == LM_SETTING_RESPONSE){ list lPar = llParseString2List(sStr, ["_","="],[]); string sToken = llList2String(lPar,0); @@ -672,10 +641,9 @@ state active } else if(iNum == STARTUP && sStr=="ALL"){ llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "ALL",""); } else if(iNum == DIALOG_RESPONSE){ - integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); - if(iMenuIndex!=-1){ - string sMenu = llList2String(g_lMenuIDs, iMenuIndex+1); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex-1, iMenuIndex-2+g_iMenuStride); + integer iPos = llSubStringIndex(kID, "~"+llGetScriptName()); + if(iPos>0){ + string sMenu = llGetSubString(kID, 0, iPos-1); list lMenuParams = llParseString2List(sStr, ["|"],[]); key kAv = llList2Key(lMenuParams,0); string sMsg = llList2String(lMenuParams,1); @@ -740,19 +708,23 @@ state active // llMessageLinked(LINK_SET, TIMEOUT_REGISTER, "5", "spring_access:"+(string)kAv); } else if(sMsg == "No"){ // return - g_iRunawayMode=-1; llMessageLinked(LINK_SET, TIMEOUT_REGISTER, "2", "spring_access:"+(string)kAv); return; } else if(sMsg == "Yes"){ // trigger runaway if((kAv == g_kWearer || iAuth == CMD_OWNER ) && g_iRunaway){ - g_iRunawayMode=2; - llMessageLinked(LINK_SET, NOTIFY_OWNERS, "%WEARERNAME% has runaway.", ""); - llMessageLinked(LINK_SET, CMD_OWNER, "runaway", g_kWearer); + // trigger runaway sequence if approval was given + llMessageLinked(LINK_SET, CMD_OWNER, "runaway_confirmed", g_kWearer); llMessageLinked(LINK_SET, CMD_SAFEWORD, "safeword", ""); - llMessageLinked(LINK_SET, CMD_OWNER, "clear", g_kWearer); - +// llMessageLinked(LINK_SET, CMD_OWNER, "clear", g_kWearer); llMessageLinked(LINK_SET, TIMEOUT_REGISTER, "5", "spring_access:"+(string)kAv); + llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_owner","origin"); + llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_trust","origin"); + llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_block","origin"); + llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_group","origin"); + llMessageLinked(LINK_SET, NOTIFY_OWNERS, "%WEARERNAME% has runaway.", ""); +// llMessageLinked(LINK_SET, NOTIFY_OWNERS, "Runaway completed on %WEARERNAME%'s collar", kID); + llMessageLinked(LINK_SET, NOTIFY, "0Runaway complete", g_kWearer); } } } else if(sMenu=="confirmdenyrunaway") { From 494ad8cd34d90e344ad876e175467f34444f6f60 Mon Sep 17 00:00:00 2001 From: NikkiLacrima <111503035+NikkiLacrima@users.noreply.github.com> Date: Sun, 19 Nov 2023 11:14:36 +0100 Subject: [PATCH 2/6] runaway issue 1001 Remove extra CMD_SAFEWORD to CMD_RELAY_SAFEWORD processing --- src/collar/oc_relay.lsl | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/collar/oc_relay.lsl b/src/collar/oc_relay.lsl index c4c9d3bcd..6360b1026 100644 --- a/src/collar/oc_relay.lsl +++ b/src/collar/oc_relay.lsl @@ -19,7 +19,9 @@ Kristen Mynx, Phidoux (taya Maruti) Also removed DO_RLV_REFRESH which cleared all restrictions and exceptions. *July 2022 - Fixed bug: Ask mode only accepted one RLV command from the object. - + +Nikki Lacrima + *Nov 2023 - Remove extra CMD_SAFEWORD to CMD_RELAY_SAFEWORD processing et al. Licensed under the GPLv2. See LICENSE for full details. @@ -94,12 +96,7 @@ string Checkbox(integer iValue, string sLabel) { } Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { - key kMenuID = llGenerateKey(); - llMessageLinked(LINK_SET, DIALOG, (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, kMenuID); - - integer iIndex = llListFindList(g_lMenuIDs, [kID]); - if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [kID, kMenuID, sName], iIndex, iIndex + g_iMenuStride - 1); - else g_lMenuIDs += [kID, kMenuID, sName]; + llMessageLinked(LINK_SET, DIALOG, (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, sName+"~"+llGetScriptName()); } integer g_iWearer=TRUE; // Lockout wearer option @@ -206,8 +203,6 @@ string tf(integer a){ else return "false"; } key g_kWearer; -list g_lMenuIDs; -integer g_iMenuStride; list g_lOwner; list g_lTrust; list g_lBlock; @@ -423,10 +418,9 @@ state active //We're hard coding page 0 because new menu calls should always be page 0 if(llSubStringIndex(sStr, g_sSubMenu + "|0|" + (string)CMD_EVERYONE) != -1) llMessageLinked(LINK_SET, CMD_ZERO, "menu "+g_sParentMenu, llGetSubString(sStr, 0, 35)); - integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); - if(iMenuIndex!=-1){ - string sMenu = llList2String(g_lMenuIDs, iMenuIndex+1); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex-1, iMenuIndex-2+g_iMenuStride); + integer iPos = llSubStringIndex(kID, "~"+llGetScriptName()); + if(iPos>0){ + string sMenu = llGetSubString(kID, 0, iPos-1); list lMenuParams = llParseString2List(sStr, ["|"],[]); key kAv = llList2Key(lMenuParams,0); string sMsg = llList2String(lMenuParams,1); @@ -527,10 +521,6 @@ state active } } } - - } else if (iNum == DIALOG_TIMEOUT) { - integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex +3); //remove stride from g_lMenuIDs } else if(iNum == LM_SETTING_RESPONSE){ // Detect here the Settings list lSettings = llParseString2List(sStr, ["_","="],[]); @@ -595,8 +585,8 @@ state active } } } else if(iNum == CMD_SAFEWORD){ - // Process safeword - llMessageLinked(LINK_SET, CMD_RELAY_SAFEWORD, "safeword", ""); + // Process safeword, can be removed, is done by SafeWord() in oc_rlvsys sending RLV_CLEAR + //llMessageLinked(LINK_SET, CMD_RELAY_SAFEWORD, "safeword", ""); } else if(iNum == RLV_CLEAR){ llMessageLinked(LINK_SET, CMD_RELAY_SAFEWORD, "",""); } else if(iNum == CMD_RELAY_SAFEWORD){ From 422d6be2506550c3553e70444905912087232b6e Mon Sep 17 00:00:00 2001 From: NikkiLacrima <111503035+NikkiLacrima@users.noreply.github.com> Date: Sun, 19 Nov 2023 11:29:09 +0100 Subject: [PATCH 3/6] listen for "runaway_confirmed" Listens for "runaway_confirmed" from oc_api instead of "runaway" Removed g_lMenuIDs. --- src/collar/oc_leash.lsl | 51 ++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/src/collar/oc_leash.lsl b/src/collar/oc_leash.lsl index 80f6d049e..9ce7796ad 100644 --- a/src/collar/oc_leash.lsl +++ b/src/collar/oc_leash.lsl @@ -1,10 +1,17 @@ -// This file is part of OpenCollar. -// Copyright (c) 2008 - 2016 Nandana Singh, Lulu Pink, Garvin Twine, -// Joy Stipe, Cleo Collins, Satomi Ahn, Master Starship, Toy Wylie, -// Kaori Gray, Sei Lisa, Wendy Starfall, littlemousy, Romka Swallowtail, -// Sumi Perl, Karo Weirsider, Kurt Burleigh, Marissa Mistwallow et al. -// Licensed under the GPLv2. See LICENSE for full details. -string g_sScriptVersion = "8.1"; +/* +This file is part of OpenCollar. +Copyright (c) 2008 - 2016 Nandana Singh, Lulu Pink, Garvin Twine, +Joy Stipe, Cleo Collins, Satomi Ahn, Master Starship, Toy Wylie, +Kaori Gray, Sei Lisa, Wendy Starfall, littlemousy, Romka Swallowtail, +Sumi Perl, Karo Weirsider, Kurt Burleigh, Marissa Mistwallow et al. + +aug 2023 Nikki Lacrima + +Licensed under the GPLv2. See LICENSE for full details. +https://github.com/OpenCollarTeam/OpenCollar +*/ + +string g_sScriptVersion = "8.3"; integer LINK_CMD_DEBUG=1999; // ------ TOKEN DEFINITIONS ------ @@ -41,7 +48,7 @@ integer LM_SETTING_SAVE = 2000; integer LM_SETTING_REQUEST = 2001; integer LM_SETTING_RESPONSE = 2002; integer LM_SETTING_DELETE = 2003; -integer LM_SETTING_EMPTY = 2004; +integer LM_SETTING_EMPTY = 2004; // -- MENU/DIALOG integer MENUNAME_REQUEST = 3000; @@ -58,7 +65,7 @@ integer LEASH_END_MOVEMENT = 6201; integer DIALOG = -9000; integer DIALOG_RESPONSE = -9001; -integer DIALOG_TIMEOUT = -9002; +//integer DIALOG_TIMEOUT = -9002; integer SENSORDIALOG = -9003; integer CMD_PARTICLE = 20000; @@ -72,8 +79,6 @@ string BUTTON_SUBMENU = "Leash"; // --------------------------------------------- // ------ VARIABLE DEFINITIONS ------ // ----- menu ----- -list g_lMenuIDs; -integer g_iMenuStride = 3; integer g_iPreviousAuth; key g_kLeashCmderID; @@ -138,20 +143,12 @@ string NameURI(key kID){ } Dialog(key kRCPT, string sPrompt, list lButtons, list lUtilityButtons, integer iPage, integer iAuth, string sMenuID) { - key kMenuID = llGenerateKey(); - llMessageLinked(LINK_SET, DIALOG, (string)kRCPT + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lButtons, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, kMenuID); - integer iIndex = llListFindList(g_lMenuIDs, [kRCPT]); - if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [kRCPT, kMenuID, sMenuID], iIndex, iIndex + g_iMenuStride - 1); - else g_lMenuIDs += [kRCPT, kMenuID, sMenuID]; + llMessageLinked(LINK_SET, DIALOG, (string)kRCPT + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lButtons, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, sMenuID+"~"+llGetScriptName()); } SensorDialog(key kRCPT, string sPrompt, string sSearchName, integer iAuth, string sMenuID, integer iSensorType) { - key kMenuID = llGenerateKey(); if (sSearchName != "") sSearchName = "`"+sSearchName+"`1"; - llMessageLinked(LINK_SET, SENSORDIALOG, (string)kRCPT +"|"+sPrompt+"|0|``"+(string)iSensorType+"`10`"+(string)PI+sSearchName+"|"+BUTTON_UPMENU+"|" + (string)iAuth, kMenuID); - integer iIndex = llListFindList(g_lMenuIDs, [kRCPT]); - if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [kRCPT, kMenuID, sMenuID], iIndex, iIndex + g_iMenuStride - 1); - else g_lMenuIDs += [kRCPT, kMenuID, sMenuID]; + llMessageLinked(LINK_SET, SENSORDIALOG, (string)kRCPT +"|"+sPrompt+"|0|``"+(string)iSensorType+"`10`"+(string)PI+sSearchName+"|"+BUTTON_UPMENU+"|" + (string)iAuth, sMenuID+"~"+llGetScriptName()); } ConfirmDialog(key kAv, key kCmdGiver, string sType, integer iAuth) { @@ -488,7 +485,7 @@ UserCommand(integer iAuth, string sMessage, key kMessageID, integer bFromMenu) { //LeashTo((key)sVal, kMessageID, iAuth, [], TRUE,0); } else SensorDialog(g_kCmdGiver, "\nWho shall be followed?\n", sVal,iAuth,"FollowTarget", AGENT); - } else if (sMessage == "runaway" && iAuth == CMD_OWNER) { + } else if (sMessage == "runaway_confirmed" && iAuth == CMD_OWNER) { Unleash(kMessageID); } else if (sMessage == "unleash" || sMessage == "unfollow" || (sMessage == "toggleleash" && NULL_KEY != g_kLeashedTo)) { if (CheckCommandAuth(kMessageID, iAuth)) Unleash(kMessageID); @@ -814,15 +811,14 @@ state active g_iRLVOn = FALSE; ApplyRestrictions(); } else if (iNum == DIALOG_RESPONSE) { - integer iMenuIndex = llListFindList(g_lMenuIDs, [kMessageID]); - if (~iMenuIndex) { + integer iPos = llSubStringIndex(kMessageID, "~"+llGetScriptName()); + if (iPos>0) { list lMenuParams = llParseString2List(sMessage, ["|"], []); key kAV = (key)llList2String(lMenuParams, 0); string sButton = llList2String(lMenuParams, 1); //integer iPage = (integer)llList2String(lMenuParams, 2); integer iAuth = (integer)llList2String(lMenuParams, 3); - string sMenu=llList2String(g_lMenuIDs, iMenuIndex + 1); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex - 2 + g_iMenuStride); + string sMenu = llGetSubString(kMessageID, 0, iPos-1); if (sMenu == "MainDialog"){ if (sButton == BUTTON_UPMENU) llMessageLinked(LINK_SET, iAuth, "menu "+BUTTON_PARENTMENU, kAV); @@ -870,9 +866,6 @@ state active g_kLeashCmderID = ""; } } - } else if (iNum == DIALOG_TIMEOUT) { - integer iMenuIndex = llListFindList(g_lMenuIDs, [kMessageID]); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex - 2 + g_iMenuStride); } else if (iNum == REBOOT && sMessage == "reboot") llResetScript(); else if(iNum == AUTH_REPLY){ list lParams = llParseString2List(sMessage, ["|"],[]); From 5cf9801724450c87a944d5ae29a8a80a5f3ae45f Mon Sep 17 00:00:00 2001 From: NikkiLacrima <111503035+NikkiLacrima@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:51:44 +0100 Subject: [PATCH 4/6] Update oc_api.lsl notify owners before owner list is deleted --- src/collar/oc_api.lsl | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/collar/oc_api.lsl b/src/collar/oc_api.lsl index 3053847c6..3a74f24d4 100644 --- a/src/collar/oc_api.lsl +++ b/src/collar/oc_api.lsl @@ -26,7 +26,7 @@ Nikki Lacrima *Nov 2023 - Only wearer can initiate and confirm runaway, add link message "runaway_confirmed" and remove the g_iRunawayMode. - Add "#" prefix wildcard, issue #897 - - Remove g_lMenuIDs, similar tp pr #963 + - implemented Yosty7b3's menu streamlining, see pr#963 et al. Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar @@ -703,27 +703,21 @@ state active } else if(sMsg == "Disable"){ g_kDenyRunawayRequester=kAv; Dialog(g_kWearer, "\nsecondlife:///app/agent/"+(string)kAv+"/about wants to disable your ability to 'Runaway'. This can only be reversed by an owner. \n\nYou may accept or deny this action.", [], ["Accept", "Deny"], 0, CMD_WEARER, "confirmdenyrunaway"); - // g_iRunaway=FALSE; - // llMessageLinked(LINK_SET, LM_SETTING_SAVE, "AUTH_runaway=0", "origin"); - // llMessageLinked(LINK_SET, TIMEOUT_REGISTER, "5", "spring_access:"+(string)kAv); } else if(sMsg == "No"){ - // return llMessageLinked(LINK_SET, TIMEOUT_REGISTER, "2", "spring_access:"+(string)kAv); return; } else if(sMsg == "Yes"){ - // trigger runaway if((kAv == g_kWearer || iAuth == CMD_OWNER ) && g_iRunaway){ // trigger runaway sequence if approval was given + llMessageLinked(LINK_SET, NOTIFY_OWNERS, "%WEARERNAME% has runaway.", ""); llMessageLinked(LINK_SET, CMD_OWNER, "runaway_confirmed", g_kWearer); llMessageLinked(LINK_SET, CMD_SAFEWORD, "safeword", ""); -// llMessageLinked(LINK_SET, CMD_OWNER, "clear", g_kWearer); + llSleep(0.5); // Wait for notifications before clearing owners llMessageLinked(LINK_SET, TIMEOUT_REGISTER, "5", "spring_access:"+(string)kAv); llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_owner","origin"); llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_trust","origin"); llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_block","origin"); llMessageLinked(LINK_SET, LM_SETTING_DELETE, "auth_group","origin"); - llMessageLinked(LINK_SET, NOTIFY_OWNERS, "%WEARERNAME% has runaway.", ""); -// llMessageLinked(LINK_SET, NOTIFY_OWNERS, "Runaway completed on %WEARERNAME%'s collar", kID); llMessageLinked(LINK_SET, NOTIFY, "0Runaway complete", g_kWearer); } } From efd7badc68dc3f22da6d50a0ff1e99260747115b Mon Sep 17 00:00:00 2001 From: NikkiLacrima <111503035+NikkiLacrima@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:56:22 +0100 Subject: [PATCH 5/6] Update oc_leash.lsl Remove unnecessary runaway handling --- src/collar/oc_leash.lsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/collar/oc_leash.lsl b/src/collar/oc_leash.lsl index 9ce7796ad..fbbf7a07b 100644 --- a/src/collar/oc_leash.lsl +++ b/src/collar/oc_leash.lsl @@ -5,7 +5,9 @@ Joy Stipe, Cleo Collins, Satomi Ahn, Master Starship, Toy Wylie, Kaori Gray, Sei Lisa, Wendy Starfall, littlemousy, Romka Swallowtail, Sumi Perl, Karo Weirsider, Kurt Burleigh, Marissa Mistwallow et al. -aug 2023 Nikki Lacrima +Nikki Larima + Nov 2023 - Remove processing of "runaway" command string, handled by CMD_SATEWORD + implemented Yosty7b3's menu streamlining, see pr#963 Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar @@ -485,8 +487,6 @@ UserCommand(integer iAuth, string sMessage, key kMessageID, integer bFromMenu) { //LeashTo((key)sVal, kMessageID, iAuth, [], TRUE,0); } else SensorDialog(g_kCmdGiver, "\nWho shall be followed?\n", sVal,iAuth,"FollowTarget", AGENT); - } else if (sMessage == "runaway_confirmed" && iAuth == CMD_OWNER) { - Unleash(kMessageID); } else if (sMessage == "unleash" || sMessage == "unfollow" || (sMessage == "toggleleash" && NULL_KEY != g_kLeashedTo)) { if (CheckCommandAuth(kMessageID, iAuth)) Unleash(kMessageID); if (bFromMenu) UserCommand(iAuth, "leashmenu", kMessageID ,bFromMenu); From fdbe5748ccd752b9d105d6abf653384cfa6c93b7 Mon Sep 17 00:00:00 2001 From: NikkiLacrima <111503035+NikkiLacrima@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:59:25 +0100 Subject: [PATCH 6/6] Update oc_relay.lsl credits: implemented Yosty7b3 --- src/collar/oc_relay.lsl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/collar/oc_relay.lsl b/src/collar/oc_relay.lsl index 6360b1026..6bfc9b06c 100644 --- a/src/collar/oc_relay.lsl +++ b/src/collar/oc_relay.lsl @@ -22,6 +22,7 @@ Kristen Mynx, Phidoux (taya Maruti) Nikki Lacrima *Nov 2023 - Remove extra CMD_SAFEWORD to CMD_RELAY_SAFEWORD processing + - implemented Yosty7b3's menu streamlining, see pr#963 et al. Licensed under the GPLv2. See LICENSE for full details.