From a0ac1f06e62bdfcf08264c8e89fb4e42a2d1f5d6 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Fri, 13 Jul 2007 07:19:00 +0000 Subject: * Moved SendNameReply to ClientView * Removed unused LoginService * Minor renames on BinaryStreamHandler --- .../Communications/CommunicationsManager.cs | 17 +++++------ OpenSim/Framework/General/Interfaces/IClientAPI.cs | 1 + OpenSim/Framework/General/LoginService.cs | 34 ---------------------- OpenSim/Framework/Servers/BinaryStreamHandler.cs | 19 +++++++----- OpenSim/Framework/Servers/RestMethod.cs | 1 - 5 files changed, 20 insertions(+), 52 deletions(-) delete mode 100644 OpenSim/Framework/General/LoginService.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index ebc9632..550372f 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 edd693e..b6f304b 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 02efcec..0000000 --- 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 302dbff..7d4e4ce 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 2a92fc1..c6cb230 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); } -- cgit v1.1