From a963b3057bdc80fc403e2b8402d0666c3d3f5c97 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Tue, 18 Sep 2007 09:59:33 +0000
Subject: * Replaced usage of ClientView with IClientAPI * Some
propertification and hideousness of fields.
---
OpenSim/Region/ClientStack/ClientView.API.cs | 53 ++++++++++------------
.../ClientStack/ClientView.PacketHandlers.cs | 19 ++++----
.../ClientStack/ClientView.ProcessPackets.cs | 11 +++--
OpenSim/Region/ClientStack/ClientView.cs | 20 ++++----
OpenSim/Region/ClientStack/PacketServer.cs | 8 ++--
.../Region/Examples/SimpleApp/MyNpcCharacter.cs | 15 +++---
.../ScriptEngine/DotNetEngine/ScriptManager.cs | 6 ++-
7 files changed, 68 insertions(+), 64 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index c97ba37..9d5a9e8 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -124,19 +124,12 @@ namespace OpenSim.Region.ClientStack
///
///
///
+ private LLUUID m_agentId;
public LLUUID AgentId
{
get
{
- return this.AgentID;
- }
- }
-
- public LLUUID SessionId
- {
- get
- {
- return this.SessionID;
+ return m_agentId;
}
}
@@ -212,8 +205,8 @@ namespace OpenSim.Region.ClientStack
public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
{
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
- mov.AgentData.SessionID = this.SessionID;
- mov.AgentData.AgentID = this.AgentID;
+ mov.AgentData.SessionID = this.m_sessionId;
+ mov.AgentData.AgentID = this.AgentId;
mov.Data.RegionHandle = regInfo.RegionHandle;
mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this
@@ -377,7 +370,7 @@ namespace OpenSim.Region.ClientStack
{
AgentCircuitData agentData = new AgentCircuitData();
agentData.AgentID = this.AgentId;
- agentData.SessionID = this.SessionID;
+ agentData.SessionID = this.m_sessionId;
agentData.SecureSessionID = this.SecureSessionID;
agentData.circuitcode = this.CircuitCode;
agentData.child = false;
@@ -393,8 +386,8 @@ namespace OpenSim.Region.ClientStack
CrossedRegionPacket newSimPack = new CrossedRegionPacket();
newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
- newSimPack.AgentData.AgentID = this.AgentID;
- newSimPack.AgentData.SessionID = this.SessionID;
+ newSimPack.AgentData.AgentID = this.AgentId;
+ newSimPack.AgentData.SessionID = this.m_sessionId;
newSimPack.Info = new CrossedRegionPacket.InfoBlock();
newSimPack.Info.Position = pos;
newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
@@ -415,7 +408,7 @@ namespace OpenSim.Region.ClientStack
public void SendMapBlock(List mapBlocks)
{
MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
- mapReply.AgentData.AgentID = this.AgentID;
+ mapReply.AgentData.AgentID = this.AgentId;
mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
mapReply.AgentData.Flags = 0;
@@ -437,7 +430,7 @@ namespace OpenSim.Region.ClientStack
public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
{
TeleportLocalPacket tpLocal = new TeleportLocalPacket();
- tpLocal.Info.AgentID = this.AgentID;
+ tpLocal.Info.AgentID = this.AgentId;
tpLocal.Info.TeleportFlags = flags;
tpLocal.Info.LocationID = 2;
tpLocal.Info.LookAt = lookAt;
@@ -448,7 +441,7 @@ namespace OpenSim.Region.ClientStack
public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags, string capsURL)
{
TeleportFinishPacket teleport = new TeleportFinishPacket();
- teleport.Info.AgentID = this.AgentID;
+ teleport.Info.AgentID = this.AgentId;
teleport.Info.RegionHandle = regionHandle;
teleport.Info.SimAccess = simAccess;
@@ -475,8 +468,8 @@ namespace OpenSim.Region.ClientStack
public void SendTeleportCancel()
{
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
- tpCancel.Info.SessionID = this.SessionID;
- tpCancel.Info.AgentID = this.AgentID;
+ tpCancel.Info.SessionID = this.m_sessionId;
+ tpCancel.Info.AgentID = this.AgentId;
OutPacket(tpCancel);
}
@@ -494,7 +487,7 @@ namespace OpenSim.Region.ClientStack
public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
{
MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket();
- money.MoneyData.AgentID = this.AgentID;
+ money.MoneyData.AgentID = this.AgentId;
money.MoneyData.TransactionID = transaction;
money.MoneyData.TransactionSuccess = success;
money.MoneyData.Description = description;
@@ -641,7 +634,7 @@ namespace OpenSim.Region.ClientStack
Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647;
UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
- InventoryReply.AgentData.AgentID = this.AgentID;
+ InventoryReply.AgentData.AgentID = this.AgentId;
InventoryReply.AgentData.SimApproved = true;
InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
@@ -672,8 +665,8 @@ namespace OpenSim.Region.ClientStack
public void SendRemoveInventoryItem(LLUUID itemID)
{
RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
- remove.AgentData.AgentID = this.AgentID;
- remove.AgentData.SessionID = this.SessionID;
+ remove.AgentData.AgentID = this.AgentId;
+ remove.AgentData.SessionID = this.m_sessionId;
remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
remove.InventoryData[0].ItemID = itemID;
@@ -718,7 +711,7 @@ namespace OpenSim.Region.ClientStack
public void SendAgentAlertMessage(string message, bool modal)
{
AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket();
- alertPack.AgentData.AgentID = this.AgentID;
+ alertPack.AgentData.AgentID = this.AgentId;
alertPack.AlertData.Message = Helpers.StringToField(message);
alertPack.AlertData.Modal = modal;
OutPacket(alertPack);
@@ -799,7 +792,7 @@ namespace OpenSim.Region.ClientStack
public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID)
{
AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket();
- avatarReply.AgentData.AgentID = this.AgentID;
+ avatarReply.AgentData.AgentID = this.AgentId;
avatarReply.AgentData.AvatarID = avatarID;
avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn);
@@ -823,9 +816,9 @@ namespace OpenSim.Region.ClientStack
public void SendWearables(AvatarWearable[] wearables)
{
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
- aw.AgentData.AgentID = this.AgentID;
+ aw.AgentData.AgentID = this.AgentId;
aw.AgentData.SerialNum = 0;
- aw.AgentData.SessionID = this.SessionID;
+ aw.AgentData.SessionID = this.m_sessionId;
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
AgentWearablesUpdatePacket.WearableDataBlock awb;
@@ -968,8 +961,8 @@ namespace OpenSim.Region.ClientStack
public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
{
ObjectAttachPacket attach = new ObjectAttachPacket();
- attach.AgentData.AgentID = this.AgentID;
- attach.AgentData.SessionID = this.SessionID;
+ attach.AgentData.AgentID = this.AgentId;
+ attach.AgentData.SessionID = this.m_sessionId;
attach.AgentData.AttachmentPoint = attachPoint;
attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
@@ -1284,7 +1277,7 @@ namespace OpenSim.Region.ClientStack
objdata.ID = 8880000;
objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
LLVector3 pos2 = new LLVector3(100f, 100f, 23f);
- //objdata.FullID=user.AgentID;
+ //objdata.FullID=user.AgentId;
byte[] pb = pos.GetBytes();
Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
index fdde027..71fea0d 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
@@ -28,6 +28,7 @@
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Console;
+using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.ClientStack
{
@@ -40,13 +41,13 @@ namespace OpenSim.Region.ClientStack
this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
}
- protected virtual bool Logout(ClientView simClient, Packet packet)
+ protected virtual bool Logout(IClientAPI simClient, Packet packet)
{
MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request");
//send reply to let the client logout
LogoutReplyPacket logReply = new LogoutReplyPacket();
- logReply.AgentData.AgentID = this.AgentID;
- logReply.AgentData.SessionID = this.SessionID;
+ logReply.AgentData.AgentID = this.AgentId;
+ logReply.AgentData.SessionID = this.m_sessionId;
logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
logReply.InventoryData[0].ItemID = LLUUID.Zero;
@@ -56,13 +57,13 @@ namespace OpenSim.Region.ClientStack
return true;
}
- protected bool AgentTextureCached(ClientView simclient, Packet packet)
+ protected bool AgentTextureCached(IClientAPI simclient, Packet packet)
{
//System.Console.WriteLine("texture cached: " + packet.ToString());
AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet;
AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
- cachedresp.AgentData.AgentID = this.AgentID;
- cachedresp.AgentData.SessionID = this.SessionID;
+ cachedresp.AgentData.AgentID = this.AgentId;
+ cachedresp.AgentData.SessionID = this.m_sessionId;
cachedresp.AgentData.SerialNum = this.cachedtextureserial;
this.cachedtextureserial++;
cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length];
@@ -77,7 +78,7 @@ namespace OpenSim.Region.ClientStack
return true;
}
- protected bool MultipleObjUpdate(ClientView simClient, Packet packet)
+ protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet)
{
MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
// System.Console.WriteLine("new multi update packet " + multipleupdate.ToString());
@@ -197,7 +198,7 @@ namespace OpenSim.Region.ClientStack
//should be getting the map layer from the grid server
//send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
- mapReply.AgentData.AgentID = this.AgentID;
+ mapReply.AgentData.AgentID = this.AgentId;
mapReply.AgentData.Flags = 0;
mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
@@ -214,7 +215,7 @@ namespace OpenSim.Region.ClientStack
/*
IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY);
MapBlockReplyPacket mbReply = new MapBlockReplyPacket();
- mbReply.AgentData.AgentID = this.AgentID;
+ mbReply.AgentData.AgentId = this.AgentId;
int len;
if (simMapProfiles == null)
len = 0;
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 80e499b..95ce3c5 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -33,6 +33,7 @@ using libsecondlife.Packets;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
+using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.ClientStack
{
@@ -76,12 +77,12 @@ namespace OpenSim.Region.ClientStack
{
case PacketType.ViewerEffect:
ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
- foreach (ClientView client in m_clientThreads.Values)
+ foreach (IClientAPI client in m_clientThreads.Values)
{
- if (client.AgentID != this.AgentID)
+ if (client.AgentId != this.AgentId)
{
- viewer.AgentData.AgentID = client.AgentID;
- viewer.AgentData.SessionID = client.SessionID;
+ viewer.AgentData.AgentID = client.AgentId;
+ viewer.AgentData.SessionID = client.SessionId;
client.OutPacket(viewer);
}
}
@@ -106,7 +107,7 @@ namespace OpenSim.Region.ClientStack
byte[] message = inchatpack.ChatData.Message;
byte type = inchatpack.ChatData.Type;
LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
- LLUUID fromAgentID = AgentID;
+ LLUUID fromAgentID = AgentId;
int channel = inchatpack.ChatData.Channel;
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 1d92cca..2bff88a 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -45,7 +45,7 @@ using Timer = System.Timers.Timer;
namespace OpenSim.Region.ClientStack
{
- public delegate bool PacketMethod(ClientView simClient, Packet packet);
+ public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
///
/// Handles new client connections
@@ -58,8 +58,7 @@ namespace OpenSim.Region.ClientStack
protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients
protected Dictionary m_packetHandlers = new Dictionary(); //local handlers for this instance
- public LLUUID AgentID;
- public LLUUID SessionID;
+ private LLUUID m_sessionId;
public LLUUID SecureSessionID = LLUUID.Zero;
public string firstName;
public string lastName;
@@ -72,7 +71,7 @@ namespace OpenSim.Region.ClientStack
private LLUUID newAssetFolder = LLUUID.Zero;
private int debug = 0;
protected IScene m_scene;
- private Dictionary m_clientThreads;
+ private Dictionary m_clientThreads;
private AssetCache m_assetCache;
// private InventoryCache m_inventoryCache;
private int cachedtextureserial = 0;
@@ -84,7 +83,7 @@ namespace OpenSim.Region.ClientStack
private int probesWithNoIngressPackets = 0;
private int lastPacketsReceived = 0;
- public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
+ public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
{
m_moneyBalance = 1000;
@@ -116,6 +115,11 @@ namespace OpenSim.Region.ClientStack
ClientThread.Start();
}
+ public LLUUID SessionId
+ {
+ get { return m_sessionId; }
+ }
+
public void SetDebug(int newDebug)
{
debug = newDebug;
@@ -285,7 +289,7 @@ namespace OpenSim.Region.ClientStack
protected virtual void AuthUser()
{
- // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
+ // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.m_sessionId, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
if (!sessionInfo.Authorised)
{
@@ -297,8 +301,8 @@ namespace OpenSim.Region.ClientStack
{
MainLog.Instance.Notice("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
//session is authorised
- this.AgentID = cirpack.CircuitCode.ID;
- this.SessionID = cirpack.CircuitCode.SessionID;
+ m_agentId = cirpack.CircuitCode.ID;
+ this.m_sessionId = cirpack.CircuitCode.SessionID;
this.CircuitCode = cirpack.CircuitCode.Code;
this.firstName = sessionInfo.LoginInfo.First;
this.lastName = sessionInfo.LoginInfo.Last;
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index 5d0862b..481e445 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ClientStack
{
private ClientStackNetworkHandler _networkHandler;
private IScene _localScene;
- public Dictionary ClientThreads = new Dictionary();
+ public Dictionary ClientThreads = new Dictionary();
private ClientManager m_clientManager = new ClientManager();
public ClientManager ClientManager
{
@@ -106,7 +106,7 @@ namespace OpenSim.Region.ClientStack
///
///
///
- public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient)
+ public virtual void SendPacketToAllExcept(Packet packet, IClientAPI simClient)
{
}
@@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack
}
- protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
+ protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
{
return new ClientView(remoteEP, initialcirpack, clientThreads, scene, assetCache, packServer, authenSessions );
}
@@ -145,7 +145,7 @@ namespace OpenSim.Region.ClientStack
///
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, AgentCircuitManager authenticateSessionsClass)
{
- ClientView newuser =
+ IClientAPI newuser =
CreateNewClient(epSender, useCircuit, ClientThreads, _localScene, assetCache, this,
authenticateSessionsClass);
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index b009192..72a1e19 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -1,16 +1,11 @@
using System.Collections.Generic;
using System.Net;
-using System.Timers;
-using System;
using System.Text;
-
using libsecondlife;
using libsecondlife.Packets;
-
-using OpenSim.Framework;
+using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
-using OpenSim.Framework.Data;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Scenes;
@@ -228,5 +223,13 @@ namespace SimpleApp
public void SendViewerTime(int phase) { }
public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { }
public void SetDebug(int newDebug) { }
+
+ public void InPacket(Packet NewPack)
+ {
+ }
+
+ public void ConnectionClosed()
+ {
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index e1989c4..197eb72 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -284,8 +284,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
long before;
before = GC.GetTotalMemory(true);
#endif
- LSL_BaseClass CompiledScript;
- CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
+
+ LSL_BaseClass CompiledScript;
+ CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
+
#if DEBUG
Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
#endif
--
cgit v1.1