diff options
author | Diva Canto | 2012-03-27 14:25:36 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-27 14:25:36 -0700 |
commit | 5e073366727b48b6467dd55c819016e450c8598c (patch) | |
tree | 29699e1e5dee4a415b19c1bae07202c08be9497f /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Amend to previous commit regarding the config name. Bugs bite. (diff) | |
parent | Two new scripting functions osInviteToGroup(userID) and osEjectFromGroup(user... (diff) | |
download | opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.zip opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.tar.gz opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.tar.bz2 opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 69 |
2 files changed, 72 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d7a629b..7455929 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4151,6 +4151,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4151 | case 4: // DATA_RATING (0,0,0,0,0,0) | 4151 | case 4: // DATA_RATING (0,0,0,0,0,0) |
4152 | reply = "0,0,0,0,0,0"; | 4152 | reply = "0,0,0,0,0,0"; |
4153 | break; | 4153 | break; |
4154 | case 7: // DATA_USERLEVEL (integer) | ||
4155 | reply = account.UserLevel.ToString(); | ||
4156 | break; | ||
4154 | case 8: // DATA_PAYINFO (0|1|2|3) | 4157 | case 8: // DATA_PAYINFO (0|1|2|3) |
4155 | reply = "0"; | 4158 | reply = "0"; |
4156 | break; | 4159 | break; |
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 |