aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting
diff options
context:
space:
mode:
authorMic Bowman2011-08-26 15:23:46 -0700
committerMic Bowman2011-08-26 15:23:46 -0700
commit23f10f1d22d5ecf542119e39503230994c521bf0 (patch)
tree2498e8cccf2ed398052dfa53e9a1faf6e998d039 /OpenSim/Region/CoreModules/Scripting
parentMerge branch 'master' into bulletsim (diff)
parentrefactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar (diff)
downloadopensim-SC_OLD-23f10f1d22d5ecf542119e39503230994c521bf0.zip
opensim-SC_OLD-23f10f1d22d5ecf542119e39503230994c521bf0.tar.gz
opensim-SC_OLD-23f10f1d22d5ecf542119e39503230994c521bf0.tar.bz2
opensim-SC_OLD-23f10f1d22d5ecf542119e39503230994c521bf0.tar.xz
Merge branch 'master' into bulletsim
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs84
1 files changed, 84 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index d647e71..22352f5 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -282,6 +282,90 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
282 } 282 }
283 } 283 }
284 284
285 /// <summary>
286 /// Delivers the message to.
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
350 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
351 {
352 // Dont process if this message is from yourself!
353 if (li.GetHostID().Equals(id))
354 continue;
355
356 SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID());
357 if (sPart == null)
358 continue;
359
360 if ( li.GetHostID().Equals(target))
361 {
362 QueueMessage(new ListenerInfo(li, name, id, msg));
363 break;
364 }
365 }
366 return true;
367 }
368
285 protected void QueueMessage(ListenerInfo li) 369 protected void QueueMessage(ListenerInfo li)
286 { 370 {
287 lock (m_pending.SyncRoot) 371 lock (m_pending.SyncRoot)