diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index ebc9632d4f..550372fa09 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -55,20 +55,17 @@ namespace OpenSim.Framework.Communications #region Packet Handlers public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) { - Encoding enc = Encoding.ASCII; UserProfileData profileData = this.UserServer.GetUserProfile(uuid); if (profileData != null) { - UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); - packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; - packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); - packet.UUIDNameBlock[0].ID = profileData.UUID; - packet.UUIDNameBlock[0].FirstName = enc.GetBytes(profileData.username + "\0"); - packet.UUIDNameBlock[0].LastName = enc.GetBytes(profileData.surname +"\0"); - remote_client.OutPacket((Packet)packet); - } - + LLUUID profileId = profileData.UUID; + string firstname = profileData.username; + string lastname = profileData.surname; + + remote_client.SendNameReply(profileId, firstname, lastname); + } } + #endregion } } diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index edd693e86e..b6f304be73 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs @@ -180,5 +180,6 @@ namespace OpenSim.Framework.Interfaces void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items); void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); + void SendNameReply(LLUUID profileId, string firstname, string lastname); } } diff --git a/OpenSim/Framework/General/LoginService.cs b/OpenSim/Framework/General/LoginService.cs deleted file mode 100644 index 02efcec554..0000000000 --- a/OpenSim/Framework/General/LoginService.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -namespace OpenSim.Framework.Grid -{ - public abstract class LoginService - { - - } -} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs index 302dbff039..7d4e4ce199 100644 --- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs @@ -5,27 +5,28 @@ using System.IO; namespace OpenSim.Framework.Servers { + public delegate string BinaryMethod(byte[] data, string path, string param); public class BinaryStreamHandler : BaseStreamHandler { - BinaryMethod m_restMethod; + BinaryMethod m_method; override public byte[] Handle(string path, Stream request) { byte[] data = ReadFully(request); string param = GetParam(path); - string responseString = m_restMethod(data, path, param); - + string responseString = m_method(data, path, param); + return Encoding.UTF8.GetBytes(responseString); } - public BinaryStreamHandler(string httpMethod, string path, BinaryMethod restMethod) + public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) : base(httpMethod, path) { - m_restMethod = restMethod; + m_method = binaryMethod; } - public byte[] ReadFully(Stream stream) + private byte[] ReadFully(Stream stream) { byte[] buffer = new byte[32768]; using (MemoryStream ms = new MemoryStream()) @@ -33,11 +34,15 @@ namespace OpenSim.Framework.Servers while (true) { int read = stream.Read(buffer, 0, buffer.Length); + if (read <= 0) + { return ms.ToArray(); + } + ms.Write(buffer, 0, read); } - } + } } } diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs index 2a92fc1fc6..c6cb230c93 100644 --- a/OpenSim/Framework/Servers/RestMethod.cs +++ b/OpenSim/Framework/Servers/RestMethod.cs @@ -28,5 +28,4 @@ namespace OpenSim.Framework.Servers { public delegate string RestMethod( string request, string path, string param ); - public delegate string BinaryMethod(byte[] data, string path, string param); } diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 1c359c2ccb..b47d95af83 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -576,7 +576,6 @@ namespace OpenSim.Region.ClientStack this.OutPacket(inventoryReply); } - #region Appearance/ Wearables Methods /// @@ -1202,5 +1201,16 @@ namespace OpenSim.Region.ClientStack } #endregion + public void SendNameReply(LLUUID profileId, string firstname, string lastname) + { + Encoding enc = Encoding.ASCII; + UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); + packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; + packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); + packet.UUIDNameBlock[0].ID = profileId; + packet.UUIDNameBlock[0].FirstName = enc.GetBytes(firstname + "\0"); + packet.UUIDNameBlock[0].LastName = enc.GetBytes(lastname + "\0"); + OutPacket((Packet)packet); + } } }