aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2012-06-28 22:02:20 +0100
committerMelanie2012-06-28 22:02:20 +0100
commita1a22a2f1034a1feb67b141abf4b138248cdb356 (patch)
treeb1f71abd8e3f9a3106a4140ad35abba94c8468e5 /OpenSim/Region/CoreModules
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.zip
opensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.tar.gz
opensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.tar.bz2
opensim-SC_OLD-a1a22a2f1034a1feb67b141abf4b138248cdb356.tar.xz
Revert "Mantis 5977 Corrections to llRegionSayTo"
This reverts commit 679da63da617d031e5e7ae3f2d2a29db1a23ace3. Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs70
2 files changed, 51 insertions, 69 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 6ffc7e6..5649855 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -197,7 +197,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
197 string fromName = c.From; 197 string fromName = c.From;
198 string fromNamePrefix = ""; 198 string fromNamePrefix = "";
199 UUID fromID = UUID.Zero; 199 UUID fromID = UUID.Zero;
200 UUID targetID = c.TargetUUID;
201 string message = c.Message; 200 string message = c.Message;
202 IScene scene = c.Scene; 201 IScene scene = c.Scene;
203 Vector3 fromPos = c.Position; 202 Vector3 fromPos = c.Position;
@@ -236,31 +235,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
236 message = message.Substring(0, 1000); 235 message = message.Substring(0, 1000);
237 236
238// m_log.DebugFormat( 237// m_log.DebugFormat(
239// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}", 238// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}",
240// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID); 239// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
241 240
242 HashSet<UUID> receiverIDs = new HashSet<UUID>(); 241 HashSet<UUID> receiverIDs = new HashSet<UUID>();
243 242
244 foreach (Scene s in m_scenes) 243 foreach (Scene s in m_scenes)
245 { 244 {
246 if (targetID == UUID.Zero) 245 // This should use ForEachClient, but clients don't have a position.
247 { 246 // If camera is moved into client, then camera position can be used
248 // This should use ForEachClient, but clients don't have a position. 247 s.ForEachRootScenePresence(
249 // If camera is moved into client, then camera position can be used 248 delegate(ScenePresence presence)
250 s.ForEachRootScenePresence(
251 delegate(ScenePresence presence)
252 {
253 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false))
254 receiverIDs.Add(presence.UUID);
255 }
256 );
257 }
258 else
259 {
260 // This is a send to a specific client eg from llRegionSayTo
261 // no need to check distance etc, jand send is as say
262 ScenePresence presence = s.GetScenePresence(targetID);
263 if (presence != null && !presence.IsChildAgent)
264 { 249 {
265 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); 250 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
266 if (Presencecheck != null) 251 if (Presencecheck != null)
@@ -271,14 +256,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
271 // objects on a parcel with access restrictions 256 // objects on a parcel with access restrictions
272 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) 257 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
273 { 258 {
274 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType, false)) 259 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType))
275 receiverIDs.Add(presence.UUID); 260 receiverIDs.Add(presence.UUID);
276 } 261 }
277 } 262 }
278 } 263 }
279 } 264 );
280 } 265 }
281 266
282 (scene as Scene).EventManager.TriggerOnChatToClients( 267 (scene as Scene).EventManager.TriggerOnChatToClients(
283 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); 268 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
284 } 269 }
@@ -358,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
358 /// precondition</returns> 343 /// precondition</returns>
359 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, 344 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
360 UUID fromAgentID, string fromName, ChatTypeEnum type, 345 UUID fromAgentID, string fromName, ChatTypeEnum type,
361 string message, ChatSourceType src, bool ignoreDistance) 346 string message, ChatSourceType src)
362 { 347 {
363 // don't send stuff to child agents 348 // don't send stuff to child agents
364 if (presence.IsChildAgent) return false; 349 if (presence.IsChildAgent) return false;
@@ -369,15 +354,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
369 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); 354 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
370 355
371 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); 356 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
372 357
373 if (!ignoreDistance) 358 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
359 type == ChatTypeEnum.Say && dis > m_saydistance ||
360 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
374 { 361 {
375 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || 362 return false;
376 type == ChatTypeEnum.Say && dis > m_saydistance ||
377 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
378 {
379 return false;
380 }
381 } 363 }
382 364
383 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView 365 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
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)