* Moved SendNameReply to ClientView

* Removed unused LoginService
* Minor renames on BinaryStreamHandler
afrisby
lbsa71 2007-07-13 07:19:00 +00:00
parent 0f1b2f278b
commit a0ac1f06e6
6 changed files with 31 additions and 53 deletions

View File

@ -55,20 +55,17 @@ namespace OpenSim.Framework.Communications
#region Packet Handlers #region Packet Handlers
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client) public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
{ {
Encoding enc = Encoding.ASCII;
UserProfileData profileData = this.UserServer.GetUserProfile(uuid); UserProfileData profileData = this.UserServer.GetUserProfile(uuid);
if (profileData != null) if (profileData != null)
{ {
UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); LLUUID profileId = profileData.UUID;
packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; string firstname = profileData.username;
packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); string lastname = profileData.surname;
packet.UUIDNameBlock[0].ID = profileData.UUID;
packet.UUIDNameBlock[0].FirstName = enc.GetBytes(profileData.username + "\0"); remote_client.SendNameReply(profileId, firstname, lastname);
packet.UUIDNameBlock[0].LastName = enc.GetBytes(profileData.surname +"\0"); }
remote_client.OutPacket((Packet)packet);
} }
}
#endregion #endregion
} }
} }

View File

@ -180,5 +180,6 @@ namespace OpenSim.Framework.Interfaces
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
void SendNameReply(LLUUID profileId, string firstname, string lastname);
} }
} }

View File

@ -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
{
}
}

View File

@ -5,27 +5,28 @@ using System.IO;
namespace OpenSim.Framework.Servers namespace OpenSim.Framework.Servers
{ {
public delegate string BinaryMethod(byte[] data, string path, string param);
public class BinaryStreamHandler : BaseStreamHandler public class BinaryStreamHandler : BaseStreamHandler
{ {
BinaryMethod m_restMethod; BinaryMethod m_method;
override public byte[] Handle(string path, Stream request) override public byte[] Handle(string path, Stream request)
{ {
byte[] data = ReadFully(request); byte[] data = ReadFully(request);
string param = GetParam(path); string param = GetParam(path);
string responseString = m_restMethod(data, path, param); string responseString = m_method(data, path, param);
return Encoding.UTF8.GetBytes(responseString); return Encoding.UTF8.GetBytes(responseString);
} }
public BinaryStreamHandler(string httpMethod, string path, BinaryMethod restMethod) public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod)
: base(httpMethod, path) : base(httpMethod, path)
{ {
m_restMethod = restMethod; m_method = binaryMethod;
} }
public byte[] ReadFully(Stream stream) private byte[] ReadFully(Stream stream)
{ {
byte[] buffer = new byte[32768]; byte[] buffer = new byte[32768];
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
@ -33,8 +34,12 @@ namespace OpenSim.Framework.Servers
while (true) while (true)
{ {
int read = stream.Read(buffer, 0, buffer.Length); int read = stream.Read(buffer, 0, buffer.Length);
if (read <= 0) if (read <= 0)
{
return ms.ToArray(); return ms.ToArray();
}
ms.Write(buffer, 0, read); ms.Write(buffer, 0, read);
} }
} }

View File

@ -28,5 +28,4 @@
namespace OpenSim.Framework.Servers namespace OpenSim.Framework.Servers
{ {
public delegate string RestMethod( string request, string path, string param ); public delegate string RestMethod( string request, string path, string param );
public delegate string BinaryMethod(byte[] data, string path, string param);
} }

View File

@ -576,7 +576,6 @@ namespace OpenSim.Region.ClientStack
this.OutPacket(inventoryReply); this.OutPacket(inventoryReply);
} }
#region Appearance/ Wearables Methods #region Appearance/ Wearables Methods
/// <summary> /// <summary>
@ -1202,5 +1201,16 @@ namespace OpenSim.Region.ClientStack
} }
#endregion #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);
}
} }
} }