aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs69
1 files changed, 69 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 d140c26..0dc2aa2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3026,5 +3026,74 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3026 3026
3027 return String.Empty; 3027 return String.Empty;
3028 } 3028 }
3029
3030 /// <summary>
3031 /// Invite user to the group this object is set to
3032 /// </summary>
3033 /// <param name="agentId"></param>
3034 /// <returns></returns>
3035 public LSL_Integer osInviteToGroup(LSL_Key agentId)
3036 {
3037 CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup");
3038 m_host.AddScriptLPS(1);
3039
3040 UUID agent = new UUID(agentId);
3041
3042 // groups module is required
3043 IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>();
3044 if (groupsModule == null) return ScriptBaseClass.FALSE;
3045
3046 // object has to be set to a group, but not group owned
3047 if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE;
3048
3049 // object owner has to be in that group and required permissions
3050 GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
3051 if (member == null || (member.GroupPowers & (ulong)GroupPowers.Invite) == 0) return ScriptBaseClass.FALSE;
3052
3053 // check if agent is in that group already
3054 //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent);
3055 //if (member != null) return ScriptBaseClass.FALSE;
3056
3057 // invited agent has to be present in this scene
3058 if (World.GetScenePresence(agent) == null) return ScriptBaseClass.FALSE;
3059
3060 groupsModule.InviteGroup(null, m_host.OwnerID, m_host.GroupID, agent, UUID.Zero);
3061
3062 return ScriptBaseClass.TRUE;
3063 }
3064
3065 /// <summary>
3066 /// Eject user from the group this object is set to
3067 /// </summary>
3068 /// <param name="agentId"></param>
3069 /// <returns></returns>
3070 public LSL_Integer osEjectFromGroup(LSL_Key agentId)
3071 {
3072 CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup");
3073 m_host.AddScriptLPS(1);
3074
3075 UUID agent = new UUID(agentId);
3076
3077 // groups module is required
3078 IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>();
3079 if (groupsModule == null) return ScriptBaseClass.FALSE;
3080
3081 // object has to be set to a group, but not group owned
3082 if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE;
3083
3084 // object owner has to be in that group and required permissions
3085 GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
3086 if (member == null || (member.GroupPowers & (ulong)GroupPowers.Eject) == 0) return ScriptBaseClass.FALSE;
3087
3088 // agent has to be in that group
3089 //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent);
3090 //if (member == null) return ScriptBaseClass.FALSE;
3091
3092 // ejectee can be offline
3093
3094 groupsModule.EjectGroupMember(null, m_host.OwnerID, m_host.GroupID, agent);
3095
3096 return ScriptBaseClass.TRUE;
3097 }
3029 } 3098 }
3030} 3099}