aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs71
1 files changed, 67 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 6917b14..22352f5 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -282,9 +282,71 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
282 } 282 }
283 } 283 }
284 284
285 // wComm.DeliverMessageTo(target, channelID, m_host.Name, m_host.UUID, text); 285 /// <summary>
286 public void DeliverMessageTo(UUID target, int channel, string name, UUID id, string msg) 286 /// Delivers the message to.
287 { 287 /// </summary>
288 /// <param name='target'>
289 /// Target.
290 /// </param>
291 /// <param name='channel'>
292 /// Channel.
293 /// </param>
294 /// <param name='name'>
295 /// Name.
296 /// </param>
297 /// <param name='id'>
298 /// Identifier.
299 /// </param>
300 /// <param name='msg'>
301 /// Message.
302 /// </param>
303 public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error)
304 {
305 error = null;
306 // Is id an avatar?
307 ScenePresence sp = m_scene.GetScenePresence(target);
308
309 if (sp != null)
310 {
311 // Send message to avatar
312 if (channel == 0)
313 {
314 m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false);
315 }
316
317 List<SceneObjectGroup> attachments = sp.Attachments;
318 // Nothing left to do
319 if (attachments == null)
320 return true;
321
322 // Get uuid of attachments
323 List<UUID> targets = new List<UUID>();
324 foreach ( SceneObjectGroup sog in attachments )
325 {
326 targets.Add(sog.UUID);
327 }
328 // Need to check each attachment
329 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
330 {
331 if (li.GetHostID().Equals(id))
332 continue;
333
334 if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
335 continue;
336
337 if ( targets.Contains(li.GetHostID()))
338 QueueMessage(new ListenerInfo(li, name, id, msg));
339 }
340 return true;
341 }
342
343 // Need to toss an error here
344 if (channel == 0)
345 {
346 error = "Cannot use llRegionSayTo to message objects on channel 0";
347 return false;
348 }
349
288 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) 350 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
289 { 351 {
290 // Dont process if this message is from yourself! 352 // Dont process if this message is from yourself!
@@ -298,9 +360,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
298 if ( li.GetHostID().Equals(target)) 360 if ( li.GetHostID().Equals(target))
299 { 361 {
300 QueueMessage(new ListenerInfo(li, name, id, msg)); 362 QueueMessage(new ListenerInfo(li, name, id, msg));
301 return; 363 break;
302 } 364 }
303 } 365 }
366 return true;
304 } 367 }
305 368
306 protected void QueueMessage(ListenerInfo li) 369 protected void QueueMessage(ListenerInfo li)