diff options
author | Snoopy Pfeffer | 2012-03-27 22:30:02 +0200 |
---|---|---|
committer | Snoopy Pfeffer | 2012-03-27 22:30:02 +0200 |
commit | 19837ff4dd8b01cf1f0a458cafc02c56be48bf66 (patch) | |
tree | d9e8bf835e92442c0020a653a4a4e6c2ba325c76 /OpenSim/Region/ScriptEngine/Shared | |
parent | Merge branch 'master' of ssh://snoopy@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-19837ff4dd8b01cf1f0a458cafc02c56be48bf66.zip opensim-SC_OLD-19837ff4dd8b01cf1f0a458cafc02c56be48bf66.tar.gz opensim-SC_OLD-19837ff4dd8b01cf1f0a458cafc02c56be48bf66.tar.bz2 opensim-SC_OLD-19837ff4dd8b01cf1f0a458cafc02c56be48bf66.tar.xz |
Two new scripting functions osInviteToGroup(userID) and osEjectFromGroup(userID) that invite/eject users to/from groups the object containing the script is set to. These functions also work for closed groups.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
3 files changed, 82 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2ecd890..a5dcba4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2980,5 +2980,74 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2980 | 2980 | ||
2981 | return String.Empty; | 2981 | return String.Empty; |
2982 | } | 2982 | } |
2983 | |||
2984 | /// <summary> | ||
2985 | /// Invite user to the group this object is set to | ||
2986 | /// </summary> | ||
2987 | /// <param name="agentId"></param> | ||
2988 | /// <returns></returns> | ||
2989 | public LSL_Integer osInviteToGroup(LSL_Key agentId) | ||
2990 | { | ||
2991 | CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup"); | ||
2992 | m_host.AddScriptLPS(1); | ||
2993 | |||
2994 | UUID agent = new UUID(agentId); | ||
2995 | |||
2996 | // groups module is required | ||
2997 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
2998 | if (groupsModule == null) return ScriptBaseClass.FALSE; | ||
2999 | |||
3000 | // object has to be set to a group, but not group owned | ||
3001 | if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE; | ||
3002 | |||
3003 | // object owner has to be in that group and required permissions | ||
3004 | GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID); | ||
3005 | if (member == null || (member.GroupPowers & (ulong)GroupPowers.Invite) == 0) return ScriptBaseClass.FALSE; | ||
3006 | |||
3007 | // check if agent is in that group already | ||
3008 | //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent); | ||
3009 | //if (member != null) return ScriptBaseClass.FALSE; | ||
3010 | |||
3011 | // invited agent has to be present in this scene | ||
3012 | if (World.GetScenePresence(agent) == null) return ScriptBaseClass.FALSE; | ||
3013 | |||
3014 | groupsModule.InviteGroup(null, m_host.OwnerID, m_host.GroupID, agent, UUID.Zero); | ||
3015 | |||
3016 | return ScriptBaseClass.TRUE; | ||
3017 | } | ||
3018 | |||
3019 | /// <summary> | ||
3020 | /// Eject user from the group this object is set to | ||
3021 | /// </summary> | ||
3022 | /// <param name="agentId"></param> | ||
3023 | /// <returns></returns> | ||
3024 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) | ||
3025 | { | ||
3026 | CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup"); | ||
3027 | m_host.AddScriptLPS(1); | ||
3028 | |||
3029 | UUID agent = new UUID(agentId); | ||
3030 | |||
3031 | // groups module is required | ||
3032 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
3033 | if (groupsModule == null) return ScriptBaseClass.FALSE; | ||
3034 | |||
3035 | // object has to be set to a group, but not group owned | ||
3036 | if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE; | ||
3037 | |||
3038 | // object owner has to be in that group and required permissions | ||
3039 | GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID); | ||
3040 | if (member == null || (member.GroupPowers & (ulong)GroupPowers.Eject) == 0) return ScriptBaseClass.FALSE; | ||
3041 | |||
3042 | // agent has to be in that group | ||
3043 | //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent); | ||
3044 | //if (member == null) return ScriptBaseClass.FALSE; | ||
3045 | |||
3046 | // ejectee can be offline | ||
3047 | |||
3048 | groupsModule.EjectGroupMember(null, m_host.OwnerID, m_host.GroupID, agent); | ||
3049 | |||
3050 | return ScriptBaseClass.TRUE; | ||
3051 | } | ||
2983 | } | 3052 | } |
2984 | } \ No newline at end of file | 3053 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 8f9efc0..30bd3ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -231,5 +231,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
231 | LSL_String osUnixTimeToTimestamp(long time); | 231 | LSL_String osUnixTimeToTimestamp(long time); |
232 | 232 | ||
233 | LSL_String osGetInventoryDesc(string item); | 233 | LSL_String osGetInventoryDesc(string item); |
234 | |||
235 | LSL_Integer osInviteToGroup(LSL_Key agentId); | ||
236 | LSL_Integer osEjectFromGroup(LSL_Key agentId); | ||
234 | } | 237 | } |
235 | } | 238 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 09e5992..680cefb4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -868,5 +868,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
868 | { | 868 | { |
869 | return m_OSSL_Functions.osGetInventoryDesc(item); | 869 | return m_OSSL_Functions.osGetInventoryDesc(item); |
870 | } | 870 | } |
871 | |||
872 | public LSL_Integer osInviteToGroup(LSL_Key agentId) | ||
873 | { | ||
874 | return m_OSSL_Functions.osInviteToGroup(agentId); | ||
875 | } | ||
876 | |||
877 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) | ||
878 | { | ||
879 | return m_OSSL_Functions.osEjectFromGroup(agentId); | ||
880 | } | ||
871 | } | 881 | } |
872 | } | 882 | } |