diff options
author | PixelTomsen | 2012-01-26 21:53:42 +0100 |
---|---|---|
committer | BlueWall | 2012-01-26 16:15:23 -0500 |
commit | 616373db169fbfc06652fb3f2d40b531426f6dd3 (patch) | |
tree | fb8f5dc64c6bbad93c25db0e88dc6ac83ee4b6c4 /OpenSim | |
parent | Change references from sop to sog and add protection from null ref (diff) | |
download | opensim-SC_OLD-616373db169fbfc06652fb3f2d40b531426f6dd3.zip opensim-SC_OLD-616373db169fbfc06652fb3f2d40b531426f6dd3.tar.gz opensim-SC_OLD-616373db169fbfc06652fb3f2d40b531426f6dd3.tar.bz2 opensim-SC_OLD-616373db169fbfc06652fb3f2d40b531426f6dd3.tar.xz |
llManageEstateAccess implementation http://wiki.secondlife.com/wiki/LlManageEstateAccess
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
Diffstat (limited to 'OpenSim')
5 files changed, 89 insertions, 0 deletions
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 2a495b0..98604f2 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -373,5 +373,11 @@ namespace OpenSim.Framework | |||
373 | 373 | ||
374 | return l_EstateAccess.Contains(user); | 374 | return l_EstateAccess.Contains(user); |
375 | } | 375 | } |
376 | |||
377 | public bool GroupAccess(UUID groupID) | ||
378 | { | ||
379 | return l_EstateGroups.Contains(groupID); | ||
380 | } | ||
381 | |||
376 | } | 382 | } |
377 | } | 383 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6fa812d..fb5fd45 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10646,6 +10646,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10646 | return list; | 10646 | return list; |
10647 | } | 10647 | } |
10648 | 10648 | ||
10649 | public LSL_Integer llManageEstateAccess(int action, string avatar) | ||
10650 | { | ||
10651 | m_host.AddScriptLPS(1); | ||
10652 | EstateSettings estate = World.RegionInfo.EstateSettings; | ||
10653 | bool isAccount = false; | ||
10654 | bool isGroup = false; | ||
10655 | |||
10656 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManager(m_host.OwnerID)) | ||
10657 | return 0; | ||
10658 | |||
10659 | UUID id = new UUID(); | ||
10660 | if (!UUID.TryParse(avatar, out id)) | ||
10661 | return 0; | ||
10662 | |||
10663 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, id); | ||
10664 | isAccount = account != null ? true : false; | ||
10665 | if (!isAccount) | ||
10666 | { | ||
10667 | IGroupsModule groups = World.RequestModuleInterface<IGroupsModule>(); | ||
10668 | if (groups != null) | ||
10669 | { | ||
10670 | GroupRecord group = groups.GetGroupRecord(id); | ||
10671 | isGroup = group != null ? true : false; | ||
10672 | if (!isGroup) | ||
10673 | return 0; | ||
10674 | } | ||
10675 | else | ||
10676 | return 0; | ||
10677 | } | ||
10678 | |||
10679 | switch (action) | ||
10680 | { | ||
10681 | case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_ADD: | ||
10682 | if (!isAccount) return 0; | ||
10683 | if (estate.HasAccess(id)) return 1; | ||
10684 | if (estate.IsBanned(id)) | ||
10685 | estate.RemoveBan(id); | ||
10686 | estate.AddEstateUser(id); | ||
10687 | break; | ||
10688 | case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_REMOVE: | ||
10689 | if (!isAccount || !estate.HasAccess(id)) return 0; | ||
10690 | estate.RemoveEstateUser(id); | ||
10691 | break; | ||
10692 | case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_ADD: | ||
10693 | if (!isGroup) return 0; | ||
10694 | if (estate.GroupAccess(id)) return 1; | ||
10695 | estate.AddEstateGroup(id); | ||
10696 | break; | ||
10697 | case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_REMOVE: | ||
10698 | if (!isGroup || !estate.GroupAccess(id)) return 0; | ||
10699 | estate.RemoveEstateGroup(id); | ||
10700 | break; | ||
10701 | case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_ADD: | ||
10702 | if (!isAccount) return 0; | ||
10703 | if (estate.IsBanned(id)) return 1; | ||
10704 | EstateBan ban = new EstateBan(); | ||
10705 | ban.EstateID = estate.EstateID; | ||
10706 | ban.BannedUserID = id; | ||
10707 | estate.AddBan(ban); | ||
10708 | break; | ||
10709 | case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_REMOVE: | ||
10710 | if (!isAccount || !estate.IsBanned(id)) return 0; | ||
10711 | estate.RemoveBan(id); | ||
10712 | break; | ||
10713 | default: return 0; | ||
10714 | } | ||
10715 | return 1; | ||
10716 | } | ||
10717 | |||
10649 | #region Not Implemented | 10718 | #region Not Implemented |
10650 | // | 10719 | // |
10651 | // Listing the unimplemented lsl functions here, please move | 10720 | // Listing the unimplemented lsl functions here, please move |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 282443b..b66537f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -242,6 +242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
242 | void llLoopSound(string sound, double volume); | 242 | void llLoopSound(string sound, double volume); |
243 | void llLoopSoundMaster(string sound, double volume); | 243 | void llLoopSoundMaster(string sound, double volume); |
244 | void llLoopSoundSlave(string sound, double volume); | 244 | void llLoopSoundSlave(string sound, double volume); |
245 | LSL_Integer llManageEstateAccess(int action, string avatar); | ||
245 | void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); | 246 | void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); |
246 | void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); | 247 | void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); |
247 | void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset); | 248 | void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 176dc56..ab2c543 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -432,6 +432,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
432 | public const int REGION_FLAG_ALLOW_DIRECT_TELEPORT = 0x100000; // region allows direct teleports | 432 | public const int REGION_FLAG_ALLOW_DIRECT_TELEPORT = 0x100000; // region allows direct teleports |
433 | public const int REGION_FLAG_RESTRICT_PUSHOBJECT = 0x400000; // region restricts llPushObject | 433 | public const int REGION_FLAG_RESTRICT_PUSHOBJECT = 0x400000; // region restricts llPushObject |
434 | 434 | ||
435 | //llManageEstateAccess | ||
436 | public const int ESTATE_ACCESS_ALLOWED_AGENT_ADD = 0; | ||
437 | public const int ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1; | ||
438 | public const int ESTATE_ACCESS_ALLOWED_GROUP_ADD = 2; | ||
439 | public const int ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 3; | ||
440 | public const int ESTATE_ACCESS_BANNED_AGENT_ADD = 4; | ||
441 | public const int ESTATE_ACCESS_BANNED_AGENT_REMOVE = 5; | ||
442 | |||
435 | public static readonly LSLInteger PAY_HIDE = new LSLInteger(-1); | 443 | public static readonly LSLInteger PAY_HIDE = new LSLInteger(-1); |
436 | public static readonly LSLInteger PAY_DEFAULT = new LSLInteger(-2); | 444 | public static readonly LSLInteger PAY_DEFAULT = new LSLInteger(-2); |
437 | 445 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 9733683..840d3a4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1054,6 +1054,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1054 | m_LSL_Functions.llLoopSoundSlave(sound, volume); | 1054 | m_LSL_Functions.llLoopSoundSlave(sound, volume); |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | public LSL_Integer llManageEstateAccess(int action, string avatar) | ||
1058 | { | ||
1059 | return m_LSL_Functions.llManageEstateAccess(action, avatar); | ||
1060 | } | ||
1061 | |||
1057 | public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) | 1062 | public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) |
1058 | { | 1063 | { |
1059 | m_LSL_Functions.llMakeExplosion(particles, scale, vel, lifetime, arc, texture, offset); | 1064 | m_LSL_Functions.llMakeExplosion(particles, scale, vel, lifetime, arc, texture, offset); |