* Added a few more packets to ClientView. Added tendons to the Skeletal Groups Module, made it shared to save on threads.

ThreadPoolClientBranch
Teravus Ovares 2008-02-20 09:45:26 +00:00
parent 9be5f9d6cc
commit ac60382599
4 changed files with 303 additions and 15 deletions

View File

@ -451,6 +451,10 @@ namespace OpenSim.Framework
event Action<IClientAPI> OnRequestAvatarsData; event Action<IClientAPI> OnRequestAvatarsData;
event AddNewPrim OnAddPrim; event AddNewPrim OnAddPrim;
event FetchInventory OnAgentDataUpdateRequest;
event FetchInventory OnUserInfoRequest;
event TeleportLocationRequest OnSetStartLocationRequest;
event RequestGodlikePowers OnRequestGodlikePowers; event RequestGodlikePowers OnRequestGodlikePowers;
event GodKickUser OnGodKickUser; event GodKickUser OnGodKickUser;
@ -620,6 +624,8 @@ namespace OpenSim.Framework
void SendXferPacket(ulong xferID, uint packet, byte[] data); void SendXferPacket(ulong xferID, uint packet, byte[] data);
void SendAvatarPickerReply(AvatarPickerReplyPacket Pack); void SendAvatarPickerReply(AvatarPickerReplyPacket Pack);
void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle);
void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID); void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID);
void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags); void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags);
void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain); void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain);

View File

@ -561,6 +561,11 @@ namespace OpenSim.Region.ClientStack
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun; public event SetAlwaysRun OnSetAlwaysRun;
public event FetchInventory OnAgentDataUpdateRequest;
public event FetchInventory OnUserInfoRequest;
public event TeleportLocationRequest OnSetStartLocationRequest;
public event CreateNewInventoryItem OnCreateNewInventoryItem; public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder; public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder; public event UpdateInventoryFolder OnUpdateInventoryFolder;
@ -1301,6 +1306,19 @@ namespace OpenSim.Region.ClientStack
OutPacket(replyPacket, ThrottleOutPacketType.Task); OutPacket(replyPacket, ThrottleOutPacketType.Task);
} }
public void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname,string grouptitle)
{
AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid;
sendAgentDataUpdate.AgentData.AgentID = agentid;
sendAgentDataUpdate.AgentData.FirstName = Helpers.StringToField(firstname);
sendAgentDataUpdate.AgentData.GroupName = Helpers.StringToField(groupname);
sendAgentDataUpdate.AgentData.GroupPowers = grouppowers;
sendAgentDataUpdate.AgentData.GroupTitle = Helpers.StringToField(grouptitle);
sendAgentDataUpdate.AgentData.LastName = Helpers.StringToField(lastname);
OutPacket(sendAgentDataUpdate,ThrottleOutPacketType.Task);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -2795,6 +2813,7 @@ namespace OpenSim.Region.ClientStack
//rezPacket.RezData.RezSelected; //rezPacket.RezData.RezSelected;
//rezPacket.RezData.FromTaskID; //rezPacket.RezData.FromTaskID;
//m_log.Info("[REZData]: " + rezPacket.ToString()); //m_log.Info("[REZData]: " + rezPacket.ToString());
OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
@ -2949,6 +2968,41 @@ namespace OpenSim.Region.ClientStack
Helpers.FieldToUTF8String(querydata.Name)); Helpers.FieldToUTF8String(querydata.Name));
} }
break; break;
case PacketType.AgentDataUpdateRequest:
AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
if (OnAgentDataUpdateRequest != null)
{
OnAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID);
}
break;
case PacketType.UserInfoRequest:
UserInfoRequestPacket avUserInfoRequestPacket = (UserInfoRequestPacket)Pack;
if (OnUserInfoRequest != null)
{
OnUserInfoRequest(this,avUserInfoRequestPacket.AgentData.AgentID,avUserInfoRequestPacket.AgentData.SessionID);
}
break;
case PacketType.SetStartLocationRequest:
SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack;
if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId)
{
if (OnSetStartLocationRequest != null)
{
OnSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
avSetStartLocationRequestPacket.StartLocationData.LocationLookAt,
avSetStartLocationRequestPacket.StartLocationData.LocationID);
}
}
break;
case PacketType.AgentThrottle:
AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles);
break;
#endregion #endregion
@ -3654,14 +3708,11 @@ namespace OpenSim.Region.ClientStack
OnEstateCovenantRequest(this, epack.SessionID); OnEstateCovenantRequest(this, epack.SessionID);
} }
break; break;
case PacketType.AgentThrottle:
AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles);
break;
#endregion #endregion
#region unimplemented handlers #region GodPackets
case PacketType.RequestGodlikePowers: case PacketType.RequestGodlikePowers:
RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack; RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
@ -3699,6 +3750,12 @@ namespace OpenSim.Region.ClientStack
//OutPacket(kupack, ThrottleOutPacketType.Task); //OutPacket(kupack, ThrottleOutPacketType.Task);
break; break;
#endregion
#region unimplemented handlers
case PacketType.StartPingCheck: case PacketType.StartPingCheck:
// Send the client the ping response back // Send the client the ping response back
// Pass the same PingID in the matching packet // Pass the same PingID in the matching packet
@ -3746,17 +3803,17 @@ namespace OpenSim.Region.ClientStack
// TODO: handle this packet // TODO: handle this packet
m_log.Warn("[CLIENT]: unhandled MuteListRequest packet"); m_log.Warn("[CLIENT]: unhandled MuteListRequest packet");
break; break;
case PacketType.AgentDataUpdateRequest: //case PacketType.AgentDataUpdateRequest:
// TODO: handle this packet // TODO: handle this packet
m_log.Warn("[CLIENT]: unhandled AgentDataUpdateRequest packet"); //m_log.Warn("[CLIENT]: unhandled AgentDataUpdateRequest packet");
break; //break;
case PacketType.ParcelDwellRequest: case PacketType.ParcelDwellRequest:
// TODO: handle this packet // TODO: handle this packet
m_log.Warn("[CLIENT]: unhandled ParcelDwellRequest packet"); m_log.Warn("[CLIENT]: unhandled ParcelDwellRequest packet");
break; break;
case PacketType.UseCircuitCode: case PacketType.UseCircuitCode:
// TODO: handle this packet // TODO: Don't display this one, we handle it at a lower level
//m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet"); //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet");
break; break;
case PacketType.EconomyDataRequest: case PacketType.EconomyDataRequest:
@ -3775,10 +3832,10 @@ namespace OpenSim.Region.ClientStack
// TODO: handle this packet // TODO: handle this packet
m_log.Warn("[CLIENT]: unhandled SoundTrigger packet"); m_log.Warn("[CLIENT]: unhandled SoundTrigger packet");
break; break;
case PacketType.UserInfoRequest: //case PacketType.UserInfoRequest:
// TODO: handle this packet // TODO: handle this packet
m_log.Warn("[CLIENT]: unhandled UserInfoRequest packet"); //m_log.Warn("[CLIENT]: unhandled UserInfoRequest packet");
break; //break;
case PacketType.InventoryDescendents: case PacketType.InventoryDescendents:
// TODO: handle this packet // TODO: handle this packet
m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");

