diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index e4452fb..6d62ff0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using Mono.Addins; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Chat | 39 | namespace OpenSim.Region.CoreModules.Avatar.Chat |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ChatModule")] | ||
40 | public class ChatModule : ISharedRegionModule | 42 | public class ChatModule : ISharedRegionModule |
41 | { | 43 | { |
42 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
@@ -186,6 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
186 | { | 188 | { |
187 | string fromName = c.From; | 189 | string fromName = c.From; |
188 | UUID fromID = UUID.Zero; | 190 | UUID fromID = UUID.Zero; |
191 | UUID ownerID = UUID.Zero; | ||
189 | UUID targetID = c.TargetUUID; | 192 | UUID targetID = c.TargetUUID; |
190 | string message = c.Message; | 193 | string message = c.Message; |
191 | IScene scene = c.Scene; | 194 | IScene scene = c.Scene; |
@@ -208,12 +211,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
208 | fromPos = avatar.AbsolutePosition; | 211 | fromPos = avatar.AbsolutePosition; |
209 | fromName = avatar.Name; | 212 | fromName = avatar.Name; |
210 | fromID = c.Sender.AgentId; | 213 | fromID = c.Sender.AgentId; |
214 | ownerID = c.Sender.AgentId; | ||
211 | 215 | ||
212 | break; | 216 | break; |
213 | 217 | ||
214 | case ChatSourceType.Object: | 218 | case ChatSourceType.Object: |
215 | fromID = c.SenderUUID; | 219 | fromID = c.SenderUUID; |
216 | 220 | ||
221 | if (c.SenderObject != null && c.SenderObject is SceneObjectPart) | ||
222 | ownerID = ((SceneObjectPart)c.SenderObject).OwnerID; | ||
223 | |||
217 | break; | 224 | break; |
218 | } | 225 | } |
219 | 226 | ||
@@ -236,7 +243,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
236 | s.ForEachRootScenePresence( | 243 | s.ForEachRootScenePresence( |
237 | delegate(ScenePresence presence) | 244 | delegate(ScenePresence presence) |
238 | { | 245 | { |
239 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false)) | 246 | if (TrySendChatMessage( |
247 | presence, fromPos, regionPos, fromID, ownerID, fromName, c.Type, message, sourceType, false)) | ||
240 | receiverIDs.Add(presence.UUID); | 248 | receiverIDs.Add(presence.UUID); |
241 | } | 249 | } |
242 | ); | 250 | ); |
@@ -248,8 +256,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
248 | ScenePresence presence = s.GetScenePresence(targetID); | 256 | ScenePresence presence = s.GetScenePresence(targetID); |
249 | if (presence != null && !presence.IsChildAgent) | 257 | if (presence != null && !presence.IsChildAgent) |
250 | { | 258 | { |
251 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true)) | 259 | if (TrySendChatMessage( |
252 | receiverIDs.Add(presence.UUID); | 260 | presence, fromPos, regionPos, fromID, ownerID, fromName, ChatTypeEnum.Say, message, sourceType, true)) |
261 | receiverIDs.Add(presence.UUID); | ||
253 | } | 262 | } |
254 | } | 263 | } |
255 | } | 264 | } |
@@ -305,9 +314,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
305 | (null != c.SenderObject) && | 314 | (null != c.SenderObject) && |
306 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 315 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) |
307 | return; | 316 | return; |
308 | 317 | ||
309 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 318 | client.SendChatMessage( |
310 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 319 | c.Message, (byte)cType, CenterOfRegion, fromName, fromID, fromID, |
320 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
321 | |||
311 | receiverIDs.Add(client.AgentId); | 322 | receiverIDs.Add(client.AgentId); |
312 | }); | 323 | }); |
313 | 324 | ||
@@ -322,15 +333,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
322 | /// <param name="fromPos"></param> | 333 | /// <param name="fromPos"></param> |
323 | /// <param name="regionPos">/param> | 334 | /// <param name="regionPos">/param> |
324 | /// <param name="fromAgentID"></param> | 335 | /// <param name="fromAgentID"></param> |
336 | /// <param name='ownerID'> | ||
337 | /// Owner of the message. For at least some messages from objects, this has to be correctly filled with the owner's UUID. | ||
338 | /// This is the case for script error messages in viewer 3 since LLViewer change EXT-7762 | ||
339 | /// </param> | ||
325 | /// <param name="fromName"></param> | 340 | /// <param name="fromName"></param> |
326 | /// <param name="type"></param> | 341 | /// <param name="type"></param> |
327 | /// <param name="message"></param> | 342 | /// <param name="message"></param> |
328 | /// <param name="src"></param> | 343 | /// <param name="src"></param> |
329 | /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a | 344 | /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a |
330 | /// precondition</returns> | 345 | /// precondition</returns> |
331 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, | 346 | protected virtual bool TrySendChatMessage( |
332 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 347 | ScenePresence presence, Vector3 fromPos, Vector3 regionPos, |
333 | string message, ChatSourceType src, bool ignoreDistance) | 348 | UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type, |
349 | string message, ChatSourceType src, bool ignoreDistance) | ||
334 | { | 350 | { |
335 | // don't send stuff to child agents | 351 | // don't send stuff to child agents |
336 | if (presence.IsChildAgent) return false; | 352 | if (presence.IsChildAgent) return false; |
@@ -353,10 +369,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
353 | } | 369 | } |
354 | 370 | ||
355 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView | 371 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView |
356 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 372 | presence.ControllingClient.SendChatMessage( |
357 | fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); | 373 | message, (byte) type, fromPos, fromName, |
374 | fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully); | ||
358 | 375 | ||
359 | return true; | 376 | return true; |
360 | } | 377 | } |
361 | } | 378 | } |
362 | } | 379 | } \ No newline at end of file |