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.cs31
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs102
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs45
-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
7 files changed, 487 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f050dcf..4fac01f 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,19 @@ 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 {
249 objatt.LoadScriptState(doc);
250 objatt.ResetOwnerChangeFlag();
251 }
252
239 // Fire after attach, so we don't get messy perms dialogs 253 // Fire after attach, so we don't get messy perms dialogs
240 // 3 == AttachedRez 254 // 3 == AttachedRez
241 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); 255 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
242 objatt.ResumeScripts(); 256 objatt.ResumeScripts();
243 257
244 // Do this last so that event listeners have access to all the effects of the attachment 258 // 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); 259 //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
246 } 260 }
247 else 261 else
248 { 262 {
@@ -271,7 +285,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
271 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 285 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
272 { 286 {
273 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 287 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
274 item = m_scene.InventoryService.GetItem(item); 288 if (m_scene.InventoryService != null)
289 item = m_scene.InventoryService.GetItem(item);
275 290
276 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 291 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
277 } 292 }
@@ -316,6 +331,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
316 { 331 {
317 // XXYY!! 332 // XXYY!!
318 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 333 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
334 if (item == null)
335 m_log.Error("[ATTACHMENT]: item == null");
336 if (m_scene == null)
337 m_log.Error("[ATTACHMENT]: m_scene == null");
338 if (m_scene.InventoryService == null)
339 m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
319 item = m_scene.InventoryService.GetItem(item); 340 item = m_scene.InventoryService.GetItem(item);
320 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 341 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
321 342
@@ -404,6 +425,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
404 if (group.GetFromItemID() == itemID) 425 if (group.GetFromItemID() == itemID)
405 { 426 {
406 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 427 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
428 // CM / XMREngine!!!! Needed to conclude attach event
429 SceneObjectSerializer.ToOriginalXmlFormat(group);
407 group.DetachToInventoryPrep(); 430 group.DetachToInventoryPrep();
408 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 431 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
409 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); 432 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/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 0c81f44..5dc9c44 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
67 return false; 67 return false;
68 } 68 }
69 } 69 }
70 70
71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
72 72
73 protected List<Scene> m_Scenes = new List<Scene>(); 73 protected List<Scene> m_Scenes = new List<Scene>();
@@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
234 newFriends.RegionID = UUID.Zero; 234 newFriends.RegionID = UUID.Zero;
235 235
236 m_Friends.Add(client.AgentId, newFriends); 236 m_Friends.Add(client.AgentId, newFriends);
237 237
238 //StatusChange(client.AgentId, true); 238 //StatusChange(client.AgentId, true);
239 } 239 }
240 240
@@ -289,7 +289,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
289 289
290 // Inform the friends that this user is online 290 // Inform the friends that this user is online
291 StatusChange(agentID, true); 291 StatusChange(agentID, true);
292 292
293 // Register that we need to send the list of online friends to this user 293 // Register that we need to send the list of online friends to this user
294 lock (m_NeedsListOfFriends) 294 lock (m_NeedsListOfFriends)
295 if (!m_NeedsListOfFriends.Contains(agentID)) 295 if (!m_NeedsListOfFriends.Contains(agentID))
@@ -439,11 +439,44 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
439 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) 439 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
440 friendList.Add(fi); 440 friendList.Add(fi);
441 } 441 }
442 /*
442 foreach (FriendInfo fi in friendList) 443 foreach (FriendInfo fi in friendList)
443 { 444 {
444 // Notify about this user status 445 // Notify about this user status
445 StatusNotify(fi, agentID, online); 446 StatusNotify(fi, agentID, online);
446 } 447 }
448 */
449
450 StatusNotifyMass(friendList, agentID, online);
451 }
452 }
453
454 private void StatusNotifyMass(List<FriendInfo> friendList, UUID userID, bool online)
455 {
456 string[] friendIDs = new string[friendList.Count];
457 int notlocal = 0;
458 for (int x = 0; x < friendList.Count; x++)
459 {
460 UUID friendID = UUID.Zero;
461 if (UUID.TryParse(friendList[x].Friend, out friendID))
462 {
463 if (!LocalStatusNotification(userID, friendID, online))
464 {
465 friendIDs[notlocal++] = friendID.ToString();
466 }
467 }
468 }
469
470 PresenceInfo[] friendSessions = PresenceService.GetAgents(friendIDs);
471
472 for (int x = 0; x < friendSessions.GetLength(0); x++)
473 {
474 PresenceInfo friendSession = friendSessions[x];
475 if (friendSession != null)
476 {
477 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
478 m_FriendsSimConnector.StatusNotify(region, userID, new UUID(friendIDs[x]), online);
479 }
447 } 480 }
448 } 481 }
449 482
@@ -456,7 +489,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
456 // Try local 489 // Try local
457 if (LocalStatusNotification(userID, friendID, online)) 490 if (LocalStatusNotification(userID, friendID, online))
458 return; 491 return;
459 492
460 // The friend is not here [as root]. Let's forward. 493 // The friend is not here [as root]. Let's forward.
461 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 494 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
462 if (friendSessions != null && friendSessions.Length > 0) 495 if (friendSessions != null && friendSessions.Length > 0)
@@ -476,7 +509,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
476 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 509 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
477 { 510 {
478 if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) 511 if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered)
479 { 512 {
480 // we got a friendship offer 513 // we got a friendship offer
481 UUID principalID = new UUID(im.fromAgentID); 514 UUID principalID = new UUID(im.fromAgentID);
482 UUID friendID = new UUID(im.toAgentID); 515 UUID friendID = new UUID(im.toAgentID);
@@ -701,7 +734,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
701 // we're done 734 // we're done
702 return true; 735 return true;
703 } 736 }
704 737
705 return false; 738 return false;
706 } 739 }
707 740
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 139e6ff..d05235e 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))
@@ -1510,5 +1522,321 @@ namespace OpenSim.Region.CoreModules.World.Land
1510 1522
1511 UpdateLandObject(localID, land.LandData); 1523 UpdateLandObject(localID, land.LandData);
1512 } 1524 }
1525
1526 public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
1527 {
1528 ILandObject land = null;
1529 List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels();
1530 foreach (ILandObject landObject in Land)
1531 {
1532 if (landObject.LandData.LocalID == landID)
1533 {
1534 land = landObject;
1535 }
1536 }
1537 land.DeedToGroup(DefaultGodParcelGroup);
1538 land.LandData.Name = DefaultGodParcelName;
1539 land.SendLandUpdateToAvatarsOverMe();
1540 }
1541
1542 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
1543 {
1544 ScenePresence SP;
1545 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1546 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1547 if (SP.GodLevel != 0)
1548 {
1549 if (flags == 0) //All parcels, scripted or not
1550 {
1551 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1552 {
1553 if (e.OwnerID == targetID)
1554 {
1555 returns.Add(e);
1556 }
1557 }
1558 );
1559 }
1560 if (flags == 4) //All parcels, scripted object
1561 {
1562 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1563 {
1564 if (e.OwnerID == targetID)
1565 {
1566 if (e.scriptScore >= 0.01)
1567 {
1568 returns.Add(e);
1569 }
1570 }
1571 }
1572 );
1573 }
1574 if (flags == 4) //not target parcel, scripted object
1575 {
1576 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1577 {
1578 if (e.OwnerID == targetID)
1579 {
1580 ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
1581 if (landobject.LandData.OwnerID != e.OwnerID)
1582 {
1583 if (e.scriptScore >= 0.01)
1584 {
1585 returns.Add(e);
1586 }
1587 }
1588 }
1589 }
1590 );
1591 }
1592 foreach (SceneObjectGroup ol in returns)
1593 {
1594 ReturnObject(ol, client);
1595 }
1596 }
1597 }
1598 public void ReturnObject(SceneObjectGroup obj, IClientAPI client)
1599 {
1600 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1601 objs[0] = obj;
1602 ((Scene)client.Scene).returnObjects(objs, client.AgentId);
1603 }
1604
1605 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1606
1607 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1608 {
1609 ScenePresence targetAvatar = null;
1610 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1611 ScenePresence parcelManager = null;
1612 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1613 System.Threading.Timer Timer;
1614
1615 if (targetAvatar.GodLevel == 0)
1616 {
1617 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1618 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1619 return;
1620 if (flags == 0)
1621 {
1622 targetAvatar.AllowMovement = false;
1623 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world.");
1624 parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen.");
1625 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
1626 Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
1627 Timers.Add(targetAvatar.UUID, Timer);
1628 }
1629 else
1630 {
1631 targetAvatar.AllowMovement = true;
1632 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you.");
1633 parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen.");
1634 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1635 Timers.Remove(targetAvatar.UUID);
1636 Timer.Dispose();
1637 }
1638 }
1639 }
1640 private void OnEndParcelFrozen(object avatar)
1641 {
1642 ScenePresence targetAvatar = (ScenePresence)avatar;
1643 targetAvatar.AllowMovement = true;
1644 System.Threading.Timer Timer;
1645 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1646 Timers.Remove(targetAvatar.UUID);
1647 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1648 }
1649
1650
1651 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1652 {
1653 ScenePresence targetAvatar = null;
1654 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1655 ScenePresence parcelManager = null;
1656 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1657 //Just eject
1658 if (flags == 0)
1659 {
1660 if (targetAvatar.GodLevel == 0)
1661 {
1662 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1663 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1664 return;
1665
1666 Vector3 position = new Vector3(0, 0, 0);
1667 List<ILandObject> allParcels = new List<ILandObject>();
1668 allParcels = AllParcels();
1669 if (allParcels.Count != 1)
1670 {
1671 foreach (ILandObject parcel in allParcels)
1672 {
1673 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1674 {
1675 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1676 {
1677 for (int x = 1; x <= Constants.RegionSize; x += 2)
1678 {
1679 for (int y = 1; y <= Constants.RegionSize; y += 2)
1680 {
1681 if (parcel.ContainsPoint(x, y))
1682 {
1683 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1684 targetAvatar.TeleportWithMomentum(position);
1685 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1686 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1687 return;
1688 }
1689 }
1690 }
1691 }
1692 }
1693 }
1694 }
1695 Vector3 targetVector;
1696 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1697 {
1698 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1699 {
1700 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1701 targetAvatar.TeleportWithMomentum(targetVector);
1702 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1703 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1704 return;
1705 }
1706 else
1707 {
1708 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1709 targetAvatar.TeleportWithMomentum(targetVector);
1710 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1711 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1712 return;
1713 }
1714 }
1715 else
1716 {
1717 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1718 {
1719 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1720 targetAvatar.TeleportWithMomentum(targetVector);
1721 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1722 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1723 return;
1724 }
1725 else
1726 {
1727 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1728 targetAvatar.TeleportWithMomentum(targetVector);
1729 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1730 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1731 return;
1732 }
1733 }
1734 }
1735 }
1736 //Eject and ban
1737 if (flags == 1)
1738 {
1739 if (targetAvatar.GodLevel == 0)
1740 {
1741 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1742 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1743 return;
1744
1745 Vector3 position = new Vector3(0, 0, 0);
1746 List<ILandObject> allParcels = new List<ILandObject>();
1747 allParcels = AllParcels();
1748 if (allParcels.Count != 1)
1749 {
1750 foreach (ILandObject parcel in allParcels)
1751 {
1752 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1753 {
1754 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1755 {
1756 for (int x = 1; x <= Constants.RegionSize; x += 2)
1757 {
1758 for (int y = 1; y <= Constants.RegionSize; y += 2)
1759 {
1760 if (parcel.ContainsPoint(x, y))
1761 {
1762 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1763 targetAvatar.TeleportWithMomentum(position);
1764 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1765 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1766 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1767 entry.AgentID = targetAvatar.UUID;
1768 entry.Flags = AccessList.Ban;
1769 entry.Time = new DateTime();
1770 land.LandData.ParcelAccessList.Add(entry);
1771 return;
1772 }
1773 }
1774 }
1775 }
1776 }
1777 }
1778 }
1779 Vector3 targetVector;
1780 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1781 {
1782 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1783 {
1784 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1785 targetAvatar.TeleportWithMomentum(targetVector);
1786 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1787 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1788 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1789 entry.AgentID = targetAvatar.UUID;
1790 entry.Flags = AccessList.Ban;
1791 entry.Time = new DateTime();
1792 land.LandData.ParcelAccessList.Add(entry);
1793 return;
1794 }
1795 else
1796 {
1797 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1798 targetAvatar.TeleportWithMomentum(targetVector);
1799 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1800 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1801 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1802 entry.AgentID = targetAvatar.UUID;
1803 entry.Flags = AccessList.Ban;
1804 entry.Time = new DateTime();
1805 land.LandData.ParcelAccessList.Add(entry);
1806 return;
1807 }
1808 }
1809 else
1810 {
1811 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1812 {
1813 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1814 targetAvatar.TeleportWithMomentum(targetVector);
1815 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1816 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1817 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1818 entry.AgentID = targetAvatar.UUID;
1819 entry.Flags = AccessList.Ban;
1820 entry.Time = new DateTime();
1821 land.LandData.ParcelAccessList.Add(entry);
1822 return;
1823 }
1824 else
1825 {
1826 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1827 targetAvatar.TeleportWithMomentum(targetVector);
1828 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1829 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1830 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1831 entry.AgentID = targetAvatar.UUID;
1832 entry.Flags = AccessList.Ban;
1833 entry.Time = new DateTime();
1834 land.LandData.ParcelAccessList.Add(entry);
1835 return;
1836 }
1837 }
1838 }
1839 }
1840 }
1513 } 1841 }
1514} 1842}