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.cs30
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs106
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs69
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs59
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs71
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs74
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs15
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs349
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs36
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
22 files changed, 819 insertions, 156 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 6555b54..bd9e621 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Xml;
31using log4net; 32using log4net;
32using Mono.Addins; 33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
@@ -225,8 +226,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
225 226
226 public UUID RezSingleAttachmentFromInventory( 227 public UUID RezSingleAttachmentFromInventory(
227 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) 228 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
229 {
230 return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
231 }
232
233 public UUID RezSingleAttachmentFromInventory(
234 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
228 { 235 {
229 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); 236 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
230 237
231 if (updateInventoryStatus) 238 if (updateInventoryStatus)
232 { 239 {
@@ -245,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
245 } 252 }
246 253
247 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 254 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
248 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 255 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
249 { 256 {
250 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); 257 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
251 if (invAccess != null) 258 if (invAccess != null)
@@ -270,13 +277,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
270 if (tainted) 277 if (tainted)
271 objatt.HasGroupChanged = true; 278 objatt.HasGroupChanged = true;
272 279
280 if (doc != null)
281 {
282 objatt.LoadScriptState(doc);
283 objatt.ResetOwnerChangeFlag();
284 }
285
273 // Fire after attach, so we don't get messy perms dialogs 286 // Fire after attach, so we don't get messy perms dialogs
274 // 4 == AttachedRez 287 // 4 == AttachedRez
275 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); 288 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
276 objatt.ResumeScripts(); 289 objatt.ResumeScripts();
277 290
278 // Do this last so that event listeners have access to all the effects of the attachment 291 // Do this last so that event listeners have access to all the effects of the attachment
279 m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); 292 //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
280 } 293 }
281 else 294 else
282 { 295 {
@@ -305,7 +318,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
305 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 318 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
306 { 319 {
307 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 320 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
308 item = m_scene.InventoryService.GetItem(item); 321 if (m_scene.InventoryService != null)
322 item = m_scene.InventoryService.GetItem(item);
309 323
310 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 324 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
311 } 325 }
@@ -350,6 +364,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
350 { 364 {
351 // XXYY!! 365 // XXYY!!
352 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 366 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
367 if (item == null)
368 m_log.Error("[ATTACHMENT]: item == null");
369 if (m_scene == null)
370 m_log.Error("[ATTACHMENT]: m_scene == null");
371 if (m_scene.InventoryService == null)
372 m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
353 item = m_scene.InventoryService.GetItem(item); 373 item = m_scene.InventoryService.GetItem(item);
354 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 374 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
355 375
@@ -438,6 +458,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
438 if (group.GetFromItemID() == itemID) 458 if (group.GetFromItemID() == itemID)
439 { 459 {
440 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 460 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
461 // CM / XMREngine!!!! Needed to conclude attach event
462 SceneObjectSerializer.ToOriginalXmlFormat(group);
441 group.DetachToInventoryPrep(); 463 group.DetachToInventoryPrep();
442 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 464 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
443 UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); 465 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 02f0968..06b1b00 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,19 @@ 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 // This will pass all chat from objects. Not
248 // perfect, but it will do. For now. Better
249 // than the prior behavior of muting all
250 // objects on a parcel with access restrictions
251 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
252 {
253 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType);
254 }
255 }
256
231 } 257 }
232 ); 258 );
233 } 259 }
@@ -270,25 +296,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
270 } 296 }
271 297
272 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 298 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
273 299 if (c.Scene != null)
274 ((Scene)c.Scene).ForEachScenePresence( 300 {
275 delegate(ScenePresence presence) 301 ((Scene)c.Scene).ForEachScenePresence
276 { 302 (
277 // ignore chat from child agents 303 delegate(ScenePresence presence)
278 if (presence.IsChildAgent) return; 304 {
279 305 // ignore chat from child agents
280 IClientAPI client = presence.ControllingClient; 306 if (presence.IsChildAgent) return;
281 307
282 // don't forward SayOwner chat from objects to 308 IClientAPI client = presence.ControllingClient;
283 // non-owner agents 309
284 if ((c.Type == ChatTypeEnum.Owner) && 310 // don't forward SayOwner chat from objects to
285 (null != c.SenderObject) && 311 // non-owner agents
286 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) 312 if ((c.Type == ChatTypeEnum.Owner) &&
287 return; 313 (null != c.SenderObject) &&
288 314 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
289 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 315 return;
290 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 316
291 }); 317 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
318 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
319 }
320 );
321 }
292 } 322 }
293 323
294 324
@@ -317,5 +347,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
317 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 347 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
318 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); 348 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
319 } 349 }
350
351 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
352 public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
353 {
354 System.Threading.Timer Timer;
355 if (flags == 0)
356 {
357 FreezeCache.Add(target.ToString());
358 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
359 Timer = new System.Threading.Timer(timeCB, target, 30000, 0);
360 Timers.Add(target, Timer);
361 }
362 else
363 {
364 FreezeCache.Remove(target.ToString());
365 Timers.TryGetValue(target, out Timer);
366 Timers.Remove(target);
367 Timer.Dispose();
368 }
369 }
370
371 private void OnEndParcelFrozen(object avatar)
372 {
373 UUID target = (UUID)avatar;
374 FreezeCache.Remove(target.ToString());
375 System.Threading.Timer Timer;
376 Timers.TryGetValue(target, out Timer);
377 Timers.Remove(target);
378 Timer.Dispose();
379 }
320 } 380 }
321} 381}
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 2b3d2a9..a514a83 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -239,4 +239,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
239 return result; 239 return result;
240 } 240 }
241 } 241 }
242} \ No newline at end of file 242}
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 6f044cb..ca0b7ad 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>();
@@ -203,9 +203,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
203 203
204 UserFriendData data = m_Friends[principalID]; 204 UserFriendData data = m_Friends[principalID];
205 205
206 string searchFor = friendID.ToString();
206 foreach (FriendInfo fi in data.Friends) 207 foreach (FriendInfo fi in data.Friends)
207 { 208 {
208 if (fi.Friend == friendID.ToString()) 209 if (fi.Friend == searchFor)
209 return (uint)fi.TheirFlags; 210 return (uint)fi.TheirFlags;
210 } 211 }
211 return 0; 212 return 0;
@@ -292,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
292 293
293 // Inform the friends that this user is online 294 // Inform the friends that this user is online
294 StatusChange(agentID, true); 295 StatusChange(agentID, true);
295 296
296 // Register that we need to send the list of online friends to this user 297 // Register that we need to send the list of online friends to this user
297 lock (m_NeedsListOfFriends) 298 lock (m_NeedsListOfFriends)
298 if (!m_NeedsListOfFriends.Contains(agentID)) 299 if (!m_NeedsListOfFriends.Contains(agentID))
@@ -498,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
498 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 499 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
499 { 500 {
500 if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) 501 if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered)
501 { 502 {
502 // we got a friendship offer 503 // we got a friendship offer
503 UUID principalID = new UUID(im.fromAgentID); 504 UUID principalID = new UUID(im.fromAgentID);
504 UUID friendID = new UUID(im.toAgentID); 505 UUID friendID = new UUID(im.toAgentID);
@@ -730,7 +731,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
730 // we're done 731 // we're done
731 return true; 732 return true;
732 } 733 }
733 734
734 return false; 735 return false;
735 } 736 }
736 737
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index 420e3ca..fc1afaf 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -156,6 +156,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
156 return; 156 return;
157 } 157 }
158 158
159 DateTime dt = DateTime.UtcNow;
160
161 // Ticks from UtcNow, but make it look like local. Evil, huh?
162 dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
163
164 try
165 {
166 // Convert that to the PST timezone
167 TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
168 dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
169 }
170 catch
171 {
172 //m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp.");
173 }
174
175 // And make it look local again to fool the unix time util
176 dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
177
178 im.timestamp = (uint)Util.ToUnixTime(dt);
179
180 // If client is null, this message comes from storage and IS offline
181 if (client != null)
182 im.offline = 0;
183
159 if (m_TransferModule != null) 184 if (m_TransferModule != null)
160 { 185 {
161 m_TransferModule.SendInstantMessage(im, 186 m_TransferModule.SendInstantMessage(im,
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 730cc77..a49faec 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
137 { 137 {
138 if (scene.Entities.ContainsKey(toAgentID) && 138 if (scene.Entities.ContainsKey(toAgentID) &&
139 scene.Entities[toAgentID] is ScenePresence) 139 scene.Entities[toAgentID] is ScenePresence)
140 { 140 {
141// m_log.DebugFormat( 141 // m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName);
142// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", 142 // Local message
143// toAgentID.ToString(), scene.RegionInfo.RegionName);
144
145 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 143 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
146 if (!user.IsChildAgent) 144 if (!user.IsChildAgent)
147 { 145 {
148 // Local message 146 // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
149 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
150 user.ControllingClient.SendInstantMessage(im); 147 user.ControllingClient.SendInstantMessage(im);
151 148
152 // Message sent 149 // Message sent
@@ -168,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
168 // Local message 165 // Local message
169 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 166 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
170 167
171 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); 168 // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
172 user.ControllingClient.SendInstantMessage(im); 169 user.ControllingClient.SendInstantMessage(im);
173 170
174 // Message sent 171 // Message sent
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index fdfcd10..feeb9e6 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);
@@ -189,6 +192,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
189 // Needed for proper state management for stored group 192 // Needed for proper state management for stored group
190 // invitations 193 // invitations
191 // 194 //
195
196 im.offline = 1;
197
198 // Reconstruct imSessionID
199 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
200 {
201 UUID fromAgentID = new UUID(im.fromAgentID);
202 UUID sessionID = fromAgentID ^ client.AgentId;
203 im.imSessionID = new Guid(sessionID.ToString());
204 }
205
192 Scene s = FindScene(client.AgentId); 206 Scene s = FindScene(client.AgentId);
193 if (s != null) 207 if (s != null)
194 s.EventManager.TriggerIncomingInstantMessage(im); 208 s.EventManager.TriggerIncomingInstantMessage(im);
@@ -198,26 +212,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
198 212
199 private void UndeliveredMessage(GridInstantMessage im) 213 private void UndeliveredMessage(GridInstantMessage im)
200 { 214 {
201 if ((im.offline != 0) 215 if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
202 && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) 216 im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
217 im.dialog != (byte)InstantMessageDialog.GroupNotice &&
218 im.dialog != (byte)InstantMessageDialog.InventoryOffered)
203 { 219 {
204 bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( 220 return;
205 "POST", m_RestURL+"/SaveMessage/", im); 221 }
206 222
207 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) 223 // It's not delivered. Make sure the scope id is saved
208 { 224 // We don't need the imSessionID here anymore, overwrite it
209 IClientAPI client = FindClient(new UUID(im.fromAgentID)); 225 Scene scene = FindScene(new UUID(im.fromAgentID));
210 if (client == null) 226 if (scene == null)
211 return; 227 scene = m_SceneList[0];
212 228 im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString());
213 client.SendInstantMessage(new GridInstantMessage( 229
214 null, new UUID(im.toAgentID), 230 bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
215 "System", new UUID(im.fromAgentID), 231 "POST", m_RestURL+"/SaveMessage/", im);
216 (byte)InstantMessageDialog.MessageFromAgent, 232
217 "User is not logged in. "+ 233 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
218 (success ? "Message saved." : "Message not saved"), 234 {
219 false, new Vector3())); 235 IClientAPI client = FindClient(new UUID(im.fromAgentID));
220 } 236 if (client == null)
237 return;
238
239 client.SendInstantMessage(new GridInstantMessage(
240 null, new UUID(im.toAgentID),
241 "System", new UUID(im.fromAgentID),
242 (byte)InstantMessageDialog.MessageFromAgent,
243 "User is not logged in. "+
244 (success ? "Message saved." : "Message not saved"),
245 false, new Vector3()));
221 } 246 }
222 } 247 }
223 } 248 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index d1274e9..a08a628 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -159,10 +159,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
159 159
160 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 160 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
161 { 161 {
162 m_log.DebugFormat( 162 //m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog);
163 "[INVENTORY TRANSFER]: {0} IM type received from {1}", 163
164 (InstantMessageDialog)im.dialog, client.Name);
165
166 Scene scene = FindClientScene(client.AgentId); 164 Scene scene = FindClientScene(client.AgentId);
167 165
168 if (scene == null) // Something seriously wrong here. 166 if (scene == null) // Something seriously wrong here.
@@ -248,6 +246,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
248 im.imSessionID = itemID.Guid; 246 im.imSessionID = itemID.Guid;
249 } 247 }
250 248
249 im.offline = 1; // Remember these
250
251 // Send the IM to the recipient. The item is already 251 // Send the IM to the recipient. The item is already
252 // in their inventory, so it will not be lost if 252 // in their inventory, so it will not be lost if
253 // they are offline. 253 // they are offline.
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 81f49b6..1cd2ff4 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
99 99
100 protected virtual void OnNewClient(IClientAPI client) 100 protected virtual void OnNewClient(IClientAPI client)
101 { 101 {
102 client.OnTeleportHomeRequest += TeleportHome; 102 client.OnTeleportHomeRequest += TeleportHomeFired;
103 } 103 }
104 104
105 public virtual void Close() 105 public virtual void Close()
@@ -268,7 +268,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
268 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, 268 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
269 // it's actually doing a lot of work. 269 // it's actually doing a lot of work.
270 IPEndPoint endPoint = finalDestination.ExternalEndPoint; 270 IPEndPoint endPoint = finalDestination.ExternalEndPoint;
271 if (endPoint.Address != null) 271 if (endPoint != null && endPoint.Address != null)
272 { 272 {
273 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from 273 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
274 // both regions 274 // both regions
@@ -455,6 +455,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
455 // Now let's make it officially a child agent 455 // Now let's make it officially a child agent
456 sp.MakeChildAgent(); 456 sp.MakeChildAgent();
457 457
458 sp.Scene.CleanDroppedAttachments();
459
458 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 460 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
459 461
460 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 462 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
@@ -561,7 +563,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
561 563
562 #region Teleport Home 564 #region Teleport Home
563 565
564 public virtual void TeleportHome(UUID id, IClientAPI client) 566 public void TeleportHomeFired(UUID id, IClientAPI client)
567 {
568 TeleportHome(id, client);
569 }
570
571 public virtual bool TeleportHome(UUID id, IClientAPI client)
565 { 572 {
566 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); 573 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
567 574
@@ -570,14 +577,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
570 577
571 if (uinfo != null) 578 if (uinfo != null)
572 { 579 {
580 if (uinfo.HomeRegionID == UUID.Zero)
581 {
582 // can't find the Home region: Tell viewer and abort
583 client.SendTeleportFailed("You don't have a home position set.");
584 return false;
585 }
573 GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); 586 GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
574 if (regionInfo == null) 587 if (regionInfo == null)
575 { 588 {
576 // can't find the Home region: Tell viewer and abort 589 // can't find the Home region: Tell viewer and abort
577 client.SendTeleportFailed("Your home region could not be found."); 590 client.SendTeleportFailed("Your home region could not be found.");
578 return; 591 return false;
579 } 592 }
580 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", 593 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
581 regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize); 594 regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize);
582 595
583 // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... 596 // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
@@ -585,6 +598,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
585 client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, 598 client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
586 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); 599 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
587 } 600 }
601 else
602 {
603 // can't find the Home region: Tell viewer and abort
604 client.SendTeleportFailed("Your home region could not be found.");
605 return false;
606 }
607 return true;
588 } 608 }
589 609
590 #endregion 610 #endregion
@@ -872,15 +892,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
872 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 892 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
873 893
874 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); 894 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
875 if (eq != null) 895 IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint;
876 { 896 if (neighbourExternal != null)
877 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
878 capsPath, agent.UUID, agent.ControllingClient.SessionId);
879 }
880 else
881 { 897 {
882 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, 898 if (eq != null)
883 capsPath); 899 {
900 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal,
901 capsPath, agent.UUID, agent.ControllingClient.SessionId);
902 }
903 else
904 {
905 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal,
906 capsPath);
907 }
884 } 908 }
885 909
886 if (!WaitForCallback(agent.UUID)) 910 if (!WaitForCallback(agent.UUID))
@@ -978,10 +1002,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
978 agent.Viewer = currentAgentCircuit.Viewer; 1002 agent.Viewer = currentAgentCircuit.Viewer;
979 } 1003 }
980 1004
981 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 1005 IPEndPoint external = region.ExternalEndPoint;
982 d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, 1006 if (external != null)
1007 {
1008 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
1009 d.BeginInvoke(sp, agent, region, external, true,
983 InformClientOfNeighbourCompleted, 1010 InformClientOfNeighbourCompleted,
984 d); 1011 d);
1012 }
985 } 1013 }
986 #endregion 1014 #endregion
987 1015
@@ -1110,6 +1138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1110 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 1138 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
1111 try 1139 try
1112 { 1140 {
1141 //neighbour.ExternalEndPoint may return null, which will be caught
1113 d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, 1142 d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
1114 InformClientOfNeighbourCompleted, 1143 InformClientOfNeighbourCompleted,
1115 d); 1144 d);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 1ac7508..47898cc 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
86 86
87 protected override void OnNewClient(IClientAPI client) 87 protected override void OnNewClient(IClientAPI client)
88 { 88 {
89 client.OnTeleportHomeRequest += TeleportHome; 89 client.OnTeleportHomeRequest += TeleportHomeFired;
90 client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); 90 client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
91 } 91 }
92 92
@@ -174,7 +174,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
174 return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); 174 return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
175 } 175 }
176 176
177 public override void TeleportHome(UUID id, IClientAPI client) 177 public void TeleportHomeFired(UUID id, IClientAPI client)
178 {
179 TeleportHome(id, client);
180 }
181
182 public override bool TeleportHome(UUID id, IClientAPI client)
178 { 183 {
179 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); 184 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
180 185
@@ -184,8 +189,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
184 { 189 {
185 // local grid user 190 // local grid user
186 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); 191 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local");
187 base.TeleportHome(id, client); 192 return base.TeleportHome(id, client);
188 return;
189 } 193 }
190 194
191 // Foreign user wants to go home 195 // Foreign user wants to go home
@@ -195,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
195 { 199 {
196 client.SendTeleportFailed("Your information has been lost"); 200 client.SendTeleportFailed("Your information has been lost");
197 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); 201 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information");
198 return; 202 return false;
199 } 203 }
200 204
201 IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); 205 IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString());
@@ -205,7 +209,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
205 { 209 {
206 client.SendTeleportFailed("Your home region could not be found"); 210 client.SendTeleportFailed("Your home region could not be found");
207 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); 211 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
208 return; 212 return false;
209 } 213 }
210 214
211 ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); 215 ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId);
@@ -213,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
213 { 217 {
214 client.SendTeleportFailed("Internal error"); 218 client.SendTeleportFailed("Internal error");
215 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); 219 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
216 return; 220 return false;
217 } 221 }
218 222
219 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); 223 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
@@ -223,6 +227,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
223 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); 227 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName);
224 228
225 DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); 229 DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
230 return true;
226 } 231 }
227 #endregion 232 #endregion
228 233
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index d87f7f1..37f6ea0 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -219,6 +219,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
219 219
220 Vector3 originalPosition = objectGroup.AbsolutePosition; 220 Vector3 originalPosition = objectGroup.AbsolutePosition;
221 221
222 // Restore attachment data after trip through the sim
223 if (objectGroup.RootPart.AttachPoint > 0)
224 inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
225 objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
226
222 objectGroup.AbsolutePosition = inventoryStoredPosition; 227 objectGroup.AbsolutePosition = inventoryStoredPosition;
223 228
224 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); 229 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
@@ -491,6 +496,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
491 496
492 if (item != null) 497 if (item != null)
493 { 498 {
499 if (item.ID == UUID.Zero)
500 {
501 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 1");
502 }
503
494 AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); 504 AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString());
495 505
496 if (rezAsset != null) 506 if (rezAsset != null)
@@ -513,17 +523,30 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
513 itemId = item.ID; 523 itemId = item.ID;
514 } 524 }
515 525
526 if (item.ID == UUID.Zero)
527 {
528 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 2");
529 }
530
516 string xmlData = Utils.BytesToString(rezAsset.Data); 531 string xmlData = Utils.BytesToString(rezAsset.Data);
517 SceneObjectGroup group 532 SceneObjectGroup group
518 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); 533 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
519 534 Vector3 storedPosition = group.AbsolutePosition;
535 if (group.UUID == UUID.Zero)
536 {
537 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3");
538 }
520 group.RootPart.FromFolderID = item.Folder; 539 group.RootPart.FromFolderID = item.Folder;
521 540
522 // If it's rezzed in world, select it. Much easier to 541 // If it's rezzed in world, select it. Much easier to
523 // find small items. 542 // find small items.
524 // 543 //
525 if (!attachment) 544 if (!attachment)
545 {
526 group.RootPart.CreateSelected = true; 546 group.RootPart.CreateSelected = true;
547 foreach (SceneObjectPart child in group.Children.Values)
548 child.CreateSelected = true;
549 }
527 550
528 if (!m_Scene.Permissions.CanRezObject( 551 if (!m_Scene.Permissions.CanRezObject(
529 group.PrimCount, remoteClient.AgentId, pos) 552 group.PrimCount, remoteClient.AgentId, pos)
@@ -538,9 +561,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
538 remoteClient.SendBulkUpdateInventory(item); 561 remoteClient.SendBulkUpdateInventory(item);
539 return null; 562 return null;
540 } 563 }
541 564 if (group.UUID == UUID.Zero)
565 {
566 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 4");
567 }
542 group.ResetIDs(); 568 group.ResetIDs();
543 569 if (group.UUID == UUID.Zero)
570 {
571 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 5");
572 }
544 if (attachment) 573 if (attachment)
545 { 574 {
546 group.RootPart.Flags |= PrimFlags.Phantom; 575 group.RootPart.Flags |= PrimFlags.Phantom;
@@ -572,7 +601,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
572 { 601 {
573 group.SetFromItemID(itemID); 602 group.SetFromItemID(itemID);
574 } 603 }
575 604 if (group.UUID == UUID.Zero)
605 {
606 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 6");
607 }
576 SceneObjectPart rootPart = null; 608 SceneObjectPart rootPart = null;
577 try 609 try
578 { 610 {
@@ -587,7 +619,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
587 619
588 m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); 620 m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment);
589 } 621 }
590 622 if (group.UUID == UUID.Zero)
623 {
624 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 7");
625 }
591 // Since renaming the item in the inventory does not affect the name stored 626 // Since renaming the item in the inventory does not affect the name stored
592 // in the serialization, transfer the correct name from the inventory to the 627 // in the serialization, transfer the correct name from the inventory to the
593 // object itself before we rez. 628 // object itself before we rez.
@@ -617,7 +652,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
617 group.ApplyNextOwnerPermissions(); 652 group.ApplyNextOwnerPermissions();
618 } 653 }
619 } 654 }
620 655 if (group.UUID == UUID.Zero)
656 {
657 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 8");
658 }
621 foreach (SceneObjectPart part in partList) 659 foreach (SceneObjectPart part in partList)
622 { 660 {
623 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) 661 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
@@ -630,13 +668,23 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
630 part.EveryoneMask = item.EveryOnePermissions; 668 part.EveryoneMask = item.EveryOnePermissions;
631 part.NextOwnerMask = item.NextPermissions; 669 part.NextOwnerMask = item.NextPermissions;
632 } 670 }
633 671 if (group.UUID == UUID.Zero)
672 {
673 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 9");
674 }
634 rootPart.TrimPermissions(); 675 rootPart.TrimPermissions();
635 676 if (group.UUID == UUID.Zero)
677 {
678 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 10");
679 }
636 if (!attachment) 680 if (!attachment)
637 { 681 {
638 if (group.RootPart.Shape.PCode == (byte)PCode.Prim) 682 if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
639 { 683 {
684 // Save attachment data
685 group.RootPart.AttachPoint = group.RootPart.Shape.State;
686 group.RootPart.AttachOffset = storedPosition;
687
640 group.ClearPartAttachmentData(); 688 group.ClearPartAttachmentData();
641 } 689 }
642 690
@@ -662,8 +710,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
662 } 710 }
663 } 711 }
664 } 712 }
665 713 if (group.UUID == UUID.Zero)
666 return rootPart.ParentGroup; 714 {
715 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 11");
716 }
717 return group;
667 } 718 }
668 } 719 }
669 720
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 9b565ed..1fd1f47 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
142 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); 142 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
143 return urlcode; 143 return urlcode;
144 } 144 }
145 string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; 145 string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString();
146 146
147 UrlData urlData = new UrlData(); 147 UrlData urlData = new UrlData();
148 urlData.hostID = host.UUID; 148 urlData.hostID = host.UUID;
@@ -152,10 +152,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
152 urlData.urlcode = urlcode; 152 urlData.urlcode = urlcode;
153 urlData.requests = new Dictionary<UUID, RequestData>(); 153 urlData.requests = new Dictionary<UUID, RequestData>();
154 154
155
156 m_UrlMap[url] = urlData; 155 m_UrlMap[url] = urlData;
157 156
158 string uri = "/lslhttp/" + urlcode.ToString() + "/"; 157 string uri = "/lslhttp/" + urlcode.ToString();
159 158
160 m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, 159 m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll,
161 new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, 160 new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents,
@@ -386,6 +385,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
386 385
387 return response; 386 return response;
388 } 387 }
388
389 public void HttpRequestHandler(UUID requestID, Hashtable request) 389 public void HttpRequestHandler(UUID requestID, Hashtable request)
390 { 390 {
391 lock (request) 391 lock (request)
@@ -400,8 +400,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
400 400
401 int pos1 = uri.IndexOf("/");// /lslhttp 401 int pos1 = uri.IndexOf("/");// /lslhttp
402 int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ 402 int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
403 int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ 403 int pos3 = pos2 + 37; // /lslhttp/urlcode
404 string uri_tmp = uri.Substring(0, pos3 + 1); 404 string uri_tmp = uri.Substring(0, pos3);
405 //HTTP server code doesn't provide us with QueryStrings 405 //HTTP server code doesn't provide us with QueryStrings
406 string pathInfo; 406 string pathInfo;
407 string queryString; 407 string queryString;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index e54ee02..ebfba2b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -57,9 +57,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
57 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); 57 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
58 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); 58 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
59 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 59 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
60 config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); 60 config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion");
61 config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); 61 config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion");
62 config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); 62 config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion");
63 config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); 63 config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion");
64 64
65 m_LocalConnector = new LocalGridServicesConnector(config); 65 m_LocalConnector = new LocalGridServicesConnector(config);
@@ -128,8 +128,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
128 Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); 128 Assert.IsNotNull(result, "Retrieved GetRegionByName is null");
129 Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); 129 Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match");
130 130
131 m_LocalConnector.RegisterRegion(UUID.Zero, r2); 131 m_LocalConnector.RegisterRegion(UUID.Zero, r2);
132 m_LocalConnector.RegisterRegion(UUID.Zero, r3); 132 m_LocalConnector.RegisterRegion(UUID.Zero, r3);
133 m_LocalConnector.RegisterRegion(UUID.Zero, r4); 133 m_LocalConnector.RegisterRegion(UUID.Zero, r4);
134 134
135 result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); 135 result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1));
@@ -154,38 +154,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
154 Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); 154 Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null");
155 Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); 155 Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected");
156 156
157 results = m_LocalConnector.GetDefaultRegions(UUID.Zero); 157 results = m_LocalConnector.GetDefaultRegions(UUID.Zero);
158 Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); 158 Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null");
159 Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); 159 Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size");
160 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); 160 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match");
161 161
162 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); 162 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY);
163 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); 163 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null");
164 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); 164 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size");
165 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); 165 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
166 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); 166 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
167 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); 167 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
168 168
169 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); 169 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY);
170 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); 170 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null");
171 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); 171 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size");
172 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); 172 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3");
173 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); 173 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3");
174 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); 174 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3");
175 175
176 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); 176 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY);
177 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); 177 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null");
178 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); 178 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size");
179 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); 179 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2");
180 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); 180 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2");
181 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); 181 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2");
182 182
183 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); 183 results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY);
184 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); 184 Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null");
185 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); 185 Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size");
186 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); 186 Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2");
187 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); 187 Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2");
188 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); 188 Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2");
189 189
190 results = m_LocalConnector.GetHyperlinks(UUID.Zero); 190 results = m_LocalConnector.GetHyperlinks(UUID.Zero);
191 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); 191 Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index e32dbb3..329a259 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -290,6 +290,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
290 return false; 290 return false;
291 } 291 }
292 292
293 public bool CloseChildAgent(GridRegion destination, UUID id)
294 {
295 if (destination == null)
296 return false;
297
298 foreach (Scene s in m_sceneList)
299 {
300 if (s.RegionInfo.RegionID == destination.RegionID)
301 {
302 //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent");
303 return s.IncomingCloseChildAgent(id);
304 }
305 }
306 //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
307 return false;
308 }
309
293 /** 310 /**
294 * Object-related communications 311 * Object-related communications
295 */ 312 */
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 3f577f2..e16e273 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -252,6 +252,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
252 return false; 252 return false;
253 } 253 }
254 254
255 public bool CloseChildAgent(GridRegion destination, UUID id)
256 {
257 if (destination == null)
258 return false;
259
260 // Try local first
261 if (m_localBackend.CloseChildAgent(destination, id))
262 return true;
263
264 // else do the remote thing
265 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
266 return m_remoteConnector.CloseChildAgent(destination, id);
267
268 return false;
269 }
255 270
256 public bool CloseAgent(GridRegion destination, UUID id) 271 public bool CloseAgent(GridRegion destination, UUID id)
257 { 272 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index e1bc243..fb2edb9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
55 if (account != null) 55 if (account != null)
56 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 56 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d));
57 57
58 m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); 58 // m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
59 } 59 }
60 60
61 public UserAccount Get(UUID userID, out bool inCache) 61 public UserAccount Get(UUID userID, out bool inCache)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 1fba6c2..e51f118 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -267,6 +267,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
267 // being no copy/no mod for everyone 267 // being no copy/no mod for everyone
268 lock (part.TaskInventory) 268 lock (part.TaskInventory)
269 { 269 {
270 if (!ResolveUserUuid(part.CreatorID))
271 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
272
273 if (!ResolveUserUuid(part.OwnerID))
274 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
275
276 if (!ResolveUserUuid(part.LastOwnerID))
277 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
278
279 // And zap any troublesome sit target information
280 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
281 part.SitTargetPosition = new Vector3(0, 0, 0);
282
283 // Fix ownership/creator of inventory items
284 // Not doing so results in inventory items
285 // being no copy/no mod for everyone
286 part.TaskInventory.LockItemsForRead(true);
270 TaskInventoryDictionary inv = part.TaskInventory; 287 TaskInventoryDictionary inv = part.TaskInventory;
271 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 288 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
272 { 289 {
@@ -279,6 +296,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
279 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 296 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
280 } 297 }
281 } 298 }
299 part.TaskInventory.LockItemsForRead(false);
282 } 300 }
283 } 301 }
284 302
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 5025c88..fb15d91 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -29,6 +29,7 @@ using System.Collections.Generic;
29using System.IO; 29using System.IO;
30using System.Reflection; 30using System.Reflection;
31using System.Security; 31using System.Security;
32using System.Timers;
32using log4net; 33using log4net;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
@@ -45,6 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
45 private delegate void LookupUUIDS(List<UUID> uuidLst); 46 private delegate void LookupUUIDS(List<UUID> uuidLst);
46 47
47 private Scene m_scene; 48 private Scene m_scene;
49 private Timer m_regionChangeTimer = new Timer();
48 50
49 private EstateTerrainXferHandler TerrainUploader; 51 private EstateTerrainXferHandler TerrainUploader;
50 52
@@ -250,7 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
250 252
251 if ((estateAccessType & 4) != 0) // User add 253 if ((estateAccessType & 4) != 0) // User add
252 { 254 {
253 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 255 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
254 { 256 {
255 m_scene.RegionInfo.EstateSettings.AddEstateUser(user); 257 m_scene.RegionInfo.EstateSettings.AddEstateUser(user);
256 m_scene.RegionInfo.EstateSettings.Save(); 258 m_scene.RegionInfo.EstateSettings.Save();
@@ -265,7 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
265 } 267 }
266 if ((estateAccessType & 8) != 0) // User remove 268 if ((estateAccessType & 8) != 0) // User remove
267 { 269 {
268 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 270 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
269 { 271 {
270 m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); 272 m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
271 m_scene.RegionInfo.EstateSettings.Save(); 273 m_scene.RegionInfo.EstateSettings.Save();
@@ -280,7 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
280 } 282 }
281 if ((estateAccessType & 16) != 0) // Group add 283 if ((estateAccessType & 16) != 0) // Group add
282 { 284 {
283 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 285 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
284 { 286 {
285 m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); 287 m_scene.RegionInfo.EstateSettings.AddEstateGroup(user);
286 m_scene.RegionInfo.EstateSettings.Save(); 288 m_scene.RegionInfo.EstateSettings.Save();
@@ -294,7 +296,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
294 } 296 }
295 if ((estateAccessType & 32) != 0) // Group remove 297 if ((estateAccessType & 32) != 0) // Group remove
296 { 298 {
297 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 299 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
298 { 300 {
299 m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); 301 m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
300 m_scene.RegionInfo.EstateSettings.Save(); 302 m_scene.RegionInfo.EstateSettings.Save();
@@ -343,7 +345,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
343 { 345 {
344 if (!s.IsChildAgent) 346 if (!s.IsChildAgent)
345 { 347 {
346 m_scene.TeleportClientHome(user, s.ControllingClient); 348 if (!m_scene.TeleportClientHome(user, s.ControllingClient))
349 {
350 s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out.");
351 s.ControllingClient.Close();
352 }
347 } 353 }
348 } 354 }
349 355
@@ -477,7 +483,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
477 ScenePresence s = m_scene.GetScenePresence(prey); 483 ScenePresence s = m_scene.GetScenePresence(prey);
478 if (s != null) 484 if (s != null)
479 { 485 {
480 m_scene.TeleportClientHome(prey, s.ControllingClient); 486 if (!m_scene.TeleportClientHome(prey, s.ControllingClient))
487 {
488 s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
489 s.ControllingClient.Close();
490 }
481 } 491 }
482 } 492 }
483 } 493 }
@@ -496,7 +506,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
496 // Also make sure they are actually in the region 506 // Also make sure they are actually in the region
497 if (p != null && !p.IsChildAgent) 507 if (p != null && !p.IsChildAgent)
498 { 508 {
499 m_scene.TeleportClientHome(p.UUID, p.ControllingClient); 509 if (!m_scene.TeleportClientHome(p.UUID, p.ControllingClient))
510 {
511 p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
512 p.ControllingClient.Close();
513 }
500 } 514 }
501 } 515 }
502 }); 516 });
@@ -896,6 +910,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
896 m_scene.RegisterModuleInterface<IEstateModule>(this); 910 m_scene.RegisterModuleInterface<IEstateModule>(this);
897 m_scene.EventManager.OnNewClient += EventManager_OnNewClient; 911 m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
898 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; 912 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
913 m_regionChangeTimer.AutoReset = false;
914 m_regionChangeTimer.Interval = 2000;
915 m_regionChangeTimer.Elapsed += RaiseRegionInfoChange;
899 916
900 m_scene.AddCommand(this, "set terrain texture", 917 m_scene.AddCommand(this, "set terrain texture",
901 "set terrain texture <number> <uuid> [<x>] [<y>]", 918 "set terrain texture <number> <uuid> [<x>] [<y>]",
@@ -1166,6 +1183,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
1166 1183
1167 protected void TriggerRegionInfoChange() 1184 protected void TriggerRegionInfoChange()
1168 { 1185 {
1186 m_regionChangeTimer.Stop();
1187 m_regionChangeTimer.Start();
1188 }
1189
1190 protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
1191 {
1169 ChangeDelegate change = OnRegionInfoChange; 1192 ChangeDelegate change = OnRegionInfoChange;
1170 1193
1171 if (change != null) 1194 if (change != null)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 268e2ee..040dc8c 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -85,6 +85,8 @@ namespace OpenSim.Region.CoreModules.World.Land
85 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 85 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
86 86
87 private bool m_allowedForcefulBans = true; 87 private bool m_allowedForcefulBans = true;
88 private UUID DefaultGodParcelGroup;
89 private string DefaultGodParcelName;
88 90
89 // caches ExtendedLandData 91 // caches ExtendedLandData
90 private Cache parcelInfoCache; 92 private Cache parcelInfoCache;
@@ -99,6 +101,12 @@ namespace OpenSim.Region.CoreModules.World.Land
99 101
100 public void Initialise(IConfigSource source) 102 public void Initialise(IConfigSource source)
101 { 103 {
104 IConfig cnf = source.Configs["LandManagement"];
105 if (cnf != null)
106 {
107 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
108 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
109 }
102 } 110 }
103 111
104 public void AddRegion(Scene scene) 112 public void AddRegion(Scene scene)
@@ -353,7 +361,7 @@ namespace OpenSim.Region.CoreModules.World.Land
353 { 361 {
354 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) 362 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
355 { 363 {
356 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) 364 if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID))
357 { 365 {
358 SendYouAreBannedNotice(avatar); 366 SendYouAreBannedNotice(avatar);
359 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); 367 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
@@ -650,7 +658,7 @@ namespace OpenSim.Region.CoreModules.World.Land
650 int x; 658 int x;
651 int y; 659 int y;
652 660
653 if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) 661 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0)
654 return null; 662 return null;
655 663
656 try 664 try
@@ -993,6 +1001,10 @@ namespace OpenSim.Region.CoreModules.World.Land
993 //Owner Flag 1001 //Owner Flag
994 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); 1002 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
995 } 1003 }
1004 else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID))
1005 {
1006 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP);
1007 }
996 else if (currentParcelBlock.LandData.SalePrice > 0 && 1008 else if (currentParcelBlock.LandData.SalePrice > 0 &&
997 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || 1009 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
998 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) 1010 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
@@ -1292,18 +1304,31 @@ namespace OpenSim.Region.CoreModules.World.Land
1292 1304
1293 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1305 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1294 { 1306 {
1295 for (int i = 0; i < data.Count; i++) 1307 lock (m_landList)
1296 { 1308 {
1297 IncomingLandObjectFromStorage(data[i]); 1309 //Remove all the land objects in the sim and then process our new data
1310 foreach (int n in m_landList.Keys)
1311 {
1312 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
1313 }
1314 m_landIDList.Initialize();
1315 m_landList.Clear();
1316
1317 for (int i = 0; i < data.Count; i++)
1318 {
1319 IncomingLandObjectFromStorage(data[i]);
1320 }
1298 } 1321 }
1299 } 1322 }
1300 1323
1301 public void IncomingLandObjectFromStorage(LandData data) 1324 public void IncomingLandObjectFromStorage(LandData data)
1302 { 1325 {
1326
1303 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1327 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1304 new_land.LandData = data.Copy(); 1328 new_land.LandData = data.Copy();
1305 new_land.SetLandBitmapFromByteArray(); 1329 new_land.SetLandBitmapFromByteArray();
1306 AddLandObject(new_land); 1330 AddLandObject(new_land);
1331 new_land.SendLandUpdateToAvatarsOverMe();
1307 } 1332 }
1308 1333
1309 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 1334 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
@@ -1572,5 +1597,321 @@ namespace OpenSim.Region.CoreModules.World.Land
1572 1597
1573 UpdateLandObject(localID, land.LandData); 1598 UpdateLandObject(localID, land.LandData);
1574 } 1599 }
1600
1601 public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
1602 {
1603 ILandObject land = null;
1604 List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels();
1605 foreach (ILandObject landObject in Land)
1606 {
1607 if (landObject.LandData.LocalID == landID)
1608 {
1609 land = landObject;
1610 }
1611 }
1612 land.DeedToGroup(DefaultGodParcelGroup);
1613 land.LandData.Name = DefaultGodParcelName;
1614 land.SendLandUpdateToAvatarsOverMe();
1615 }
1616
1617 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
1618 {
1619 ScenePresence SP;
1620 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1621 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1622 if (SP.GodLevel != 0)
1623 {
1624 if (flags == 0) //All parcels, scripted or not
1625 {
1626 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1627 {
1628 if (e.OwnerID == targetID)
1629 {
1630 returns.Add(e);
1631 }
1632 }
1633 );
1634 }
1635 if (flags == 4) //All parcels, scripted object
1636 {
1637 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1638 {
1639 if (e.OwnerID == targetID)
1640 {
1641 if (e.scriptScore >= 0.01)
1642 {
1643 returns.Add(e);
1644 }
1645 }
1646 }
1647 );
1648 }
1649 if (flags == 4) //not target parcel, scripted object
1650 {
1651 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1652 {
1653 if (e.OwnerID == targetID)
1654 {
1655 ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
1656 if (landobject.LandData.OwnerID != e.OwnerID)
1657 {
1658 if (e.scriptScore >= 0.01)
1659 {
1660 returns.Add(e);
1661 }
1662 }
1663 }
1664 }
1665 );
1666 }
1667 foreach (SceneObjectGroup ol in returns)
1668 {
1669 ReturnObject(ol, client);
1670 }
1671 }
1672 }
1673 public void ReturnObject(SceneObjectGroup obj, IClientAPI client)
1674 {
1675 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1676 objs[0] = obj;
1677 ((Scene)client.Scene).returnObjects(objs, client.AgentId);
1678 }
1679
1680 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1681
1682 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1683 {
1684 ScenePresence targetAvatar = null;
1685 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1686 ScenePresence parcelManager = null;
1687 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1688 System.Threading.Timer Timer;
1689
1690 if (targetAvatar.GodLevel == 0)
1691 {
1692 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1693 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1694 return;
1695 if (flags == 0)
1696 {
1697 targetAvatar.AllowMovement = false;
1698 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world.");
1699 parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen.");
1700 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
1701 Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
1702 Timers.Add(targetAvatar.UUID, Timer);
1703 }
1704 else
1705 {
1706 targetAvatar.AllowMovement = true;
1707 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you.");
1708 parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen.");
1709 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1710 Timers.Remove(targetAvatar.UUID);
1711 Timer.Dispose();
1712 }
1713 }
1714 }
1715 private void OnEndParcelFrozen(object avatar)
1716 {
1717 ScenePresence targetAvatar = (ScenePresence)avatar;
1718 targetAvatar.AllowMovement = true;
1719 System.Threading.Timer Timer;
1720 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1721 Timers.Remove(targetAvatar.UUID);
1722 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1723 }
1724
1725
1726 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1727 {
1728 ScenePresence targetAvatar = null;
1729 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1730 ScenePresence parcelManager = null;
1731 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1732 //Just eject
1733 if (flags == 0)
1734 {
1735 if (targetAvatar.GodLevel == 0)
1736 {
1737 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1738 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1739 return;
1740
1741 Vector3 position = new Vector3(0, 0, 0);
1742 List<ILandObject> allParcels = new List<ILandObject>();
1743 allParcels = AllParcels();
1744 if (allParcels.Count != 1)
1745 {
1746 foreach (ILandObject parcel in allParcels)
1747 {
1748 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1749 {
1750 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1751 {
1752 for (int x = 1; x <= Constants.RegionSize; x += 2)
1753 {
1754 for (int y = 1; y <= Constants.RegionSize; y += 2)
1755 {
1756 if (parcel.ContainsPoint(x, y))
1757 {
1758 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1759 targetAvatar.TeleportWithMomentum(position);
1760 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1761 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1762 return;
1763 }
1764 }
1765 }
1766 }
1767 }
1768 }
1769 }
1770 Vector3 targetVector;
1771 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1772 {
1773 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1774 {
1775 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1776 targetAvatar.TeleportWithMomentum(targetVector);
1777 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1778 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1779 return;
1780 }
1781 else
1782 {
1783 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1784 targetAvatar.TeleportWithMomentum(targetVector);
1785 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1786 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1787 return;
1788 }
1789 }
1790 else
1791 {
1792 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1793 {
1794 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1795 targetAvatar.TeleportWithMomentum(targetVector);
1796 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1797 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1798 return;
1799 }
1800 else
1801 {
1802 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1803 targetAvatar.TeleportWithMomentum(targetVector);
1804 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1805 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1806 return;
1807 }
1808 }
1809 }
1810 }
1811 //Eject and ban
1812 if (flags == 1)
1813 {
1814 if (targetAvatar.GodLevel == 0)
1815 {
1816 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1817 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1818 return;
1819
1820 Vector3 position = new Vector3(0, 0, 0);
1821 List<ILandObject> allParcels = new List<ILandObject>();
1822 allParcels = AllParcels();
1823 if (allParcels.Count != 1)
1824 {
1825 foreach (ILandObject parcel in allParcels)
1826 {
1827 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1828 {
1829 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1830 {
1831 for (int x = 1; x <= Constants.RegionSize; x += 2)
1832 {
1833 for (int y = 1; y <= Constants.RegionSize; y += 2)
1834 {
1835 if (parcel.ContainsPoint(x, y))
1836 {
1837 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1838 targetAvatar.TeleportWithMomentum(position);
1839 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1840 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1841 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1842 entry.AgentID = targetAvatar.UUID;
1843 entry.Flags = AccessList.Ban;
1844 entry.Time = new DateTime();
1845 land.LandData.ParcelAccessList.Add(entry);
1846 return;
1847 }
1848 }
1849 }
1850 }
1851 }
1852 }
1853 }
1854 Vector3 targetVector;
1855 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1856 {
1857 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1858 {
1859 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1860 targetAvatar.TeleportWithMomentum(targetVector);
1861 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1862 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1863 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1864 entry.AgentID = targetAvatar.UUID;
1865 entry.Flags = AccessList.Ban;
1866 entry.Time = new DateTime();
1867 land.LandData.ParcelAccessList.Add(entry);
1868 return;
1869 }
1870 else
1871 {
1872 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1873 targetAvatar.TeleportWithMomentum(targetVector);
1874 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1875 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1876 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1877 entry.AgentID = targetAvatar.UUID;
1878 entry.Flags = AccessList.Ban;
1879 entry.Time = new DateTime();
1880 land.LandData.ParcelAccessList.Add(entry);
1881 return;
1882 }
1883 }
1884 else
1885 {
1886 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1887 {
1888 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1889 targetAvatar.TeleportWithMomentum(targetVector);
1890 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1891 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1892 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1893 entry.AgentID = targetAvatar.UUID;
1894 entry.Flags = AccessList.Ban;
1895 entry.Time = new DateTime();
1896 land.LandData.ParcelAccessList.Add(entry);
1897 return;
1898 }
1899 else
1900 {
1901 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1902 targetAvatar.TeleportWithMomentum(targetVector);
1903 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1904 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1905 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1906 entry.AgentID = targetAvatar.UUID;
1907 entry.Flags = AccessList.Ban;
1908 entry.Time = new DateTime();
1909 land.LandData.ParcelAccessList.Add(entry);
1910 return;
1911 }
1912 }
1913 }
1914 }
1915 }
1575 } 1916 }
1576} 1917}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 499b60c..1b2cabb 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -288,6 +288,34 @@ namespace OpenSim.Region.CoreModules.World.Land
288 return false; 288 return false;
289 } 289 }
290 290
291 public bool HasGroupAccess(UUID avatar)
292 {
293 if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)
294 {
295 IGroupsModule groupsModule =
296 m_scene.RequestModuleInterface<IGroupsModule>();
297
298 List<UUID> agentGroups = new List<UUID>();
299 if (groupsModule != null)
300 {
301 GroupMembershipData[] GroupMembership =
302 groupsModule.GetMembershipData(avatar);
303
304 if (GroupMembership != null)
305 {
306 for (int i = 0; i < GroupMembership.Length; i++)
307 {
308 if (LandData.GroupID == GroupMembership[i].GroupID)
309 {
310 return true;
311 }
312 }
313 }
314 }
315 }
316 return false;
317 }
318
291 public bool IsBannedFromLand(UUID avatar) 319 public bool IsBannedFromLand(UUID avatar)
292 { 320 {
293 if (m_scene.Permissions.IsAdministrator(avatar)) 321 if (m_scene.Permissions.IsAdministrator(avatar))
@@ -324,10 +352,14 @@ namespace OpenSim.Region.CoreModules.World.Land
324 //If they are not on the access list and are not the owner 352 //If they are not on the access list and are not the owner
325 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 353 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
326 { 354 {
327 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel 355 if (!HasGroupAccess(avatar))
328 return true; 356 {
357 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
358 return true;
359 }
329 } 360 }
330 } 361 }
362
331 return false; 363 return false;
332 } 364 }
333 365
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index bc54997..b1747ef 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
412 412
413 public string Name 413 public string Name
414 { 414 {
415 get { return "PermissionsModule"; } 415 get { return "DefaultPermissionsModule"; }
416 } 416 }
417 417
418 public bool IsSharedModule 418 public bool IsSharedModule
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index cb80111..d4166d0 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -549,6 +549,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
549 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); 549 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
550 m_scene.SaveTerrain(); 550 m_scene.SaveTerrain();
551 551
552 m_scene.EventManager.TriggerTerrainUpdate();
553
552 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. 554 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
553 //m_scene.CreateTerrainTexture(true); 555 //m_scene.CreateTerrainTexture(true);
554 } 556 }