* Move a few of the ProcessInPacket switch case blocks into packet handler delegates
parent
f7916d10f3
commit
079691b98f
|
@ -350,7 +350,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
protected IAssetService m_assetService;
|
protected IAssetService m_assetService;
|
||||||
private IHyperAssetService m_hyperAssets;
|
private IHyperAssetService m_hyperAssets;
|
||||||
|
private const bool m_checkPackets = true;
|
||||||
|
|
||||||
#endregion Class Members
|
#endregion Class Members
|
||||||
|
|
||||||
|
@ -4297,6 +4297,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest);
|
AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest);
|
||||||
AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest);
|
AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest);
|
||||||
AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage);
|
AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage);
|
||||||
|
AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest);
|
||||||
|
AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
|
||||||
|
AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate);
|
||||||
|
AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
|
||||||
|
AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Packet Handlers
|
#region Packet Handlers
|
||||||
|
@ -4512,6 +4517,98 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack)
|
||||||
|
{
|
||||||
|
AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
|
||||||
|
|
||||||
|
#region Packet Session and User Check
|
||||||
|
if (m_checkPackets)
|
||||||
|
{
|
||||||
|
if (avatarProperties.AgentData.SessionID != SessionId ||
|
||||||
|
avatarProperties.AgentData.AgentID != AgentId)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
RequestAvatarProperties handlerRequestAvatarProperties = OnRequestAvatarProperties;
|
||||||
|
if (handlerRequestAvatarProperties != null)
|
||||||
|
{
|
||||||
|
handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool HandleChatFromViewer(IClientAPI sender, Packet Pack)
|
||||||
|
{
|
||||||
|
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
|
||||||
|
|
||||||
|
#region Packet Session and User Check
|
||||||
|
if (m_checkPackets)
|
||||||
|
{
|
||||||
|
if (inchatpack.AgentData.SessionID != SessionId ||
|
||||||
|
inchatpack.AgentData.AgentID != AgentId)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
string fromName = String.Empty; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
|
||||||
|
byte[] message = inchatpack.ChatData.Message;
|
||||||
|
byte type = inchatpack.ChatData.Type;
|
||||||
|
Vector3 fromPos = new Vector3(); // ClientAvatar.Pos;
|
||||||
|
// UUID fromAgentID = AgentId;
|
||||||
|
|
||||||
|
int channel = inchatpack.ChatData.Channel;
|
||||||
|
|
||||||
|
if (OnChatFromClient != null)
|
||||||
|
{
|
||||||
|
OSChatMessage args = new OSChatMessage();
|
||||||
|
args.Channel = channel;
|
||||||
|
args.From = fromName;
|
||||||
|
args.Message = Utils.BytesToString(message);
|
||||||
|
args.Type = (ChatTypeEnum)type;
|
||||||
|
args.Position = fromPos;
|
||||||
|
|
||||||
|
args.Scene = Scene;
|
||||||
|
args.Sender = this;
|
||||||
|
args.SenderUUID = this.AgentId;
|
||||||
|
|
||||||
|
ChatMessage handlerChatFromClient = OnChatFromClient;
|
||||||
|
if (handlerChatFromClient != null)
|
||||||
|
handlerChatFromClient(this, args);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool HandlerAvatarPropertiesUpdate(IClientAPI sender, Packet Pack)
|
||||||
|
{
|
||||||
|
AvatarPropertiesUpdatePacket avatarProps = (AvatarPropertiesUpdatePacket)Pack;
|
||||||
|
|
||||||
|
#region Packet Session and User Check
|
||||||
|
if (m_checkPackets)
|
||||||
|
{
|
||||||
|
if (avatarProps.AgentData.SessionID != SessionId ||
|
||||||
|
avatarProps.AgentData.AgentID != AgentId)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
UpdateAvatarProperties handlerUpdateAvatarProperties = OnUpdateAvatarProperties;
|
||||||
|
if (handlerUpdateAvatarProperties != null)
|
||||||
|
{
|
||||||
|
AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = avatarProps.PropertiesData;
|
||||||
|
UserProfileData UserProfile = new UserProfileData();
|
||||||
|
UserProfile.ID = AgentId;
|
||||||
|
UserProfile.AboutText = Utils.BytesToString(Properties.AboutText);
|
||||||
|
UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText);
|
||||||
|
UserProfile.FirstLifeImage = Properties.FLImageID;
|
||||||
|
UserProfile.Image = Properties.ImageID;
|
||||||
|
UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL);
|
||||||
|
|
||||||
|
handlerUpdateAvatarProperties(this, UserProfile);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Packet Handlers
|
#endregion Packet Handlers
|
||||||
|
|
||||||
public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
|
public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
|
||||||
|
@ -5003,13 +5100,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool m_checkPackets = true;
|
|
||||||
|
|
||||||
// Main packet processing conditional
|
// Main packet processing conditional
|
||||||
switch (Pack.Type)
|
switch (Pack.Type)
|
||||||
{
|
{
|
||||||
#region Scene/Avatar
|
#region Scene/Avatar
|
||||||
|
/*
|
||||||
case PacketType.AvatarPropertiesRequest:
|
case PacketType.AvatarPropertiesRequest:
|
||||||
AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
|
AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
|
||||||
|
|
||||||
|
@ -5096,7 +5193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerUpdateAvatarProperties(this, UserProfile);
|
handlerUpdateAvatarProperties(this, UserProfile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
case PacketType.ScriptDialogReply:
|
case PacketType.ScriptDialogReply:
|
||||||
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
|
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue