aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs58
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs5
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScenePresence.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs39
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs8
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs5
9 files changed, 117 insertions, 95 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index effa8d0..af68de6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -390,6 +390,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
390 } 390 }
391 } 391 }
392 public UUID AgentId { get { return m_agentId; } } 392 public UUID AgentId { get { return m_agentId; } }
393 public ISceneAgent SceneAgent { get; private set; }
393 public UUID ActiveGroupId { get { return m_activeGroupID; } } 394 public UUID ActiveGroupId { get { return m_activeGroupID; } }
394 public string ActiveGroupName { get { return m_activeGroupName; } } 395 public string ActiveGroupName { get { return m_activeGroupName; } }
395 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } 396 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
@@ -531,6 +532,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
531 532
532 // Remove ourselves from the scene 533 // Remove ourselves from the scene
533 m_scene.RemoveClient(AgentId, true); 534 m_scene.RemoveClient(AgentId, true);
535 SceneAgent = null;
534 536
535 // We can't reach into other scenes and close the connection 537 // We can't reach into other scenes and close the connection
536 // We need to do this over grid communications 538 // We need to do this over grid communications
@@ -710,7 +712,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
710 712
711 public virtual void Start() 713 public virtual void Start()
712 { 714 {
713 m_scene.AddNewClient(this, PresenceType.User); 715 SceneAgent = m_scene.AddNewClient(this, PresenceType.User);
714 716
715 RefreshGroupMembership(); 717 RefreshGroupMembership();
716 } 718 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index ae8251a..b04fe9f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -894,11 +894,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
894 IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; 894 IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
895 895
896 // Begin the process of adding the client to the simulator 896 // Begin the process of adding the client to the simulator
897 AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); 897 IClientAPI client = AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint);
898 898
899 // Send ack 899 // Send ack straight away to let the viewer know that the connection is active.
900 SendAckImmediate(remoteEndPoint, packet.Header.Sequence); 900 SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
901 901
902 // FIXME: Nasty - this is the only way we currently know if Scene.AddNewClient() failed to find a
903 // circuit and bombed out early. That check might be pointless since authorization is established
904 // up here.
905 if (client != null && client.SceneAgent != null)
906 client.SceneAgent.SendInitialDataToMe();
907
902 // m_log.DebugFormat( 908 // m_log.DebugFormat(
903// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 909// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
904// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 910// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
@@ -933,7 +939,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
933 return sessionInfo.Authorised; 939 return sessionInfo.Authorised;
934 } 940 }
935 941
936 private void AddNewClient(UseCircuitCodePacket useCircuitCode, IPEndPoint remoteEndPoint) 942 /// <summary>
943 /// Add a new client.
944 /// </summary>
945 /// <param name="useCircuitCode"></param>
946 /// <param name="remoteEndPoint"></param>
947 /// <returns>
948 /// The client that was added or null if the client failed authorization or already existed.
949 /// </returns>
950 private IClientAPI AddNewClient(UseCircuitCodePacket useCircuitCode, IPEndPoint remoteEndPoint)
937 { 951 {
938 UUID agentID = useCircuitCode.CircuitCode.ID; 952 UUID agentID = useCircuitCode.CircuitCode.ID;
939 UUID sessionID = useCircuitCode.CircuitCode.SessionID; 953 UUID sessionID = useCircuitCode.CircuitCode.SessionID;
@@ -942,7 +956,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
942 AuthenticateResponse sessionInfo; 956 AuthenticateResponse sessionInfo;
943 if (IsClientAuthorized(useCircuitCode, out sessionInfo)) 957 if (IsClientAuthorized(useCircuitCode, out sessionInfo))
944 { 958 {
945 AddClient(circuitCode, agentID, sessionID, remoteEndPoint, sessionInfo); 959 return AddClient(circuitCode, agentID, sessionID, remoteEndPoint, sessionInfo);
946 } 960 }
947 else 961 else
948 { 962 {
@@ -950,38 +964,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
950 m_log.WarnFormat( 964 m_log.WarnFormat(
951 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", 965 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
952 useCircuitCode.CircuitCode.ID, useCircuitCode.CircuitCode.Code, remoteEndPoint); 966 useCircuitCode.CircuitCode.ID, useCircuitCode.CircuitCode.Code, remoteEndPoint);
967
968 return null;
953 } 969 }
954 } 970 }
955 971
956 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) 972 /// <summary>
973 /// Add a client.
974 /// </summary>
975 /// <param name="circuitCode"></param>
976 /// <param name="agentID"></param>
977 /// <param name="sessionID"></param>
978 /// <param name="remoteEndPoint"></param>
979 /// <param name="sessionInfo"></param>
980 /// <returns>The client if it was added. Null if the client already existed.</returns>
981 protected virtual IClientAPI AddClient(
982 uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
957 { 983 {
984 IClientAPI client = null;
985
958 // In priciple there shouldn't be more than one thread here, ever. 986 // In priciple there shouldn't be more than one thread here, ever.
959 // But in case that happens, we need to synchronize this piece of code 987 // But in case that happens, we need to synchronize this piece of code
960 // because it's too important 988 // because it's too important
961 lock (this) 989 lock (this)
962 { 990 {
963 IClientAPI existingClient; 991 if (!m_scene.TryGetClient(agentID, out client))
964
965 if (!m_scene.TryGetClient(agentID, out existingClient))
966 { 992 {
967 // Create the LLUDPClient
968 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 993 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
969 // Create the LLClientView 994
970 LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 995 client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
971 client.OnLogout += LogoutHandler; 996 client.OnLogout += LogoutHandler;
972 997
973 client.DisableFacelights = m_disableFacelights; 998 ((LLClientView)client).DisableFacelights = m_disableFacelights;
974 999
975 // Start the IClientAPI
976 client.Start(); 1000 client.Start();
977
978 }
979 else
980 {
981 m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}",
982 existingClient.AgentId, remoteEndPoint, circuitCode);
983 } 1001 }
984 } 1002 }
1003
1004 return client;
985 } 1005 }
986 1006
987 private void RemoveClient(LLUDPClient udpClient) 1007 private void RemoveClient(LLUDPClient udpClient)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
index 737c654..fb94355 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
@@ -53,9 +53,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
53 public override void Update() {} 53 public override void Update() {}
54 public override void LoadWorldMap() {} 54 public override void LoadWorldMap() {}
55 55
56 public override void AddNewClient(IClientAPI client, PresenceType type) 56 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)
57 { 57 {
58 client.OnObjectName += RecordObjectNameCall; 58 client.OnObjectName += RecordObjectNameCall;
59
60 // FIXME
61 return null;
59 } 62 }
60 63
61 public override void RemoveClient(UUID agentID, bool someReason) {} 64 public override void RemoveClient(UUID agentID, bool someReason) {}
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index ff39283..5e43843 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -38,28 +38,8 @@ namespace OpenSim.Region.Framework.Interfaces
38 /// <remarks> 38 /// <remarks>
39 /// Interface is a work in progress. Please feel free to add other required properties and methods. 39 /// Interface is a work in progress. Please feel free to add other required properties and methods.
40 /// </remarks> 40 /// </remarks>
41 public interface IScenePresence : ISceneEntity 41 public interface IScenePresence : ISceneAgent
42 { 42 {
43 /// <value>
44 /// The client controlling this presence
45 /// </value>
46 IClientAPI ControllingClient { get; }
47
48 /// <summary>
49 /// What type of presence is this? User, NPC, etc.
50 /// </summary>
51 PresenceType PresenceType { get; }
52
53 /// <summary>
54 /// Avatar appearance data.
55 /// </summary>
56 /// <remarks>
57 // Because appearance setting is in a module, we actually need
58 // to give it access to our appearance directly, otherwise we
59 // get a synchronization issue.
60 /// </remarks>
61 AvatarAppearance Appearance { get; set; }
62
63 /// <summary> 43 /// <summary>
64 /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments. 44 /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
65 /// </summary> 45 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f9ae39c..a51fca2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2610,17 +2610,17 @@ namespace OpenSim.Region.Framework.Scenes
2610 #region Add/Remove Avatar Methods 2610 #region Add/Remove Avatar Methods
2611 2611
2612 /// <summary> 2612 /// <summary>
2613 /// Add a new client and create a child agent for it. 2613 /// Add a new client and create a child scene presence for it.
2614 /// </summary> 2614 /// </summary>
2615 /// <param name="client"></param> 2615 /// <param name="client"></param>
2616 /// <param name="type">The type of agent to add.</param> 2616 /// <param name="type">The type of agent to add.</param>
2617 public override void AddNewClient(IClientAPI client, PresenceType type) 2617 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)
2618 { 2618 {
2619 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2619 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2620 bool vialogin = false; 2620 bool vialogin = false;
2621 2621
2622 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully 2622 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
2623 return; 2623 return null;
2624 2624
2625 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || 2625 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
2626 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2626 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
@@ -2628,60 +2628,61 @@ namespace OpenSim.Region.Framework.Scenes
2628 CheckHeartbeat(); 2628 CheckHeartbeat();
2629 ScenePresence presence; 2629 ScenePresence presence;
2630 2630
2631 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here 2631 ScenePresence sp = GetScenePresence(client.AgentId);
2632
2633 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
2634 // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause
2635 // other problems, and possible the code calling AddNewClient() should ensure that no client is already
2636 // connected.
2637 if (sp == null)
2632 { 2638 {
2633 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); 2639 m_log.Debug("[SCENE]: Adding new child scene presence " + client.Name + " to scene " + RegionInfo.RegionName);
2634 2640
2635 m_clientManager.Add(client); 2641 m_clientManager.Add(client);
2636 SubscribeToClientEvents(client); 2642 SubscribeToClientEvents(client);
2637 2643
2638 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); 2644 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2639 m_eventManager.TriggerOnNewPresence(sp); 2645 m_eventManager.TriggerOnNewPresence(sp);
2640 2646
2641 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; 2647 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
2642 2648
2643 // HERE!!! Do the initial attachments right here 2649 // The first agent upon login is a root agent by design.
2644 // first agent upon login is a root agent by design. 2650 // For this agent we will have to rez the attachments.
2645 // All other AddNewClient calls find aCircuit.child to be true 2651 // All other AddNewClient calls find aCircuit.child to be true.
2646 if (aCircuit.child == false) 2652 if (aCircuit.child == false)
2647 { 2653 {
2654 // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to
2655 // start the scripts again (since this is done in RezAttachments()).
2656 // XXX: This is convoluted.
2648 sp.IsChildAgent = false; 2657 sp.IsChildAgent = false;
2649 2658
2650 if (AttachmentsModule != null) 2659 if (AttachmentsModule != null)
2651 Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); 2660 Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); });
2652 } 2661 }
2653 } 2662 }
2654 2663 else
2655 ScenePresence createdSp = GetScenePresence(client.AgentId);
2656 if (createdSp != null)
2657 { 2664 {
2658 m_LastLogin = Util.EnvironmentTickCount(); 2665 m_log.WarnFormat(
2666 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence",
2667 sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName);
2668 }
2659 2669
2660 // Cache the user's name 2670 m_LastLogin = Util.EnvironmentTickCount();
2661 CacheUserName(createdSp, aCircuit);
2662 2671
2663 EventManager.TriggerOnNewClient(client); 2672 // Cache the user's name
2664 if (vialogin) 2673 CacheUserName(sp, aCircuit);
2665 {
2666 EventManager.TriggerOnClientLogin(client);
2667 2674
2668 // Send initial parcel data 2675 EventManager.TriggerOnNewClient(client);
2669 Vector3 pos = createdSp.AbsolutePosition; 2676 if (vialogin)
2670 ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); 2677 {
2671 land.SendLandUpdateToClient(client); 2678 EventManager.TriggerOnClientLogin(client);
2672 } 2679 // Send initial parcel data
2680 Vector3 pos = sp.AbsolutePosition;
2681 ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y);
2682 land.SendLandUpdateToClient(client);
2673 } 2683 }
2674 2684
2675 // Send all scene object to the new client 2685 return sp;
2676 Util.FireAndForget(delegate
2677 {
2678 EntityBase[] entities = Entities.GetEntities();
2679 foreach(EntityBase e in entities)
2680 {
2681 if (e != null && e is SceneObjectGroup)
2682 ((SceneObjectGroup)e).SendFullUpdateToClient(client);
2683 }
2684 });
2685 } 2686 }
2686 2687
2687 /// <summary> 2688 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 29ab071..84da700 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -177,7 +177,7 @@ namespace OpenSim.Region.Framework.Scenes
177 177
178 #region Add/Remove Agent/Avatar 178 #region Add/Remove Agent/Avatar
179 179
180 public abstract void AddNewClient(IClientAPI client, PresenceType type); 180 public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type);
181 public abstract void RemoveClient(UUID agentID, bool closeChildAgents); 181 public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
182 182
183 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 183 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3c97852..2748a75 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -794,15 +794,6 @@ namespace OpenSim.Region.Framework.Scenes
794 794
795 AdjustKnownSeeds(); 795 AdjustKnownSeeds();
796 796
797 // we created a new ScenePresence (a new child agent) in a fresh region.
798 // Request info about all the (root) agents in this region
799 // Note: This won't send data *to* other clients in that region (children don't send)
800
801// MIC: This gets called again in CompleteMovement
802 // SendInitialFullUpdateToAllClients();
803 SendOtherAgentsAvatarDataToMe();
804 SendOtherAgentsAppearanceToMe();
805
806 RegisterToEvents(); 797 RegisterToEvents();
807 SetDirectionVectors(); 798 SetDirectionVectors();
808 799
@@ -1207,9 +1198,9 @@ namespace OpenSim.Region.Framework.Scenes
1207 { 1198 {
1208// DateTime startTime = DateTime.Now; 1199// DateTime startTime = DateTime.Now;
1209 1200
1210 m_log.DebugFormat( 1201// m_log.DebugFormat(
1211 "[SCENE PRESENCE]: Completing movement of {0} into region {1}", 1202// "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
1212 client.Name, Scene.RegionInfo.RegionName); 1203// client.Name, Scene.RegionInfo.RegionName);
1213 1204
1214 Vector3 look = Velocity; 1205 Vector3 look = Velocity;
1215 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1206 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -1241,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes
1241 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1232 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1242 1233
1243 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1234 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1244 SendInitialData(); 1235 ValidateAndSendAppearanceAndAgentData();
1245 1236
1246 // Create child agents in neighbouring regions 1237 // Create child agents in neighbouring regions
1247 if (openChildAgents && !IsChildAgent) 1238 if (openChildAgents && !IsChildAgent)
@@ -2531,11 +2522,31 @@ namespace OpenSim.Region.Framework.Scenes
2531 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 2522 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
2532 } 2523 }
2533 2524
2525 public void SendInitialDataToMe()
2526 {
2527 // Send all scene object to the new client
2528 Util.FireAndForget(delegate
2529 {
2530 // we created a new ScenePresence (a new child agent) in a fresh region.
2531 // Request info about all the (root) agents in this region
2532 // Note: This won't send data *to* other clients in that region (children don't send)
2533 SendOtherAgentsAvatarDataToMe();
2534 SendOtherAgentsAppearanceToMe();
2535
2536 EntityBase[] entities = Scene.Entities.GetEntities();
2537 foreach(EntityBase e in entities)
2538 {
2539 if (e != null && e is SceneObjectGroup)
2540 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
2541 }
2542 });
2543 }
2544
2534 /// <summary> 2545 /// <summary>
2535 /// Do everything required once a client completes its movement into a region and becomes 2546 /// Do everything required once a client completes its movement into a region and becomes
2536 /// a root agent. 2547 /// a root agent.
2537 /// </summary> 2548 /// </summary>
2538 private void SendInitialData() 2549 private void ValidateAndSendAppearanceAndAgentData()
2539 { 2550 {
2540 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); 2551 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID);
2541 // Moved this into CompleteMovement to ensure that Appearance is initialized before 2552 // Moved this into CompleteMovement to ensure that Appearance is initialized before
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 60d3c2d..e62e30f 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -55,6 +55,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
55 55
56 private UUID m_agentID = UUID.Random(); 56 private UUID m_agentID = UUID.Random();
57 57
58 public ISceneAgent SceneAgent { get; private set; }
59
58 private string m_username; 60 private string m_username;
59 private string m_nick; 61 private string m_nick;
60 62
@@ -547,6 +549,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
547 549
548 m_connected = false; 550 m_connected = false;
549 m_client.Close(); 551 m_client.Close();
552 SceneAgent = null;
550 } 553 }
551 554
552 public UUID SessionId 555 public UUID SessionId
@@ -897,12 +900,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
897 900
898 public void Start() 901 public void Start()
899 { 902 {
900 Scene.AddNewClient(this, PresenceType.User); 903 SceneAgent = m_scene.AddNewClient(this, PresenceType.User);
901 904
902 // Mimicking LLClientView which gets always set appearance from client. 905 // Mimicking LLClientView which gets always set appearance from client.
903 Scene scene = (Scene)Scene;
904 AvatarAppearance appearance; 906 AvatarAppearance appearance;
905 scene.GetAvatarAppearance(this, out appearance); 907 m_scene.GetAvatarAppearance(this, out appearance);
906 OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone()); 908 OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone());
907 } 909 }
908 910
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 2b60cc3..1b31663 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -43,7 +43,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
43 private readonly UUID m_uuid = UUID.Random(); 43 private readonly UUID m_uuid = UUID.Random();
44 private readonly Scene m_scene; 44 private readonly Scene m_scene;
45 45
46
47 public NPCAvatar(string firstname, string lastname, Vector3 position, Scene scene) 46 public NPCAvatar(string firstname, string lastname, Vector3 position, Scene scene)
48 { 47 {
49 m_firstname = firstname; 48 m_firstname = firstname;
@@ -57,6 +56,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
57 get { return m_scene; } 56 get { return m_scene; }
58 } 57 }
59 58
59 public ISceneAgent SceneAgent { get { throw new NotImplementedException(); } }
60
60 public void Say(string message) 61 public void Say(string message)
61 { 62 {
62 SendOnChatFromClient(message, ChatTypeEnum.Say); 63 SendOnChatFromClient(message, ChatTypeEnum.Say);
@@ -845,6 +846,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
845 846
846 public void Start() 847 public void Start()
847 { 848 {
849 // We never start the client, so always fail.
850 throw new NotImplementedException();
848 } 851 }
849 852
850 public void Stop() 853 public void Stop()