aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs31
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs102
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs13
-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/OfflineMessageModule.cs69
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs31
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs10
-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/World/Archiver/ArchiveReadRequest.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs351
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
14 files changed, 609 insertions, 78 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index a7b4c66..d3d6f25 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 Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
@@ -36,6 +37,7 @@ using OpenSim.Framework;
36using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
37using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization;
39 41
40namespace OpenSim.Region.CoreModules.Avatar.Attachments 42namespace OpenSim.Region.CoreModules.Avatar.Attachments
41{ 43{
@@ -198,8 +200,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
198 200
199 public UUID RezSingleAttachmentFromInventory( 201 public UUID RezSingleAttachmentFromInventory(
200 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) 202 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
203 {
204 return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
205 }
206
207 public UUID RezSingleAttachmentFromInventory(
208 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
201 { 209 {
202 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); 210 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
203 211
204 if (updateInventoryStatus) 212 if (updateInventoryStatus)
205 { 213 {
@@ -218,7 +226,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
218 } 226 }
219 227
220 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 228 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
221 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 229 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
222 { 230 {
223 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); 231 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
224 if (invAccess != null) 232 if (invAccess != null)
@@ -244,13 +252,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
244 if (tainted) 252 if (tainted)
245 objatt.HasGroupChanged = true; 253 objatt.HasGroupChanged = true;
246 254
255 if (doc != null)
256 {
257 objatt.LoadScriptState(doc);
258 objatt.ResetOwnerChangeFlag();
259 }
260
247 // Fire after attach, so we don't get messy perms dialogs 261 // Fire after attach, so we don't get messy perms dialogs
248 // 3 == AttachedRez 262 // 3 == AttachedRez
249 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); 263 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
250 objatt.ResumeScripts(); 264 objatt.ResumeScripts();
251 265
252 // Do this last so that event listeners have access to all the effects of the attachment 266 // Do this last so that event listeners have access to all the effects of the attachment
253 m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); 267 //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
254 } 268 }
255 else 269 else
256 { 270 {
@@ -279,7 +293,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
279 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 293 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
280 { 294 {
281 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 295 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
282 item = m_scene.InventoryService.GetItem(item); 296 if (m_scene.InventoryService != null)
297 item = m_scene.InventoryService.GetItem(item);
283 298
284 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 299 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
285 } 300 }
@@ -324,6 +339,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
324 { 339 {
325 // XXYY!! 340 // XXYY!!
326 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 341 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
342 if (item == null)
343 m_log.Error("[ATTACHMENT]: item == null");
344 if (m_scene == null)
345 m_log.Error("[ATTACHMENT]: m_scene == null");
346 if (m_scene.InventoryService == null)
347 m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
327 item = m_scene.InventoryService.GetItem(item); 348 item = m_scene.InventoryService.GetItem(item);
328 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 349 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
329 350
@@ -412,6 +433,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
412 if (group.GetFromItemID() == itemID) 433 if (group.GetFromItemID() == itemID)
413 { 434 {
414 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 435 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
436 // CM / XMREngine!!!! Needed to conclude attach event
437 SceneObjectSerializer.ToOriginalXmlFormat(group);
415 group.DetachToInventoryPrep(); 438 group.DetachToInventoryPrep();
416 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 439 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
417 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); 440 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID);
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 02f0968..9c8cbc6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
49 private int m_shoutdistance = 100; 49 private int m_shoutdistance = 100;
50 private int m_whisperdistance = 10; 50 private int m_whisperdistance = 10;
51 private List<Scene> m_scenes = new List<Scene>(); 51 private List<Scene> m_scenes = new List<Scene>();
52 52 private List<string> FreezeCache = new List<string>();
53 private string m_adminPrefix = "";
53 internal object m_syncy = new object(); 54 internal object m_syncy = new object();
54 55
55 internal IConfig m_config; 56 internal IConfig m_config;
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
76 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); 77 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
77 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); 78 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
78 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); 79 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
80 m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", "");
79 } 81 }
80 82
81 public virtual void AddRegion(Scene scene) 83 public virtual void AddRegion(Scene scene)
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
171 return; 173 return;
172 } 174 }
173 175
174 DeliverChatToAvatars(ChatSourceType.Agent, c); 176 if (FreezeCache.Contains(c.Sender.AgentId.ToString()))
177 {
178 if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping)
179 c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false);
180 }
181 else
182 {
183 DeliverChatToAvatars(ChatSourceType.Agent, c);
184 }
175 } 185 }
176 186
177 public virtual void OnChatFromWorld(Object sender, OSChatMessage c) 187 public virtual void OnChatFromWorld(Object sender, OSChatMessage c)
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
185 protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) 195 protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
186 { 196 {
187 string fromName = c.From; 197 string fromName = c.From;
198 string fromNamePrefix = "";
188 UUID fromID = UUID.Zero; 199 UUID fromID = UUID.Zero;
189 string message = c.Message; 200 string message = c.Message;
190 IScene scene = c.Scene; 201 IScene scene = c.Scene;
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
207 fromPos = avatar.AbsolutePosition; 218 fromPos = avatar.AbsolutePosition;
208 fromName = avatar.Name; 219 fromName = avatar.Name;
209 fromID = c.Sender.AgentId; 220 fromID = c.Sender.AgentId;
210 221 if (avatar.GodLevel > 200)
222 {
223 fromNamePrefix = m_adminPrefix;
224 }
211 break; 225 break;
212 226
213 case ChatSourceType.Object: 227 case ChatSourceType.Object:
@@ -227,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
227 s.ForEachScenePresence( 241 s.ForEachScenePresence(
228 delegate(ScenePresence presence) 242 delegate(ScenePresence presence)
229 { 243 {
230 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); 244 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
245 if (Presencecheck != null)
246 {
247 if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true)
248 {
249 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType);
250 }
251 }
252
231 } 253 }
232 ); 254 );
233 } 255 }
@@ -270,25 +292,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
270 } 292 }
271 293
272 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 294 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
273 295 if (c.Scene != null)
274 ((Scene)c.Scene).ForEachScenePresence( 296 {
275 delegate(ScenePresence presence) 297 ((Scene)c.Scene).ForEachScenePresence
276 { 298 (
277 // ignore chat from child agents 299 delegate(ScenePresence presence)
278 if (presence.IsChildAgent) return; 300 {
279 301 // ignore chat from child agents
280 IClientAPI client = presence.ControllingClient; 302 if (presence.IsChildAgent) return;
281 303
282 // don't forward SayOwner chat from objects to 304 IClientAPI client = presence.ControllingClient;
283 // non-owner agents 305
284 if ((c.Type == ChatTypeEnum.Owner) && 306 // don't forward SayOwner chat from objects to
285 (null != c.SenderObject) && 307 // non-owner agents
286 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) 308 if ((c.Type == ChatTypeEnum.Owner) &&
287 return; 309 (null != c.SenderObject) &&
288 310 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
289 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 311 return;
290 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 312
291 }); 313 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
314 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
315 }
316 );
317 }
292 } 318 }
293 319
294 320
@@ -317,5 +343,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
317 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 343 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
318 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); 344 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
319 } 345 }
346
347 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
348 public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
349 {
350 System.Threading.Timer Timer;
351 if (flags == 0)
352 {
353 FreezeCache.Add(target.ToString());
354 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
355 Timer = new System.Threading.Timer(timeCB, target, 30000, 0);
356 Timers.Add(target, Timer);
357 }
358 else
359 {
360 FreezeCache.Remove(target.ToString());
361 Timers.TryGetValue(target, out Timer);
362 Timers.Remove(target);
363 Timer.Dispose();
364 }
365 }
366
367 private void OnEndParcelFrozen(object avatar)
368 {
369 UUID target = (UUID)avatar;
370 FreezeCache.Remove(target.ToString());
371 System.Threading.Timer Timer;
372 Timers.TryGetValue(target, out Timer);
373 Timers.Remove(target);
374 Timer.Dispose();
375 }
320 } 376 }
321} 377}
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index b5c3176..4e36c5d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -55,6 +55,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
55 55
56 m_scene.AddCommand( 56 m_scene.AddCommand(
57 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand); 57 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand);
58
59 m_scene.AddCommand(
60 this, "alert dialog", "alert dialog <message>", "Send a dialog alert to everyone", HandleAlertConsoleCommand);
61
62
58 } 63 }
59 64
60 public void PostInitialise() {} 65 public void PostInitialise() {}
@@ -181,6 +186,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
181 "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); 186 "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message);
182 SendGeneralAlert(message); 187 SendGeneralAlert(message);
183 } 188 }
189 else if (cmdparams[1] == "dialog")
190 {
191 string message = CombineParams(cmdparams, 2);
192
193 m_log.InfoFormat(
194 "[DIALOG]: Sending dialog alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message);
195 SendNotificationToUsersInRegion(UUID.Zero, "System", message);
196 }
184 else 197 else
185 { 198 {
186 string firstName = cmdparams[1]; 199 string firstName = cmdparams[1];
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 ab141eb..ffdac58 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/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 2f1e9dd..0d04491 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -241,6 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
241 im.imSessionID = itemID.Guid; 241 im.imSessionID = itemID.Guid;
242 } 242 }
243 243
244 im.offline = 1; // Remember these
245
244 // Send the IM to the recipient. The item is already 246 // Send the IM to the recipient. The item is already
245 // in their inventory, so it will not be lost if 247 // in their inventory, so it will not be lost if
246 // they are offline. 248 // they are offline.
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ab1cfc3..927eeab 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
264 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, 264 // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
265 // it's actually doing a lot of work. 265 // it's actually doing a lot of work.
266 IPEndPoint endPoint = finalDestination.ExternalEndPoint; 266 IPEndPoint endPoint = finalDestination.ExternalEndPoint;
267 if (endPoint.Address != null) 267 if (endPoint != null && endPoint.Address != null)
268 { 268 {
269 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from 269 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
270 // both regions 270 // both regions
@@ -851,15 +851,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
851 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 851 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
852 852
853 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); 853 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
854 if (eq != null) 854 IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint;
855 { 855 if (neighbourExternal != null)
856 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
857 capsPath, agent.UUID, agent.ControllingClient.SessionId);
858 }
859 else
860 { 856 {
861 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, 857 if (eq != null)
862 capsPath); 858 {
859 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal,
860 capsPath, agent.UUID, agent.ControllingClient.SessionId);
861 }
862 else
863 {
864 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal,
865 capsPath);
866 }
863 } 867 }
864 868
865 if (!WaitForCallback(agent.UUID)) 869 if (!WaitForCallback(agent.UUID))
@@ -957,10 +961,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
957 agent.Viewer = currentAgentCircuit.Viewer; 961 agent.Viewer = currentAgentCircuit.Viewer;
958 } 962 }
959 963
960 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 964 IPEndPoint external = region.ExternalEndPoint;
961 d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, 965 if (external != null)
966 {
967 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
968 d.BeginInvoke(sp, agent, region, external, true,
962 InformClientOfNeighbourCompleted, 969 InformClientOfNeighbourCompleted,
963 d); 970 d);
971 }
964 } 972 }
965 #endregion 973 #endregion
966 974
@@ -1089,6 +1097,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1089 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 1097 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
1090 try 1098 try
1091 { 1099 {
1100 //neighbour.ExternalEndPoint may return null, which will be caught
1092 d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, 1101 d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
1093 InformClientOfNeighbourCompleted, 1102 InformClientOfNeighbourCompleted,
1094 d); 1103 d);
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/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/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index bc653ce..57b7672 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -261,10 +261,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
261 // Fix ownership/creator of inventory items 261 // Fix ownership/creator of inventory items
262 // Not doing so results in inventory items 262 // Not doing so results in inventory items
263 // being no copy/no mod for everyone 263 // being no copy/no mod for everyone
264 lock (part.TaskInventory) 264 part.TaskInventory.LockItemsForRead(true);
265 TaskInventoryDictionary inv = part.TaskInventory;
266 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
265 { 267 {
266 TaskInventoryDictionary inv = part.TaskInventory; 268 if (!ResolveUserUuid(kvp.Value.OwnerID))
267 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
268 { 269 {
269 if (!ResolveUserUuid(kvp.Value.OwnerID)) 270 if (!ResolveUserUuid(kvp.Value.OwnerID))
270 { 271 {
@@ -276,6 +277,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
276 } 277 }
277 } 278 }
278 } 279 }
280 part.TaskInventory.LockItemsForRead(false);
279 } 281 }
280 282
281 if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) 283 if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 4ccd0f0..cfee1b0 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -82,6 +82,8 @@ namespace OpenSim.Region.CoreModules.World.Land
82 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 82 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
83 83
84 private bool m_allowedForcefulBans = true; 84 private bool m_allowedForcefulBans = true;
85 private UUID DefaultGodParcelGroup;
86 private string DefaultGodParcelName;
85 87
86 // caches ExtendedLandData 88 // caches ExtendedLandData
87 private Cache parcelInfoCache; 89 private Cache parcelInfoCache;
@@ -96,6 +98,12 @@ namespace OpenSim.Region.CoreModules.World.Land
96 98
97 public void Initialise(IConfigSource source) 99 public void Initialise(IConfigSource source)
98 { 100 {
101 IConfig cnf = source.Configs["LandManagement"];
102 if (cnf != null)
103 {
104 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
105 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
106 }
99 } 107 }
100 108
101 public void AddRegion(Scene scene) 109 public void AddRegion(Scene scene)
@@ -160,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Land
160 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; 168 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
161 client.OnParcelReclaim += ClientOnParcelReclaim; 169 client.OnParcelReclaim += ClientOnParcelReclaim;
162 client.OnParcelInfoRequest += ClientOnParcelInfoRequest; 170 client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
163 client.OnParcelDwellRequest += ClientOnParcelDwellRequest; 171// client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
164 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; 172 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
165 client.OnPreAgentUpdate += ClientOnPreAgentUpdate; 173 client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
166 174
@@ -351,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Land
351 { 359 {
352 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) 360 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
353 { 361 {
354 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) 362 if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID))
355 { 363 {
356 SendYouAreBannedNotice(avatar); 364 SendYouAreBannedNotice(avatar);
357 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); 365 ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar));
@@ -648,7 +656,7 @@ namespace OpenSim.Region.CoreModules.World.Land
648 int x; 656 int x;
649 int y; 657 int y;
650 658
651 if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) 659 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0)
652 return null; 660 return null;
653 661
654 try 662 try
@@ -991,6 +999,10 @@ namespace OpenSim.Region.CoreModules.World.Land
991 //Owner Flag 999 //Owner Flag
992 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); 1000 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
993 } 1001 }
1002 else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID))
1003 {
1004 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP);
1005 }
994 else if (currentParcelBlock.LandData.SalePrice > 0 && 1006 else if (currentParcelBlock.LandData.SalePrice > 0 &&
995 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || 1007 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
996 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) 1008 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
@@ -1291,18 +1303,31 @@ namespace OpenSim.Region.CoreModules.World.Land
1291 1303
1292 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1304 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1293 { 1305 {
1294 for (int i = 0; i < data.Count; i++) 1306 lock (m_landList)
1295 { 1307 {
1296 IncomingLandObjectFromStorage(data[i]); 1308 //Remove all the land objects in the sim and then process our new data
1309 foreach (int n in m_landList.Keys)
1310 {
1311 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
1312 }
1313 m_landIDList.Initialize();
1314 m_landList.Clear();
1315
1316 for (int i = 0; i < data.Count; i++)
1317 {
1318 IncomingLandObjectFromStorage(data[i]);
1319 }
1297 } 1320 }
1298 } 1321 }
1299 1322
1300 public void IncomingLandObjectFromStorage(LandData data) 1323 public void IncomingLandObjectFromStorage(LandData data)
1301 { 1324 {
1325
1302 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1326 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1303 new_land.LandData = data.Copy(); 1327 new_land.LandData = data.Copy();
1304 new_land.SetLandBitmapFromByteArray(); 1328 new_land.SetLandBitmapFromByteArray();
1305 AddLandObject(new_land); 1329 AddLandObject(new_land);
1330 new_land.SendLandUpdateToAvatarsOverMe();
1306 } 1331 }
1307 1332
1308 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 1333 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
@@ -1520,5 +1545,321 @@ namespace OpenSim.Region.CoreModules.World.Land
1520 1545
1521 UpdateLandObject(localID, land.LandData); 1546 UpdateLandObject(localID, land.LandData);
1522 } 1547 }
1548
1549 public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
1550 {
1551 ILandObject land = null;
1552 List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels();
1553 foreach (ILandObject landObject in Land)
1554 {
1555 if (landObject.LandData.LocalID == landID)
1556 {
1557 land = landObject;
1558 }
1559 }
1560 land.DeedToGroup(DefaultGodParcelGroup);
1561 land.LandData.Name = DefaultGodParcelName;
1562 land.SendLandUpdateToAvatarsOverMe();
1563 }
1564
1565 private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID)
1566 {
1567 ScenePresence SP;
1568 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1569 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1570 if (SP.GodLevel != 0)
1571 {
1572 if (flags == 0) //All parcels, scripted or not
1573 {
1574 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1575 {
1576 if (e.OwnerID == targetID)
1577 {
1578 returns.Add(e);
1579 }
1580 }
1581 );
1582 }
1583 if (flags == 4) //All parcels, scripted object
1584 {
1585 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1586 {
1587 if (e.OwnerID == targetID)
1588 {
1589 if (e.scriptScore >= 0.01)
1590 {
1591 returns.Add(e);
1592 }
1593 }
1594 }
1595 );
1596 }
1597 if (flags == 4) //not target parcel, scripted object
1598 {
1599 ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e)
1600 {
1601 if (e.OwnerID == targetID)
1602 {
1603 ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
1604 if (landobject.LandData.OwnerID != e.OwnerID)
1605 {
1606 if (e.scriptScore >= 0.01)
1607 {
1608 returns.Add(e);
1609 }
1610 }
1611 }
1612 }
1613 );
1614 }
1615 foreach (SceneObjectGroup ol in returns)
1616 {
1617 ReturnObject(ol, client);
1618 }
1619 }
1620 }
1621 public void ReturnObject(SceneObjectGroup obj, IClientAPI client)
1622 {
1623 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1624 objs[0] = obj;
1625 ((Scene)client.Scene).returnObjects(objs, client.AgentId);
1626 }
1627
1628 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
1629
1630 public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1631 {
1632 ScenePresence targetAvatar = null;
1633 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1634 ScenePresence parcelManager = null;
1635 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1636 System.Threading.Timer Timer;
1637
1638 if (targetAvatar.GodLevel == 0)
1639 {
1640 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1641 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1642 return;
1643 if (flags == 0)
1644 {
1645 targetAvatar.AllowMovement = false;
1646 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world.");
1647 parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen.");
1648 System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
1649 Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
1650 Timers.Add(targetAvatar.UUID, Timer);
1651 }
1652 else
1653 {
1654 targetAvatar.AllowMovement = true;
1655 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you.");
1656 parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen.");
1657 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1658 Timers.Remove(targetAvatar.UUID);
1659 Timer.Dispose();
1660 }
1661 }
1662 }
1663 private void OnEndParcelFrozen(object avatar)
1664 {
1665 ScenePresence targetAvatar = (ScenePresence)avatar;
1666 targetAvatar.AllowMovement = true;
1667 System.Threading.Timer Timer;
1668 Timers.TryGetValue(targetAvatar.UUID, out Timer);
1669 Timers.Remove(targetAvatar.UUID);
1670 targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false);
1671 }
1672
1673
1674 public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
1675 {
1676 ScenePresence targetAvatar = null;
1677 ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar);
1678 ScenePresence parcelManager = null;
1679 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
1680 //Just eject
1681 if (flags == 0)
1682 {
1683 if (targetAvatar.GodLevel == 0)
1684 {
1685 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1686 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1687 return;
1688
1689 Vector3 position = new Vector3(0, 0, 0);
1690 List<ILandObject> allParcels = new List<ILandObject>();
1691 allParcels = AllParcels();
1692 if (allParcels.Count != 1)
1693 {
1694 foreach (ILandObject parcel in allParcels)
1695 {
1696 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1697 {
1698 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1699 {
1700 for (int x = 1; x <= Constants.RegionSize; x += 2)
1701 {
1702 for (int y = 1; y <= Constants.RegionSize; y += 2)
1703 {
1704 if (parcel.ContainsPoint(x, y))
1705 {
1706 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1707 targetAvatar.TeleportWithMomentum(position);
1708 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1709 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1710 return;
1711 }
1712 }
1713 }
1714 }
1715 }
1716 }
1717 }
1718 Vector3 targetVector;
1719 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1720 {
1721 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1722 {
1723 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1724 targetAvatar.TeleportWithMomentum(targetVector);
1725 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1726 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1727 return;
1728 }
1729 else
1730 {
1731 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1732 targetAvatar.TeleportWithMomentum(targetVector);
1733 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1734 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1735 return;
1736 }
1737 }
1738 else
1739 {
1740 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1741 {
1742 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1743 targetAvatar.TeleportWithMomentum(targetVector);
1744 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1745 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1746 return;
1747 }
1748 else
1749 {
1750 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1751 targetAvatar.TeleportWithMomentum(targetVector);
1752 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1753 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");
1754 return;
1755 }
1756 }
1757 }
1758 }
1759 //Eject and ban
1760 if (flags == 1)
1761 {
1762 if (targetAvatar.GodLevel == 0)
1763 {
1764 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1765 if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
1766 return;
1767
1768 Vector3 position = new Vector3(0, 0, 0);
1769 List<ILandObject> allParcels = new List<ILandObject>();
1770 allParcels = AllParcels();
1771 if (allParcels.Count != 1)
1772 {
1773 foreach (ILandObject parcel in allParcels)
1774 {
1775 if (parcel.LandData.GlobalID != land.LandData.GlobalID)
1776 {
1777 if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true)
1778 {
1779 for (int x = 1; x <= Constants.RegionSize; x += 2)
1780 {
1781 for (int y = 1; y <= Constants.RegionSize; y += 2)
1782 {
1783 if (parcel.ContainsPoint(x, y))
1784 {
1785 position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z);
1786 targetAvatar.TeleportWithMomentum(position);
1787 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1788 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1789 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1790 entry.AgentID = targetAvatar.UUID;
1791 entry.Flags = AccessList.Ban;
1792 entry.Time = new DateTime();
1793 land.LandData.ParcelAccessList.Add(entry);
1794 return;
1795 }
1796 }
1797 }
1798 }
1799 }
1800 }
1801 }
1802 Vector3 targetVector;
1803 if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y)
1804 {
1805 if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize)
1806 {
1807 targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1808 targetAvatar.TeleportWithMomentum(targetVector);
1809 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1810 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1811 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1812 entry.AgentID = targetAvatar.UUID;
1813 entry.Flags = AccessList.Ban;
1814 entry.Time = new DateTime();
1815 land.LandData.ParcelAccessList.Add(entry);
1816 return;
1817 }
1818 else
1819 {
1820 targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ;
1821 targetAvatar.TeleportWithMomentum(targetVector);
1822 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1823 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1824 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1825 entry.AgentID = targetAvatar.UUID;
1826 entry.Flags = AccessList.Ban;
1827 entry.Time = new DateTime();
1828 land.LandData.ParcelAccessList.Add(entry);
1829 return;
1830 }
1831 }
1832 else
1833 {
1834 if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize)
1835 {
1836 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ;
1837 targetAvatar.TeleportWithMomentum(targetVector);
1838 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1839 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1840 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1841 entry.AgentID = targetAvatar.UUID;
1842 entry.Flags = AccessList.Ban;
1843 entry.Time = new DateTime();
1844 land.LandData.ParcelAccessList.Add(entry);
1845 return;
1846 }
1847 else
1848 {
1849 targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ;
1850 targetAvatar.TeleportWithMomentum(targetVector);
1851 targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname);
1852 parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned.");
1853 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
1854 entry.AgentID = targetAvatar.UUID;
1855 entry.Flags = AccessList.Ban;
1856 entry.Time = new DateTime();
1857 land.LandData.ParcelAccessList.Add(entry);
1858 return;
1859 }
1860 }
1861 }
1862 }
1863 }
1523 } 1864 }
1524} 1865}
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 1e7ea7b..0c20393 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -544,6 +544,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
544 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); 544 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
545 m_scene.SaveTerrain(); 545 m_scene.SaveTerrain();
546 546
547 m_scene.EventManager.TriggerTerrainUpdate();
548
547 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. 549 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
548 //m_scene.CreateTerrainTexture(true); 550 //m_scene.CreateTerrainTexture(true);
549 } 551 }