Applied patch from Mantis# 3240, thanks tlaukkan/Tommil
parent
b83d5c7cdb
commit
95230c244c
|
@ -46,30 +46,38 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
{
|
{
|
||||||
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private readonly Session mxpSession;
|
private readonly Session m_session;
|
||||||
private readonly UUID mxpSessionID;
|
private readonly UUID m_sessionID;
|
||||||
private readonly IScene mxpHostBubble;
|
private readonly UUID m_userID;
|
||||||
private readonly string mxpUsername;
|
private readonly IScene m_hostBubble;
|
||||||
|
private readonly string m_firstName;
|
||||||
|
private readonly string m_lastName;
|
||||||
|
|
||||||
private int debugLevel;
|
private Vector3 m_startPosition=new Vector3(128f, 128f, 128f);
|
||||||
|
private int m_debugLevel;
|
||||||
|
|
||||||
public MXPClientView(Session mxpSession, UUID mxpSessionID, IScene mxpHostBubble, string mxpUsername)
|
|
||||||
|
public MXPClientView(Session mxpSession, UUID mxpSessionID, UUID userID, IScene mxpHostBubble, string mxpFirstName, string mxpLastName)
|
||||||
{
|
{
|
||||||
this.mxpSession = mxpSession;
|
this.m_session = mxpSession;
|
||||||
this.mxpUsername = mxpUsername;
|
this.m_userID = userID;
|
||||||
this.mxpHostBubble = mxpHostBubble;
|
this.m_firstName = mxpFirstName;
|
||||||
this.mxpSessionID = mxpSessionID;
|
this.m_lastName = mxpLastName;
|
||||||
|
this.m_hostBubble = mxpHostBubble;
|
||||||
|
this.m_sessionID = mxpSessionID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Session Session
|
public Session Session
|
||||||
{
|
{
|
||||||
get { return mxpSession; }
|
get { return m_session; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessMXPPacket(Message msg)
|
public bool ProcessMXPPacket(Message msg)
|
||||||
{
|
{
|
||||||
if (debugLevel > 0)
|
if (m_debugLevel > 0)
|
||||||
m_log.Warn("[MXP] Got Action/Command Packet: " + msg);
|
{
|
||||||
|
m_log.Warn("[MXP] Received messaged unhandled: " + msg);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -78,23 +86,23 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
|
|
||||||
public Vector3 StartPos
|
public Vector3 StartPos
|
||||||
{
|
{
|
||||||
get { return new Vector3(128f, 128f, 128f); }
|
get { return m_startPosition; }
|
||||||
set { } // TODO: Implement Me
|
set { m_startPosition = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID AgentId
|
public UUID AgentId
|
||||||
{
|
{
|
||||||
get { return mxpSessionID; }
|
get { return m_userID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID SessionId
|
public UUID SessionId
|
||||||
{
|
{
|
||||||
get { return mxpSessionID; }
|
get { return m_sessionID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID SecureSessionId
|
public UUID SecureSessionId
|
||||||
{
|
{
|
||||||
get { return mxpSessionID; }
|
get { return m_sessionID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID ActiveGroupId
|
public UUID ActiveGroupId
|
||||||
|
@ -124,17 +132,17 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
|
|
||||||
public string FirstName
|
public string FirstName
|
||||||
{
|
{
|
||||||
get { return mxpUsername; }
|
get { return m_firstName; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LastName
|
public string LastName
|
||||||
{
|
{
|
||||||
get { return "@mxp://" + Session.RemoteEndPoint.Address; }
|
get { return m_lastName; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScene Scene
|
public IScene Scene
|
||||||
{
|
{
|
||||||
get { return mxpHostBubble; }
|
get { return m_hostBubble; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int NextAnimationSequenceNumber
|
public int NextAnimationSequenceNumber
|
||||||
|
@ -165,7 +173,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
|
|
||||||
public uint CircuitCode
|
public uint CircuitCode
|
||||||
{
|
{
|
||||||
get { return mxpSessionID.CRC(); }
|
get { return m_sessionID.CRC(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public event GenericMessage OnGenericMessage;
|
public event GenericMessage OnGenericMessage;
|
||||||
|
@ -348,7 +356,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
|
|
||||||
public void SetDebugPacketLevel(int newDebug)
|
public void SetDebugPacketLevel(int newDebug)
|
||||||
{
|
{
|
||||||
debugLevel = newDebug;
|
m_debugLevel = newDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InPacket(object NewPack)
|
public void InPacket(object NewPack)
|
||||||
|
@ -560,14 +568,42 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
// Need to translate to MXP somehow
|
// Need to translate to MXP somehow
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
|
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 pos, byte[] textureEntry, uint parentID, Quaternion rotation)
|
||||||
{
|
{
|
||||||
// TODO: This needs handling - to display other avatars
|
m_log.Info("[MXP] Transmitting Avatar Data " + firstName + " " + lastName);
|
||||||
|
|
||||||
|
PerceptionEventMessage pe = new PerceptionEventMessage();
|
||||||
|
|
||||||
|
pe.ObjectFragment.ObjectId = avatarID.Guid;
|
||||||
|
// TODO Resolve ParentID
|
||||||
|
pe.ObjectFragment.ParentObjectId = Guid.Empty;
|
||||||
|
pe.ObjectFragment.ObjectIndex = avatarLocalID;
|
||||||
|
pe.ObjectFragment.ObjectName = firstName+" "+lastName;
|
||||||
|
pe.ObjectFragment.OwnerId = Guid.Empty;
|
||||||
|
pe.ObjectFragment.TypeId = Guid.Empty;
|
||||||
|
pe.ObjectFragment.TypeName = "Avatar";
|
||||||
|
pe.ObjectFragment.Acceleration = new float[3];
|
||||||
|
pe.ObjectFragment.AngularAcceleration = new float[4];
|
||||||
|
pe.ObjectFragment.AngularVelocity = new float[4];
|
||||||
|
pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value
|
||||||
|
|
||||||
|
pe.ObjectFragment.Location = new float[] { pos.X, pos.Y, pos.Z };
|
||||||
|
|
||||||
|
pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value
|
||||||
|
pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
|
||||||
|
pe.ObjectFragment.Velocity = new float[3];
|
||||||
|
|
||||||
|
Session.Send(pe);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation)
|
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation)
|
||||||
{
|
{
|
||||||
// TODO: This probably needs handling - update other avatar positions
|
MovementEventMessage me = new MovementEventMessage();
|
||||||
|
me.ObjectIndex = localID;
|
||||||
|
me.Location = new float[] { position.X, position.Y, position.Z };
|
||||||
|
me.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
|
||||||
|
|
||||||
|
Session.Send(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCoarseLocationUpdate(List<Vector3> CoarseLocations)
|
public void SendCoarseLocationUpdate(List<Vector3> CoarseLocations)
|
||||||
|
@ -610,20 +646,17 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f };
|
pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f };
|
||||||
pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
|
pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
|
||||||
|
|
||||||
pe.ObjectFragment.Location = new float[] { pos.X - 120.0f, pos.Z, pos.Y - 128.0f };
|
pe.ObjectFragment.Location = new float[] { pos.X , pos.Y, pos.Z };
|
||||||
|
|
||||||
pe.ObjectFragment.Mass = 1.0f;
|
pe.ObjectFragment.Mass = 1.0f;
|
||||||
pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
|
pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
|
||||||
pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z };
|
pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z };
|
||||||
|
|
||||||
|
ObjectExtFragment ext = new ObjectExtFragment();
|
||||||
|
|
||||||
if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
|
if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
|
||||||
{
|
{
|
||||||
ObjectExtFragment ext = new ObjectExtFragment();
|
|
||||||
ext.UpdateFlags = flags;
|
|
||||||
|
|
||||||
ext.TextureEntry = primShape.TextureEntry;
|
|
||||||
ext.TextureAnim = textureanim;
|
|
||||||
ext.State = primShape.State;
|
|
||||||
ext.PathBegin = primShape.PathBegin;
|
ext.PathBegin = primShape.PathBegin;
|
||||||
ext.PathEnd = primShape.PathEnd;
|
ext.PathEnd = primShape.PathEnd;
|
||||||
ext.PathScaleX = primShape.PathScaleX;
|
ext.PathScaleX = primShape.PathScaleX;
|
||||||
|
@ -633,7 +666,6 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
ext.PathSkew = primShape.PathSkew;
|
ext.PathSkew = primShape.PathSkew;
|
||||||
ext.ProfileBegin = primShape.ProfileBegin;
|
ext.ProfileBegin = primShape.ProfileBegin;
|
||||||
ext.ProfileEnd = primShape.ProfileEnd;
|
ext.ProfileEnd = primShape.ProfileEnd;
|
||||||
ext.Scale = EncodeVector(primShape.Scale);
|
|
||||||
ext.PathCurve = primShape.PathCurve;
|
ext.PathCurve = primShape.PathCurve;
|
||||||
ext.ProfileCurve = primShape.ProfileCurve;
|
ext.ProfileCurve = primShape.ProfileCurve;
|
||||||
ext.ProfileHollow = primShape.ProfileHollow;
|
ext.ProfileHollow = primShape.ProfileHollow;
|
||||||
|
@ -643,8 +675,16 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
ext.PathTaperY = primShape.PathTaperY;
|
ext.PathTaperY = primShape.PathTaperY;
|
||||||
ext.PathTwist = primShape.PathTwist;
|
ext.PathTwist = primShape.PathTwist;
|
||||||
ext.PathTwistBegin = primShape.PathTwistBegin;
|
ext.PathTwistBegin = primShape.PathTwistBegin;
|
||||||
ext.ExtraParams = primShape.ExtraParams;
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ext.UpdateFlags = flags;
|
||||||
|
ext.ExtraParams = primShape.ExtraParams;
|
||||||
|
ext.State = primShape.State;
|
||||||
|
ext.TextureEntry = primShape.TextureEntry;
|
||||||
|
ext.TextureAnim = textureanim;
|
||||||
|
ext.Scale = EncodeVector(primShape.Scale);
|
||||||
ext.Text = text;
|
ext.Text = text;
|
||||||
ext.TextColor = EncodeColor(textColor);
|
ext.TextColor = EncodeColor(textColor);
|
||||||
ext.PSBlock = particleSystem;
|
ext.PSBlock = particleSystem;
|
||||||
|
@ -653,8 +693,6 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
|
|
||||||
pe.SetExtension<ObjectExtFragment>(ext);
|
pe.SetExtension<ObjectExtFragment>(ext);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Session.Send(pe);
|
Session.Send(pe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,8 +216,8 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
m_log.Info("Pending Sessions: " + PendingSessionCount);
|
m_log.Info("Pending Sessions: " + PendingSessionCount);
|
||||||
m_log.Info("Sessions: " + SessionCount + " (Clients: " + Clients.Count + " )");
|
m_log.Info("Sessions: " + SessionCount + " (Clients: " + Clients.Count + " )");
|
||||||
m_log.Info("Transmitter Alive?: " + IsTransmitterAlive);
|
m_log.Info("Transmitter Alive?: " + IsTransmitterAlive);
|
||||||
m_log.Info("Packets Sent/Recieved: " + PacketsSent + " / " + PacketsReceived);
|
m_log.Info("Packets Sent/Received: " + PacketsSent + " / " + PacketsReceived);
|
||||||
m_log.Info("Bytes Sent/Recieved: " + BytesSent + " / " + BytesReceived);
|
m_log.Info("Bytes Sent/Received: " + BytesSent + " / " + BytesReceived);
|
||||||
m_log.Info("Send/Recieve Rate (bps): " + SendRate + " / " + ReceiveRate);
|
m_log.Info("Send/Recieve Rate (bps): " + SendRate + " / " + ReceiveRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,14 +247,45 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
sessionsToRemove.Clear();
|
sessionsToRemove.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AuthoriseUser(string participantName, string pass, UUID scene)
|
public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UUID userId, out string firstName, out string lastName)
|
||||||
{
|
{
|
||||||
if (Scenes.ContainsKey(scene))
|
userId = UUID.Zero;
|
||||||
return true;
|
firstName = "";
|
||||||
|
lastName = "";
|
||||||
|
|
||||||
|
if (!Scenes.ContainsKey(sceneId))
|
||||||
|
{
|
||||||
|
m_log.Info("Login failed as region was not found: " + sceneId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string[] nameParts=participantName.Split(' ');
|
||||||
|
if(nameParts.Length!=2)
|
||||||
|
{
|
||||||
|
m_log.Info("Login failed as user name is not formed of first and last name separated by space: " + participantName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
firstName = nameParts[0];
|
||||||
|
lastName = nameParts[1];
|
||||||
|
|
||||||
|
UserProfileData userProfile = Scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName);
|
||||||
|
if (userProfile == null)
|
||||||
|
{
|
||||||
|
m_log.Info("Login failed as user was not found: " + participantName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
userId = userProfile.ID;
|
||||||
|
|
||||||
|
if (!password.StartsWith("$1$"))
|
||||||
|
{
|
||||||
|
password = "$1$" + Util.Md5Hash(password);
|
||||||
|
}
|
||||||
|
password = password.Remove(0, 3); //remove $1$
|
||||||
|
string s = Util.Md5Hash(password + ":" + userProfile.PasswordSalt);
|
||||||
|
return (userProfile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| userProfile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessMessages()
|
public void ProcessMessages()
|
||||||
{
|
{
|
||||||
if (transmitter.PendingSessionCount > 0)
|
if (transmitter.PendingSessionCount > 0)
|
||||||
|
@ -278,9 +309,13 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
|
|
||||||
JoinRequestMessage joinRequestMessage = (JoinRequestMessage) message;
|
JoinRequestMessage joinRequestMessage = (JoinRequestMessage) message;
|
||||||
|
|
||||||
|
UUID userId;
|
||||||
|
string firstName;
|
||||||
|
string lastName;
|
||||||
|
|
||||||
bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName,
|
bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName,
|
||||||
joinRequestMessage.ParticipantPassphrase,
|
joinRequestMessage.ParticipantPassphrase,
|
||||||
new UUID(joinRequestMessage.BubbleId));
|
new UUID(joinRequestMessage.BubbleId), out userId, out firstName, out lastName);
|
||||||
|
|
||||||
if (authorized)
|
if (authorized)
|
||||||
{
|
{
|
||||||
|
@ -292,10 +327,10 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
(session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
|
(session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
|
||||||
session.RemoteEndPoint.Port + ")");
|
session.RemoteEndPoint.Port + ")");
|
||||||
|
|
||||||
AcceptConnection(session, joinRequestMessage, mxpSessionID);
|
AcceptConnection(session, joinRequestMessage, mxpSessionID,userId);
|
||||||
|
|
||||||
MXPClientView client = new MXPClientView(session, mxpSessionID, target,
|
MXPClientView client = new MXPClientView(session, mxpSessionID,userId, target,
|
||||||
joinRequestMessage.ParticipantName);
|
firstName, lastName);
|
||||||
m_log.Info("[MXP ClientStack] Created Client");
|
m_log.Info("[MXP ClientStack] Created Client");
|
||||||
Clients.Add(client);
|
Clients.Add(client);
|
||||||
|
|
||||||
|
@ -393,7 +428,7 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID)
|
private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID, UUID userId)
|
||||||
{
|
{
|
||||||
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(
|
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(
|
||||||
typeof(JoinResponseMessage));
|
typeof(JoinResponseMessage));
|
||||||
|
@ -401,7 +436,7 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
||||||
joinResponseMessage.FailureCode = 0;
|
joinResponseMessage.FailureCode = 0;
|
||||||
|
|
||||||
joinResponseMessage.ParticipantId = mxpSessionID.Guid;
|
joinResponseMessage.ParticipantId = userId.Guid;
|
||||||
joinResponseMessage.CloudUrl = cloudUrl;
|
joinResponseMessage.CloudUrl = cloudUrl;
|
||||||
|
|
||||||
joinResponseMessage.BubbleName = Scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
|
joinResponseMessage.BubbleName = Scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
|
||||||
|
|
|
@ -1702,6 +1702,7 @@
|
||||||
<Reference name="System"/>
|
<Reference name="System"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Region.Framework"/>
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
<Reference name="protobuf-net"/>
|
<Reference name="protobuf-net"/>
|
||||||
|
|
Loading…
Reference in New Issue