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