diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 323 |
1 files changed, 185 insertions, 138 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 9e6d0fc..ae956e6 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -68,8 +68,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
68 | public event ChangeDelegate OnEstateInfoChange; | 68 | public event ChangeDelegate OnEstateInfoChange; |
69 | public event MessageDelegate OnEstateMessage; | 69 | public event MessageDelegate OnEstateMessage; |
70 | 70 | ||
71 | private int m_delayCount = 0; | ||
72 | |||
73 | #region Region Module interface | 71 | #region Region Module interface |
74 | 72 | ||
75 | public string Name { get { return "EstateManagementModule"; } } | 73 | public string Name { get { return "EstateManagementModule"; } } |
@@ -117,6 +115,189 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
117 | 115 | ||
118 | #endregion | 116 | #endregion |
119 | 117 | ||
118 | #region IEstateModule Functions | ||
119 | public uint GetRegionFlags() | ||
120 | { | ||
121 | RegionFlags flags = RegionFlags.None; | ||
122 | |||
123 | // Fully implemented | ||
124 | // | ||
125 | if (Scene.RegionInfo.RegionSettings.AllowDamage) | ||
126 | flags |= RegionFlags.AllowDamage; | ||
127 | if (Scene.RegionInfo.RegionSettings.BlockTerraform) | ||
128 | flags |= RegionFlags.BlockTerraform; | ||
129 | if (!Scene.RegionInfo.RegionSettings.AllowLandResell) | ||
130 | flags |= RegionFlags.BlockLandResell; | ||
131 | if (Scene.RegionInfo.RegionSettings.DisableCollisions) | ||
132 | flags |= RegionFlags.SkipCollisions; | ||
133 | if (Scene.RegionInfo.RegionSettings.DisableScripts) | ||
134 | flags |= RegionFlags.SkipScripts; | ||
135 | if (Scene.RegionInfo.RegionSettings.DisablePhysics) | ||
136 | flags |= RegionFlags.SkipPhysics; | ||
137 | if (Scene.RegionInfo.RegionSettings.BlockFly) | ||
138 | flags |= RegionFlags.NoFly; | ||
139 | if (Scene.RegionInfo.RegionSettings.RestrictPushing) | ||
140 | flags |= RegionFlags.RestrictPushObject; | ||
141 | if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) | ||
142 | flags |= RegionFlags.AllowParcelChanges; | ||
143 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | ||
144 | flags |= RegionFlags.BlockParcelSearch; | ||
145 | |||
146 | if (Scene.RegionInfo.RegionSettings.FixedSun) | ||
147 | flags |= RegionFlags.SunFixed; | ||
148 | if (Scene.RegionInfo.RegionSettings.Sandbox) | ||
149 | flags |= RegionFlags.Sandbox; | ||
150 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | ||
151 | flags |= RegionFlags.AllowVoice; | ||
152 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
153 | flags |= RegionFlags.AllowLandmark; | ||
154 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
155 | flags |= RegionFlags.AllowSetHome; | ||
156 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
157 | flags |= RegionFlags.BlockDwell; | ||
158 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
159 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
160 | |||
161 | |||
162 | // TODO: SkipUpdateInterestList | ||
163 | |||
164 | // Omitted | ||
165 | // | ||
166 | // Omitted: NullLayer (what is that?) | ||
167 | // Omitted: SkipAgentAction (what does it do?) | ||
168 | |||
169 | return (uint)flags; | ||
170 | } | ||
171 | |||
172 | public bool IsManager(UUID avatarID) | ||
173 | { | ||
174 | if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner) | ||
175 | return true; | ||
176 | |||
177 | List<UUID> ems = new List<UUID>(Scene.RegionInfo.EstateSettings.EstateManagers); | ||
178 | if (ems.Contains(avatarID)) | ||
179 | return true; | ||
180 | |||
181 | return false; | ||
182 | } | ||
183 | |||
184 | public void sendRegionHandshakeToAll() | ||
185 | { | ||
186 | Scene.ForEachClient(sendRegionHandshake); | ||
187 | } | ||
188 | |||
189 | public void TriggerEstateInfoChange() | ||
190 | { | ||
191 | ChangeDelegate change = OnEstateInfoChange; | ||
192 | |||
193 | if (change != null) | ||
194 | change(Scene.RegionInfo.RegionID); | ||
195 | } | ||
196 | |||
197 | public void TriggerRegionInfoChange() | ||
198 | { | ||
199 | m_regionChangeTimer.Stop(); | ||
200 | m_regionChangeTimer.Start(); | ||
201 | |||
202 | ChangeDelegate change = OnRegionInfoChange; | ||
203 | |||
204 | if (change != null) | ||
205 | change(Scene.RegionInfo.RegionID); | ||
206 | } | ||
207 | |||
208 | public void setEstateTerrainBaseTexture(int level, UUID texture) | ||
209 | { | ||
210 | setEstateTerrainBaseTexture(null, level, texture); | ||
211 | sendRegionHandshakeToAll(); | ||
212 | } | ||
213 | |||
214 | public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) | ||
215 | { | ||
216 | setEstateTerrainTextureHeights(null, corner, lowValue, highValue); | ||
217 | } | ||
218 | |||
219 | public bool IsTerrainXfer(ulong xferID) | ||
220 | { | ||
221 | lock (this) | ||
222 | { | ||
223 | if (TerrainUploader == null) | ||
224 | return false; | ||
225 | else | ||
226 | return TerrainUploader.XferID == xferID; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | public string SetEstateOwner(int estateID, UserAccount account) | ||
231 | { | ||
232 | string response; | ||
233 | |||
234 | // get the current settings from DB | ||
235 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
236 | if (dbSettings.EstateID == 0) | ||
237 | { | ||
238 | response = String.Format("No estate found with ID {0}", estateID); | ||
239 | } | ||
240 | else if (account.PrincipalID == dbSettings.EstateOwner) | ||
241 | { | ||
242 | response = String.Format("Estate already belongs to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
243 | } | ||
244 | else | ||
245 | { | ||
246 | dbSettings.EstateOwner = account.PrincipalID; | ||
247 | dbSettings.Save(); | ||
248 | response = String.Empty; | ||
249 | |||
250 | // make sure there's a log entry to document the change | ||
251 | m_log.InfoFormat("[ESTATE]: Estate Owner for {0} changed to {1} ({2} {3})", dbSettings.EstateName, | ||
252 | account.PrincipalID, account.FirstName, account.LastName); | ||
253 | |||
254 | TriggerEstateInfoChange(); | ||
255 | sendRegionHandshakeToAll(); | ||
256 | } | ||
257 | return response; | ||
258 | } | ||
259 | |||
260 | public string SetEstateName(int estateID, string newName) | ||
261 | { | ||
262 | string response; | ||
263 | |||
264 | // get the current settings from DB | ||
265 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
266 | |||
267 | if (dbSettings.EstateID == 0) | ||
268 | { | ||
269 | response = String.Format("No estate found with ID {0}", estateID); | ||
270 | } | ||
271 | else if (newName == dbSettings.EstateName) | ||
272 | { | ||
273 | response = String.Format("Estate {0} is already named \"{1}\"", estateID, newName); | ||
274 | } | ||
275 | else | ||
276 | { | ||
277 | List<int> estates = Scene.EstateDataService.GetEstates(newName); | ||
278 | if (estates.Count() > 0) | ||
279 | { | ||
280 | response = String.Format("An estate named \"{0}\" already exists.", newName); | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | string oldName = dbSettings.EstateName; | ||
285 | dbSettings.EstateName = newName; | ||
286 | dbSettings.Save(); | ||
287 | response = String.Empty; | ||
288 | |||
289 | // make sure there's a log entry to document the change | ||
290 | m_log.InfoFormat("[ESTATE]: Estate {0} renamed from \"{1}\" to \"{2}\"", estateID, oldName, newName); | ||
291 | |||
292 | TriggerEstateInfoChange(); | ||
293 | sendRegionHandshakeToAll(); | ||
294 | } | ||
295 | } | ||
296 | return response; | ||
297 | } | ||
298 | |||
299 | #endregion | ||
300 | |||
120 | #region Packet Data Responders | 301 | #region Packet Data Responders |
121 | 302 | ||
122 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 303 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
@@ -224,12 +405,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
224 | sendRegionInfoPacketToAll(); | 405 | sendRegionInfoPacketToAll(); |
225 | } | 406 | } |
226 | 407 | ||
227 | public void setEstateTerrainBaseTexture(int level, UUID texture) | ||
228 | { | ||
229 | setEstateTerrainBaseTexture(null, level, texture); | ||
230 | sendRegionHandshakeToAll(); | ||
231 | } | ||
232 | |||
233 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) | 408 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) |
234 | { | 409 | { |
235 | if (texture == UUID.Zero) | 410 | if (texture == UUID.Zero) |
@@ -256,11 +431,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
256 | sendRegionInfoPacketToAll(); | 431 | sendRegionInfoPacketToAll(); |
257 | } | 432 | } |
258 | 433 | ||
259 | public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) | ||
260 | { | ||
261 | setEstateTerrainTextureHeights(null, corner, lowValue, highValue); | ||
262 | } | ||
263 | |||
264 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) | 434 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) |
265 | { | 435 | { |
266 | switch (corner) | 436 | switch (corner) |
@@ -925,17 +1095,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
925 | } | 1095 | } |
926 | } | 1096 | } |
927 | 1097 | ||
928 | public bool IsTerrainXfer(ulong xferID) | ||
929 | { | ||
930 | lock (this) | ||
931 | { | ||
932 | if (TerrainUploader == null) | ||
933 | return false; | ||
934 | else | ||
935 | return TerrainUploader.XferID == xferID; | ||
936 | } | ||
937 | } | ||
938 | |||
939 | private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) | 1098 | private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) |
940 | { | 1099 | { |
941 | // Save terrain here | 1100 | // Save terrain here |
@@ -1117,11 +1276,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1117 | remoteClient.SendRegionHandshake(Scene.RegionInfo,args); | 1276 | remoteClient.SendRegionHandshake(Scene.RegionInfo,args); |
1118 | } | 1277 | } |
1119 | 1278 | ||
1120 | public void sendRegionHandshakeToAll() | ||
1121 | { | ||
1122 | Scene.ForEachClient(sendRegionHandshake); | ||
1123 | } | ||
1124 | |||
1125 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) | 1279 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) |
1126 | { | 1280 | { |
1127 | if (parms2 == 0) | 1281 | if (parms2 == 0) |
@@ -1203,31 +1357,8 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1203 | sendRegionInfoPacketToAll(); | 1357 | sendRegionInfoPacketToAll(); |
1204 | } | 1358 | } |
1205 | 1359 | ||
1206 | public string setEstateOwner(int estateID, UserAccount account) | ||
1207 | { | ||
1208 | string response; | ||
1209 | 1360 | ||
1210 | // get the current settings from DB | 1361 | #endregion |
1211 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
1212 | if(account.PrincipalID != dbSettings.EstateOwner) { | ||
1213 | dbSettings.EstateOwner = account.PrincipalID; | ||
1214 | dbSettings.Save(); | ||
1215 | response = String.Format("Estate owner changed to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
1216 | |||
1217 | // make sure there's a log entry to document the change | ||
1218 | m_log.InfoFormat("[ESTATE]: Estate Owner for {0} changed to {1} ({2} {3})", dbSettings.EstateName, | ||
1219 | account.PrincipalID, account.FirstName, account.LastName); | ||
1220 | |||
1221 | TriggerEstateInfoChange(); | ||
1222 | } | ||
1223 | else | ||
1224 | { | ||
1225 | response = String.Format("Estate already belongs to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
1226 | } | ||
1227 | return response; | ||
1228 | } | ||
1229 | |||
1230 | #endregion | ||
1231 | 1362 | ||
1232 | private void EventManager_OnNewClient(IClientAPI client) | 1363 | private void EventManager_OnNewClient(IClientAPI client) |
1233 | { | 1364 | { |
@@ -1257,60 +1388,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1257 | sendRegionHandshake(client); | 1388 | sendRegionHandshake(client); |
1258 | } | 1389 | } |
1259 | 1390 | ||
1260 | public uint GetRegionFlags() | 1391 | private uint GetEstateFlags() |
1261 | { | ||
1262 | RegionFlags flags = RegionFlags.None; | ||
1263 | |||
1264 | // Fully implemented | ||
1265 | // | ||
1266 | if (Scene.RegionInfo.RegionSettings.AllowDamage) | ||
1267 | flags |= RegionFlags.AllowDamage; | ||
1268 | if (Scene.RegionInfo.RegionSettings.BlockTerraform) | ||
1269 | flags |= RegionFlags.BlockTerraform; | ||
1270 | if (!Scene.RegionInfo.RegionSettings.AllowLandResell) | ||
1271 | flags |= RegionFlags.BlockLandResell; | ||
1272 | if (Scene.RegionInfo.RegionSettings.DisableCollisions) | ||
1273 | flags |= RegionFlags.SkipCollisions; | ||
1274 | if (Scene.RegionInfo.RegionSettings.DisableScripts) | ||
1275 | flags |= RegionFlags.SkipScripts; | ||
1276 | if (Scene.RegionInfo.RegionSettings.DisablePhysics) | ||
1277 | flags |= RegionFlags.SkipPhysics; | ||
1278 | if (Scene.RegionInfo.RegionSettings.BlockFly) | ||
1279 | flags |= RegionFlags.NoFly; | ||
1280 | if (Scene.RegionInfo.RegionSettings.RestrictPushing) | ||
1281 | flags |= RegionFlags.RestrictPushObject; | ||
1282 | if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) | ||
1283 | flags |= RegionFlags.AllowParcelChanges; | ||
1284 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | ||
1285 | flags |= RegionFlags.BlockParcelSearch; | ||
1286 | |||
1287 | if (Scene.RegionInfo.RegionSettings.FixedSun) | ||
1288 | flags |= RegionFlags.SunFixed; | ||
1289 | if (Scene.RegionInfo.RegionSettings.Sandbox) | ||
1290 | flags |= RegionFlags.Sandbox; | ||
1291 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | ||
1292 | flags |= RegionFlags.AllowVoice; | ||
1293 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1294 | flags |= RegionFlags.AllowLandmark; | ||
1295 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1296 | flags |= RegionFlags.AllowSetHome; | ||
1297 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1298 | flags |= RegionFlags.BlockDwell; | ||
1299 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1300 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1301 | |||
1302 | |||
1303 | // TODO: SkipUpdateInterestList | ||
1304 | |||
1305 | // Omitted | ||
1306 | // | ||
1307 | // Omitted: NullLayer (what is that?) | ||
1308 | // Omitted: SkipAgentAction (what does it do?) | ||
1309 | |||
1310 | return (uint)flags; | ||
1311 | } | ||
1312 | |||
1313 | public uint GetEstateFlags() | ||
1314 | { | 1392 | { |
1315 | RegionFlags flags = RegionFlags.None; | 1393 | RegionFlags flags = RegionFlags.None; |
1316 | 1394 | ||
@@ -1351,37 +1429,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1351 | return (uint)flags; | 1429 | return (uint)flags; |
1352 | } | 1430 | } |
1353 | 1431 | ||
1354 | public bool IsManager(UUID avatarID) | ||
1355 | { | ||
1356 | if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner) | ||
1357 | return true; | ||
1358 | |||
1359 | List<UUID> ems = new List<UUID>(Scene.RegionInfo.EstateSettings.EstateManagers); | ||
1360 | if (ems.Contains(avatarID)) | ||
1361 | return true; | ||
1362 | |||
1363 | return false; | ||
1364 | } | ||
1365 | |||
1366 | public void TriggerRegionInfoChange() | ||
1367 | { | ||
1368 | m_regionChangeTimer.Stop(); | ||
1369 | m_regionChangeTimer.Start(); | ||
1370 | |||
1371 | ChangeDelegate change = OnRegionInfoChange; | ||
1372 | |||
1373 | if (change != null) | ||
1374 | change(Scene.RegionInfo.RegionID); | ||
1375 | } | ||
1376 | |||
1377 | public void TriggerEstateInfoChange() | ||
1378 | { | ||
1379 | ChangeDelegate change = OnEstateInfoChange; | ||
1380 | |||
1381 | if (change != null) | ||
1382 | change(Scene.RegionInfo.RegionID); | ||
1383 | } | ||
1384 | |||
1385 | public void TriggerEstateMessage(UUID fromID, string fromName, string message) | 1432 | public void TriggerEstateMessage(UUID fromID, string fromName, string message) |
1386 | { | 1433 | { |
1387 | MessageDelegate onmessage = OnEstateMessage; | 1434 | MessageDelegate onmessage = OnEstateMessage; |