aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs70
1 files changed, 35 insertions, 35 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 8358bc0..176c86d 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -308,56 +308,56 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
308 /// <param name='msg'> 308 /// <param name='msg'>
309 /// Message. 309 /// Message.
310 /// </param> 310 /// </param>
311 public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg) 311 public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error)
312 { 312 {
313 error = null;
313 // Is id an avatar? 314 // Is id an avatar?
314 ScenePresence sp = m_scene.GetScenePresence(target); 315 ScenePresence sp = m_scene.GetScenePresence(target);
315 316
316 if (sp != null) 317 if (sp != null)
317 { 318 {
318 // ignore if a child agent this is restricted to inside one region 319 // Send message to avatar
319 if (sp.IsChildAgent)
320 return;
321
322 // Send message to the avatar.
323 // Channel zero only goes to the avatar
324 // non zero channel messages only go to the attachments
325 if (channel == 0) 320 if (channel == 0)
326 { 321 {
327 m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false); 322 m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false);
328 } 323 }
329 else
330 {
331 List<SceneObjectGroup> attachments = sp.GetAttachments();
332 if (attachments.Count == 0)
333 return;
334 324
335 // Get uuid of attachments 325 List<SceneObjectGroup> attachments = sp.GetAttachments();
336 List<UUID> targets = new List<UUID>();
337 foreach (SceneObjectGroup sog in attachments)
338 {
339 if (!sog.IsDeleted)
340 targets.Add(sog.UUID);
341 }
342 326
343 // Need to check each attachment 327 if (attachments.Count == 0)
344 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) 328 return true;
345 {
346 if (li.GetHostID().Equals(id))
347 continue;
348 329
349 if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) 330 // Get uuid of attachments
350 continue; 331 List<UUID> targets = new List<UUID>();
332 foreach (SceneObjectGroup sog in attachments)
333 {
334 if (!sog.IsDeleted)
335 targets.Add(sog.UUID);
336 }
351 337
352 if (targets.Contains(li.GetHostID())) 338 // Need to check each attachment
353 QueueMessage(new ListenerInfo(li, name, id, msg)); 339 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
354 } 340 {
341 if (li.GetHostID().Equals(id))
342 continue;
343
344 if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
345 continue;
346
347 if (targets.Contains(li.GetHostID()))
348 QueueMessage(new ListenerInfo(li, name, id, msg));
355 } 349 }
356 350
357 return; 351 return true;
352 }
353
354 // Need to toss an error here
355 if (channel == 0)
356 {
357 error = "Cannot use llRegionSayTo to message objects on channel 0";
358 return false;
358 } 359 }
359 360
360 // No avatar found so look for an object
361 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) 361 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
362 { 362 {
363 // Dont process if this message is from yourself! 363 // Dont process if this message is from yourself!
@@ -375,7 +375,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
375 } 375 }
376 } 376 }
377 377
378 return; 378 return true;
379 } 379 }
380 380
381 protected void QueueMessage(ListenerInfo li) 381 protected void QueueMessage(ListenerInfo li)