diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
4 files changed, 119 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 6d16c52..f63089d 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 Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
@@ -36,6 +37,7 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Region.Framework; | 37 | using OpenSim.Region.Framework; |
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
39 | 41 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 42 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
41 | { | 43 | { |
@@ -198,8 +200,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
198 | 200 | ||
199 | public UUID RezSingleAttachmentFromInventory( | 201 | public UUID RezSingleAttachmentFromInventory( |
200 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 202 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
203 | { | ||
204 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); | ||
205 | } | ||
206 | |||
207 | public UUID RezSingleAttachmentFromInventory( | ||
208 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
201 | { | 209 | { |
202 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 210 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); |
203 | 211 | ||
204 | if (updateInventoryStatus) | 212 | if (updateInventoryStatus) |
205 | { | 213 | { |
@@ -218,7 +226,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
218 | } | 226 | } |
219 | 227 | ||
220 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 228 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
221 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 229 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
222 | { | 230 | { |
223 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 231 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
224 | if (invAccess != null) | 232 | if (invAccess != null) |
@@ -244,13 +252,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
244 | if (tainted) | 252 | if (tainted) |
245 | objatt.HasGroupChanged = true; | 253 | objatt.HasGroupChanged = true; |
246 | 254 | ||
255 | if (doc != null) | ||
256 | { | ||
257 | objatt.LoadScriptState(doc); | ||
258 | objatt.ResetOwnerChangeFlag(); | ||
259 | } | ||
260 | |||
247 | // Fire after attach, so we don't get messy perms dialogs | 261 | // Fire after attach, so we don't get messy perms dialogs |
248 | // 3 == AttachedRez | 262 | // 3 == AttachedRez |
249 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | 263 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); |
250 | objatt.ResumeScripts(); | 264 | objatt.ResumeScripts(); |
251 | 265 | ||
252 | // Do this last so that event listeners have access to all the effects of the attachment | 266 | // Do this last so that event listeners have access to all the effects of the attachment |
253 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 267 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
254 | } | 268 | } |
255 | else | 269 | else |
256 | { | 270 | { |
@@ -279,7 +293,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
279 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 293 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
280 | { | 294 | { |
281 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 295 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
282 | item = m_scene.InventoryService.GetItem(item); | 296 | if (m_scene.InventoryService != null) |
297 | item = m_scene.InventoryService.GetItem(item); | ||
283 | 298 | ||
284 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 299 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); |
285 | } | 300 | } |
@@ -324,6 +339,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
324 | { | 339 | { |
325 | // XXYY!! | 340 | // XXYY!! |
326 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 341 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
342 | if (item == null) | ||
343 | m_log.Error("[ATTACHMENT]: item == null"); | ||
344 | if (m_scene == null) | ||
345 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
346 | if (m_scene.InventoryService == null) | ||
347 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
327 | item = m_scene.InventoryService.GetItem(item); | 348 | item = m_scene.InventoryService.GetItem(item); |
328 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 349 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
329 | 350 | ||
@@ -412,6 +433,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
412 | if (group.GetFromItemID() == itemID) | 433 | if (group.GetFromItemID() == itemID) |
413 | { | 434 | { |
414 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 435 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
436 | // CM / XMREngine!!!! Needed to conclude attach event | ||
437 | SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
415 | group.DetachToInventoryPrep(); | 438 | group.DetachToInventoryPrep(); |
416 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 439 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
417 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); | 440 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 02f0968..9c8cbc6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
49 | private int m_shoutdistance = 100; | 49 | private int m_shoutdistance = 100; |
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | private List<string> FreezeCache = new List<string>(); | |
53 | private string m_adminPrefix = ""; | ||
53 | internal object m_syncy = new object(); | 54 | internal object m_syncy = new object(); |
54 | 55 | ||
55 | internal IConfig m_config; | 56 | internal IConfig m_config; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 77 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 78 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 79 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
80 | m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | public virtual void AddRegion(Scene scene) | 83 | public virtual void AddRegion(Scene scene) |
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
171 | return; | 173 | return; |
172 | } | 174 | } |
173 | 175 | ||
174 | DeliverChatToAvatars(ChatSourceType.Agent, c); | 176 | if (FreezeCache.Contains(c.Sender.AgentId.ToString())) |
177 | { | ||
178 | if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) | ||
179 | c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | DeliverChatToAvatars(ChatSourceType.Agent, c); | ||
184 | } | ||
175 | } | 185 | } |
176 | 186 | ||
177 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) | 187 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) |
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
185 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) | 195 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) |
186 | { | 196 | { |
187 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | ||
188 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
189 | string message = c.Message; | 200 | string message = c.Message; |
190 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
207 | fromPos = avatar.AbsolutePosition; | 218 | fromPos = avatar.AbsolutePosition; |
208 | fromName = avatar.Name; | 219 | fromName = avatar.Name; |
209 | fromID = c.Sender.AgentId; | 220 | fromID = c.Sender.AgentId; |
210 | 221 | if (avatar.GodLevel > 200) | |
222 | { | ||
223 | fromNamePrefix = m_adminPrefix; | ||
224 | } | ||
211 | break; | 225 | break; |
212 | 226 | ||
213 | case ChatSourceType.Object: | 227 | case ChatSourceType.Object: |
@@ -227,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
227 | s.ForEachScenePresence( | 241 | s.ForEachScenePresence( |
228 | delegate(ScenePresence presence) | 242 | delegate(ScenePresence presence) |
229 | { | 243 | { |
230 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); | 244 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
245 | if (Presencecheck != null) | ||
246 | { | ||
247 | if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true) | ||
248 | { | ||
249 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); | ||
250 | } | ||
251 | } | ||
252 | |||
231 | } | 253 | } |
232 | ); | 254 | ); |
233 | } | 255 | } |
@@ -270,25 +292,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
270 | } | 292 | } |
271 | 293 | ||
272 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 294 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
273 | 295 | if (c.Scene != null) | |
274 | ((Scene)c.Scene).ForEachScenePresence( | 296 | { |
275 | delegate(ScenePresence presence) | 297 | ((Scene)c.Scene).ForEachScenePresence |
276 | { | 298 | ( |
277 | // ignore chat from child agents | 299 | delegate(ScenePresence presence) |
278 | if (presence.IsChildAgent) return; | 300 | { |
279 | 301 | // ignore chat from child agents | |
280 | IClientAPI client = presence.ControllingClient; | 302 | if (presence.IsChildAgent) return; |
281 | 303 | ||
282 | // don't forward SayOwner chat from objects to | 304 | IClientAPI client = presence.ControllingClient; |
283 | // non-owner agents | 305 | |
284 | if ((c.Type == ChatTypeEnum.Owner) && | 306 | // don't forward SayOwner chat from objects to |
285 | (null != c.SenderObject) && | 307 | // non-owner agents |
286 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 308 | if ((c.Type == ChatTypeEnum.Owner) && |
287 | return; | 309 | (null != c.SenderObject) && |
288 | 310 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | |
289 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 311 | return; |
290 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 312 | |
291 | }); | 313 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
314 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
315 | } | ||
316 | ); | ||
317 | } | ||
292 | } | 318 | } |
293 | 319 | ||
294 | 320 | ||
@@ -317,5 +343,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
317 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 343 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, |
318 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); | 344 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); |
319 | } | 345 | } |
346 | |||
347 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
348 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
349 | { | ||
350 | System.Threading.Timer Timer; | ||
351 | if (flags == 0) | ||
352 | { | ||
353 | FreezeCache.Add(target.ToString()); | ||
354 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
355 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
356 | Timers.Add(target, Timer); | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | FreezeCache.Remove(target.ToString()); | ||
361 | Timers.TryGetValue(target, out Timer); | ||
362 | Timers.Remove(target); | ||
363 | Timer.Dispose(); | ||
364 | } | ||
365 | } | ||
366 | |||
367 | private void OnEndParcelFrozen(object avatar) | ||
368 | { | ||
369 | UUID target = (UUID)avatar; | ||
370 | FreezeCache.Remove(target.ToString()); | ||
371 | System.Threading.Timer Timer; | ||
372 | Timers.TryGetValue(target, out Timer); | ||
373 | Timers.Remove(target); | ||
374 | Timer.Dispose(); | ||
375 | } | ||
320 | } | 376 | } |
321 | } | 377 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 80982fd..4c01985 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); |
@@ -727,7 +728,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
727 | // we're done | 728 | // we're done |
728 | return true; | 729 | return true; |
729 | } | 730 | } |
730 | 731 | ||
731 | return false; | 732 | return false; |
732 | } | 733 | } |
733 | 734 | ||
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); |