diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
9 files changed, 911 insertions, 171 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 02f0968..9c8cbc6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
49 | private int m_shoutdistance = 100; | 49 | private int m_shoutdistance = 100; |
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | private List<string> FreezeCache = new List<string>(); | |
53 | private string m_adminPrefix = ""; | ||
53 | internal object m_syncy = new object(); | 54 | internal object m_syncy = new object(); |
54 | 55 | ||
55 | internal IConfig m_config; | 56 | internal IConfig m_config; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 77 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 78 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 79 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
80 | m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | public virtual void AddRegion(Scene scene) | 83 | public virtual void AddRegion(Scene scene) |
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
171 | return; | 173 | return; |
172 | } | 174 | } |
173 | 175 | ||
174 | DeliverChatToAvatars(ChatSourceType.Agent, c); | 176 | if (FreezeCache.Contains(c.Sender.AgentId.ToString())) |
177 | { | ||
178 | if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) | ||
179 | c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | DeliverChatToAvatars(ChatSourceType.Agent, c); | ||
184 | } | ||
175 | } | 185 | } |
176 | 186 | ||
177 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) | 187 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) |
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
185 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) | 195 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) |
186 | { | 196 | { |
187 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | ||
188 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
189 | string message = c.Message; | 200 | string message = c.Message; |
190 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
207 | fromPos = avatar.AbsolutePosition; | 218 | fromPos = avatar.AbsolutePosition; |
208 | fromName = avatar.Name; | 219 | fromName = avatar.Name; |
209 | fromID = c.Sender.AgentId; | 220 | fromID = c.Sender.AgentId; |
210 | 221 | if (avatar.GodLevel > 200) | |
222 | { | ||
223 | fromNamePrefix = m_adminPrefix; | ||
224 | } | ||
211 | break; | 225 | break; |
212 | 226 | ||
213 | case ChatSourceType.Object: | 227 | case ChatSourceType.Object: |
@@ -227,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
227 | s.ForEachScenePresence( | 241 | s.ForEachScenePresence( |
228 | delegate(ScenePresence presence) | 242 | delegate(ScenePresence presence) |
229 | { | 243 | { |
230 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); | 244 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
245 | if (Presencecheck != null) | ||
246 | { | ||
247 | if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true) | ||
248 | { | ||
249 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); | ||
250 | } | ||
251 | } | ||
252 | |||
231 | } | 253 | } |
232 | ); | 254 | ); |
233 | } | 255 | } |
@@ -270,25 +292,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
270 | } | 292 | } |
271 | 293 | ||
272 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 294 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
273 | 295 | if (c.Scene != null) | |
274 | ((Scene)c.Scene).ForEachScenePresence( | 296 | { |
275 | delegate(ScenePresence presence) | 297 | ((Scene)c.Scene).ForEachScenePresence |
276 | { | 298 | ( |
277 | // ignore chat from child agents | 299 | delegate(ScenePresence presence) |
278 | if (presence.IsChildAgent) return; | 300 | { |
279 | 301 | // ignore chat from child agents | |
280 | IClientAPI client = presence.ControllingClient; | 302 | if (presence.IsChildAgent) return; |
281 | 303 | ||
282 | // don't forward SayOwner chat from objects to | 304 | IClientAPI client = presence.ControllingClient; |
283 | // non-owner agents | 305 | |
284 | if ((c.Type == ChatTypeEnum.Owner) && | 306 | // don't forward SayOwner chat from objects to |
285 | (null != c.SenderObject) && | 307 | // non-owner agents |
286 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 308 | if ((c.Type == ChatTypeEnum.Owner) && |
287 | return; | 309 | (null != c.SenderObject) && |
288 | 310 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | |
289 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 311 | return; |
290 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 312 | |
291 | }); | 313 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
314 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
315 | } | ||
316 | ); | ||
317 | } | ||
292 | } | 318 | } |
293 | 319 | ||
294 | 320 | ||
@@ -317,5 +343,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
317 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 343 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, |
318 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); | 344 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); |
319 | } | 345 | } |
346 | |||
347 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
348 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
349 | { | ||
350 | System.Threading.Timer Timer; | ||
351 | if (flags == 0) | ||
352 | { | ||
353 | FreezeCache.Add(target.ToString()); | ||
354 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
355 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
356 | Timers.Add(target, Timer); | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | FreezeCache.Remove(target.ToString()); | ||
361 | Timers.TryGetValue(target, out Timer); | ||
362 | Timers.Remove(target); | ||
363 | Timer.Dispose(); | ||
364 | } | ||
365 | } | ||
366 | |||
367 | private void OnEndParcelFrozen(object avatar) | ||
368 | { | ||
369 | UUID target = (UUID)avatar; | ||
370 | FreezeCache.Remove(target.ToString()); | ||
371 | System.Threading.Timer Timer; | ||
372 | Timers.TryGetValue(target, out Timer); | ||
373 | Timers.Remove(target); | ||
374 | Timer.Dispose(); | ||
375 | } | ||
320 | } | 376 | } |
321 | } | 377 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index ff38b6f..0727fa9 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -163,13 +163,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
163 | 163 | ||
164 | private void RetrieveInstantMessages(IClientAPI client) | 164 | private void RetrieveInstantMessages(IClientAPI client) |
165 | { | 165 | { |
166 | if (m_RestURL != "") | 166 | if (m_RestURL == String.Empty) |
167 | { | 167 | return; |
168 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
169 | 168 | ||
170 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 169 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); |
170 | |||
171 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | ||
171 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 172 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
172 | 173 | ||
174 | if (msglist != null) | ||
175 | { | ||
173 | foreach (GridInstantMessage im in msglist) | 176 | foreach (GridInstantMessage im in msglist) |
174 | { | 177 | { |
175 | // client.SendInstantMessage(im); | 178 | // client.SendInstantMessage(im); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index d9a021f..b60b32b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -389,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
389 | { | 389 | { |
390 | // Check if this is ours to handle | 390 | // Check if this is ours to handle |
391 | // | 391 | // |
392 | m_log.Info("OnFridInstantMessage"); | 392 | //m_log.Info("OnFridInstantMessage"); |
393 | if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered) | 393 | if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered) |
394 | return; | 394 | return; |
395 | 395 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs index fa3681a..b7f3adf 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs | |||
@@ -331,12 +331,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
331 | { | 331 | { |
332 | //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); | 332 | //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); |
333 | 333 | ||
334 | m_log.Debug("---------------------------"); | 334 | /* m_log.Debug("---------------------------"); |
335 | m_log.Debug(" >> uri=" + request["uri"]); | 335 | m_log.Debug(" >> uri=" + request["uri"]); |
336 | m_log.Debug(" >> content-type=" + request["content-type"]); | 336 | m_log.Debug(" >> content-type=" + request["content-type"]); |
337 | m_log.Debug(" >> http-method=" + request["http-method"]); | 337 | m_log.Debug(" >> http-method=" + request["http-method"]); |
338 | m_log.Debug("---------------------------\n"); | 338 | m_log.Debug("---------------------------\n"); */ |
339 | |||
340 | Hashtable responsedata = new Hashtable(); | 339 | Hashtable responsedata = new Hashtable(); |
341 | responsedata["content_type"] = "text/html"; | 340 | responsedata["content_type"] = "text/html"; |
342 | responsedata["keepalive"] = false; | 341 | responsedata["keepalive"] = false; |
@@ -581,11 +580,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
581 | { | 580 | { |
582 | m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); | 581 | m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); |
583 | 582 | ||
584 | m_log.Debug("---------------------------"); | 583 | /* m_log.Debug("---------------------------"); |
585 | m_log.Debug(" >> uri=" + request["uri"]); | 584 | m_log.Debug(" >> uri=" + request["uri"]); |
586 | m_log.Debug(" >> content-type=" + request["content-type"]); | 585 | m_log.Debug(" >> content-type=" + request["content-type"]); |
587 | m_log.Debug(" >> http-method=" + request["http-method"]); | 586 | m_log.Debug(" >> http-method=" + request["http-method"]); |
588 | m_log.Debug("---------------------------\n"); | 587 | m_log.Debug("---------------------------\n"); */ |
589 | 588 | ||
590 | Hashtable responsedata = new Hashtable(); | 589 | Hashtable responsedata = new Hashtable(); |
591 | responsedata["content_type"] = "text/html"; | 590 | responsedata["content_type"] = "text/html"; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 2e30e09..4999508 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -259,21 +259,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
259 | // Fix ownership/creator of inventory items | 259 | // Fix ownership/creator of inventory items |
260 | // Not doing so results in inventory items | 260 | // Not doing so results in inventory items |
261 | // being no copy/no mod for everyone | 261 | // being no copy/no mod for everyone |
262 | lock (part.TaskInventory) | 262 | part.TaskInventory.LockItemsForRead(true); |
263 | TaskInventoryDictionary inv = part.TaskInventory; | ||
264 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
263 | { | 265 | { |
264 | TaskInventoryDictionary inv = part.TaskInventory; | 266 | if (!ResolveUserUuid(kvp.Value.OwnerID)) |
265 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
266 | { | 267 | { |
267 | if (!ResolveUserUuid(kvp.Value.OwnerID)) | 268 | kvp.Value.OwnerID = masterAvatarId; |
268 | { | 269 | } |
269 | kvp.Value.OwnerID = masterAvatarId; | 270 | if (!ResolveUserUuid(kvp.Value.CreatorID)) |
270 | } | 271 | { |
271 | if (!ResolveUserUuid(kvp.Value.CreatorID)) | 272 | kvp.Value.CreatorID = masterAvatarId; |
272 | { | ||
273 | kvp.Value.CreatorID = masterAvatarId; | ||
274 | } | ||
275 | } | 273 | } |
276 | } | 274 | } |
275 | part.TaskInventory.LockItemsForRead(false); | ||
277 | } | 276 | } |
278 | 277 | ||
279 | if (!m_scene.AddRestoredSceneObject(sceneObject, true, false)) | 278 | if (!m_scene.AddRestoredSceneObject(sceneObject, true, false)) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 9b39b09..8039558 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -81,6 +81,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
81 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 81 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
82 | 82 | ||
83 | private bool m_allowedForcefulBans = true; | 83 | private bool m_allowedForcefulBans = true; |
84 | private UUID DefaultGodParcelGroup; | ||
85 | private string DefaultGodParcelName; | ||
84 | 86 | ||
85 | // caches ExtendedLandData | 87 | // caches ExtendedLandData |
86 | private Cache parcelInfoCache; | 88 | private Cache parcelInfoCache; |
@@ -94,6 +96,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
94 | 96 | ||
95 | public void Initialise(IConfigSource source) | 97 | public void Initialise(IConfigSource source) |
96 | { | 98 | { |
99 | IConfig cnf = source.Configs["LandManagement"]; | ||
100 | if (cnf != null) | ||
101 | { | ||
102 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
103 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
104 | } | ||
97 | } | 105 | } |
98 | 106 | ||
99 | public void AddRegion(Scene scene) | 107 | public void AddRegion(Scene scene) |
@@ -153,6 +161,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
153 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; | 161 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; |
154 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | 162 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; |
155 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 163 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
164 | client.OnParcelGodMark += ClientOnParcelGodMark; | ||
165 | client.OnSimWideDeletes += ClientOnSimWideDeletes; | ||
166 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; | ||
167 | client.OnParcelEjectUser += ClientOnParcelEjectUser; | ||
156 | 168 | ||
157 | EntityBase presenceEntity; | 169 | EntityBase presenceEntity; |
158 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 170 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
@@ -264,20 +276,103 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
264 | return parcelsNear; | 276 | return parcelsNear; |
265 | } | 277 | } |
266 | 278 | ||
267 | public void SendYouAreBannedNotice(ScenePresence avatar) | 279 | |
280 | public void MoveUserOutOfParcel(ScenePresence avatar) | ||
268 | { | 281 | { |
269 | if (AllowedForcefulBans) | 282 | if (avatar.GodLevel == 0) |
270 | { | 283 | { |
271 | avatar.ControllingClient.SendAlertMessage( | 284 | ILandObject land = m_scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
272 | "You are not allowed on this parcel because you are banned. Please go away."); | 285 | List<ILandObject> parcelsNear = new List<ILandObject>(); |
273 | 286 | ||
274 | avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition; | 287 | for (int x = -2; x <= 2; x += 2) |
275 | avatar.PhysicsActor.Velocity = Vector3.Zero; | 288 | { |
276 | } | 289 | ILandObject check = GetLandObject(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y); |
277 | else | 290 | if (check != null) |
278 | { | 291 | { |
279 | avatar.ControllingClient.SendAlertMessage( | 292 | if (check.IsEitherBannedOrRestricted(avatar.UUID) != true) |
280 | "You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim!"); | 293 | { |
294 | Vector3 target = new Vector3(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); | ||
295 | avatar.TeleportWithMomentum(target); | ||
296 | return; | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | for (int y = -2; y <= 2; y += 2) | ||
301 | { | ||
302 | ILandObject check = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y); | ||
303 | if (check != null) | ||
304 | { | ||
305 | if (check.IsEitherBannedOrRestricted(avatar.UUID) != true) | ||
306 | { | ||
307 | Vector3 target = new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y, avatar.AbsolutePosition.Z); | ||
308 | avatar.TeleportWithMomentum(target); | ||
309 | return; | ||
310 | } | ||
311 | } | ||
312 | } | ||
313 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
314 | allParcels = AllParcels(); | ||
315 | if (allParcels.Count != 1) | ||
316 | { | ||
317 | foreach (ILandObject parcel in allParcels) | ||
318 | { | ||
319 | if (parcel.IsEitherBannedOrRestricted(avatar.UUID) != true) | ||
320 | { | ||
321 | Vector3 temptarget = parcel.LandData.UserLocation; | ||
322 | if (parcel.ContainsPoint((int)parcel.LandData.UserLocation.X, (int)parcel.LandData.UserLocation.Y)) | ||
323 | { | ||
324 | avatar.TeleportWithMomentum(temptarget); | ||
325 | return; | ||
326 | } | ||
327 | else | ||
328 | { | ||
329 | for (int x = 0; x <= Constants.RegionSize / 3; x += 3) | ||
330 | { | ||
331 | for (int y = 0; y <= Constants.RegionSize / 3; y += 3) | ||
332 | { | ||
333 | if (parcel.ContainsPoint(x, y)) | ||
334 | { | ||
335 | temptarget = new Vector3(x, y, avatar.AbsolutePosition.Z); | ||
336 | avatar.TeleportWithMomentum(temptarget); | ||
337 | return; | ||
338 | } | ||
339 | } | ||
340 | } | ||
341 | } | ||
342 | } | ||
343 | } | ||
344 | } | ||
345 | //Move to region side | ||
346 | if (avatar.AbsolutePosition.X > avatar.AbsolutePosition.Y) | ||
347 | { | ||
348 | if (avatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
349 | { | ||
350 | Vector3 target = new Vector3(Constants.RegionSize, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); ; | ||
351 | avatar.TeleportWithMomentum(target); | ||
352 | return; | ||
353 | } | ||
354 | else | ||
355 | { | ||
356 | Vector3 target = new Vector3(0, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); ; | ||
357 | avatar.TeleportWithMomentum(target); | ||
358 | return; | ||
359 | } | ||
360 | } | ||
361 | else | ||
362 | { | ||
363 | if (avatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
364 | { | ||
365 | Vector3 target = new Vector3(avatar.AbsolutePosition.X, Constants.RegionSize, avatar.AbsolutePosition.Z); ; | ||
366 | avatar.TeleportWithMomentum(target); | ||
367 | return; | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | Vector3 target = new Vector3(avatar.AbsolutePosition.X, 0, avatar.AbsolutePosition.Z); ; | ||
372 | avatar.TeleportWithMomentum(target); | ||
373 | return; | ||
374 | } | ||
375 | } | ||
281 | } | 376 | } |
282 | } | 377 | } |
283 | 378 | ||
@@ -295,18 +390,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
295 | { | 390 | { |
296 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | 391 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) |
297 | { | 392 | { |
298 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | 393 | if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID)) |
299 | { | ||
300 | SendYouAreBannedNotice(avatar); | ||
301 | } | ||
302 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | ||
303 | { | ||
304 | avatar.ControllingClient.SendAlertMessage( | ||
305 | "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!)."); | ||
306 | } | ||
307 | else | ||
308 | { | 394 | { |
309 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | 395 | MoveUserOutOfParcel(avatar); |
310 | } | 396 | } |
311 | } | 397 | } |
312 | else | 398 | else |
@@ -317,28 +403,47 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
317 | } | 403 | } |
318 | } | 404 | } |
319 | 405 | ||
320 | public void SendOutNearestBanLine(IClientAPI avatar) | 406 | public void SendOutNearestBanLine(ScenePresence avatar) |
321 | { | 407 | { |
322 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 408 | ILandObject checkBan = null; |
323 | foreach (ScenePresence presence in avatars) | 409 | for (int x = -2; x <= 2; x += 2) |
324 | { | 410 | { |
325 | if (presence.UUID == avatar.AgentId) | 411 | checkBan = GetLandObject(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y); |
412 | if (checkBan != null) | ||
326 | { | 413 | { |
327 | List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); | 414 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) |
328 | foreach (ILandObject checkBan in checkLandParcels) | ||
329 | { | 415 | { |
330 | if (checkBan.IsBannedFromLand(avatar.AgentId)) | 416 | if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) |
331 | { | 417 | { |
332 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); | 418 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, true, (int)ParcelResult.Multiple, avatar.ControllingClient); |
333 | return; //Only send one | 419 | return; |
334 | } | 420 | } |
335 | if (checkBan.IsRestrictedFromLand(avatar.AgentId)) | 421 | if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) |
336 | { | 422 | { |
337 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); | 423 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, true, (int)ParcelResult.Multiple, avatar.ControllingClient); |
338 | return; //Only send one | 424 | return; |
425 | } | ||
426 | } | ||
427 | } | ||
428 | } | ||
429 | for (int y = -2; y <= 2; y += 2) | ||
430 | { | ||
431 | checkBan = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y); | ||
432 | if (checkBan != null) | ||
433 | { | ||
434 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
435 | { | ||
436 | if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) | ||
437 | { | ||
438 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, true, (int)ParcelResult.Multiple, avatar.ControllingClient); | ||
439 | return; | ||
440 | } | ||
441 | if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) | ||
442 | { | ||
443 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, true, (int)ParcelResult.Multiple, avatar.ControllingClient); | ||
444 | return; | ||
339 | } | 445 | } |
340 | } | 446 | } |
341 | return; | ||
342 | } | 447 | } |
343 | } | 448 | } |
344 | } | 449 | } |
@@ -385,25 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
385 | if (clientAvatar != null) | 490 | if (clientAvatar != null) |
386 | { | 491 | { |
387 | SendLandUpdate(clientAvatar); | 492 | SendLandUpdate(clientAvatar); |
388 | SendOutNearestBanLine(remote_client); | 493 | SendOutNearestBanLine(clientAvatar); |
389 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | 494 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); |
390 | if (parcel != null) | 495 | if (parcel != null) |
391 | { | 496 | { |
392 | if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | 497 | if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && |
393 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | ||
394 | { | ||
395 | EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, | ||
396 | m_scene.RegionInfo.RegionID); | ||
397 | //They are going under the safety line! | ||
398 | if (!parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
399 | { | ||
400 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | ||
401 | } | ||
402 | } | ||
403 | else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | ||
404 | parcel.IsBannedFromLand(clientAvatar.UUID)) | 498 | parcel.IsBannedFromLand(clientAvatar.UUID)) |
405 | { | 499 | { |
406 | SendYouAreBannedNotice(clientAvatar); | 500 | MoveUserOutOfParcel(clientAvatar); |
407 | } | 501 | } |
408 | } | 502 | } |
409 | } | 503 | } |
@@ -451,9 +545,21 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
451 | 545 | ||
452 | if (land != null) | 546 | if (land != null) |
453 | { | 547 | { |
454 | if (agentID == land.LandData.OwnerID) | 548 | if (m_scene.Permissions.CanEditParcel(agentID, land)) |
455 | { | 549 | { |
456 | land.UpdateAccessList(flags, entries, remote_client); | 550 | land.UpdateAccessList(flags, entries, remote_client); |
551 | List<ScenePresence> presences = ((Scene)remote_client.Scene).GetAvatars(); | ||
552 | foreach (ScenePresence presence in presences) | ||
553 | { | ||
554 | land = GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | ||
555 | if (land != null) | ||
556 | { | ||
557 | if (land.IsEitherBannedOrRestricted(presence.UUID)) | ||
558 | { | ||
559 | MoveUserOutOfParcel(presence); | ||
560 | } | ||
561 | } | ||
562 | } | ||
457 | } | 563 | } |
458 | } | 564 | } |
459 | else | 565 | else |
@@ -908,6 +1014,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
908 | //Owner Flag | 1014 | //Owner Flag |
909 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 1015 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
910 | } | 1016 | } |
1017 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1018 | { | ||
1019 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
1020 | } | ||
911 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 1021 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
912 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 1022 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
913 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 1023 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1019,7 +1129,25 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1019 | m_landList.TryGetValue(localID, out land); | 1129 | m_landList.TryGetValue(localID, out land); |
1020 | } | 1130 | } |
1021 | 1131 | ||
1022 | if (land != null) land.UpdateLandProperties(args, remote_client); | 1132 | if (land != null) |
1133 | { | ||
1134 | land.UpdateLandProperties(args, remote_client); | ||
1135 | if ((args.ParcelFlags & (uint)(ParcelFlags.UseBanList | ParcelFlags.UseAccessList | ParcelFlags.UseAccessGroup | ParcelFlags.UsePassList)) != 0) | ||
1136 | { | ||
1137 | List<ScenePresence> presences = ((Scene)remote_client.Scene).GetAvatars(); | ||
1138 | foreach (ScenePresence presence in presences) | ||
1139 | { | ||
1140 | land = GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | ||
1141 | if (land != null) | ||
1142 | { | ||
1143 | if (land.IsEitherBannedOrRestricted(presence.UUID)) | ||
1144 | { | ||
1145 | MoveUserOutOfParcel(presence); | ||
1146 | } | ||
1147 | } | ||
1148 | } | ||
1149 | } | ||
1150 | } | ||
1023 | } | 1151 | } |
1024 | 1152 | ||
1025 | public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) | 1153 | public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) |
@@ -1437,5 +1565,319 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1437 | 1565 | ||
1438 | UpdateLandObject(localID, land.LandData); | 1566 | UpdateLandObject(localID, land.LandData); |
1439 | } | 1567 | } |
1568 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1569 | { | ||
1570 | ILandObject land = null; | ||
1571 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1572 | foreach (ILandObject landObject in Land) | ||
1573 | { | ||
1574 | if (landObject.LandData.LocalID == landID) | ||
1575 | { | ||
1576 | land = landObject; | ||
1577 | } | ||
1578 | } | ||
1579 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1580 | land.LandData.Name = DefaultGodParcelName; | ||
1581 | land.SendLandUpdateToAvatarsOverMe(); | ||
1582 | } | ||
1583 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1584 | { | ||
1585 | ScenePresence SP; | ||
1586 | ((Scene)client.Scene).TryGetAvatar(client.AgentId, out SP); | ||
1587 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1588 | if (SP.GodLevel != 0) | ||
1589 | { | ||
1590 | if (flags == 0) //All parcels, scripted or not | ||
1591 | { | ||
1592 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1593 | { | ||
1594 | if (e.OwnerID == targetID) | ||
1595 | { | ||
1596 | returns.Add(e); | ||
1597 | } | ||
1598 | } | ||
1599 | ); | ||
1600 | } | ||
1601 | if (flags == 4) //All parcels, scripted object | ||
1602 | { | ||
1603 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1604 | { | ||
1605 | if (e.OwnerID == targetID) | ||
1606 | { | ||
1607 | if (e.scriptScore >= 0.01) | ||
1608 | { | ||
1609 | returns.Add(e); | ||
1610 | } | ||
1611 | } | ||
1612 | } | ||
1613 | ); | ||
1614 | } | ||
1615 | if (flags == 4) //not target parcel, scripted object | ||
1616 | { | ||
1617 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1618 | { | ||
1619 | if (e.OwnerID == targetID) | ||
1620 | { | ||
1621 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1622 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1623 | { | ||
1624 | if (e.scriptScore >= 0.01) | ||
1625 | { | ||
1626 | returns.Add(e); | ||
1627 | } | ||
1628 | } | ||
1629 | } | ||
1630 | } | ||
1631 | ); | ||
1632 | } | ||
1633 | foreach (SceneObjectGroup ol in returns) | ||
1634 | { | ||
1635 | ReturnObject(ol, client); | ||
1636 | } | ||
1637 | } | ||
1638 | } | ||
1639 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1640 | { | ||
1641 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1642 | objs[0] = obj; | ||
1643 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1644 | } | ||
1645 | |||
1646 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1647 | |||
1648 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1649 | { | ||
1650 | ScenePresence targetAvatar = null; | ||
1651 | ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); | ||
1652 | ScenePresence parcelManager = null; | ||
1653 | ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); | ||
1654 | System.Threading.Timer Timer; | ||
1655 | |||
1656 | if (targetAvatar.GodLevel == 0) | ||
1657 | { | ||
1658 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1659 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1660 | return; | ||
1661 | if (flags == 0) | ||
1662 | { | ||
1663 | targetAvatar.AllowMovement = false; | ||
1664 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1665 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1666 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1667 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1668 | Timers.Add(targetAvatar.UUID, Timer); | ||
1669 | } | ||
1670 | else | ||
1671 | { | ||
1672 | targetAvatar.AllowMovement = true; | ||
1673 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1674 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1675 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1676 | Timers.Remove(targetAvatar.UUID); | ||
1677 | Timer.Dispose(); | ||
1678 | } | ||
1679 | } | ||
1680 | } | ||
1681 | private void OnEndParcelFrozen(object avatar) | ||
1682 | { | ||
1683 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1684 | targetAvatar.AllowMovement = true; | ||
1685 | System.Threading.Timer Timer; | ||
1686 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1687 | Timers.Remove(targetAvatar.UUID); | ||
1688 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1689 | } | ||
1690 | |||
1691 | |||
1692 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1693 | { | ||
1694 | ScenePresence targetAvatar = null; | ||
1695 | ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); | ||
1696 | ScenePresence parcelManager = null; | ||
1697 | ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); | ||
1698 | //Just eject | ||
1699 | if (flags == 0) | ||
1700 | { | ||
1701 | if (targetAvatar.GodLevel == 0) | ||
1702 | { | ||
1703 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1704 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1705 | return; | ||
1706 | |||
1707 | Vector3 position = new Vector3(0, 0, 0); | ||
1708 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1709 | allParcels = AllParcels(); | ||
1710 | if (allParcels.Count != 1) | ||
1711 | { | ||
1712 | foreach (ILandObject parcel in allParcels) | ||
1713 | { | ||
1714 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1715 | { | ||
1716 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1717 | { | ||
1718 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1719 | { | ||
1720 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1721 | { | ||
1722 | if (parcel.ContainsPoint(x, y)) | ||
1723 | { | ||
1724 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1725 | targetAvatar.TeleportWithMomentum(position); | ||
1726 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1727 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1728 | return; | ||
1729 | } | ||
1730 | } | ||
1731 | } | ||
1732 | } | ||
1733 | } | ||
1734 | } | ||
1735 | } | ||
1736 | Vector3 targetVector; | ||
1737 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1738 | { | ||
1739 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1740 | { | ||
1741 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1742 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1743 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1744 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1745 | return; | ||
1746 | } | ||
1747 | else | ||
1748 | { | ||
1749 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1750 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1751 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1752 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1753 | return; | ||
1754 | } | ||
1755 | } | ||
1756 | else | ||
1757 | { | ||
1758 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1759 | { | ||
1760 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1761 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1762 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1763 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1764 | return; | ||
1765 | } | ||
1766 | else | ||
1767 | { | ||
1768 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1769 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1770 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1771 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1772 | return; | ||
1773 | } | ||
1774 | } | ||
1775 | } | ||
1776 | } | ||
1777 | //Eject and ban | ||
1778 | if (flags == 1) | ||
1779 | { | ||
1780 | if (targetAvatar.GodLevel == 0) | ||
1781 | { | ||
1782 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1783 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1784 | return; | ||
1785 | |||
1786 | Vector3 position = new Vector3(0, 0, 0); | ||
1787 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1788 | allParcels = AllParcels(); | ||
1789 | if (allParcels.Count != 1) | ||
1790 | { | ||
1791 | foreach (ILandObject parcel in allParcels) | ||
1792 | { | ||
1793 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1794 | { | ||
1795 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1796 | { | ||
1797 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1798 | { | ||
1799 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1800 | { | ||
1801 | if (parcel.ContainsPoint(x, y)) | ||
1802 | { | ||
1803 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1804 | targetAvatar.TeleportWithMomentum(position); | ||
1805 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1806 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1807 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1808 | entry.AgentID = targetAvatar.UUID; | ||
1809 | entry.Flags = AccessList.Ban; | ||
1810 | entry.Time = new DateTime(); | ||
1811 | land.LandData.ParcelAccessList.Add(entry); | ||
1812 | return; | ||
1813 | } | ||
1814 | } | ||
1815 | } | ||
1816 | } | ||
1817 | } | ||
1818 | } | ||
1819 | } | ||
1820 | Vector3 targetVector; | ||
1821 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1822 | { | ||
1823 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1824 | { | ||
1825 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1826 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1827 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1828 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1829 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1830 | entry.AgentID = targetAvatar.UUID; | ||
1831 | entry.Flags = AccessList.Ban; | ||
1832 | entry.Time = new DateTime(); | ||
1833 | land.LandData.ParcelAccessList.Add(entry); | ||
1834 | return; | ||
1835 | } | ||
1836 | else | ||
1837 | { | ||
1838 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1839 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1840 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1841 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1842 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1843 | entry.AgentID = targetAvatar.UUID; | ||
1844 | entry.Flags = AccessList.Ban; | ||
1845 | entry.Time = new DateTime(); | ||
1846 | land.LandData.ParcelAccessList.Add(entry); | ||
1847 | return; | ||
1848 | } | ||
1849 | } | ||
1850 | else | ||
1851 | { | ||
1852 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1853 | { | ||
1854 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1855 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1856 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1857 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1858 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1859 | entry.AgentID = targetAvatar.UUID; | ||
1860 | entry.Flags = AccessList.Ban; | ||
1861 | entry.Time = new DateTime(); | ||
1862 | land.LandData.ParcelAccessList.Add(entry); | ||
1863 | return; | ||
1864 | } | ||
1865 | else | ||
1866 | { | ||
1867 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1868 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1869 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1870 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1871 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1872 | entry.AgentID = targetAvatar.UUID; | ||
1873 | entry.Flags = AccessList.Ban; | ||
1874 | entry.Time = new DateTime(); | ||
1875 | land.LandData.ParcelAccessList.Add(entry); | ||
1876 | return; | ||
1877 | } | ||
1878 | } | ||
1879 | } | ||
1880 | } | ||
1881 | } | ||
1440 | } | 1882 | } |
1441 | } | 1883 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 1fa8630..b8c35f7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -267,11 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
267 | 267 | ||
268 | public bool IsEitherBannedOrRestricted(UUID avatar) | 268 | public bool IsEitherBannedOrRestricted(UUID avatar) |
269 | { | 269 | { |
270 | if (IsBannedFromLand(avatar)) | 270 | if (IsRestrictedFromLand(avatar) || IsBannedFromLand(avatar)) |
271 | { | ||
272 | return true; | ||
273 | } | ||
274 | else if (IsRestrictedFromLand(avatar)) | ||
275 | { | 271 | { |
276 | return true; | 272 | return true; |
277 | } | 273 | } |
@@ -280,7 +276,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
280 | 276 | ||
281 | public bool IsBannedFromLand(UUID avatar) | 277 | public bool IsBannedFromLand(UUID avatar) |
282 | { | 278 | { |
283 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 279 | ScenePresence SP = m_scene.GetScenePresence(avatar); |
280 | if ((LandData.Flags & (uint)ParcelFlags.UseBanList) > 0) | ||
284 | { | 281 | { |
285 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 282 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
286 | entry.AgentID = avatar; | 283 | entry.AgentID = avatar; |
@@ -288,8 +285,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
288 | entry.Time = new DateTime(); | 285 | entry.Time = new DateTime(); |
289 | if (LandData.ParcelAccessList.Contains(entry)) | 286 | if (LandData.ParcelAccessList.Contains(entry)) |
290 | { | 287 | { |
291 | //They are banned, so lets send them a notice about this parcel | 288 | if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0) |
292 | return true; | 289 | { |
290 | if (LandData.GroupID == SP.ControllingClient.ActiveGroupId) | ||
291 | { | ||
292 | return false; | ||
293 | } | ||
294 | else | ||
295 | { | ||
296 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | ||
297 | return true; | ||
298 | } | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | return true; | ||
303 | } | ||
293 | } | 304 | } |
294 | } | 305 | } |
295 | return false; | 306 | return false; |
@@ -297,7 +308,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
297 | 308 | ||
298 | public bool IsRestrictedFromLand(UUID avatar) | 309 | public bool IsRestrictedFromLand(UUID avatar) |
299 | { | 310 | { |
300 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 311 | ScenePresence SP = m_scene.GetScenePresence(avatar); |
312 | if ((LandData.Flags & (uint)ParcelFlags.UseAccessList) > 0) | ||
301 | { | 313 | { |
302 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 314 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
303 | entry.AgentID = avatar; | 315 | entry.AgentID = avatar; |
@@ -305,8 +317,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
305 | entry.Time = new DateTime(); | 317 | entry.Time = new DateTime(); |
306 | if (!LandData.ParcelAccessList.Contains(entry)) | 318 | if (!LandData.ParcelAccessList.Contains(entry)) |
307 | { | 319 | { |
308 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | 320 | if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0) |
309 | return true; | 321 | { |
322 | if (LandData.GroupID == SP.ControllingClient.ActiveGroupId) | ||
323 | { | ||
324 | return false; | ||
325 | } | ||
326 | else | ||
327 | { | ||
328 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | ||
329 | return true; | ||
330 | } | ||
331 | } | ||
332 | else | ||
333 | { | ||
334 | return true; | ||
335 | } | ||
310 | } | 336 | } |
311 | } | 337 | } |
312 | return false; | 338 | return false; |
@@ -889,7 +915,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
889 | 915 | ||
890 | foreach (List<SceneObjectGroup> ol in returns.Values) | 916 | foreach (List<SceneObjectGroup> ol in returns.Values) |
891 | { | 917 | { |
892 | if (m_scene.Permissions.CanUseObjectReturn(this, type, remote_client, ol)) | 918 | if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) |
893 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); | 919 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); |
894 | } | 920 | } |
895 | } | 921 | } |
diff --git a/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs b/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs new file mode 100644 index 0000000..72b0b38 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs | |||
@@ -0,0 +1,274 @@ | |||
1 | /* | ||
2 | * Copyright (c) Thomas Grimshaw and Magne Metaverse Research | ||
3 | * | ||
4 | * This module is not open source. All rights reserved. | ||
5 | * Unauthorised copying, distribution or public display is prohibited. | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | using System; | ||
10 | using System.Collections.Generic; | ||
11 | using System.IO; | ||
12 | using System.Reflection; | ||
13 | using OpenMetaverse; | ||
14 | using log4net; | ||
15 | using Nini.Config; | ||
16 | using OpenSim.Data; | ||
17 | using OpenSim.Framework; | ||
18 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | ||
19 | using OpenSim.Region.Framework.Interfaces; | ||
20 | using OpenSim.Region.Framework.Scenes; | ||
21 | |||
22 | |||
23 | namespace OpenSim.Region.CoreModules.World.Meta7Windlight | ||
24 | { | ||
25 | public class Meta7WindlightModule : IRegionModule, ICommandableModule | ||
26 | { | ||
27 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
28 | private readonly Commander m_commander = new Commander("windlight"); | ||
29 | private Scene m_scene; | ||
30 | private static bool m_enableWindlight; | ||
31 | |||
32 | #region ICommandableModule Members | ||
33 | |||
34 | public ICommander CommandInterface | ||
35 | { | ||
36 | get { return m_commander; } | ||
37 | } | ||
38 | |||
39 | #endregion | ||
40 | |||
41 | #region IRegionModule Members | ||
42 | |||
43 | public static bool EnableWindlight | ||
44 | { | ||
45 | get | ||
46 | { | ||
47 | return m_enableWindlight; | ||
48 | } | ||
49 | set | ||
50 | { | ||
51 | } | ||
52 | } | ||
53 | |||
54 | public void Initialise(Scene scene, IConfigSource config) | ||
55 | { | ||
56 | m_scene = scene; | ||
57 | m_scene.RegisterModuleInterface<IRegionModule>(this); | ||
58 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | ||
59 | |||
60 | // ini file settings | ||
61 | try | ||
62 | { | ||
63 | m_enableWindlight = config.Configs["Meta7Windlight"].GetBoolean("enable_windlight", false); | ||
64 | } | ||
65 | catch (Exception) | ||
66 | { | ||
67 | m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); | ||
68 | } | ||
69 | |||
70 | if (m_enableWindlight) | ||
71 | { | ||
72 | m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; | ||
73 | m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; | ||
74 | m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; | ||
75 | } | ||
76 | |||
77 | InstallCommands(); | ||
78 | |||
79 | m_log.Debug("[WINDLIGHT]: Initialised windlight module"); | ||
80 | } | ||
81 | |||
82 | private List<byte[]> compileWindlightSettings(RegionMeta7WindlightData wl) | ||
83 | { | ||
84 | byte[] mBlock = new Byte[249]; | ||
85 | int pos = 0; | ||
86 | |||
87 | wl.waterColor.ToBytes(mBlock, 0); pos += 12; | ||
88 | Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4; | ||
89 | Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4; | ||
90 | wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12; | ||
91 | Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4; | ||
92 | Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4; | ||
93 | Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4; | ||
94 | Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4; | ||
95 | Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
96 | wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8; | ||
97 | wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8; | ||
98 | wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16; | ||
99 | wl.horizon.ToBytes(mBlock, pos); pos += 16; | ||
100 | Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4; | ||
101 | wl.blueDensity.ToBytes(mBlock, pos); pos += 16; | ||
102 | Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4; | ||
103 | Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
104 | Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
105 | wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16; | ||
106 | Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4; | ||
107 | wl.ambient.ToBytes(mBlock, pos); pos += 16; | ||
108 | Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4; | ||
109 | Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4; | ||
110 | Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4; | ||
111 | Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4; | ||
112 | Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4; | ||
113 | wl.cloudColor.ToBytes(mBlock, pos); pos += 16; | ||
114 | wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12; | ||
115 | Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4; | ||
116 | Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4; | ||
117 | wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12; | ||
118 | Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4; | ||
119 | Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4; | ||
120 | Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2; | ||
121 | mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++; | ||
122 | mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++; | ||
123 | mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++; | ||
124 | List<byte[]> param = new List<byte[]>(); | ||
125 | param.Add(mBlock); | ||
126 | return param; | ||
127 | } | ||
128 | public void SendProfileToClient(ScenePresence presence) | ||
129 | { | ||
130 | IClientAPI client = presence.ControllingClient; | ||
131 | if (m_enableWindlight) | ||
132 | { | ||
133 | if (presence.IsChildAgent == false) | ||
134 | { | ||
135 | List<byte[]> param = compileWindlightSettings(m_scene.RegionInfo.WindlightSettings); | ||
136 | client.SendGenericMessage("Windlight", param); | ||
137 | } | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | //We probably don't want to spam chat with this.. probably | ||
142 | //m_log.Debug("[WINDLIGHT]: Module disabled"); | ||
143 | } | ||
144 | } | ||
145 | public void SendProfileToClient(ScenePresence presence, RegionMeta7WindlightData wl) | ||
146 | { | ||
147 | IClientAPI client = presence.ControllingClient; | ||
148 | if (m_enableWindlight) | ||
149 | { | ||
150 | if (presence.IsChildAgent == false) | ||
151 | { | ||
152 | List<byte[]> param = compileWindlightSettings(wl); | ||
153 | client.SendGenericMessage("Windlight", param); | ||
154 | } | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | //We probably don't want to spam chat with this.. probably | ||
159 | //m_log.Debug("[WINDLIGHT]: Module disabled"); | ||
160 | } | ||
161 | } | ||
162 | private void EventManager_OnMakeRootAgent(ScenePresence presence) | ||
163 | { | ||
164 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); | ||
165 | SendProfileToClient(presence); | ||
166 | } | ||
167 | private void EventManager_OnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID pUUID) | ||
168 | { | ||
169 | ScenePresence Sc; | ||
170 | if (m_scene.TryGetAvatar(pUUID,out Sc)) | ||
171 | { | ||
172 | SendProfileToClient(Sc,wl); | ||
173 | } | ||
174 | } | ||
175 | private void EventManager_OnSaveNewWindlightProfile() | ||
176 | { | ||
177 | m_scene.ForEachScenePresence(SendProfileToClient); | ||
178 | } | ||
179 | |||
180 | public void PostInitialise() | ||
181 | { | ||
182 | |||
183 | } | ||
184 | |||
185 | public void Close() | ||
186 | { | ||
187 | } | ||
188 | |||
189 | public string Name | ||
190 | { | ||
191 | get { return "Meta7WindlightModule"; } | ||
192 | } | ||
193 | |||
194 | public bool IsSharedModule | ||
195 | { | ||
196 | get { return false; } | ||
197 | } | ||
198 | |||
199 | #endregion | ||
200 | |||
201 | #region events | ||
202 | |||
203 | #endregion | ||
204 | |||
205 | #region ICommandableModule Members | ||
206 | |||
207 | private void InstallCommands() | ||
208 | { | ||
209 | Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast"); | ||
210 | Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin"); | ||
211 | Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Enable the windlight plugin"); | ||
212 | |||
213 | m_commander.RegisterCommand("load", wlload); | ||
214 | m_commander.RegisterCommand("enable", wlenable); | ||
215 | m_commander.RegisterCommand("disable", wldisable); | ||
216 | |||
217 | m_scene.RegisterModuleCommander(m_commander); | ||
218 | } | ||
219 | |||
220 | private void HandleLoad(Object[] args) | ||
221 | { | ||
222 | if (!m_enableWindlight) | ||
223 | { | ||
224 | m_log.InfoFormat("[WINDLIGHT]: Cannot load windlight profile, module disabled. Use 'windlight enable' first."); | ||
225 | } | ||
226 | else | ||
227 | { | ||
228 | m_log.InfoFormat("[WINDLIGHT]: Loading Windlight profile from database"); | ||
229 | m_scene.LoadWindlightProfile(); | ||
230 | m_log.InfoFormat("[WINDLIGHT]: Load complete"); | ||
231 | } | ||
232 | } | ||
233 | |||
234 | private void HandleDisable(Object[] args) | ||
235 | { | ||
236 | m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled"); | ||
237 | m_enableWindlight=false; | ||
238 | } | ||
239 | |||
240 | private void HandleEnable(Object[] args) | ||
241 | { | ||
242 | m_log.InfoFormat("[WINDLIGHT]: Plugin now enabled"); | ||
243 | m_enableWindlight = true; | ||
244 | } | ||
245 | |||
246 | /// <summary> | ||
247 | /// Processes commandline input. Do not call directly. | ||
248 | /// </summary> | ||
249 | /// <param name="args">Commandline arguments</param> | ||
250 | private void EventManager_OnPluginConsole(string[] args) | ||
251 | { | ||
252 | if (args[0] == "windlight") | ||
253 | { | ||
254 | if (args.Length == 1) | ||
255 | { | ||
256 | m_commander.ProcessConsoleCommand("add", new string[0]); | ||
257 | return; | ||
258 | } | ||
259 | |||
260 | string[] tmpArgs = new string[args.Length - 2]; | ||
261 | int i; | ||
262 | for (i = 2; i < args.Length; i++) | ||
263 | { | ||
264 | tmpArgs[i - 2] = args[i]; | ||
265 | } | ||
266 | |||
267 | m_commander.ProcessConsoleCommand(args[1], tmpArgs); | ||
268 | } | ||
269 | } | ||
270 | #endregion | ||
271 | |||
272 | } | ||
273 | } | ||
274 | |||
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index b557186..212cfee 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
200 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED | 200 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED |
201 | m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED | 201 | m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED |
202 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; | 202 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; |
203 | m_scene.Permissions.OnReturnObject += CanReturnObject; //NOT YET IMPLEMENTED | 203 | m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED |
204 | m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED | 204 | m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED |
205 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; | 205 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; |
206 | m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED | 206 | m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED |
@@ -230,7 +230,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
230 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED | 230 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED |
231 | 231 | ||
232 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED | 232 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED |
233 | m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED | ||
234 | 233 | ||
235 | m_scene.AddCommand(this, "bypass permissions", | 234 | m_scene.AddCommand(this, "bypass permissions", |
236 | "bypass permissions <true / false>", | 235 | "bypass permissions <true / false>", |
@@ -1258,12 +1257,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1258 | return false; | 1257 | return false; |
1259 | } | 1258 | } |
1260 | 1259 | ||
1261 | private bool CanReturnObject(UUID objectID, UUID returnerID, Scene scene) | 1260 | private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene) |
1262 | { | 1261 | { |
1262 | if (objects.Count == 0) | ||
1263 | return false; | ||
1264 | |||
1263 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1265 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1264 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1266 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1265 | 1267 | ||
1266 | return GenericObjectPermission(returnerID, objectID, false); | 1268 | return GenericObjectPermission(user, objects[0].UUID, false); |
1267 | } | 1269 | } |
1268 | 1270 | ||
1269 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) | 1271 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) |
@@ -1730,67 +1732,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1730 | return GenericObjectPermission(agentID, prim, false); | 1732 | return GenericObjectPermission(agentID, prim, false); |
1731 | } | 1733 | } |
1732 | 1734 | ||
1733 | private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene) | ||
1734 | { | ||
1735 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1736 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1737 | |||
1738 | long powers = 0; | ||
1739 | if (parcel.LandData.GroupID != UUID.Zero) | ||
1740 | client.GetGroupPowers(parcel.LandData.GroupID); | ||
1741 | |||
1742 | switch (type) | ||
1743 | { | ||
1744 | case (uint)ObjectReturnType.Owner: | ||
1745 | // Don't let group members return owner's objects, ever | ||
1746 | // | ||
1747 | if (parcel.LandData.IsGroupOwned) | ||
1748 | { | ||
1749 | if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0) | ||
1750 | return true; | ||
1751 | } | ||
1752 | else | ||
1753 | { | ||
1754 | if (parcel.LandData.OwnerID != client.AgentId) | ||
1755 | return false; | ||
1756 | } | ||
1757 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned); | ||
1758 | case (uint)ObjectReturnType.Group: | ||
1759 | if (parcel.LandData.OwnerID != client.AgentId) | ||
1760 | { | ||
1761 | // If permissionis granted through a group... | ||
1762 | // | ||
1763 | if ((powers & (long)GroupPowers.ReturnGroupSet) != 0) | ||
1764 | { | ||
1765 | foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist)) | ||
1766 | { | ||
1767 | // check for and remove group owned objects unless | ||
1768 | // the user also has permissions to return those | ||
1769 | // | ||
1770 | if (g.OwnerID == g.GroupID && | ||
1771 | ((powers & (long)GroupPowers.ReturnGroupOwned) == 0)) | ||
1772 | { | ||
1773 | retlist.Remove(g); | ||
1774 | } | ||
1775 | } | ||
1776 | // And allow the operation | ||
1777 | // | ||
1778 | return true; | ||
1779 | } | ||
1780 | } | ||
1781 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupSet); | ||
1782 | case (uint)ObjectReturnType.Other: | ||
1783 | if ((powers & (long)GroupPowers.ReturnNonGroup) != 0) | ||
1784 | return true; | ||
1785 | return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnNonGroup); | ||
1786 | case (uint)ObjectReturnType.List: | ||
1787 | break; | ||
1788 | } | ||
1789 | |||
1790 | return GenericParcelOwnerPermission(client.AgentId, parcel, 0); | ||
1791 | // Is it correct to be less restrictive for lists of objects to be returned? | ||
1792 | } | ||
1793 | |||
1794 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { | 1735 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { |
1795 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); | 1736 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); |
1796 | switch (scriptType) { | 1737 | switch (scriptType) { |