aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
diff options
context:
space:
mode:
authorBlueWall2011-08-20 12:36:35 -0400
committerBlueWall2011-08-20 12:36:35 -0400
commit5e231acdce7a006a4d88a205044d9862f7d4dda8 (patch)
tree7ce528d13ddabcdcd19b9fb3b55232661d5db34d /OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
parentAdd llRegionSayTo (diff)
downloadopensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.zip
opensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.tar.gz
opensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.tar.bz2
opensim-SC_OLD-5e231acdce7a006a4d88a205044d9862f7d4dda8.tar.xz
Add avatar and attachments to llRegionSay
llRegionSay will now message avatars on chan 0 and will message attachments on the avatar that listen on channels other than 0. This behavior is consistant with the LL implementation as tested on regions in Agni with one exception: this implementation does not include issue: https://jira.secondlife.com/browse/SCR-66?
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs')
-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)