aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2012-04-11 23:35:27 +0100
committerMelanie2012-04-11 23:35:27 +0100
commit4a67e8b98fd6ec2b2a7e390256e0c3ef7aa21753 (patch)
tree28253aa39e6bf11e8f814d6818f727e5f27eb036 /OpenSim/Region
parentMerge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff)
parentHGFriendsModule: Type casts to fix compile error (diff)
downloadopensim-SC-4a67e8b98fd6ec2b2a7e390256e0c3ef7aa21753.zip
opensim-SC-4a67e8b98fd6ec2b2a7e390256e0c3ef7aa21753.tar.gz
opensim-SC-4a67e8b98fd6ec2b2a7e390256e0c3ef7aa21753.tar.bz2
opensim-SC-4a67e8b98fd6ec2b2a7e390256e0c3ef7aa21753.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Interfaces/IEstateModule.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs46
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs55
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
8 files changed, 135 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index f64c161..fc6325d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
162 } 162 }
163 } 163 }
164 164
165 protected void InitModule(IConfigSource config) 165 protected virtual void InitModule(IConfigSource config)
166 { 166 {
167 IConfig friendsConfig = config.Configs["Friends"]; 167 IConfig friendsConfig = config.Configs["Friends"];
168 if (friendsConfig != null) 168 if (friendsConfig != null)
@@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
546 } 546 }
547 } 547 }
548 548
549 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 549 protected virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
550 { 550 {
551 if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) 551 if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
552 { 552 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 9a6d277..3728b85 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private int m_levelHGFriends = 0;
54
53 IUserManagement m_uMan; 55 IUserManagement m_uMan;
54 public IUserManagement UserManagementModule 56 public IUserManagement UserManagementModule
55 { 57 {
@@ -87,6 +89,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
87 m_StatusNotifier = new HGStatusNotifier(this); 89 m_StatusNotifier = new HGStatusNotifier(this);
88 } 90 }
89 91
92 protected override void InitModule(IConfigSource config)
93 {
94 base.InitModule(config);
95
96 // Additionally to the base method
97 IConfig friendsConfig = config.Configs["HGFriendsModule"];
98 if (friendsConfig != null)
99 {
100 m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0);
101
102 // TODO: read in all config variables pertaining to
103 // HG friendship permissions
104 }
105 }
106
90 #endregion 107 #endregion
91 108
92 #region IFriendsSimConnector 109 #region IFriendsSimConnector
@@ -105,6 +122,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
105 122
106 #endregion 123 #endregion
107 124
125 protected override void OnInstantMessage(IClientAPI client, GridInstantMessage im)
126 {
127 if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
128 {
129 // we got a friendship offer
130 UUID principalID = new UUID(im.fromAgentID);
131 UUID friendID = new UUID(im.toAgentID);
132
133 // Check if friendID is foreigner and if principalID has the permission
134 // to request friendships with foreigners. If not, return immediately.
135 if (!UserManagementModule.IsLocalGridUser(friendID))
136 {
137 ScenePresence avatar = null;
138 ((Scene)client.Scene).TryGetScenePresence(principalID, out avatar);
139
140 if (avatar == null)
141 return;
142
143 if (avatar.UserLevel < m_levelHGFriends)
144 {
145 client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
146 return;
147 }
148 }
149 }
150
151 base.OnInstantMessage(client, im);
152 }
153
108 protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders) 154 protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
109 { 155 {
110 // Update the local cache. Yes, we need to do it right here 156 // Update the local cache. Yes, we need to do it right here
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 1e743c3..366e02d 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -168,12 +168,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
168 sendRegionInfoPacketToAll(); 168 sendRegionInfoPacketToAll();
169 } 169 }
170 170
171 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, UUID texture) 171 public void setEstateTerrainBaseTexture(int level, UUID texture)
172 {
173 setEstateTerrainBaseTexture(null, level, texture);
174 sendRegionHandshakeToAll();
175 }
176
177 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture)
172 { 178 {
173 if (texture == UUID.Zero) 179 if (texture == UUID.Zero)
174 return; 180 return;
175 181
176 switch (corner) 182 switch (level)
177 { 183 {
178 case 0: 184 case 0:
179 Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; 185 Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
@@ -193,6 +199,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
193 sendRegionInfoPacketToAll(); 199 sendRegionInfoPacketToAll();
194 } 200 }
195 201
202 public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue)
203 {
204 setEstateTerrainTextureHeights(null, corner, lowValue, highValue);
205 }
206
196 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) 207 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
197 { 208 {
198 switch (corner) 209 switch (corner)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 509c4d7..9b2ddfd 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -447,7 +447,10 @@ namespace OpenSim.Region.CoreModules.World.Land
447 { 447 {
448 bool isMember; 448 bool isMember;
449 if (m_groupMemberCache.TryGetValue(avatar, out isMember)) 449 if (m_groupMemberCache.TryGetValue(avatar, out isMember))
450 {
451 m_groupMemberCache.Update(avatar, isMember, m_groupMemberCacheTimeout);
450 return isMember; 452 return isMember;
453 }
451 454
452 IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); 455 IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
453 if (groupsModule == null) 456 if (groupsModule == null)
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index 72e79ed..ca2ad94 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -47,5 +47,8 @@ namespace OpenSim.Region.Framework.Interfaces
47 void sendRegionHandshakeToAll(); 47 void sendRegionHandshakeToAll();
48 void TriggerEstateInfoChange(); 48 void TriggerEstateInfoChange();
49 void TriggerRegionInfoChange(); 49 void TriggerRegionInfoChange();
50
51 void setEstateTerrainBaseTexture(int level, UUID texture);
52 void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue);
50 } 53 }
51} 54}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 0dc2aa2..2899774 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3095,5 +3095,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3095 3095
3096 return ScriptBaseClass.TRUE; 3096 return ScriptBaseClass.TRUE;
3097 } 3097 }
3098
3099 /// <summary>
3100 /// Sets terrain estate texture
3101 /// </summary>
3102 /// <param name="level"></param>
3103 /// <param name="texture"></param>
3104 /// <returns></returns>
3105 public void osSetTerrainTexture(int level, LSL_Key texture)
3106 {
3107 CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture");
3108
3109 m_host.AddScriptLPS(1);
3110 //Check to make sure that the script's owner is the estate manager/master
3111 //World.Permissions.GenericEstatePermission(
3112 if (World.Permissions.IsGod(m_host.OwnerID))
3113 {
3114 if (level < 0 || level > 3)
3115 return;
3116
3117 UUID textureID = new UUID();
3118 if (!UUID.TryParse(texture, out textureID))
3119 return;
3120
3121 // estate module is required
3122 IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
3123 if (estate != null)
3124 estate.setEstateTerrainBaseTexture(level, textureID);
3125 }
3126 }
3127
3128 /// <summary>
3129 /// Sets terrain heights of estate
3130 /// </summary>
3131 /// <param name="corner"></param>
3132 /// <param name="low"></param>
3133 /// <param name="high"></param>
3134 /// <returns></returns>
3135 public void osSetTerrainTextureHeight(int corner, double low, double high)
3136 {
3137 CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight");
3138
3139 m_host.AddScriptLPS(1);
3140 //Check to make sure that the script's owner is the estate manager/master
3141 //World.Permissions.GenericEstatePermission(
3142 if (World.Permissions.IsGod(m_host.OwnerID))
3143 {
3144 if (corner < 0 || corner > 3)
3145 return;
3146
3147 // estate module is required
3148 IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
3149 if (estate != null)
3150 estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high);
3151 }
3152 }
3098 } 3153 }
3099} 3154}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 444a681..2fcc443 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -234,5 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
234 234
235 LSL_Integer osInviteToGroup(LSL_Key agentId); 235 LSL_Integer osInviteToGroup(LSL_Key agentId);
236 LSL_Integer osEjectFromGroup(LSL_Key agentId); 236 LSL_Integer osEjectFromGroup(LSL_Key agentId);
237
238 void osSetTerrainTexture(int level, LSL_Key texture);
239 void osSetTerrainTextureHeight(int corner, double low, double high);
237 } 240 }
238} 241}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 680cefb4..b94b9bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -878,5 +878,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
878 { 878 {
879 return m_OSSL_Functions.osEjectFromGroup(agentId); 879 return m_OSSL_Functions.osEjectFromGroup(agentId);
880 } 880 }
881
882 public void osSetTerrainTexture(int level, LSL_Key texture)
883 {
884 m_OSSL_Functions.osSetTerrainTexture(level, texture);
885 }
886
887 public void osSetTerrainTextureHeight(int corner, double low, double high)
888 {
889 m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high);
890 }
881 } 891 }
882} 892}