View File

@ -27,18 +27,182 @@
*/ */
using Nini.Config; using Nini.Config;
using System;
using System.Collections;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using libsecondlife;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class GroupsModule : IRegionModule public class GroupsModule : IRegionModule
{ {
private Scene m_scene; private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_scene = new List<Scene>();
private Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
private Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
private Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
{ {
m_scene = scene; lock (m_scene)
{
m_scene.Add(scene);
}
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnGridInstantMessageToGroupsModule += OnGridInstantMessage;
//scene.EventManager.
}
private void OnNewClient(IClientAPI client)
{
// All friends establishment protocol goes over instant message
// There's no way to send a message from the sim
// to a user to 'add a friend' without causing dialog box spam
//
// The base set of friends are added when the user signs on in their XMLRPC response
// Generated by LoginService. The friends are retreived from the database by the UserManager
// Subscribe to instant messages
client.OnInstantMessage += OnInstantMessage;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
lock (m_iclientmap)
{
if (!m_iclientmap.ContainsKey(client.AgentId))
{
m_iclientmap.Add(client.AgentId, client);
}
}
GroupData OpenSimulatorGroup = new GroupData();
OpenSimulatorGroup.ActiveGroupTitle = "OpenSimulator Tester";
OpenSimulatorGroup.GroupID = new LLUUID("00000000-68f9-1111-024e-222222111120");
OpenSimulatorGroup.GroupMembers.Add(client.AgentId);
OpenSimulatorGroup.groupName = "OpenSimulator Testing";
OpenSimulatorGroup.ActiveGroupPowers = GroupPowers.LandAllowSetHome;
OpenSimulatorGroup.GroupTitles.Add("OpenSimulator Tester");
lock (m_groupmap)
{
if (!m_groupmap.ContainsKey(client.AgentId))
{
m_groupmap.Add(client.AgentId, OpenSimulatorGroup);
}
}
GroupList testGroupList = new GroupList();
testGroupList.m_GroupList.Add(new LLUUID("00000000-68f9-1111-024e-222222111120"));
lock (m_grouplistmap)
{
if (!m_grouplistmap.ContainsKey(client.AgentId))
{
m_grouplistmap.Add(client.AgentId, testGroupList);
}
}
m_log.Info("[GROUP]: Adding " + client.FirstName + " " + client.LastName + " to OpenSimulator Tester group");
}
private void OnAgentDataUpdateRequest(IClientAPI remoteClient, LLUUID AgentID, LLUUID SessionID)
{
string firstname = remoteClient.FirstName;
string lastname = remoteClient.LastName;
LLUUID ActiveGroupID = LLUUID.Zero;
uint ActiveGroupPowers = 0;
string ActiveGroupName = "";
string ActiveGroupTitle = "";
bool foundUser = false;
lock (m_iclientmap)
{
if (m_iclientmap.ContainsKey(remoteClient.AgentId))
{
foundUser = true;
}
}
if (foundUser)
{
lock (m_groupmap)
{
if (m_groupmap.ContainsKey(remoteClient.AgentId))
{
GroupData grp = m_groupmap[remoteClient.AgentId];
if (grp != null)
{
ActiveGroupID = grp.GroupID;
ActiveGroupName = grp.groupName;
ActiveGroupPowers = grp.groupPowers;
ActiveGroupTitle = grp.ActiveGroupTitle;
}
//remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, lastname, ActiveGroupPowers, ActiveGroupName, ActiveGroupTitle);
}
}
}
}
private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID,
LLUUID fromAgentSession, LLUUID toAgentID,
LLUUID imSessionID, uint timestamp, string fromAgentName,
string message, byte dialog, bool fromGroup, byte offline,
uint ParentEstateID, LLVector3 Position, LLUUID RegionID,
byte[] binaryBucket)
{
}
private void OnGridInstantMessage(GridInstantMessage msg)
{
// Trigger the above event handler
OnInstantMessage(null, new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession),
new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,
msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID,
new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID),
msg.binaryBucket);
}
private void OnClientClosed(LLUUID agentID)
{
lock (m_iclientmap)
{
if (m_iclientmap.ContainsKey(agentID))
{
IClientAPI cli = m_iclientmap[agentID];
if (cli != null)
{
m_log.Info("[GROUP]: Removing all reference to groups for " + cli.FirstName + " " + cli.LastName);
}
else
{
m_log.Info("[GROUP]: Removing all reference to groups for " + agentID.ToString());
}
m_iclientmap.Remove(agentID);
}
}
lock (m_groupmap)
{
if (m_groupmap.ContainsKey(agentID))
{
m_groupmap.Remove(agentID);
}
}
lock (m_grouplistmap)
{
if (m_grouplistmap.ContainsKey(agentID))
{
m_grouplistmap.Remove(agentID);
}
}
GC.Collect();
} }
public void PostInitialise() public void PostInitialise()
@ -47,6 +211,22 @@ namespace OpenSim.Region.Environment.Modules
public void Close() public void Close()
{ {
m_log.Info("[GROUP]: Shutting down group module.");
lock (m_iclientmap)
{
m_iclientmap.Clear();
}
lock (m_groupmap)
{
m_groupmap.Clear();
}
lock (m_grouplistmap)
{
m_grouplistmap.Clear();
}
GC.Collect();
} }
public string Name public string Name
@ -56,7 +236,44 @@ namespace OpenSim.Region.Environment.Modules
public bool IsSharedModule public bool IsSharedModule
{ {
get { return false; } get { return true; }
}
}
public class GroupData
{
public LLUUID GroupID;
public string groupName;
public string ActiveGroupTitle;
public List<string> GroupTitles;
public List<LLUUID> GroupMembers;
public uint groupPowers = (uint)(GroupPowers.LandAllowLandmark | GroupPowers.LandAllowSetHome);
public GroupPowers ActiveGroupPowers
{
set
{
groupPowers = (uint) value;
}
get
{
return (GroupPowers)groupPowers;
}
}
public GroupData()
{
GroupTitles = new List<string>();
GroupMembers = new List<LLUUID>();
}
}
public class GroupList
{
public List<LLUUID> m_GroupList;
public GroupList()
{
m_GroupList = new List<LLUUID>();
} }
} }
} }

View File

@ -89,6 +89,9 @@ namespace SimpleApp
public event MoveObject OnGrabUpdate; public event MoveObject OnGrabUpdate;
public event ViewerEffectEventHandler OnViewerEffect; public event ViewerEffectEventHandler OnViewerEffect;
public event FetchInventory OnAgentDataUpdateRequest;
public event FetchInventory OnUserInfoRequest;
public event TeleportLocationRequest OnSetStartLocationRequest;
public event UpdateShape OnUpdatePrimShape; public event UpdateShape OnUpdatePrimShape;
public event ObjectExtraParams OnUpdateExtraParams; public event ObjectExtraParams OnUpdateExtraParams;
@ -226,6 +229,11 @@ namespace SimpleApp
{ {
} }
public virtual void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
{
}
public virtual void SendKillObject(ulong regionHandle, uint localID) public virtual void SendKillObject(ulong regionHandle, uint localID)
{ {
} }