aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock/TestClient.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs48
1 files changed, 47 insertions, 1 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 5daca1e..f034443 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -38,7 +38,7 @@ using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Framework.Client; 39using OpenSim.Framework.Client;
40 40
41namespace OpenSim.Tests.Common.Mock 41namespace OpenSim.Tests.Common
42{ 42{
43 public class TestClient : IClientAPI, IClientCore 43 public class TestClient : IClientAPI, IClientCore
44 { 44 {
@@ -62,12 +62,23 @@ namespace OpenSim.Tests.Common.Mock
62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; 62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion;
63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; 63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour;
64 public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; 64 public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport;
65
66 public event Action<ISceneEntity, PrimUpdateFlags> OnReceivedEntityUpdate;
67
68 public event OnReceivedChatMessageDelegate OnReceivedChatMessage;
65 public event Action<GridInstantMessage> OnReceivedInstantMessage; 69 public event Action<GridInstantMessage> OnReceivedInstantMessage;
66 70
71 public event Action<UUID> OnReceivedSendRebakeAvatarTextures;
72
67 public delegate void TestClientOnSendRegionTeleportDelegate( 73 public delegate void TestClientOnSendRegionTeleportDelegate(
68 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 74 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
69 uint locationID, uint flags, string capsURL); 75 uint locationID, uint flags, string capsURL);
70 76
77 public delegate void OnReceivedChatMessageDelegate(
78 string message, byte type, Vector3 fromPos, string fromName,
79 UUID fromAgentID, UUID ownerID, byte source, byte audible);
80
81
71// disable warning: public events, part of the public API 82// disable warning: public events, part of the public API
72#pragma warning disable 67 83#pragma warning disable 67
73 84
@@ -472,6 +483,34 @@ namespace OpenSim.Tests.Common.Mock
472 } 483 }
473 484
474 /// <summary> 485 /// <summary>
486 /// Trigger chat coming from this connection.
487 /// </summary>
488 /// <param name="channel"></param>
489 /// <param name="type"></param>
490 /// <param name="message"></param>
491 public bool Chat(int channel, ChatTypeEnum type, string message)
492 {
493 ChatMessage handlerChatFromClient = OnChatFromClient;
494
495 if (handlerChatFromClient != null)
496 {
497 OSChatMessage args = new OSChatMessage();
498 args.Channel = channel;
499 args.From = Name;
500 args.Message = message;
501 args.Type = type;
502
503 args.Scene = Scene;
504 args.Sender = this;
505 args.SenderUUID = AgentId;
506
507 handlerChatFromClient(this, args);
508 }
509
510 return true;
511 }
512
513 /// <summary>
475 /// Attempt a teleport to the given region. 514 /// Attempt a teleport to the given region.
476 /// </summary> 515 /// </summary>
477 /// <param name="regionHandle"></param> 516 /// <param name="regionHandle"></param>
@@ -572,6 +611,9 @@ namespace OpenSim.Tests.Common.Mock
572 string message, byte type, Vector3 fromPos, string fromName, 611 string message, byte type, Vector3 fromPos, string fromName,
573 UUID fromAgentID, UUID ownerID, byte source, byte audible) 612 UUID fromAgentID, UUID ownerID, byte source, byte audible)
574 { 613 {
614// Console.WriteLine("mmm {0} {1} {2}", message, Name, AgentId);
615 if (OnReceivedChatMessage != null)
616 OnReceivedChatMessage(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible);
575 } 617 }
576 618
577 public void SendInstantMessage(GridInstantMessage im) 619 public void SendInstantMessage(GridInstantMessage im)
@@ -713,6 +755,8 @@ namespace OpenSim.Tests.Common.Mock
713 755
714 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 756 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
715 { 757 {
758 if (OnReceivedEntityUpdate != null)
759 OnReceivedEntityUpdate(entity, updateFlags);
716 } 760 }
717 761
718 public void ReprioritizeUpdates() 762 public void ReprioritizeUpdates()
@@ -1260,6 +1304,8 @@ namespace OpenSim.Tests.Common.Mock
1260 1304
1261 public void SendRebakeAvatarTextures(UUID textureID) 1305 public void SendRebakeAvatarTextures(UUID textureID)
1262 { 1306 {
1307 if (OnReceivedSendRebakeAvatarTextures != null)
1308 OnReceivedSendRebakeAvatarTextures(textureID);
1263 } 1309 }
1264 1310
1265 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) 1311 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)