diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
21 files changed, 1781 insertions, 1158 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 365cdbb..c802490 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Xml; | ||
31 | using log4net; | 32 | using log4net; |
32 | using Mono.Addins; | 33 | using Mono.Addins; |
33 | using Nini.Config; | 34 | using Nini.Config; |
@@ -37,6 +38,7 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Region.Framework; | 38 | using OpenSim.Region.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
40 | 42 | ||
41 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 43 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
42 | { | 44 | { |
@@ -233,8 +235,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
233 | 235 | ||
234 | public UUID RezSingleAttachmentFromInventory( | 236 | public UUID RezSingleAttachmentFromInventory( |
235 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 237 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
238 | { | ||
239 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); | ||
240 | } | ||
241 | |||
242 | public UUID RezSingleAttachmentFromInventory( | ||
243 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
236 | { | 244 | { |
237 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 245 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); |
238 | 246 | ||
239 | if (updateInventoryStatus) | 247 | if (updateInventoryStatus) |
240 | { | 248 | { |
@@ -253,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
253 | } | 261 | } |
254 | 262 | ||
255 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 263 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
256 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 264 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
257 | { | 265 | { |
258 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 266 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
259 | if (invAccess != null) | 267 | if (invAccess != null) |
@@ -278,13 +286,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
278 | if (tainted) | 286 | if (tainted) |
279 | objatt.HasGroupChanged = true; | 287 | objatt.HasGroupChanged = true; |
280 | 288 | ||
289 | if (doc != null) | ||
290 | { | ||
291 | objatt.LoadScriptState(doc); | ||
292 | objatt.ResetOwnerChangeFlag(); | ||
293 | } | ||
294 | |||
281 | // Fire after attach, so we don't get messy perms dialogs | 295 | // Fire after attach, so we don't get messy perms dialogs |
282 | // 4 == AttachedRez | 296 | // 4 == AttachedRez |
283 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | 297 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); |
284 | objatt.ResumeScripts(); | 298 | objatt.ResumeScripts(); |
285 | 299 | ||
286 | // Do this last so that event listeners have access to all the effects of the attachment | 300 | // Do this last so that event listeners have access to all the effects of the attachment |
287 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 301 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
288 | } | 302 | } |
289 | else | 303 | else |
290 | { | 304 | { |
@@ -313,7 +327,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
313 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 327 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
314 | { | 328 | { |
315 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 329 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
316 | item = m_scene.InventoryService.GetItem(item); | 330 | if (m_scene.InventoryService != null) |
331 | item = m_scene.InventoryService.GetItem(item); | ||
317 | 332 | ||
318 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 333 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); |
319 | } | 334 | } |
@@ -358,6 +373,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
358 | { | 373 | { |
359 | // XXYY!! | 374 | // XXYY!! |
360 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 375 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
376 | if (item == null) | ||
377 | m_log.Error("[ATTACHMENT]: item == null"); | ||
378 | if (m_scene == null) | ||
379 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
380 | if (m_scene.InventoryService == null) | ||
381 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
361 | item = m_scene.InventoryService.GetItem(item); | 382 | item = m_scene.InventoryService.GetItem(item); |
362 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 383 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
363 | 384 | ||
@@ -446,6 +467,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
446 | if (group.GetFromItemID() == itemID) | 467 | if (group.GetFromItemID() == itemID) |
447 | { | 468 | { |
448 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 469 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
470 | // CM / XMREngine!!!! Needed to conclude attach event | ||
471 | SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
449 | group.DetachToInventoryPrep(); | 472 | group.DetachToInventoryPrep(); |
450 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 473 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
451 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); | 474 | 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..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 4117e86..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.InfoFormat( | 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 bb98dba..0ba67d3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
259 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 259 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
260 | // it's actually doing a lot of work. | 260 | // it's actually doing a lot of work. |
261 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 261 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
262 | if (endPoint.Address != null) | 262 | if (endPoint != null && endPoint.Address != null) |
263 | { | 263 | { |
264 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 264 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
265 | // both regions | 265 | // both regions |
@@ -561,6 +561,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
561 | 561 | ||
562 | if (uinfo != null) | 562 | if (uinfo != null) |
563 | { | 563 | { |
564 | if (uinfo.HomeRegionID == UUID.Zero) | ||
565 | { | ||
566 | // can't find the Home region: Tell viewer and abort | ||
567 | client.SendTeleportFailed("You don't have a home position set."); | ||
568 | return; | ||
569 | } | ||
564 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 570 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
565 | if (regionInfo == null) | 571 | if (regionInfo == null) |
566 | { | 572 | { |
@@ -568,7 +574,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
568 | client.SendTeleportFailed("Your home region could not be found."); | 574 | client.SendTeleportFailed("Your home region could not be found."); |
569 | return; | 575 | return; |
570 | } | 576 | } |
571 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 577 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
572 | regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize); | 578 | regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize); |
573 | 579 | ||
574 | // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... | 580 | // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... |
@@ -576,6 +582,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
576 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 582 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
577 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 583 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
578 | } | 584 | } |
585 | else | ||
586 | { | ||
587 | // can't find the Home region: Tell viewer and abort | ||
588 | client.SendTeleportFailed("Your home region could not be found."); | ||
589 | return; | ||
590 | } | ||
579 | } | 591 | } |
580 | 592 | ||
581 | #endregion | 593 | #endregion |
@@ -863,15 +875,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
863 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 875 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
864 | 876 | ||
865 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 877 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
866 | if (eq != null) | 878 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
867 | { | 879 | if (neighbourExternal != null) |
868 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
869 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
870 | } | ||
871 | else | ||
872 | { | 880 | { |
873 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 881 | if (eq != null) |
874 | capsPath); | 882 | { |
883 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
884 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
885 | } | ||
886 | else | ||
887 | { | ||
888 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
889 | capsPath); | ||
890 | } | ||
875 | } | 891 | } |
876 | 892 | ||
877 | if (!WaitForCallback(agent.UUID)) | 893 | if (!WaitForCallback(agent.UUID)) |
@@ -969,10 +985,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
969 | agent.Viewer = currentAgentCircuit.Viewer; | 985 | agent.Viewer = currentAgentCircuit.Viewer; |
970 | } | 986 | } |
971 | 987 | ||
972 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 988 | IPEndPoint external = region.ExternalEndPoint; |
973 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 989 | if (external != null) |
990 | { | ||
991 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
992 | d.BeginInvoke(sp, agent, region, external, true, | ||
974 | InformClientOfNeighbourCompleted, | 993 | InformClientOfNeighbourCompleted, |
975 | d); | 994 | d); |
995 | } | ||
976 | } | 996 | } |
977 | #endregion | 997 | #endregion |
978 | 998 | ||
@@ -1101,6 +1121,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1101 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1121 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1102 | try | 1122 | try |
1103 | { | 1123 | { |
1124 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1104 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1125 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1105 | InformClientOfNeighbourCompleted, | 1126 | InformClientOfNeighbourCompleted, |
1106 | d); | 1127 | d); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index eef0c73..cc12df0 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.Children.Count, remoteClient.AgentId, pos) | 552 | group.Children.Count, 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. |
@@ -615,7 +650,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
615 | group.ApplyNextOwnerPermissions(); | 650 | group.ApplyNextOwnerPermissions(); |
616 | } | 651 | } |
617 | } | 652 | } |
618 | 653 | if (group.UUID == UUID.Zero) | |
654 | { | ||
655 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 8"); | ||
656 | } | ||
619 | foreach (SceneObjectPart part in partList) | 657 | foreach (SceneObjectPart part in partList) |
620 | { | 658 | { |
621 | if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) | 659 | if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) |
@@ -628,13 +666,23 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
628 | part.EveryoneMask = item.EveryOnePermissions; | 666 | part.EveryoneMask = item.EveryOnePermissions; |
629 | part.NextOwnerMask = item.NextPermissions; | 667 | part.NextOwnerMask = item.NextPermissions; |
630 | } | 668 | } |
631 | 669 | if (group.UUID == UUID.Zero) | |
670 | { | ||
671 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 9"); | ||
672 | } | ||
632 | rootPart.TrimPermissions(); | 673 | rootPart.TrimPermissions(); |
633 | 674 | if (group.UUID == UUID.Zero) | |
675 | { | ||
676 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 10"); | ||
677 | } | ||
634 | if (!attachment) | 678 | if (!attachment) |
635 | { | 679 | { |
636 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | 680 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
637 | { | 681 | { |
682 | // Save attachment data | ||
683 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | ||
684 | group.RootPart.AttachOffset = storedPosition; | ||
685 | |||
638 | group.ClearPartAttachmentData(); | 686 | group.ClearPartAttachmentData(); |
639 | } | 687 | } |
640 | 688 | ||
@@ -660,8 +708,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
660 | } | 708 | } |
661 | } | 709 | } |
662 | } | 710 | } |
663 | 711 | if (group.UUID == UUID.Zero) | |
664 | return rootPart.ParentGroup; | 712 | { |
713 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 11"); | ||
714 | } | ||
715 | return group; | ||
665 | } | 716 | } |
666 | } | 717 | } |
667 | 718 | ||
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 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/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 5025c88..6e7971e 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; | |||
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Security; | 31 | using System.Security; |
32 | using System.Timers; | ||
32 | using log4net; | 33 | using log4net; |
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using 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(); |
@@ -896,6 +898,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
896 | m_scene.RegisterModuleInterface<IEstateModule>(this); | 898 | m_scene.RegisterModuleInterface<IEstateModule>(this); |
897 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; | 899 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; |
898 | m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; | 900 | m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; |
901 | m_regionChangeTimer.AutoReset = false; | ||
902 | m_regionChangeTimer.Interval = 2000; | ||
903 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
899 | 904 | ||
900 | m_scene.AddCommand(this, "set terrain texture", | 905 | m_scene.AddCommand(this, "set terrain texture", |
901 | "set terrain texture <number> <uuid> [<x>] [<y>]", | 906 | "set terrain texture <number> <uuid> [<x>] [<y>]", |
@@ -1166,6 +1171,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1166 | 1171 | ||
1167 | protected void TriggerRegionInfoChange() | 1172 | protected void TriggerRegionInfoChange() |
1168 | { | 1173 | { |
1174 | m_regionChangeTimer.Stop(); | ||
1175 | m_regionChangeTimer.Start(); | ||
1176 | } | ||
1177 | |||
1178 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1179 | { | ||
1169 | ChangeDelegate change = OnRegionInfoChange; | 1180 | ChangeDelegate change = OnRegionInfoChange; |
1170 | 1181 | ||
1171 | if (change != null) | 1182 | if (change != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 15dc301..d00cb07 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -83,6 +83,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
83 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 83 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
84 | 84 | ||
85 | private bool m_allowedForcefulBans = true; | 85 | private bool m_allowedForcefulBans = true; |
86 | private UUID DefaultGodParcelGroup; | ||
87 | private string DefaultGodParcelName; | ||
86 | 88 | ||
87 | // caches ExtendedLandData | 89 | // caches ExtendedLandData |
88 | private Cache parcelInfoCache; | 90 | private Cache parcelInfoCache; |
@@ -97,6 +99,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
97 | 99 | ||
98 | public void Initialise(IConfigSource source) | 100 | public void Initialise(IConfigSource source) |
99 | { | 101 | { |
102 | IConfig cnf = source.Configs["LandManagement"]; | ||
103 | if (cnf != null) | ||
104 | { | ||
105 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
106 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
107 | } | ||
100 | } | 108 | } |
101 | 109 | ||
102 | public void AddRegion(Scene scene) | 110 | public void AddRegion(Scene scene) |
@@ -161,7 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
161 | client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; | 169 | client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; |
162 | client.OnParcelReclaim += ClientOnParcelReclaim; | 170 | client.OnParcelReclaim += ClientOnParcelReclaim; |
163 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; | 171 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; |
164 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | 172 | // client.OnParcelDwellRequest += ClientOnParcelDwellRequest; |
165 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 173 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
166 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; | 174 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; |
167 | 175 | ||
@@ -352,7 +360,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
352 | { | 360 | { |
353 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | 361 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) |
354 | { | 362 | { |
355 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | 363 | if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID)) |
356 | { | 364 | { |
357 | SendYouAreBannedNotice(avatar); | 365 | SendYouAreBannedNotice(avatar); |
358 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | 366 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); |
@@ -649,7 +657,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
649 | int x; | 657 | int x; |
650 | int y; | 658 | int y; |
651 | 659 | ||
652 | if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) | 660 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
653 | return null; | 661 | return null; |
654 | 662 | ||
655 | try | 663 | try |
@@ -992,6 +1000,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
992 | //Owner Flag | 1000 | //Owner Flag |
993 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 1001 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
994 | } | 1002 | } |
1003 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1004 | { | ||
1005 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
1006 | } | ||
995 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 1007 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
996 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 1008 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
997 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 1009 | 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) |
@@ -1524,5 +1549,321 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1524 | 1549 | ||
1525 | UpdateLandObject(localID, land.LandData); | 1550 | UpdateLandObject(localID, land.LandData); |
1526 | } | 1551 | } |
1552 | |||
1553 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1554 | { | ||
1555 | ILandObject land = null; | ||
1556 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1557 | foreach (ILandObject landObject in Land) | ||
1558 | { | ||
1559 | if (landObject.LandData.LocalID == landID) | ||
1560 | { | ||
1561 | land = landObject; | ||
1562 | } | ||
1563 | } | ||
1564 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1565 | land.LandData.Name = DefaultGodParcelName; | ||
1566 | land.SendLandUpdateToAvatarsOverMe(); | ||
1567 | } | ||
1568 | |||
1569 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1570 | { | ||
1571 | ScenePresence SP; | ||
1572 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1573 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1574 | if (SP.GodLevel != 0) | ||
1575 | { | ||
1576 | if (flags == 0) //All parcels, scripted or not | ||
1577 | { | ||
1578 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1579 | { | ||
1580 | if (e.OwnerID == targetID) | ||
1581 | { | ||
1582 | returns.Add(e); | ||
1583 | } | ||
1584 | } | ||
1585 | ); | ||
1586 | } | ||
1587 | if (flags == 4) //All parcels, scripted object | ||
1588 | { | ||
1589 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1590 | { | ||
1591 | if (e.OwnerID == targetID) | ||
1592 | { | ||
1593 | if (e.scriptScore >= 0.01) | ||
1594 | { | ||
1595 | returns.Add(e); | ||
1596 | } | ||
1597 | } | ||
1598 | } | ||
1599 | ); | ||
1600 | } | ||
1601 | if (flags == 4) //not target parcel, scripted object | ||
1602 | { | ||
1603 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1604 | { | ||
1605 | if (e.OwnerID == targetID) | ||
1606 | { | ||
1607 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1608 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1609 | { | ||
1610 | if (e.scriptScore >= 0.01) | ||
1611 | { | ||
1612 | returns.Add(e); | ||
1613 | } | ||
1614 | } | ||
1615 | } | ||
1616 | } | ||
1617 | ); | ||
1618 | } | ||
1619 | foreach (SceneObjectGroup ol in returns) | ||
1620 | { | ||
1621 | ReturnObject(ol, client); | ||
1622 | } | ||
1623 | } | ||
1624 | } | ||
1625 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1626 | { | ||
1627 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1628 | objs[0] = obj; | ||
1629 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1630 | } | ||
1631 | |||
1632 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1633 | |||
1634 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1635 | { | ||
1636 | ScenePresence targetAvatar = null; | ||
1637 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1638 | ScenePresence parcelManager = null; | ||
1639 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1640 | System.Threading.Timer Timer; | ||
1641 | |||
1642 | if (targetAvatar.GodLevel == 0) | ||
1643 | { | ||
1644 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1645 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1646 | return; | ||
1647 | if (flags == 0) | ||
1648 | { | ||
1649 | targetAvatar.AllowMovement = false; | ||
1650 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1651 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1652 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1653 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1654 | Timers.Add(targetAvatar.UUID, Timer); | ||
1655 | } | ||
1656 | else | ||
1657 | { | ||
1658 | targetAvatar.AllowMovement = true; | ||
1659 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1660 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1661 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1662 | Timers.Remove(targetAvatar.UUID); | ||
1663 | Timer.Dispose(); | ||
1664 | } | ||
1665 | } | ||
1666 | } | ||
1667 | private void OnEndParcelFrozen(object avatar) | ||
1668 | { | ||
1669 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1670 | targetAvatar.AllowMovement = true; | ||
1671 | System.Threading.Timer Timer; | ||
1672 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1673 | Timers.Remove(targetAvatar.UUID); | ||
1674 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1675 | } | ||
1676 | |||
1677 | |||
1678 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1679 | { | ||
1680 | ScenePresence targetAvatar = null; | ||
1681 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1682 | ScenePresence parcelManager = null; | ||
1683 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1684 | //Just eject | ||
1685 | if (flags == 0) | ||
1686 | { | ||
1687 | if (targetAvatar.GodLevel == 0) | ||
1688 | { | ||
1689 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1690 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1691 | return; | ||
1692 | |||
1693 | Vector3 position = new Vector3(0, 0, 0); | ||
1694 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1695 | allParcels = AllParcels(); | ||
1696 | if (allParcels.Count != 1) | ||
1697 | { | ||
1698 | foreach (ILandObject parcel in allParcels) | ||
1699 | { | ||
1700 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1701 | { | ||
1702 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1703 | { | ||
1704 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1705 | { | ||
1706 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1707 | { | ||
1708 | if (parcel.ContainsPoint(x, y)) | ||
1709 | { | ||
1710 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1711 | targetAvatar.TeleportWithMomentum(position); | ||
1712 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1713 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1714 | return; | ||
1715 | } | ||
1716 | } | ||
1717 | } | ||
1718 | } | ||
1719 | } | ||
1720 | } | ||
1721 | } | ||
1722 | Vector3 targetVector; | ||
1723 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1724 | { | ||
1725 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1726 | { | ||
1727 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1728 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1729 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1730 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1731 | return; | ||
1732 | } | ||
1733 | else | ||
1734 | { | ||
1735 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1736 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1737 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1738 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1739 | return; | ||
1740 | } | ||
1741 | } | ||
1742 | else | ||
1743 | { | ||
1744 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1745 | { | ||
1746 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1747 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1748 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1749 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1750 | return; | ||
1751 | } | ||
1752 | else | ||
1753 | { | ||
1754 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1755 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1756 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1757 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1758 | return; | ||
1759 | } | ||
1760 | } | ||
1761 | } | ||
1762 | } | ||
1763 | //Eject and ban | ||
1764 | if (flags == 1) | ||
1765 | { | ||
1766 | if (targetAvatar.GodLevel == 0) | ||
1767 | { | ||
1768 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1769 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1770 | return; | ||
1771 | |||
1772 | Vector3 position = new Vector3(0, 0, 0); | ||
1773 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1774 | allParcels = AllParcels(); | ||
1775 | if (allParcels.Count != 1) | ||
1776 | { | ||
1777 | foreach (ILandObject parcel in allParcels) | ||
1778 | { | ||
1779 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1780 | { | ||
1781 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1782 | { | ||
1783 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1784 | { | ||
1785 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1786 | { | ||
1787 | if (parcel.ContainsPoint(x, y)) | ||
1788 | { | ||
1789 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1790 | targetAvatar.TeleportWithMomentum(position); | ||
1791 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1792 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1793 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1794 | entry.AgentID = targetAvatar.UUID; | ||
1795 | entry.Flags = AccessList.Ban; | ||
1796 | entry.Time = new DateTime(); | ||
1797 | land.LandData.ParcelAccessList.Add(entry); | ||
1798 | return; | ||
1799 | } | ||
1800 | } | ||
1801 | } | ||
1802 | } | ||
1803 | } | ||
1804 | } | ||
1805 | } | ||
1806 | Vector3 targetVector; | ||
1807 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1808 | { | ||
1809 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1810 | { | ||
1811 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1812 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1813 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1814 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1815 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1816 | entry.AgentID = targetAvatar.UUID; | ||
1817 | entry.Flags = AccessList.Ban; | ||
1818 | entry.Time = new DateTime(); | ||
1819 | land.LandData.ParcelAccessList.Add(entry); | ||
1820 | return; | ||
1821 | } | ||
1822 | else | ||
1823 | { | ||
1824 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1825 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1826 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1827 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1828 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1829 | entry.AgentID = targetAvatar.UUID; | ||
1830 | entry.Flags = AccessList.Ban; | ||
1831 | entry.Time = new DateTime(); | ||
1832 | land.LandData.ParcelAccessList.Add(entry); | ||
1833 | return; | ||
1834 | } | ||
1835 | } | ||
1836 | else | ||
1837 | { | ||
1838 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1839 | { | ||
1840 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1841 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1842 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1843 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1844 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1845 | entry.AgentID = targetAvatar.UUID; | ||
1846 | entry.Flags = AccessList.Ban; | ||
1847 | entry.Time = new DateTime(); | ||
1848 | land.LandData.ParcelAccessList.Add(entry); | ||
1849 | return; | ||
1850 | } | ||
1851 | else | ||
1852 | { | ||
1853 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1854 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1855 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1856 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1857 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1858 | entry.AgentID = targetAvatar.UUID; | ||
1859 | entry.Flags = AccessList.Ban; | ||
1860 | entry.Time = new DateTime(); | ||
1861 | land.LandData.ParcelAccessList.Add(entry); | ||
1862 | return; | ||
1863 | } | ||
1864 | } | ||
1865 | } | ||
1866 | } | ||
1867 | } | ||
1527 | } | 1868 | } |
1528 | } | 1869 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 6864629..fcd993c 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -1,1013 +1,1045 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | 36 | ||
37 | namespace OpenSim.Region.CoreModules.World.Land | 37 | namespace OpenSim.Region.CoreModules.World.Land |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// Keeps track of a specific piece of land's information | 40 | /// Keeps track of a specific piece of land's information |
41 | /// </summary> | 41 | /// </summary> |
42 | public class LandObject : ILandObject | 42 | public class LandObject : ILandObject |
43 | { | 43 | { |
44 | #region Member Variables | 44 | #region Member Variables |
45 | 45 | ||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | #pragma warning disable 0429 | 47 | #pragma warning disable 0429 |
48 | private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; | 48 | private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; |
49 | #pragma warning restore 0429 | 49 | #pragma warning restore 0429 |
50 | private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; | 50 | private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; |
51 | 51 | ||
52 | private int m_lastSeqId = 0; | 52 | private int m_lastSeqId = 0; |
53 | 53 | ||
54 | protected LandData m_landData = new LandData(); | 54 | protected LandData m_landData = new LandData(); |
55 | protected Scene m_scene; | 55 | protected Scene m_scene; |
56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
57 | 57 | ||
58 | public bool[,] LandBitmap | 58 | public bool[,] LandBitmap |
59 | { | 59 | { |
60 | get { return m_landBitmap; } | 60 | get { return m_landBitmap; } |
61 | set { m_landBitmap = value; } | 61 | set { m_landBitmap = value; } |
62 | } | 62 | } |
63 | 63 | ||
64 | #endregion | 64 | #endregion |
65 | 65 | ||
66 | #region ILandObject Members | 66 | #region ILandObject Members |
67 | 67 | ||
68 | public LandData LandData | 68 | public LandData LandData |
69 | { | 69 | { |
70 | get { return m_landData; } | 70 | get { return m_landData; } |
71 | 71 | ||
72 | set { m_landData = value; } | 72 | set { m_landData = value; } |
73 | } | 73 | } |
74 | 74 | ||
75 | public UUID RegionUUID | 75 | public UUID RegionUUID |
76 | { | 76 | { |
77 | get { return m_scene.RegionInfo.RegionID; } | 77 | get { return m_scene.RegionInfo.RegionID; } |
78 | } | 78 | } |
79 | 79 | ||
80 | #region Constructors | 80 | #region Constructors |
81 | 81 | ||
82 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 82 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) |
83 | { | 83 | { |
84 | m_scene = scene; | 84 | m_scene = scene; |
85 | LandData.OwnerID = owner_id; | 85 | LandData.OwnerID = owner_id; |
86 | if (is_group_owned) | 86 | if (is_group_owned) |
87 | LandData.GroupID = owner_id; | 87 | LandData.GroupID = owner_id; |
88 | else | 88 | else |
89 | LandData.GroupID = UUID.Zero; | 89 | LandData.GroupID = UUID.Zero; |
90 | LandData.IsGroupOwned = is_group_owned; | 90 | LandData.IsGroupOwned = is_group_owned; |
91 | } | 91 | } |
92 | 92 | ||
93 | #endregion | 93 | #endregion |
94 | 94 | ||
95 | #region Member Functions | 95 | #region Member Functions |
96 | 96 | ||
97 | #region General Functions | 97 | #region General Functions |
98 | 98 | ||
99 | /// <summary> | 99 | /// <summary> |
100 | /// Checks to see if this land object contains a point | 100 | /// Checks to see if this land object contains a point |
101 | /// </summary> | 101 | /// </summary> |
102 | /// <param name="x"></param> | 102 | /// <param name="x"></param> |
103 | /// <param name="y"></param> | 103 | /// <param name="y"></param> |
104 | /// <returns>Returns true if the piece of land contains the specified point</returns> | 104 | /// <returns>Returns true if the piece of land contains the specified point</returns> |
105 | public bool ContainsPoint(int x, int y) | 105 | public bool ContainsPoint(int x, int y) |
106 | { | 106 | { |
107 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) | 107 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) |
108 | { | 108 | { |
109 | return (LandBitmap[x / 4, y / 4] == true); | 109 | return (LandBitmap[x / 4, y / 4] == true); |
110 | } | 110 | } |
111 | else | 111 | else |
112 | { | 112 | { |
113 | return false; | 113 | return false; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | public ILandObject Copy() | 117 | public ILandObject Copy() |
118 | { | 118 | { |
119 | ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene); | 119 | ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene); |
120 | 120 | ||
121 | //Place all new variables here! | 121 | //Place all new variables here! |
122 | newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); | 122 | newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); |
123 | newLand.LandData = LandData.Copy(); | 123 | newLand.LandData = LandData.Copy(); |
124 | 124 | ||
125 | return newLand; | 125 | return newLand; |
126 | } | 126 | } |
127 | 127 | ||
128 | static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; | 128 | static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; |
129 | static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; | 129 | static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; |
130 | 130 | ||
131 | public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) | 131 | public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) |
132 | { | 132 | { |
133 | overrideParcelMaxPrimCount = overrideDel; | 133 | overrideParcelMaxPrimCount = overrideDel; |
134 | } | 134 | } |
135 | public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) | 135 | public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) |
136 | { | 136 | { |
137 | overrideSimulatorMaxPrimCount = overrideDel; | 137 | overrideSimulatorMaxPrimCount = overrideDel; |
138 | } | 138 | } |
139 | 139 | ||
140 | public int GetParcelMaxPrimCount(ILandObject thisObject) | 140 | public int GetParcelMaxPrimCount(ILandObject thisObject) |
141 | { | 141 | { |
142 | if (overrideParcelMaxPrimCount != null) | 142 | if (overrideParcelMaxPrimCount != null) |
143 | { | 143 | { |
144 | return overrideParcelMaxPrimCount(thisObject); | 144 | return overrideParcelMaxPrimCount(thisObject); |
145 | } | 145 | } |
146 | else | 146 | else |
147 | { | 147 | { |
148 | // Normal Calculations | 148 | // Normal Calculations |
149 | return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 149 | return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) | 152 | public int GetSimulatorMaxPrimCount(ILandObject thisObject) |
153 | { | 153 | { |
154 | if (overrideSimulatorMaxPrimCount != null) | 154 | if (overrideSimulatorMaxPrimCount != null) |
155 | { | 155 | { |
156 | return overrideSimulatorMaxPrimCount(thisObject); | 156 | return overrideSimulatorMaxPrimCount(thisObject); |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | //Normal Calculations | 160 | //Normal Calculations |
161 | return m_scene.RegionInfo.ObjectCapacity; | 161 | return m_scene.RegionInfo.ObjectCapacity; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | #endregion | 164 | #endregion |
165 | 165 | ||
166 | #region Packet Request Handling | 166 | #region Packet Request Handling |
167 | 167 | ||
168 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) | 168 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) |
169 | { | 169 | { |
170 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | 170 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); |
171 | uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); | 171 | uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); |
172 | if (estateModule != null) | 172 | if (estateModule != null) |
173 | regionFlags = estateModule.GetRegionFlags(); | 173 | regionFlags = estateModule.GetRegionFlags(); |
174 | 174 | ||
175 | // In a perfect world, this would have worked. | 175 | // In a perfect world, this would have worked. |
176 | // | 176 | // |
177 | // if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0) | 177 | // if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0) |
178 | // regionFlags |= (uint)RegionFlags.AllowLandmark; | 178 | // regionFlags |= (uint)RegionFlags.AllowLandmark; |
179 | // if (landData.OwnerID == remote_client.AgentId) | 179 | // if (landData.OwnerID == remote_client.AgentId) |
180 | // regionFlags |= (uint)RegionFlags.AllowSetHome; | 180 | // regionFlags |= (uint)RegionFlags.AllowSetHome; |
181 | 181 | ||
182 | int seq_id; | 182 | int seq_id; |
183 | if (snap_selection && (sequence_id == 0)) | 183 | if (snap_selection && (sequence_id == 0)) |
184 | { | 184 | { |
185 | seq_id = m_lastSeqId; | 185 | seq_id = m_lastSeqId; |
186 | } | 186 | } |
187 | else | 187 | else |
188 | { | 188 | { |
189 | seq_id = sequence_id; | 189 | seq_id = sequence_id; |
190 | m_lastSeqId = seq_id; | 190 | m_lastSeqId = seq_id; |
191 | } | 191 | } |
192 | 192 | ||
193 | remote_client.SendLandProperties(seq_id, | 193 | remote_client.SendLandProperties(seq_id, |
194 | snap_selection, request_result, LandData, | 194 | snap_selection, request_result, LandData, |
195 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 195 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
196 | GetParcelMaxPrimCount(this), | 196 | GetParcelMaxPrimCount(this), |
197 | GetSimulatorMaxPrimCount(this), regionFlags); | 197 | GetSimulatorMaxPrimCount(this), regionFlags); |
198 | } | 198 | } |
199 | 199 | ||
200 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) | 200 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) |
201 | { | 201 | { |
202 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) | 202 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) |
203 | { | 203 | { |
204 | //Needs later group support | 204 | //Needs later group support |
205 | bool snap_selection = false; | 205 | bool snap_selection = false; |
206 | LandData newData = LandData.Copy(); | 206 | LandData newData = LandData.Copy(); |
207 | 207 | ||
208 | if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) | 208 | if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) |
209 | { | 209 | { |
210 | if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) | 210 | if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) |
211 | { | 211 | { |
212 | newData.AuthBuyerID = args.AuthBuyerID; | 212 | newData.AuthBuyerID = args.AuthBuyerID; |
213 | newData.SalePrice = args.SalePrice; | 213 | newData.SalePrice = args.SalePrice; |
214 | snap_selection = true; | 214 | snap_selection = true; |
215 | } | 215 | } |
216 | } | 216 | } |
217 | newData.Category = args.Category; | 217 | newData.Category = args.Category; |
218 | newData.Description = args.Desc; | 218 | newData.Description = args.Desc; |
219 | newData.GroupID = args.GroupID; | 219 | newData.GroupID = args.GroupID; |
220 | newData.LandingType = args.LandingType; | 220 | newData.LandingType = args.LandingType; |
221 | newData.MediaAutoScale = args.MediaAutoScale; | 221 | newData.MediaAutoScale = args.MediaAutoScale; |
222 | newData.MediaID = args.MediaID; | 222 | newData.MediaID = args.MediaID; |
223 | newData.MediaURL = args.MediaURL; | 223 | newData.MediaURL = args.MediaURL; |
224 | newData.MusicURL = args.MusicURL; | 224 | newData.MusicURL = args.MusicURL; |
225 | newData.Name = args.Name; | 225 | newData.Name = args.Name; |
226 | newData.Flags = args.ParcelFlags; | 226 | newData.Flags = args.ParcelFlags; |
227 | newData.PassHours = args.PassHours; | 227 | newData.PassHours = args.PassHours; |
228 | newData.PassPrice = args.PassPrice; | 228 | newData.PassPrice = args.PassPrice; |
229 | newData.SnapshotID = args.SnapshotID; | 229 | newData.SnapshotID = args.SnapshotID; |
230 | newData.UserLocation = args.UserLocation; | 230 | newData.UserLocation = args.UserLocation; |
231 | newData.UserLookAt = args.UserLookAt; | 231 | newData.UserLookAt = args.UserLookAt; |
232 | 232 | ||
233 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 233 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
234 | 234 | ||
235 | SendLandUpdateToAvatarsOverMe(snap_selection); | 235 | SendLandUpdateToAvatarsOverMe(snap_selection); |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | 239 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) |
240 | { | 240 | { |
241 | LandData newData = LandData.Copy(); | 241 | LandData newData = LandData.Copy(); |
242 | newData.OwnerID = avatarID; | 242 | newData.OwnerID = avatarID; |
243 | newData.GroupID = groupID; | 243 | newData.GroupID = groupID; |
244 | newData.IsGroupOwned = groupOwned; | 244 | newData.IsGroupOwned = groupOwned; |
245 | //newData.auctionID = AuctionID; | 245 | //newData.auctionID = AuctionID; |
246 | newData.ClaimDate = Util.UnixTimeSinceEpoch(); | 246 | newData.ClaimDate = Util.UnixTimeSinceEpoch(); |
247 | newData.ClaimPrice = claimprice; | 247 | newData.ClaimPrice = claimprice; |
248 | newData.SalePrice = 0; | 248 | newData.SalePrice = 0; |
249 | newData.AuthBuyerID = UUID.Zero; | 249 | newData.AuthBuyerID = UUID.Zero; |
250 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 250 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
251 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 251 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
252 | 252 | ||
253 | SendLandUpdateToAvatarsOverMe(true); | 253 | SendLandUpdateToAvatarsOverMe(true); |
254 | } | 254 | } |
255 | 255 | ||
256 | public void DeedToGroup(UUID groupID) | 256 | public void DeedToGroup(UUID groupID) |
257 | { | 257 | { |
258 | LandData newData = LandData.Copy(); | 258 | LandData newData = LandData.Copy(); |
259 | newData.OwnerID = groupID; | 259 | newData.OwnerID = groupID; |
260 | newData.GroupID = groupID; | 260 | newData.GroupID = groupID; |
261 | newData.IsGroupOwned = true; | 261 | newData.IsGroupOwned = true; |
262 | 262 | ||
263 | // Reset show in directory flag on deed | 263 | // Reset show in directory flag on deed |
264 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 264 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
265 | 265 | ||
266 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 266 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
267 | 267 | ||
268 | SendLandUpdateToAvatarsOverMe(true); | 268 | SendLandUpdateToAvatarsOverMe(true); |
269 | } | 269 | } |
270 | 270 | ||
271 | public bool IsEitherBannedOrRestricted(UUID avatar) | 271 | public bool IsEitherBannedOrRestricted(UUID avatar) |
272 | { | 272 | { |
273 | if (IsBannedFromLand(avatar)) | 273 | if (IsBannedFromLand(avatar)) |
274 | { | 274 | { |
275 | return true; | 275 | return true; |
276 | } | 276 | } |
277 | else if (IsRestrictedFromLand(avatar)) | 277 | else if (IsRestrictedFromLand(avatar)) |
278 | { | 278 | { |
279 | return true; | 279 | return true; |
280 | } | 280 | } |
281 | return false; | 281 | return false; |
282 | } | 282 | } |
283 | 283 | ||
284 | public bool IsBannedFromLand(UUID avatar) | 284 | public bool HasGroupAccess(UUID avatar) |
285 | { | 285 | { |
286 | if (m_scene.Permissions.IsAdministrator(avatar)) | 286 | if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) |
287 | return false; | 287 | { |
288 | 288 | IGroupsModule groupsModule = | |
289 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 289 | m_scene.RequestModuleInterface<IGroupsModule>(); |
290 | { | 290 | |
291 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 291 | List<UUID> agentGroups = new List<UUID>(); |
292 | entry.AgentID = avatar; | 292 | if (groupsModule != null) |
293 | entry.Flags = AccessList.Ban; | 293 | { |
294 | entry.Time = new DateTime(); | 294 | GroupMembershipData[] GroupMembership = |
295 | //See if they are on the list, but make sure the owner isn't banned | 295 | groupsModule.GetMembershipData(avatar); |
296 | if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) | 296 | |
297 | { | 297 | if (GroupMembership != null) |
298 | //They are banned, so lets send them a notice about this parcel | 298 | { |
299 | return true; | 299 | for (int i = 0; i < GroupMembership.Length; i++) |
300 | } | 300 | { |
301 | } | 301 | if (LandData.GroupID == GroupMembership[i].GroupID) |
302 | return false; | 302 | { |
303 | } | 303 | return true; |
304 | 304 | } | |
305 | public bool IsRestrictedFromLand(UUID avatar) | 305 | } |
306 | { | 306 | } |
307 | if (m_scene.Permissions.IsAdministrator(avatar)) | 307 | } |
308 | return false; | 308 | } |
309 | 309 | return false; | |
310 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 310 | } |
311 | { | 311 | |
312 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 312 | public bool IsBannedFromLand(UUID avatar) |
313 | entry.AgentID = avatar; | 313 | { |
314 | entry.Flags = AccessList.Access; | 314 | if (m_scene.Permissions.IsAdministrator(avatar)) |
315 | entry.Time = new DateTime(); | 315 | return false; |
316 | 316 | ||
317 | //If they are not on the access list and are not the owner | 317 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
318 | if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) | 318 | { |
319 | { | 319 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
320 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | 320 | entry.AgentID = avatar; |
321 | return true; | 321 | entry.Flags = AccessList.Ban; |
322 | } | 322 | entry.Time = new DateTime(); |
323 | } | 323 | //See if they are on the list, but make sure the owner isn't banned |
324 | return false; | 324 | if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) |
325 | } | 325 | { |
326 | 326 | //They are banned, so lets send them a notice about this parcel | |
327 | public void SendLandUpdateToClient(IClientAPI remote_client) | 327 | return true; |
328 | { | 328 | } |
329 | SendLandProperties(0, false, 0, remote_client); | 329 | } |
330 | } | 330 | return false; |
331 | 331 | } | |
332 | public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) | 332 | |
333 | { | 333 | public bool IsRestrictedFromLand(UUID avatar) |
334 | SendLandProperties(0, snap_selection, 0, remote_client); | 334 | { |
335 | } | 335 | if (m_scene.Permissions.IsAdministrator(avatar)) |
336 | 336 | return false; | |
337 | public void SendLandUpdateToAvatarsOverMe() | 337 | |
338 | { | 338 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
339 | SendLandUpdateToAvatarsOverMe(false); | 339 | { |
340 | } | 340 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
341 | 341 | entry.AgentID = avatar; | |
342 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) | 342 | entry.Flags = AccessList.Access; |
343 | { | 343 | entry.Time = new DateTime(); |
344 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) | 344 | |
345 | { | 345 | //If they are not on the access list and are not the owner |
346 | if (avatar.IsChildAgent) | 346 | if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) |
347 | return; | 347 | { |
348 | 348 | if (!HasGroupAccess(avatar)) | |
349 | ILandObject over = null; | 349 | { |
350 | try | 350 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel |
351 | { | 351 | return true; |
352 | over = | 352 | } |
353 | m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), | 353 | } |
354 | Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); | 354 | } |
355 | } | 355 | |
356 | catch (Exception) | 356 | return false; |
357 | { | 357 | } |
358 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + | 358 | |
359 | Math.Round(avatar.AbsolutePosition.Y)); | 359 | public void SendLandUpdateToClient(IClientAPI remote_client) |
360 | } | 360 | { |
361 | 361 | SendLandProperties(0, false, 0, remote_client); | |
362 | if (over != null) | 362 | } |
363 | { | 363 | |
364 | if (over.LandData.LocalID == LandData.LocalID) | 364 | public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) |
365 | { | 365 | { |
366 | if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && | 366 | SendLandProperties(0, snap_selection, 0, remote_client); |
367 | m_scene.RegionInfo.RegionSettings.AllowDamage) | 367 | } |
368 | avatar.Invulnerable = false; | 368 | |
369 | else | 369 | public void SendLandUpdateToAvatarsOverMe() |
370 | avatar.Invulnerable = true; | 370 | { |
371 | 371 | SendLandUpdateToAvatarsOverMe(false); | |
372 | SendLandUpdateToClient(snap_selection, avatar.ControllingClient); | 372 | } |
373 | } | 373 | |
374 | } | 374 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) |
375 | }); | 375 | { |
376 | } | 376 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) |
377 | 377 | { | |
378 | #endregion | 378 | if (avatar.IsChildAgent) |
379 | 379 | return; | |
380 | #region AccessList Functions | 380 | |
381 | 381 | ILandObject over = null; | |
382 | public List<UUID> CreateAccessListArrayByFlag(AccessList flag) | 382 | try |
383 | { | 383 | { |
384 | List<UUID> list = new List<UUID>(); | 384 | over = |
385 | foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) | 385 | m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), |
386 | { | 386 | Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); |
387 | if (entry.Flags == flag) | 387 | } |
388 | { | 388 | catch (Exception) |
389 | list.Add(entry.AgentID); | 389 | { |
390 | } | 390 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + |
391 | } | 391 | Math.Round(avatar.AbsolutePosition.Y)); |
392 | if (list.Count == 0) | 392 | } |
393 | { | 393 | |
394 | list.Add(UUID.Zero); | 394 | if (over != null) |
395 | } | 395 | { |
396 | 396 | if (over.LandData.LocalID == LandData.LocalID) | |
397 | return list; | 397 | { |
398 | } | 398 | if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && |
399 | 399 | m_scene.RegionInfo.RegionSettings.AllowDamage) | |
400 | public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, | 400 | avatar.Invulnerable = false; |
401 | IClientAPI remote_client) | 401 | else |
402 | { | 402 | avatar.Invulnerable = true; |
403 | 403 | ||
404 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) | 404 | SendLandUpdateToClient(snap_selection, avatar.ControllingClient); |
405 | { | 405 | } |
406 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); | 406 | } |
407 | remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); | 407 | }); |
408 | } | 408 | } |
409 | 409 | ||
410 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) | 410 | #endregion |
411 | { | 411 | |
412 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); | 412 | #region AccessList Functions |
413 | remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); | 413 | |
414 | } | 414 | public List<UUID> CreateAccessListArrayByFlag(AccessList flag) |
415 | } | 415 | { |
416 | 416 | List<UUID> list = new List<UUID>(); | |
417 | public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) | 417 | foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) |
418 | { | 418 | { |
419 | LandData newData = LandData.Copy(); | 419 | if (entry.Flags == flag) |
420 | 420 | { | |
421 | if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) | 421 | list.Add(entry.AgentID); |
422 | { | 422 | } |
423 | entries.Clear(); | 423 | } |
424 | } | 424 | if (list.Count == 0) |
425 | 425 | { | |
426 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); | 426 | list.Add(UUID.Zero); |
427 | foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) | 427 | } |
428 | { | 428 | |
429 | if (entry.Flags == (AccessList)flags) | 429 | return list; |
430 | { | 430 | } |
431 | toRemove.Add(entry); | 431 | |
432 | } | 432 | public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, |
433 | } | 433 | IClientAPI remote_client) |
434 | 434 | { | |
435 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) | 435 | |
436 | { | 436 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) |
437 | newData.ParcelAccessList.Remove(entry); | 437 | { |
438 | } | 438 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); |
439 | foreach (ParcelManager.ParcelAccessEntry entry in entries) | 439 | remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); |
440 | { | 440 | } |
441 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); | 441 | |
442 | temp.AgentID = entry.AgentID; | 442 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) |
443 | temp.Time = new DateTime(); //Pointless? Yes. | 443 | { |
444 | temp.Flags = (AccessList)flags; | 444 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); |
445 | 445 | remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); | |
446 | if (!newData.ParcelAccessList.Contains(temp)) | 446 | } |
447 | { | 447 | } |
448 | newData.ParcelAccessList.Add(temp); | 448 | |
449 | } | 449 | public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) |
450 | } | 450 | { |
451 | 451 | LandData newData = LandData.Copy(); | |
452 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 452 | |
453 | } | 453 | if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) |
454 | 454 | { | |
455 | #endregion | 455 | entries.Clear(); |
456 | 456 | } | |
457 | #region Update Functions | 457 | |
458 | 458 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); | |
459 | public void UpdateLandBitmapByteArray() | 459 | foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) |
460 | { | 460 | { |
461 | LandData.Bitmap = ConvertLandBitmapToBytes(); | 461 | if (entry.Flags == (AccessList)flags) |
462 | } | 462 | { |
463 | 463 | toRemove.Add(entry); | |
464 | /// <summary> | 464 | } |
465 | /// Update all settings in land such as area, bitmap byte array, etc | 465 | } |
466 | /// </summary> | 466 | |
467 | public void ForceUpdateLandInfo() | 467 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) |
468 | { | 468 | { |
469 | UpdateAABBAndAreaValues(); | 469 | newData.ParcelAccessList.Remove(entry); |
470 | UpdateLandBitmapByteArray(); | 470 | } |
471 | } | 471 | foreach (ParcelManager.ParcelAccessEntry entry in entries) |
472 | 472 | { | |
473 | public void SetLandBitmapFromByteArray() | 473 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); |
474 | { | 474 | temp.AgentID = entry.AgentID; |
475 | LandBitmap = ConvertBytesToLandBitmap(); | 475 | temp.Time = new DateTime(); //Pointless? Yes. |
476 | } | 476 | temp.Flags = (AccessList)flags; |
477 | 477 | ||
478 | /// <summary> | 478 | if (!newData.ParcelAccessList.Contains(temp)) |
479 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object | 479 | { |
480 | /// </summary> | 480 | newData.ParcelAccessList.Add(temp); |
481 | private void UpdateAABBAndAreaValues() | 481 | } |
482 | { | 482 | } |
483 | int min_x = 64; | 483 | |
484 | int min_y = 64; | 484 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
485 | int max_x = 0; | 485 | } |
486 | int max_y = 0; | 486 | |
487 | int tempArea = 0; | 487 | #endregion |
488 | int x, y; | 488 | |
489 | for (x = 0; x < 64; x++) | 489 | #region Update Functions |
490 | { | 490 | |
491 | for (y = 0; y < 64; y++) | 491 | public void UpdateLandBitmapByteArray() |
492 | { | 492 | { |
493 | if (LandBitmap[x, y] == true) | 493 | LandData.Bitmap = ConvertLandBitmapToBytes(); |
494 | { | 494 | } |
495 | if (min_x > x) min_x = x; | 495 | |
496 | if (min_y > y) min_y = y; | 496 | /// <summary> |
497 | if (max_x < x) max_x = x; | 497 | /// Update all settings in land such as area, bitmap byte array, etc |
498 | if (max_y < y) max_y = y; | 498 | /// </summary> |
499 | tempArea += 16; //16sqm peice of land | 499 | public void ForceUpdateLandInfo() |
500 | } | 500 | { |
501 | } | 501 | UpdateAABBAndAreaValues(); |
502 | } | 502 | UpdateLandBitmapByteArray(); |
503 | int tx = min_x * 4; | 503 | } |
504 | if (tx > ((int)Constants.RegionSize - 1)) | 504 | |
505 | tx = ((int)Constants.RegionSize - 1); | 505 | public void SetLandBitmapFromByteArray() |
506 | int ty = min_y * 4; | 506 | { |
507 | if (ty > ((int)Constants.RegionSize - 1)) | 507 | LandBitmap = ConvertBytesToLandBitmap(); |
508 | ty = ((int)Constants.RegionSize - 1); | 508 | } |
509 | LandData.AABBMin = | 509 | |
510 | new Vector3((float) (min_x * 4), (float) (min_y * 4), | 510 | /// <summary> |
511 | (float) m_scene.Heightmap[tx, ty]); | 511 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object |
512 | 512 | /// </summary> | |
513 | tx = max_x * 4; | 513 | private void UpdateAABBAndAreaValues() |
514 | if (tx > ((int)Constants.RegionSize - 1)) | 514 | { |
515 | tx = ((int)Constants.RegionSize - 1); | 515 | int min_x = 64; |
516 | ty = max_y * 4; | 516 | int min_y = 64; |
517 | if (ty > ((int)Constants.RegionSize - 1)) | 517 | int max_x = 0; |
518 | ty = ((int)Constants.RegionSize - 1); | 518 | int max_y = 0; |
519 | LandData.AABBMax = | 519 | int tempArea = 0; |
520 | new Vector3((float) (max_x * 4), (float) (max_y * 4), | 520 | int x, y; |
521 | (float) m_scene.Heightmap[tx, ty]); | 521 | for (x = 0; x < 64; x++) |
522 | LandData.Area = tempArea; | 522 | { |
523 | } | 523 | for (y = 0; y < 64; y++) |
524 | 524 | { | |
525 | #endregion | 525 | if (LandBitmap[x, y] == true) |
526 | 526 | { | |
527 | #region Land Bitmap Functions | 527 | if (min_x > x) min_x = x; |
528 | 528 | if (min_y > y) min_y = y; | |
529 | /// <summary> | 529 | if (max_x < x) max_x = x; |
530 | /// Sets the land's bitmap manually | 530 | if (max_y < y) max_y = y; |
531 | /// </summary> | 531 | tempArea += 16; //16sqm peice of land |
532 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> | 532 | } |
533 | public void SetLandBitmap(bool[,] bitmap) | 533 | } |
534 | { | 534 | } |
535 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) | 535 | int tx = min_x * 4; |
536 | { | 536 | if (tx > ((int)Constants.RegionSize - 1)) |
537 | //Throw an exception - The bitmap is not 64x64 | 537 | tx = ((int)Constants.RegionSize - 1); |
538 | //throw new Exception("Error: Invalid Parcel Bitmap"); | 538 | int ty = min_y * 4; |
539 | } | 539 | if (ty > ((int)Constants.RegionSize - 1)) |
540 | else | 540 | ty = ((int)Constants.RegionSize - 1); |
541 | { | 541 | LandData.AABBMin = |
542 | //Valid: Lets set it | 542 | new Vector3((float) (min_x * 4), (float) (min_y * 4), |
543 | LandBitmap = bitmap; | 543 | (float) m_scene.Heightmap[tx, ty]); |
544 | ForceUpdateLandInfo(); | 544 | |
545 | } | 545 | tx = max_x * 4; |
546 | } | 546 | if (tx > ((int)Constants.RegionSize - 1)) |
547 | 547 | tx = ((int)Constants.RegionSize - 1); | |
548 | /// <summary> | 548 | ty = max_y * 4; |
549 | /// Gets the land's bitmap manually | 549 | if (ty > ((int)Constants.RegionSize - 1)) |
550 | /// </summary> | 550 | ty = ((int)Constants.RegionSize - 1); |
551 | /// <returns></returns> | 551 | LandData.AABBMax = |
552 | public bool[,] GetLandBitmap() | 552 | new Vector3((float) (max_x * 4), (float) (max_y * 4), |
553 | { | 553 | (float) m_scene.Heightmap[tx, ty]); |
554 | return LandBitmap; | 554 | LandData.Area = tempArea; |
555 | } | 555 | } |
556 | 556 | ||
557 | /// <summary> | 557 | #endregion |
558 | /// Full sim land object creation | 558 | |
559 | /// </summary> | 559 | #region Land Bitmap Functions |
560 | /// <returns></returns> | 560 | |
561 | public bool[,] BasicFullRegionLandBitmap() | 561 | /// <summary> |
562 | { | 562 | /// Sets the land's bitmap manually |
563 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); | 563 | /// </summary> |
564 | } | 564 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> |
565 | 565 | public void SetLandBitmap(bool[,] bitmap) | |
566 | /// <summary> | 566 | { |
567 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | 567 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) |
568 | /// </summary> | 568 | { |
569 | /// <param name="start_x"></param> | 569 | //Throw an exception - The bitmap is not 64x64 |
570 | /// <param name="start_y"></param> | 570 | //throw new Exception("Error: Invalid Parcel Bitmap"); |
571 | /// <param name="end_x"></param> | 571 | } |
572 | /// <param name="end_y"></param> | 572 | else |
573 | /// <returns></returns> | 573 | { |
574 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) | 574 | //Valid: Lets set it |
575 | { | 575 | LandBitmap = bitmap; |
576 | bool[,] tempBitmap = new bool[64,64]; | 576 | ForceUpdateLandInfo(); |
577 | tempBitmap.Initialize(); | 577 | } |
578 | 578 | } | |
579 | tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | 579 | |
580 | return tempBitmap; | 580 | /// <summary> |
581 | } | 581 | /// Gets the land's bitmap manually |
582 | 582 | /// </summary> | |
583 | /// <summary> | 583 | /// <returns></returns> |
584 | /// Change a land bitmap at within a square and set those points to a specific value | 584 | public bool[,] GetLandBitmap() |
585 | /// </summary> | 585 | { |
586 | /// <param name="land_bitmap"></param> | 586 | return LandBitmap; |
587 | /// <param name="start_x"></param> | 587 | } |
588 | /// <param name="start_y"></param> | 588 | |
589 | /// <param name="end_x"></param> | 589 | /// <summary> |
590 | /// <param name="end_y"></param> | 590 | /// Full sim land object creation |
591 | /// <param name="set_value"></param> | 591 | /// </summary> |
592 | /// <returns></returns> | 592 | /// <returns></returns> |
593 | public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, | 593 | public bool[,] BasicFullRegionLandBitmap() |
594 | bool set_value) | 594 | { |
595 | { | 595 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); |
596 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) | 596 | } |
597 | { | 597 | |
598 | //Throw an exception - The bitmap is not 64x64 | 598 | /// <summary> |
599 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); | 599 | /// Used to modify the bitmap between the x and y points. Points use 64 scale |
600 | } | 600 | /// </summary> |
601 | 601 | /// <param name="start_x"></param> | |
602 | int x, y; | 602 | /// <param name="start_y"></param> |
603 | for (y = 0; y < 64; y++) | 603 | /// <param name="end_x"></param> |
604 | { | 604 | /// <param name="end_y"></param> |
605 | for (x = 0; x < 64; x++) | 605 | /// <returns></returns> |
606 | { | 606 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) |
607 | if (x >= start_x / 4 && x < end_x / 4 | 607 | { |
608 | && y >= start_y / 4 && y < end_y / 4) | 608 | bool[,] tempBitmap = new bool[64,64]; |
609 | { | 609 | tempBitmap.Initialize(); |
610 | land_bitmap[x, y] = set_value; | 610 | |
611 | } | 611 | tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); |
612 | } | 612 | return tempBitmap; |
613 | } | 613 | } |
614 | return land_bitmap; | 614 | |
615 | } | 615 | /// <summary> |
616 | 616 | /// Change a land bitmap at within a square and set those points to a specific value | |
617 | /// <summary> | 617 | /// </summary> |
618 | /// Join the true values of 2 bitmaps together | 618 | /// <param name="land_bitmap"></param> |
619 | /// </summary> | 619 | /// <param name="start_x"></param> |
620 | /// <param name="bitmap_base"></param> | 620 | /// <param name="start_y"></param> |
621 | /// <param name="bitmap_add"></param> | 621 | /// <param name="end_x"></param> |
622 | /// <returns></returns> | 622 | /// <param name="end_y"></param> |
623 | public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) | 623 | /// <param name="set_value"></param> |
624 | { | 624 | /// <returns></returns> |
625 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) | 625 | public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, |
626 | { | 626 | bool set_value) |
627 | //Throw an exception - The bitmap is not 64x64 | 627 | { |
628 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); | 628 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) |
629 | } | 629 | { |
630 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) | 630 | //Throw an exception - The bitmap is not 64x64 |
631 | { | 631 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); |
632 | //Throw an exception - The bitmap is not 64x64 | 632 | } |
633 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); | 633 | |
634 | } | 634 | int x, y; |
635 | 635 | for (y = 0; y < 64; y++) | |
636 | int x, y; | 636 | { |
637 | for (y = 0; y < 64; y++) | 637 | for (x = 0; x < 64; x++) |
638 | { | 638 | { |
639 | for (x = 0; x < 64; x++) | 639 | if (x >= start_x / 4 && x < end_x / 4 |
640 | { | 640 | && y >= start_y / 4 && y < end_y / 4) |
641 | if (bitmap_add[x, y]) | 641 | { |
642 | { | 642 | land_bitmap[x, y] = set_value; |
643 | bitmap_base[x, y] = true; | 643 | } |
644 | } | 644 | } |
645 | } | 645 | } |
646 | } | 646 | return land_bitmap; |
647 | return bitmap_base; | 647 | } |
648 | } | 648 | |
649 | 649 | /// <summary> | |
650 | /// <summary> | 650 | /// Join the true values of 2 bitmaps together |
651 | /// Converts the land bitmap to a packet friendly byte array | 651 | /// </summary> |
652 | /// </summary> | 652 | /// <param name="bitmap_base"></param> |
653 | /// <returns></returns> | 653 | /// <param name="bitmap_add"></param> |
654 | private byte[] ConvertLandBitmapToBytes() | 654 | /// <returns></returns> |
655 | { | 655 | public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) |
656 | byte[] tempConvertArr = new byte[512]; | 656 | { |
657 | byte tempByte = 0; | 657 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) |
658 | int x, y, i, byteNum = 0; | 658 | { |
659 | i = 0; | 659 | //Throw an exception - The bitmap is not 64x64 |
660 | for (y = 0; y < 64; y++) | 660 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); |
661 | { | 661 | } |
662 | for (x = 0; x < 64; x++) | 662 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) |
663 | { | 663 | { |
664 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); | 664 | //Throw an exception - The bitmap is not 64x64 |
665 | if (i % 8 == 0) | 665 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); |
666 | { | 666 | } |
667 | tempConvertArr[byteNum] = tempByte; | 667 | |
668 | tempByte = (byte) 0; | 668 | int x, y; |
669 | i = 0; | 669 | for (y = 0; y < 64; y++) |
670 | byteNum++; | 670 | { |
671 | } | 671 | for (x = 0; x < 64; x++) |
672 | } | 672 | { |
673 | } | 673 | if (bitmap_add[x, y]) |
674 | return tempConvertArr; | 674 | { |
675 | } | 675 | bitmap_base[x, y] = true; |
676 | 676 | } | |
677 | private bool[,] ConvertBytesToLandBitmap() | 677 | } |
678 | { | 678 | } |
679 | bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; | 679 | return bitmap_base; |
680 | tempConvertMap.Initialize(); | 680 | } |
681 | byte tempByte = 0; | 681 | |
682 | int x = 0, y = 0, i = 0, bitNum = 0; | 682 | /// <summary> |
683 | for (i = 0; i < 512; i++) | 683 | /// Converts the land bitmap to a packet friendly byte array |
684 | { | 684 | /// </summary> |
685 | tempByte = LandData.Bitmap[i]; | 685 | /// <returns></returns> |
686 | for (bitNum = 0; bitNum < 8; bitNum++) | 686 | private byte[] ConvertLandBitmapToBytes() |
687 | { | 687 | { |
688 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); | 688 | byte[] tempConvertArr = new byte[512]; |
689 | tempConvertMap[x, y] = bit; | 689 | byte tempByte = 0; |
690 | x++; | 690 | int x, y, i, byteNum = 0; |
691 | if (x > 63) | 691 | i = 0; |
692 | { | 692 | for (y = 0; y < 64; y++) |
693 | x = 0; | 693 | { |
694 | y++; | 694 | for (x = 0; x < 64; x++) |
695 | } | 695 | { |
696 | } | 696 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); |
697 | } | 697 | if (i % 8 == 0) |
698 | return tempConvertMap; | 698 | { |
699 | } | 699 | tempConvertArr[byteNum] = tempByte; |
700 | 700 | tempByte = (byte) 0; | |
701 | #endregion | 701 | i = 0; |
702 | 702 | byteNum++; | |
703 | #region Object Select and Object Owner Listing | 703 | } |
704 | 704 | } | |
705 | public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) | 705 | } |
706 | { | 706 | return tempConvertArr; |
707 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) | 707 | } |
708 | { | 708 | |
709 | List<uint> resultLocalIDs = new List<uint>(); | 709 | private bool[,] ConvertBytesToLandBitmap() |
710 | try | 710 | { |
711 | { | 711 | bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; |
712 | lock (primsOverMe) | 712 | tempConvertMap.Initialize(); |
713 | { | 713 | byte tempByte = 0; |
714 | foreach (SceneObjectGroup obj in primsOverMe) | 714 | int x = 0, y = 0, i = 0, bitNum = 0; |
715 | { | 715 | for (i = 0; i < 512; i++) |
716 | if (obj.LocalId > 0) | 716 | { |
717 | { | 717 | tempByte = LandData.Bitmap[i]; |
718 | if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID) | 718 | for (bitNum = 0; bitNum < 8; bitNum++) |
719 | { | 719 | { |
720 | resultLocalIDs.Add(obj.LocalId); | 720 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); |
721 | } | 721 | tempConvertMap[x, y] = bit; |
722 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero) | 722 | x++; |
723 | { | 723 | if (x > 63) |
724 | resultLocalIDs.Add(obj.LocalId); | 724 | { |
725 | } | 725 | x = 0; |
726 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && | 726 | y++; |
727 | obj.OwnerID != remote_client.AgentId) | 727 | } |
728 | { | 728 | } |
729 | resultLocalIDs.Add(obj.LocalId); | 729 | } |
730 | } | 730 | return tempConvertMap; |
731 | else if (request_type == (int)ObjectReturnType.List && returnIDs.Contains(obj.OwnerID)) | 731 | } |
732 | { | 732 | |
733 | resultLocalIDs.Add(obj.LocalId); | 733 | #endregion |
734 | } | 734 | |
735 | } | 735 | #region Object Select and Object Owner Listing |
736 | } | 736 | |
737 | } | 737 | public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) |
738 | } catch (InvalidOperationException) | 738 | { |
739 | { | 739 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) |
740 | m_log.Error("[LAND]: Unable to force select the parcel objects. Arr."); | 740 | { |
741 | } | 741 | List<uint> resultLocalIDs = new List<uint>(); |
742 | 742 | try | |
743 | remote_client.SendForceClientSelectObjects(resultLocalIDs); | 743 | { |
744 | } | 744 | lock (primsOverMe) |
745 | } | 745 | { |
746 | 746 | foreach (SceneObjectGroup obj in primsOverMe) | |
747 | /// <summary> | 747 | { |
748 | /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes | 748 | if (obj.LocalId > 0) |
749 | /// aggreagete details such as the number of prims. | 749 | { |
750 | /// | 750 | if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID) |
751 | /// </summary> | 751 | { |
752 | /// <param name="remote_client"> | 752 | resultLocalIDs.Add(obj.LocalId); |
753 | /// A <see cref="IClientAPI"/> | 753 | } |
754 | /// </param> | 754 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero) |
755 | public void SendLandObjectOwners(IClientAPI remote_client) | 755 | { |
756 | { | 756 | resultLocalIDs.Add(obj.LocalId); |
757 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) | 757 | } |
758 | { | 758 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && |
759 | Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); | 759 | obj.OwnerID != remote_client.AgentId) |
760 | List<UUID> groups = new List<UUID>(); | 760 | { |
761 | 761 | resultLocalIDs.Add(obj.LocalId); | |
762 | lock (primsOverMe) | 762 | } |
763 | { | 763 | else if (request_type == (int)ObjectReturnType.List && returnIDs.Contains(obj.OwnerID)) |
764 | try | 764 | { |
765 | { | 765 | resultLocalIDs.Add(obj.LocalId); |
766 | 766 | } | |
767 | foreach (SceneObjectGroup obj in primsOverMe) | 767 | } |
768 | { | 768 | } |
769 | try | 769 | } |
770 | { | 770 | } catch (InvalidOperationException) |
771 | if (!primCount.ContainsKey(obj.OwnerID)) | 771 | { |
772 | { | 772 | m_log.Error("[LAND]: Unable to force select the parcel objects. Arr."); |
773 | primCount.Add(obj.OwnerID, 0); | 773 | } |
774 | } | 774 | |
775 | } | 775 | remote_client.SendForceClientSelectObjects(resultLocalIDs); |
776 | catch (NullReferenceException) | 776 | } |
777 | { | 777 | } |
778 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); | 778 | |
779 | } | 779 | /// <summary> |
780 | try | 780 | /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes |
781 | { | 781 | /// aggreagete details such as the number of prims. |
782 | primCount[obj.OwnerID] += obj.PrimCount; | 782 | /// |
783 | } | 783 | /// </summary> |
784 | catch (KeyNotFoundException) | 784 | /// <param name="remote_client"> |
785 | { | 785 | /// A <see cref="IClientAPI"/> |
786 | m_log.Error("[LAND]: Unable to match a prim with it's owner."); | 786 | /// </param> |
787 | } | 787 | public void SendLandObjectOwners(IClientAPI remote_client) |
788 | if (obj.OwnerID == obj.GroupID && (!groups.Contains(obj.OwnerID))) | 788 | { |
789 | groups.Add(obj.OwnerID); | 789 | if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) |
790 | } | 790 | { |
791 | } | 791 | Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); |
792 | catch (InvalidOperationException) | 792 | List<UUID> groups = new List<UUID>(); |
793 | { | 793 | |
794 | m_log.Error("[LAND]: Unable to Enumerate Land object arr."); | 794 | lock (primsOverMe) |
795 | } | 795 | { |
796 | } | 796 | try |
797 | 797 | { | |
798 | remote_client.SendLandObjectOwners(LandData, groups, primCount); | 798 | |
799 | } | 799 | foreach (SceneObjectGroup obj in primsOverMe) |
800 | } | 800 | { |
801 | 801 | try | |
802 | public Dictionary<UUID, int> GetLandObjectOwners() | 802 | { |
803 | { | 803 | if (!primCount.ContainsKey(obj.OwnerID)) |
804 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); | 804 | { |
805 | lock (primsOverMe) | 805 | primCount.Add(obj.OwnerID, 0); |
806 | { | 806 | } |
807 | try | 807 | } |
808 | { | 808 | catch (NullReferenceException) |
809 | 809 | { | |
810 | foreach (SceneObjectGroup obj in primsOverMe) | 810 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); |
811 | { | 811 | } |
812 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | 812 | try |
813 | { | 813 | { |
814 | ownersAndCount.Add(obj.OwnerID, 0); | 814 | primCount[obj.OwnerID] += obj.PrimCount; |
815 | } | 815 | } |
816 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | 816 | catch (KeyNotFoundException) |
817 | } | 817 | { |
818 | } | 818 | m_log.Error("[LAND]: Unable to match a prim with it's owner."); |
819 | catch (InvalidOperationException) | 819 | } |
820 | { | 820 | if (obj.OwnerID == obj.GroupID && (!groups.Contains(obj.OwnerID))) |
821 | m_log.Error("[LAND]: Unable to enumerate land owners. arr."); | 821 | groups.Add(obj.OwnerID); |
822 | } | 822 | } |
823 | 823 | } | |
824 | } | 824 | catch (InvalidOperationException) |
825 | return ownersAndCount; | 825 | { |
826 | } | 826 | m_log.Error("[LAND]: Unable to Enumerate Land object arr."); |
827 | 827 | } | |
828 | #endregion | 828 | } |
829 | 829 | ||
830 | #region Object Returning | 830 | remote_client.SendLandObjectOwners(LandData, groups, primCount); |
831 | 831 | } | |
832 | public void ReturnObject(SceneObjectGroup obj) | 832 | } |
833 | { | 833 | |
834 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | 834 | public Dictionary<UUID, int> GetLandObjectOwners() |
835 | objs[0] = obj; | 835 | { |
836 | m_scene.returnObjects(objs, obj.OwnerID); | 836 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); |
837 | } | 837 | lock (primsOverMe) |
838 | 838 | { | |
839 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) | 839 | try |
840 | { | 840 | { |
841 | Dictionary<UUID,List<SceneObjectGroup>> returns = | 841 | |
842 | new Dictionary<UUID,List<SceneObjectGroup>>(); | 842 | foreach (SceneObjectGroup obj in primsOverMe) |
843 | 843 | { | |
844 | lock (primsOverMe) | 844 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) |
845 | { | 845 | { |
846 | if (type == (uint)ObjectReturnType.Owner) | 846 | ownersAndCount.Add(obj.OwnerID, 0); |
847 | { | 847 | } |
848 | foreach (SceneObjectGroup obj in primsOverMe) | 848 | ownersAndCount[obj.OwnerID] += obj.PrimCount; |
849 | { | 849 | } |
850 | if (obj.OwnerID == m_landData.OwnerID) | 850 | } |
851 | { | 851 | catch (InvalidOperationException) |
852 | if (!returns.ContainsKey(obj.OwnerID)) | 852 | { |
853 | returns[obj.OwnerID] = | 853 | m_log.Error("[LAND]: Unable to enumerate land owners. arr."); |
854 | new List<SceneObjectGroup>(); | 854 | } |
855 | returns[obj.OwnerID].Add(obj); | 855 | |
856 | } | 856 | } |
857 | } | 857 | return ownersAndCount; |
858 | } | 858 | } |
859 | else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) | 859 | |
860 | { | 860 | #endregion |
861 | foreach (SceneObjectGroup obj in primsOverMe) | 861 | |
862 | { | 862 | #region Object Returning |
863 | if (obj.GroupID == m_landData.GroupID) | 863 | |
864 | { | 864 | public void ReturnObject(SceneObjectGroup obj) |
865 | if (!returns.ContainsKey(obj.OwnerID)) | 865 | { |
866 | returns[obj.OwnerID] = | 866 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; |
867 | new List<SceneObjectGroup>(); | 867 | objs[0] = obj; |
868 | returns[obj.OwnerID].Add(obj); | 868 | m_scene.returnObjects(objs, obj.OwnerID); |
869 | } | 869 | } |
870 | } | 870 | |
871 | } | 871 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) |
872 | else if (type == (uint)ObjectReturnType.Other) | 872 | { |
873 | { | 873 | Dictionary<UUID,List<SceneObjectGroup>> returns = |
874 | foreach (SceneObjectGroup obj in primsOverMe) | 874 | new Dictionary<UUID,List<SceneObjectGroup>>(); |
875 | { | 875 | |
876 | if (obj.OwnerID != m_landData.OwnerID && | 876 | lock (primsOverMe) |
877 | (obj.GroupID != m_landData.GroupID || | 877 | { |
878 | m_landData.GroupID == UUID.Zero)) | 878 | if (type == (uint)ObjectReturnType.Owner) |
879 | { | 879 | { |
880 | if (!returns.ContainsKey(obj.OwnerID)) | 880 | foreach (SceneObjectGroup obj in primsOverMe) |
881 | returns[obj.OwnerID] = | 881 | { |
882 | new List<SceneObjectGroup>(); | 882 | if (obj.OwnerID == m_landData.OwnerID) |
883 | returns[obj.OwnerID].Add(obj); | 883 | { |
884 | } | 884 | if (!returns.ContainsKey(obj.OwnerID)) |
885 | } | 885 | returns[obj.OwnerID] = |
886 | } | 886 | new List<SceneObjectGroup>(); |
887 | else if (type == (uint)ObjectReturnType.List) | 887 | returns[obj.OwnerID].Add(obj); |
888 | { | 888 | } |
889 | List<UUID> ownerlist = new List<UUID>(owners); | 889 | } |
890 | 890 | } | |
891 | foreach (SceneObjectGroup obj in primsOverMe) | 891 | else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) |
892 | { | 892 | { |
893 | if (ownerlist.Contains(obj.OwnerID)) | 893 | foreach (SceneObjectGroup obj in primsOverMe) |
894 | { | 894 | { |
895 | if (!returns.ContainsKey(obj.OwnerID)) | 895 | if (obj.GroupID == m_landData.GroupID) |
896 | returns[obj.OwnerID] = | 896 | { |
897 | new List<SceneObjectGroup>(); | 897 | if (!returns.ContainsKey(obj.OwnerID)) |
898 | returns[obj.OwnerID].Add(obj); | 898 | returns[obj.OwnerID] = |
899 | } | 899 | new List<SceneObjectGroup>(); |
900 | } | 900 | returns[obj.OwnerID].Add(obj); |
901 | } | 901 | } |
902 | } | 902 | } |
903 | 903 | } | |
904 | foreach (List<SceneObjectGroup> ol in returns.Values) | 904 | else if (type == (uint)ObjectReturnType.Other) |
905 | { | 905 | { |
906 | if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) | 906 | foreach (SceneObjectGroup obj in primsOverMe) |
907 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); | 907 | { |
908 | } | 908 | if (obj.OwnerID != m_landData.OwnerID && |
909 | } | 909 | (obj.GroupID != m_landData.GroupID || |
910 | 910 | m_landData.GroupID == UUID.Zero)) | |
911 | #endregion | 911 | { |
912 | 912 | if (!returns.ContainsKey(obj.OwnerID)) | |
913 | #region Object Adding/Removing from Parcel | 913 | returns[obj.OwnerID] = |
914 | 914 | new List<SceneObjectGroup>(); | |
915 | public void ResetLandPrimCounts() | 915 | returns[obj.OwnerID].Add(obj); |
916 | { | 916 | } |
917 | LandData.GroupPrims = 0; | 917 | } |
918 | LandData.OwnerPrims = 0; | 918 | } |
919 | LandData.OtherPrims = 0; | 919 | else if (type == (uint)ObjectReturnType.List) |
920 | LandData.SelectedPrims = 0; | 920 | { |
921 | 921 | List<UUID> ownerlist = new List<UUID>(owners); | |
922 | 922 | ||
923 | lock (primsOverMe) | 923 | foreach (SceneObjectGroup obj in primsOverMe) |
924 | primsOverMe.Clear(); | 924 | { |
925 | } | 925 | if (ownerlist.Contains(obj.OwnerID)) |
926 | 926 | { | |
927 | public void AddPrimToCount(SceneObjectGroup obj) | 927 | if (!returns.ContainsKey(obj.OwnerID)) |
928 | { | 928 | returns[obj.OwnerID] = |
929 | 929 | new List<SceneObjectGroup>(); | |
930 | UUID prim_owner = obj.OwnerID; | 930 | returns[obj.OwnerID].Add(obj); |
931 | int prim_count = obj.PrimCount; | 931 | } |
932 | 932 | } | |
933 | if (obj.IsSelected) | 933 | } |
934 | { | 934 | } |
935 | LandData.SelectedPrims += prim_count; | 935 | |
936 | } | 936 | foreach (List<SceneObjectGroup> ol in returns.Values) |
937 | else | 937 | { |
938 | { | 938 | if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) |
939 | if (prim_owner == LandData.OwnerID) | 939 | m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); |
940 | { | 940 | } |
941 | LandData.OwnerPrims += prim_count; | 941 | } |
942 | } | 942 | |
943 | else if ((obj.GroupID == LandData.GroupID || | 943 | #endregion |
944 | prim_owner == LandData.GroupID) && | 944 | |
945 | LandData.GroupID != UUID.Zero) | 945 | #region Object Adding/Removing from Parcel |
946 | { | 946 | |
947 | LandData.GroupPrims += prim_count; | 947 | public void ResetLandPrimCounts() |
948 | } | 948 | { |
949 | else | 949 | LandData.GroupPrims = 0; |
950 | { | 950 | LandData.OwnerPrims = 0; |
951 | LandData.OtherPrims += prim_count; | 951 | LandData.OtherPrims = 0; |
952 | } | 952 | LandData.SelectedPrims = 0; |
953 | } | 953 | |
954 | 954 | ||
955 | lock (primsOverMe) | 955 | lock (primsOverMe) |
956 | primsOverMe.Add(obj); | 956 | primsOverMe.Clear(); |
957 | } | 957 | } |
958 | 958 | ||
959 | public void RemovePrimFromCount(SceneObjectGroup obj) | 959 | public void AddPrimToCount(SceneObjectGroup obj) |
960 | { | 960 | { |
961 | lock (primsOverMe) | 961 | |
962 | { | 962 | UUID prim_owner = obj.OwnerID; |
963 | if (primsOverMe.Contains(obj)) | 963 | int prim_count = obj.PrimCount; |
964 | { | 964 | |
965 | UUID prim_owner = obj.OwnerID; | 965 | if (obj.IsSelected) |
966 | int prim_count = obj.PrimCount; | 966 | { |
967 | 967 | LandData.SelectedPrims += prim_count; | |
968 | if (prim_owner == LandData.OwnerID) | 968 | } |
969 | { | 969 | else |
970 | LandData.OwnerPrims -= prim_count; | 970 | { |
971 | } | 971 | if (prim_owner == LandData.OwnerID) |
972 | else if (obj.GroupID == LandData.GroupID || | 972 | { |
973 | prim_owner == LandData.GroupID) | 973 | LandData.OwnerPrims += prim_count; |
974 | { | 974 | } |
975 | LandData.GroupPrims -= prim_count; | 975 | else if ((obj.GroupID == LandData.GroupID || |
976 | } | 976 | prim_owner == LandData.GroupID) && |
977 | else | 977 | LandData.GroupID != UUID.Zero) |
978 | { | 978 | { |
979 | LandData.OtherPrims -= prim_count; | 979 | LandData.GroupPrims += prim_count; |
980 | } | 980 | } |
981 | 981 | else | |
982 | primsOverMe.Remove(obj); | 982 | { |
983 | } | 983 | LandData.OtherPrims += prim_count; |
984 | } | 984 | } |
985 | } | 985 | } |
986 | 986 | ||
987 | #endregion | 987 | lock (primsOverMe) |
988 | 988 | primsOverMe.Add(obj); | |
989 | #endregion | 989 | } |
990 | 990 | ||
991 | #endregion | 991 | public void RemovePrimFromCount(SceneObjectGroup obj) |
992 | 992 | { | |
993 | /// <summary> | 993 | lock (primsOverMe) |
994 | /// Set the media url for this land parcel | 994 | { |
995 | /// </summary> | 995 | if (primsOverMe.Contains(obj)) |
996 | /// <param name="url"></param> | 996 | { |
997 | public void SetMediaUrl(string url) | 997 | UUID prim_owner = obj.OwnerID; |
998 | { | 998 | int prim_count = obj.PrimCount; |
999 | LandData.MediaURL = url; | 999 | |
1000 | SendLandUpdateToAvatarsOverMe(); | 1000 | if (prim_owner == LandData.OwnerID) |
1001 | } | 1001 | { |
1002 | 1002 | LandData.OwnerPrims -= prim_count; | |
1003 | /// <summary> | 1003 | } |
1004 | /// Set the music url for this land parcel | 1004 | else if (obj.GroupID == LandData.GroupID || |
1005 | /// </summary> | 1005 | prim_owner == LandData.GroupID) |
1006 | /// <param name="url"></param> | 1006 | { |
1007 | public void SetMusicUrl(string url) | 1007 | LandData.GroupPrims -= prim_count; |
1008 | { | 1008 | } |
1009 | LandData.MusicURL = url; | 1009 | else |
1010 | SendLandUpdateToAvatarsOverMe(); | 1010 | { |
1011 | } | 1011 | LandData.OtherPrims -= prim_count; |
1012 | } | 1012 | } |
1013 | } | 1013 | |
1014 | primsOverMe.Remove(obj); | ||
1015 | } | ||
1016 | } | ||
1017 | } | ||
1018 | |||
1019 | #endregion | ||
1020 | |||
1021 | #endregion | ||
1022 | |||
1023 | #endregion | ||
1024 | |||
1025 | /// <summary> | ||
1026 | /// Set the media url for this land parcel | ||
1027 | /// </summary> | ||
1028 | /// <param name="url"></param> | ||
1029 | public void SetMediaUrl(string url) | ||
1030 | { | ||
1031 | LandData.MediaURL = url; | ||
1032 | SendLandUpdateToAvatarsOverMe(); | ||
1033 | } | ||
1034 | |||
1035 | /// <summary> | ||
1036 | /// Set the music url for this land parcel | ||
1037 | /// </summary> | ||
1038 | /// <param name="url"></param> | ||
1039 | public void SetMusicUrl(string url) | ||
1040 | { | ||
1041 | LandData.MusicURL = url; | ||
1042 | SendLandUpdateToAvatarsOverMe(); | ||
1043 | } | ||
1044 | } | ||
1045 | } | ||
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 | } |