diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
4 files changed, 111 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f050dcf..1992bd4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Xml; | ||
30 | using log4net; | 31 | using log4net; |
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
@@ -35,6 +36,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Region.Framework; | 36 | using OpenSim.Region.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
38 | 40 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 41 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
40 | { | 42 | { |
@@ -190,8 +192,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
190 | 192 | ||
191 | public UUID RezSingleAttachmentFromInventory( | 193 | public UUID RezSingleAttachmentFromInventory( |
192 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 194 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
195 | { | ||
196 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); | ||
197 | } | ||
198 | |||
199 | public UUID RezSingleAttachmentFromInventory( | ||
200 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
193 | { | 201 | { |
194 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 202 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); |
195 | 203 | ||
196 | if (updateInventoryStatus) | 204 | if (updateInventoryStatus) |
197 | { | 205 | { |
@@ -210,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
210 | } | 218 | } |
211 | 219 | ||
212 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 220 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
213 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 221 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
214 | { | 222 | { |
215 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 223 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
216 | if (invAccess != null) | 224 | if (invAccess != null) |
@@ -236,13 +244,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
236 | if (tainted) | 244 | if (tainted) |
237 | objatt.HasGroupChanged = true; | 245 | objatt.HasGroupChanged = true; |
238 | 246 | ||
247 | if (doc != null) | ||
248 | objatt.LoadScriptState(doc); | ||
249 | |||
239 | // Fire after attach, so we don't get messy perms dialogs | 250 | // Fire after attach, so we don't get messy perms dialogs |
240 | // 3 == AttachedRez | 251 | // 3 == AttachedRez |
241 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | 252 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); |
242 | objatt.ResumeScripts(); | 253 | objatt.ResumeScripts(); |
243 | 254 | ||
244 | // Do this last so that event listeners have access to all the effects of the attachment | 255 | // Do this last so that event listeners have access to all the effects of the attachment |
245 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 256 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
246 | } | 257 | } |
247 | else | 258 | else |
248 | { | 259 | { |
@@ -271,7 +282,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
271 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 282 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
272 | { | 283 | { |
273 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 284 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
274 | item = m_scene.InventoryService.GetItem(item); | 285 | if (m_scene.InventoryService != null) |
286 | item = m_scene.InventoryService.GetItem(item); | ||
275 | 287 | ||
276 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 288 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); |
277 | } | 289 | } |
@@ -316,6 +328,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
316 | { | 328 | { |
317 | // XXYY!! | 329 | // XXYY!! |
318 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 330 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
331 | if (item == null) | ||
332 | m_log.Error("[ATTACHMENT]: item == null"); | ||
333 | if (m_scene == null) | ||
334 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
335 | if (m_scene.InventoryService == null) | ||
336 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
319 | item = m_scene.InventoryService.GetItem(item); | 337 | item = m_scene.InventoryService.GetItem(item); |
320 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 338 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
321 | 339 | ||
@@ -404,6 +422,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
404 | if (group.GetFromItemID() == itemID) | 422 | if (group.GetFromItemID() == itemID) |
405 | { | 423 | { |
406 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 424 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
425 | // CM / XMREngine!!!! Needed to conclude attach event | ||
426 | SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
407 | group.DetachToInventoryPrep(); | 427 | group.DetachToInventoryPrep(); |
408 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 428 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
409 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); | 429 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 6dacbba..acc3a78 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
49 | private int m_shoutdistance = 100; | 49 | private int m_shoutdistance = 100; |
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | private List<string> FreezeCache = new List<string>(); | |
53 | private string m_adminPrefix = ""; | ||
53 | internal object m_syncy = new object(); | 54 | internal object m_syncy = new object(); |
54 | 55 | ||
55 | internal IConfig m_config; | 56 | internal IConfig m_config; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 77 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 78 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 79 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
80 | m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | public virtual void AddRegion(Scene scene) | 83 | public virtual void AddRegion(Scene scene) |
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
171 | return; | 173 | return; |
172 | } | 174 | } |
173 | 175 | ||
174 | DeliverChatToAvatars(ChatSourceType.Agent, c); | 176 | if (FreezeCache.Contains(c.Sender.AgentId.ToString())) |
177 | { | ||
178 | if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) | ||
179 | c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | DeliverChatToAvatars(ChatSourceType.Agent, c); | ||
184 | } | ||
175 | } | 185 | } |
176 | 186 | ||
177 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) | 187 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) |
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
185 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) | 195 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) |
186 | { | 196 | { |
187 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | ||
188 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
189 | string message = c.Message; | 200 | string message = c.Message; |
190 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
207 | fromPos = avatar.AbsolutePosition; | 218 | fromPos = avatar.AbsolutePosition; |
208 | fromName = avatar.Name; | 219 | fromName = avatar.Name; |
209 | fromID = c.Sender.AgentId; | 220 | fromID = c.Sender.AgentId; |
210 | 221 | if (avatar.GodLevel > 200) | |
222 | { | ||
223 | fromNamePrefix = m_adminPrefix; | ||
224 | } | ||
211 | break; | 225 | break; |
212 | 226 | ||
213 | case ChatSourceType.Object: | 227 | case ChatSourceType.Object: |
@@ -227,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
227 | s.ForEachScenePresence( | 241 | s.ForEachScenePresence( |
228 | delegate(ScenePresence presence) | 242 | delegate(ScenePresence presence) |
229 | { | 243 | { |
230 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); | 244 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
245 | if (Presencecheck != null) | ||
246 | { | ||
247 | if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true) | ||
248 | { | ||
249 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); | ||
250 | } | ||
251 | } | ||
252 | |||
231 | } | 253 | } |
232 | ); | 254 | ); |
233 | } | 255 | } |
@@ -266,25 +288,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
266 | } | 288 | } |
267 | 289 | ||
268 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 290 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
269 | 291 | if (c.Scene != null) | |
270 | ((Scene)c.Scene).ForEachScenePresence( | 292 | { |
271 | delegate(ScenePresence presence) | 293 | ((Scene)c.Scene).ForEachScenePresence |
272 | { | 294 | ( |
273 | // ignore chat from child agents | 295 | delegate(ScenePresence presence) |
274 | if (presence.IsChildAgent) return; | 296 | { |
275 | 297 | // ignore chat from child agents | |
276 | IClientAPI client = presence.ControllingClient; | 298 | if (presence.IsChildAgent) return; |
277 | 299 | ||
278 | // don't forward SayOwner chat from objects to | 300 | IClientAPI client = presence.ControllingClient; |
279 | // non-owner agents | 301 | |
280 | if ((c.Type == ChatTypeEnum.Owner) && | 302 | // don't forward SayOwner chat from objects to |
281 | (null != c.SenderObject) && | 303 | // non-owner agents |
282 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 304 | if ((c.Type == ChatTypeEnum.Owner) && |
283 | return; | 305 | (null != c.SenderObject) && |
284 | 306 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | |
285 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 307 | return; |
286 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 308 | |
287 | }); | 309 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
310 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
311 | } | ||
312 | ); | ||
313 | } | ||
288 | } | 314 | } |
289 | 315 | ||
290 | 316 | ||
@@ -313,5 +339,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
313 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 339 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, |
314 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); | 340 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); |
315 | } | 341 | } |
342 | |||
343 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
344 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
345 | { | ||
346 | System.Threading.Timer Timer; | ||
347 | if (flags == 0) | ||
348 | { | ||
349 | FreezeCache.Add(target.ToString()); | ||
350 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
351 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
352 | Timers.Add(target, Timer); | ||
353 | } | ||
354 | else | ||
355 | { | ||
356 | FreezeCache.Remove(target.ToString()); | ||
357 | Timers.TryGetValue(target, out Timer); | ||
358 | Timers.Remove(target); | ||
359 | Timer.Dispose(); | ||
360 | } | ||
361 | } | ||
362 | |||
363 | private void OnEndParcelFrozen(object avatar) | ||
364 | { | ||
365 | UUID target = (UUID)avatar; | ||
366 | FreezeCache.Remove(target.ToString()); | ||
367 | System.Threading.Timer Timer; | ||
368 | Timers.TryGetValue(target, out Timer); | ||
369 | Timers.Remove(target); | ||
370 | Timer.Dispose(); | ||
371 | } | ||
316 | } | 372 | } |
317 | } | 373 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index fdfcd10..9412735 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -172,13 +172,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
172 | 172 | ||
173 | private void RetrieveInstantMessages(IClientAPI client) | 173 | private void RetrieveInstantMessages(IClientAPI client) |
174 | { | 174 | { |
175 | if (m_RestURL != "") | 175 | if (m_RestURL == String.Empty) |
176 | { | 176 | return; |
177 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
178 | 177 | ||
179 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 178 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); |
179 | |||
180 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | ||
180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 181 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
181 | 182 | ||
183 | if (msglist != null) | ||
184 | { | ||
182 | foreach (GridInstantMessage im in msglist) | 185 | foreach (GridInstantMessage im in msglist) |
183 | { | 186 | { |
184 | // client.SendInstantMessage(im); | 187 | // client.SendInstantMessage(im); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index be89740..7142442 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -417,7 +417,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
417 | { | 417 | { |
418 | // Check if this is ours to handle | 418 | // Check if this is ours to handle |
419 | // | 419 | // |
420 | m_log.Info("OnFridInstantMessage"); | 420 | //m_log.Info("OnFridInstantMessage"); |
421 | if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered) | 421 | if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered) |
422 | return; | 422 | return; |
423 | 423 | ||