* Moved SendNameReply to ClientView
* Removed unused LoginService * Minor renames on BinaryStreamHandlerafrisby
parent
0f1b2f278b
commit
a0ac1f06e6
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,5 +180,6 @@ namespace OpenSim.Framework.Interfaces
|
|||
|
||||
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
||||
void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
|
||||
void SendNameReply(LLUUID profileId, string firstname, string lastname);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -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,8 +34,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -576,7 +576,6 @@ namespace OpenSim.Region.ClientStack
|
|||
this.OutPacket(inventoryReply);
|
||||
}
|
||||
|
||||
|
||||
#region Appearance/ Wearables Methods
|
||||
|
||||
/// <summary>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue