aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs102
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs330
6 files changed, 445 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f050dcf..1992bd4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -27,6 +27,7 @@
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using System.Xml;
30using log4net; 31using log4net;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
@@ -35,6 +36,7 @@ using OpenSim.Framework;
35using OpenSim.Region.Framework; 36using OpenSim.Region.Framework;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Serialization;
38 40
39namespace OpenSim.Region.CoreModules.Avatar.Attachments 41namespace OpenSim.Region.CoreModules.Avatar.Attachments
40{ 42{
@@ -190,8 +192,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
190 192
191 public UUID RezSingleAttachmentFromInventory( 193 public UUID RezSingleAttachmentFromInventory(
192 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) 194 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
195 {
196 return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
197 }
198
199 public UUID RezSingleAttachmentFromInventory(
200 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
193 { 201 {
194 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); 202 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
195 203
196 if (updateInventoryStatus) 204 if (updateInventoryStatus)
197 { 205 {
@@ -210,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
210 } 218 }
211 219
212 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 220 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
213 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 221 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
214 { 222 {
215 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); 223 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
216 if (invAccess != null) 224 if (invAccess != null)
@@ -236,13 +244,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
236 if (tainted) 244 if (tainted)
237 objatt.HasGroupChanged = true; 245 objatt.HasGroupChanged = true;
238 246
247 if (doc != null)
248 objatt.LoadScriptState(doc);
249
239 // Fire after attach, so we don't get messy perms dialogs 250 // Fire after attach, so we don't get messy perms dialogs
240 // 3 == AttachedRez 251 // 3 == AttachedRez
241 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); 252 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
242 objatt.ResumeScripts(); 253 objatt.ResumeScripts();
243 254
244 // Do this last so that event listeners have access to all the effects of the attachment 255 // Do this last so that event listeners have access to all the effects of the attachment
245 m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); 256 //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
246 } 257 }
247 else 258 else
248 { 259 {
@@ -271,7 +282,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
271 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 282 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
272 { 283 {
273 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 284 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
274 item = m_scene.InventoryService.GetItem(item); 285 if (m_scene.InventoryService != null)
286 item = m_scene.InventoryService.GetItem(item);
275 287
276 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 288 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
277 } 289 }
@@ -316,6 +328,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
316 { 328 {
317 // XXYY!! 329 // XXYY!!
318 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 330 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
331 if (item == null)
332 m_log.Error("[ATTACHMENT]: item == null");
333 if (m_scene == null)
334 m_log.Error("[ATTACHMENT]: m_scene == null");
335 if (m_scene.InventoryService == null)
336 m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
319 item = m_scene.InventoryService.GetItem(item); 337 item = m_scene.InventoryService.GetItem(item);
320 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 338 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
321 339
@@ -404,6 +422,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
404 if (group.GetFromItemID() == itemID) 422 if (group.GetFromItemID() == itemID)
405 { 423 {
406 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 424 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
425 // CM / XMREngine!!!! Needed to conclude attach event
426 SceneObjectSerializer.ToOriginalXmlFormat(group);
407 group.DetachToInventoryPrep(); 427 group.DetachToInventoryPrep();
408 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 428 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
409 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); 429 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID);
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 6dacbba..acc3a78 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 }
@@ -266,25 +288,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
266 } 288 }
267 289
268 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 290 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
269 291 if (c.Scene != null)
270 ((Scene)c.Scene).ForEachScenePresence( 292 {
271 delegate(ScenePresence presence) 293 ((Scene)c.Scene).ForEachScenePresence
272 { 294 (
273 // ignore chat from child agents 295 delegate(ScenePresence presence)
274 if (presence.IsChildAgent) return; 296 {
275 297 // ignore chat from child agents
276 IClientAPI client = presence.ControllingClient; 298 if (presence.IsChildAgent) return;
277 299
278 // don't forward SayOwner chat from objects to 300 IClientAPI client = presence.ControllingClient;
279 // non-owner agents 301
280 if ((c.Type == ChatTypeEnum.Owner) && 302 // don't forward SayOwner chat from objects to
281 (null != c.SenderObject) && 303 // non-owner agents
282 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) 304 if ((c.Type == ChatTypeEnum.Owner) &&
283 return; 305 (null != c.SenderObject) &&
284 306 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
285 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 307 return;
286 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 308
287 }); 309 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
310 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
311 }
312 );
313 }
288 } 314 }
289 315
290 316
@@ -313,5 +339,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
313 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 339 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
314 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); 340 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
315 } 341 }
342
343 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
344 public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
345 {
346 System.Threading.Timer Timer;
347 if (flags == 0)
348 {
349 FreezeCache.Add(target.ToString());
350 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
351 Timer = new System.Threading.Timer(timeCB, target, 30000, 0);
352 Timers.Add(target, Timer);
353 }
354 else
355 {
356 FreezeCache.Remove(target.ToString());
357 Timers.TryGetValue(target, out Timer);
358 Timers.Remove(target);
359 Timer.Dispose();
360 }
361 }
362
363 private void OnEndParcelFrozen(object avatar)
364 {
365 UUID target = (UUID)avatar;
366 FreezeCache.Remove(target.ToString());
367 System.Threading.Timer Timer;
368 Timers.TryGetValue(target, out Timer);
369 Timers.Remove(target);
370 Timer.Dispose();
371 }
316 } 372 }
317} 373}
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index fdfcd10..9412735 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -172,13 +172,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
172 172
173 private void RetrieveInstantMessages(IClientAPI client) 173 private void RetrieveInstantMessages(IClientAPI client)
174 { 174 {
175 if (m_RestURL != "") 175 if (m_RestURL == String.Empty)
176 { 176 return;
177 m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId);
178 177
179 List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( 178 m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId);
179
180 List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
180 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); 181 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
181 182
183 if (msglist != null)
184 {
182 foreach (GridInstantMessage im in msglist) 185 foreach (GridInstantMessage im in msglist)
183 { 186 {
184 // client.SendInstantMessage(im); 187 // client.SendInstantMessage(im);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index be89740..7142442 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -417,7 +417,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
417 { 417 {
418 // Check if this is ours to handle 418 // Check if this is ours to handle
419 // 419 //
420 m_log.Info("OnFridInstantMessage"); 420 //m_log.Info("OnFridInstantMessage");
421 if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered) 421 if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered)
422 return; 422 return;
423 423
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index c52f029..b37beab 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -263,10 +263,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
263 // Fix ownership/creator of inventory items 263 // Fix ownership/creator of inventory items
264 // Not doing so results in inventory items 264 // Not doing so results in inventory items
265 // being no copy/no mod for everyone 265 // being no copy/no mod for everyone
266 lock (part.TaskInventory) 266 part.TaskInventory.LockItemsForRead(true);
267 TaskInventoryDictionary inv = part.TaskInventory;
268 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
267 { 269 {
268 TaskInventoryDictionary inv = part.TaskInventory; 270 if (!ResolveUserUuid(kvp.Value.OwnerID))
269 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
270 { 271 {
271 if (!ResolveUserUuid(kvp.Value.OwnerID)) 272 if (!ResolveUserUuid(kvp.Value.OwnerID))
272 { 273 {
@@ -278,6 +279,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
278 } 279 }
279 } 280 }
280 } 281 }
282 part.TaskInventory.LockItemsForRead(false);
281 } 283 }
282 284
283 if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) 285 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 5750aa4..5fe0e28 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -82,6 +82,8 @@ namespace OpenSim.Region.CoreModules.World.Land
82 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 82 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
83 83
84 private bool m_allowedForcefulBans = true; 84 private bool m_allowedForcefulBans = true;
85 private UUID DefaultGodParcelGroup;
86 private string DefaultGodParcelName;
85 87
86 // caches ExtendedLandData 88 // caches ExtendedLandData
87 private Cache parcelInfoCache; 89 private Cache parcelInfoCache;
@@ -96,6 +98,12 @@ namespace OpenSim.Region.CoreModules.World.Land
96 98
97 public void Initialise(IConfigSource source) 99 public void Initialise(IConfigSource source)
98 { 100 {
101 IConfig cnf = source.Configs["LandManagement"];
102 if (cnf != null)
103 {
104 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
105 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
106 }
99 } 107 }
100 108
101 public void AddRegion(Scene scene) 109 public void AddRegion(Scene scene)
@@ -351,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Land
351 { 359 {
352 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) 360 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
353 { 361 {
354 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) 362 if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID))
355 { 363 {
356 SendYouAreBannedNotice(avatar); 364 SendYouAreBannedNotice(avatar);
357 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); 365 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
@@ -981,6 +989,10 @@ namespace OpenSim.Region.CoreModules.World.Land
981 //Owner Flag 989 //Owner Flag
982 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); 990 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
983 } 991 }
992 else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID))
993 {
994 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP);
995 }
984 else if (currentParcelBlock.LandData.SalePrice > 0 && 996 else if (currentParcelBlock.LandData.SalePrice > 0 &&
985 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || 997 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
986 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) 998 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
@@ -1504,5 +1516,321 @@ namespace OpenSim.Region.CoreModules.World.Land
1504 1516
1505 UpdateLandObject(localID, land.LandData); 1517 UpdateLandObject(localID, land.LandData);
1506 } 1518 }
1519
1520 public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
1521 {
1522 ILandObject land = null;
1523 List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels();
1524 foreach (ILandObject landObject in Land)
1525 {
1526 if (landObject.LandData.LocalID == landID)
1527 {
1528 land = landObject;
1529 }
1530 }
1531 land.DeedToGroup(DefaultGodParcelGroup);
1532 land.LandData.Name = DefaultGodParcelName;
1533 land.SendLandUpdateToAvatarsOverMe();
1534 }
1535
1536 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
1537 {
1538 ScenePresence SP;
1539 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1540 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1541 if (SP.GodLevel != 0)
1542 {
1543 if (flags == 0) //All parcels, scripted or not
1544 {
1545 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1546 {
1547 if (e.OwnerID == targetID)
1548 {
1549 returns.Add(e);
1550 }
1551 }
1552 );
1553 }
1554 if (flags == 4) //All parcels, scripted object
1555 {
1556 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1557 {
1558 if (e.OwnerID == targetID)
1559 {
1560 if (e.scriptScore >= 0.01)
1561 {
1562 returns.Add(e);
1563 }
1564 }
1565 }
1566 );
1567 }
1568 if (flags == 4) //not target parcel, scripted object
1569 {
1570 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1571 {
1572 if (e.OwnerID == targetID)
1573 {
1574 ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
1575 if (landobject.LandData.OwnerID != e.OwnerID)
1576 {
1577 if (e.scriptScore >= 0.01)
1578 {
1579 returns.Add(e);
1580 }
1581 }
1582 }
1583 }
1584 );
1585 }
1586 foreach (SceneObjectGroup ol in returns)
1587 {
1588 ReturnObject(ol, client);
1589 }
1590 }
1591 }
1592 public void ReturnObject(SceneObjectGroup obj, IClientAPI client)
1593 {
1594 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1595 objs[0] = obj;
1596 ((Scene)client.Scene).returnObjects(objs, client.AgentId);
1597 }
1598
1599 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1600
1601 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1602 {
1603 ScenePresence targetAvatar = null;
1604 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1605 ScenePresence parcelManager = null;
1606 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1607 System.Threading.Timer Timer;
1608
1609 if (targetAvatar.GodLevel == 0)
1610 {
1611 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1612 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1613 return;
1614 if (flags == 0)
1615 {
1616 targetAvatar.AllowMovement = false;
1617 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world.");
1618 parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen.");
1619 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
1620 Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
1621 Timers.Add(targetAvatar.UUID, Timer);
1622 }
1623 else
1624 {
1625 targetAvatar.AllowMovement = true;
1626 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you.");
1627 parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen.");
1628 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1629 Timers.Remove(targetAvatar.UUID);
1630 Timer.Dispose();
1631 }
1632 }
1633 }
1634 private void OnEndParcelFrozen(object avatar)
1635 {
1636 ScenePresence targetAvatar = (ScenePresence)avatar;
1637 targetAvatar.AllowMovement = true;
1638 System.Threading.Timer Timer;
1639 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1640 Timers.Remove(targetAvatar.UUID);
1641 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1642 }
1643
1644
1645 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1646 {
1647 ScenePresence targetAvatar = null;
1648 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1649 ScenePresence parcelManager = null;
1650 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1651 //Just eject
1652 if (flags == 0)
1653 {
1654 if (targetAvatar.GodLevel == 0)
1655 {
1656 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1657 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1658 return;
1659
1660 Vector3 position = new Vector3(0, 0, 0);
1661 List<ILandObject> allParcels = new List<ILandObject>();
1662 allParcels = AllParcels();
1663 if (allParcels.Count != 1)
1664 {
1665 foreach (ILandObject parcel in allParcels)
1666 {
1667 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1668 {
1669 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1670 {
1671 for (int x = 1; x <= Constants.RegionSize; x += 2)
1672 {
1673 for (int y = 1; y <= Constants.RegionSize; y += 2)
1674 {
1675 if (parcel.ContainsPoint(x, y))
1676 {
1677 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1678 targetAvatar.TeleportWithMomentum(position);
1679 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1680 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1681 return;
1682 }
1683 }
1684 }
1685 }
1686 }
1687 }
1688 }
1689 Vector3 targetVector;
1690 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1691 {
1692 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1693 {
1694 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1695 targetAvatar.TeleportWithMomentum(targetVector);
1696 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1697 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1698 return;
1699 }
1700 else
1701 {
1702 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1703 targetAvatar.TeleportWithMomentum(targetVector);
1704 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1705 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1706 return;
1707 }
1708 }
1709 else
1710 {
1711 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1712 {
1713 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1714 targetAvatar.TeleportWithMomentum(targetVector);
1715 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1716 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1717 return;
1718 }
1719 else
1720 {
1721 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1722 targetAvatar.TeleportWithMomentum(targetVector);
1723 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1724 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1725 return;
1726 }
1727 }
1728 }
1729 }
1730 //Eject and ban
1731 if (flags == 1)
1732 {
1733 if (targetAvatar.GodLevel == 0)
1734 {
1735 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1736 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1737 return;
1738
1739 Vector3 position = new Vector3(0, 0, 0);
1740 List<ILandObject> allParcels = new List<ILandObject>();
1741 allParcels = AllParcels();
1742 if (allParcels.Count != 1)
1743 {
1744 foreach (ILandObject parcel in allParcels)
1745 {
1746 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1747 {
1748 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1749 {
1750 for (int x = 1; x <= Constants.RegionSize; x += 2)
1751 {
1752 for (int y = 1; y <= Constants.RegionSize; y += 2)
1753 {
1754 if (parcel.ContainsPoint(x, y))
1755 {
1756 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1757 targetAvatar.TeleportWithMomentum(position);
1758 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1759 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1760 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1761 entry.AgentID = targetAvatar.UUID;
1762 entry.Flags = AccessList.Ban;
1763 entry.Time = new DateTime();
1764 land.LandData.ParcelAccessList.Add(entry);
1765 return;
1766 }
1767 }
1768 }
1769 }
1770 }
1771 }
1772 }
1773 Vector3 targetVector;
1774 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1775 {
1776 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1777 {
1778 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1779 targetAvatar.TeleportWithMomentum(targetVector);
1780 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1781 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1782 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1783 entry.AgentID = targetAvatar.UUID;
1784 entry.Flags = AccessList.Ban;
1785 entry.Time = new DateTime();
1786 land.LandData.ParcelAccessList.Add(entry);
1787 return;
1788 }
1789 else
1790 {
1791 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1792 targetAvatar.TeleportWithMomentum(targetVector);
1793 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1794 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1795 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1796 entry.AgentID = targetAvatar.UUID;
1797 entry.Flags = AccessList.Ban;
1798 entry.Time = new DateTime();
1799 land.LandData.ParcelAccessList.Add(entry);
1800 return;
1801 }
1802 }
1803 else
1804 {
1805 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1806 {
1807 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1808 targetAvatar.TeleportWithMomentum(targetVector);
1809 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1810 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1811 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1812 entry.AgentID = targetAvatar.UUID;
1813 entry.Flags = AccessList.Ban;
1814 entry.Time = new DateTime();
1815 land.LandData.ParcelAccessList.Add(entry);
1816 return;
1817 }
1818 else
1819 {
1820 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1821 targetAvatar.TeleportWithMomentum(targetVector);
1822 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1823 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1824 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1825 entry.AgentID = targetAvatar.UUID;
1826 entry.Flags = AccessList.Ban;
1827 entry.Time = new DateTime();
1828 land.LandData.ParcelAccessList.Add(entry);
1829 return;
1830 }
1831 }
1832 }
1833 }
1834 }
1507 } 1835 }
1508} 1836}