aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2012-04-23 20:44:41 +0100
committerMelanie2012-04-23 20:44:41 +0100
commite9037098475202c02d3327d2dff877d0fd108c93 (patch)
treecd52623e1f12ffe0ca98609f270d27d30afc35af /OpenSim/Region/CoreModules
parentMerge branch 'master' into careminster (diff)
parentMantis 5977 Corrections to llRegionSayTo (diff)
downloadopensim-SC_OLD-e9037098475202c02d3327d2dff877d0fd108c93.zip
opensim-SC_OLD-e9037098475202c02d3327d2dff877d0fd108c93.tar.gz
opensim-SC_OLD-e9037098475202c02d3327d2dff877d0fd108c93.tar.bz2
opensim-SC_OLD-e9037098475202c02d3327d2dff877d0fd108c93.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs51
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs70
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs4
3 files changed, 71 insertions, 54 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 4d8fb90..6ffc7e6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -197,6 +197,7 @@ 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;
200 string message = c.Message; 201 string message = c.Message;
201 IScene scene = c.Scene; 202 IScene scene = c.Scene;
202 Vector3 fromPos = c.Position; 203 Vector3 fromPos = c.Position;
@@ -235,17 +236,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
235 message = message.Substring(0, 1000); 236 message = message.Substring(0, 1000);
236 237
237// m_log.DebugFormat( 238// m_log.DebugFormat(
238// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}", 239// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}",
239// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); 240// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID);
240 241
241 HashSet<UUID> receiverIDs = new HashSet<UUID>(); 242 HashSet<UUID> receiverIDs = new HashSet<UUID>();
242 243
243 foreach (Scene s in m_scenes) 244 foreach (Scene s in m_scenes)
244 { 245 {
245 // This should use ForEachClient, but clients don't have a position. 246 if (targetID == UUID.Zero)
246 // If camera is moved into client, then camera position can be used 247 {
247 s.ForEachRootScenePresence( 248 // This should use ForEachClient, but clients don't have a position.
248 delegate(ScenePresence presence) 249 // If camera is moved into client, then camera position can be used
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)
249 { 264 {
250 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); 265 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
251 if (Presencecheck != null) 266 if (Presencecheck != null)
@@ -256,15 +271,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
256 // objects on a parcel with access restrictions 271 // objects on a parcel with access restrictions
257 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) 272 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
258 { 273 {
259 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) 274 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType, false))
260 receiverIDs.Add(presence.UUID); 275 receiverIDs.Add(presence.UUID);
261 } 276 }
262 } 277 }
263
264 } 278 }
265 ); 279 }
266 } 280 }
267 281
268 (scene as Scene).EventManager.TriggerOnChatToClients( 282 (scene as Scene).EventManager.TriggerOnChatToClients(
269 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); 283 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
270 } 284 }
@@ -344,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
344 /// precondition</returns> 358 /// precondition</returns>
345 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, 359 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
346 UUID fromAgentID, string fromName, ChatTypeEnum type, 360 UUID fromAgentID, string fromName, ChatTypeEnum type,
347 string message, ChatSourceType src) 361 string message, ChatSourceType src, bool ignoreDistance)
348 { 362 {
349 // don't send stuff to child agents 363 // don't send stuff to child agents
350 if (presence.IsChildAgent) return false; 364 if (presence.IsChildAgent) return false;
@@ -355,12 +369,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
355 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); 369 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
356 370
357 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); 371 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
358 372
359 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || 373 if (!ignoreDistance)
360 type == ChatTypeEnum.Say && dis > m_saydistance ||
361 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
362 { 374 {
363 return false; 375 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
376 type == ChatTypeEnum.Say && dis > m_saydistance ||
377 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
378 {
379 return false;
380 }
364 } 381 }
365 382
366 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView 383 // 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 176c86d..8358bc0 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 bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) 311 public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg)
312 { 312 {
313 error = null;
314 // Is id an avatar? 313 // Is id an avatar?
315 ScenePresence sp = m_scene.GetScenePresence(target); 314 ScenePresence sp = m_scene.GetScenePresence(target);
316 315
317 if (sp != null) 316 if (sp != null)
318 { 317 {
319 // Send message to avatar 318 // ignore if a child agent this is restricted to inside one region
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
320 if (channel == 0) 325 if (channel == 0)
321 { 326 {
322 m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false); 327 m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false);
323 } 328 }
324 329 else
325 List<SceneObjectGroup> attachments = sp.GetAttachments();
326
327 if (attachments.Count == 0)
328 return true;
329
330 // Get uuid of attachments
331 List<UUID> targets = new List<UUID>();
332 foreach (SceneObjectGroup sog in attachments)
333 { 330 {
334 if (!sog.IsDeleted) 331 List<SceneObjectGroup> attachments = sp.GetAttachments();
335 targets.Add(sog.UUID); 332 if (attachments.Count == 0)
336 } 333 return;
337 334
338 // Need to check each attachment 335 // Get uuid of attachments
339 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) 336 List<UUID> targets = new List<UUID>();
340 { 337 foreach (SceneObjectGroup sog in attachments)
341 if (li.GetHostID().Equals(id)) 338 {
342 continue; 339 if (!sog.IsDeleted)
340 targets.Add(sog.UUID);
341 }
343 342
344 if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) 343 // Need to check each attachment
345 continue; 344 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
345 {
346 if (li.GetHostID().Equals(id))
347 continue;
346 348
347 if (targets.Contains(li.GetHostID())) 349 if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
348 QueueMessage(new ListenerInfo(li, name, id, msg)); 350 continue;
349 }
350 351
351 return true; 352 if (targets.Contains(li.GetHostID()))
352 } 353 QueueMessage(new ListenerInfo(li, name, id, msg));
354 }
355 }
353 356
354 // Need to toss an error here 357 return;
355 if (channel == 0)
356 {
357 error = "Cannot use llRegionSayTo to message objects on channel 0";
358 return false;
359 } 358 }
360 359
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 true; 378 return;
379 } 379 }
380 380
381 protected void QueueMessage(ListenerInfo li) 381 protected void QueueMessage(ListenerInfo li)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 63f1363..e05e8f6 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -102,9 +102,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
102 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); 102 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
103 Vector3 groupPosition = new Vector3(10, 20, 30); 103 Vector3 groupPosition = new Vector3(10, 20, 30);
104 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 104 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
105 Vector3 offsetPosition = new Vector3(5, 10, 15); 105// Vector3 offsetPosition = new Vector3(5, 10, 15);
106 106
107 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 107 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, Vector3.Zero) { Name = partName };
108 } 108 }
109 109
110 protected SceneObjectPart CreateSceneObjectPart2() 110 protected SceneObjectPart CreateSceneObjectPart2()