aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs93
1 files changed, 78 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index ebcdd62..8cd47fb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -40,11 +40,10 @@ using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Client; 42using OpenSim.Framework.Client;
43using OpenSim.Framework.Communications.Cache; 43
44using OpenSim.Framework.Statistics; 44using OpenSim.Framework.Statistics;
45using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Framework.Scenes.Hypergrid;
48using OpenSim.Services.Interfaces; 47using OpenSim.Services.Interfaces;
49using Timer = System.Timers.Timer; 48using Timer = System.Timers.Timer;
50using AssetLandmark = OpenSim.Framework.AssetLandmark; 49using AssetLandmark = OpenSim.Framework.AssetLandmark;
@@ -98,6 +97,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
98 /// </summary> 97 /// </summary>
99 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector 98 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
100 { 99 {
100 /// <value>
101 /// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets).
102 /// </value>
103 protected int m_debugPacketLevel = 0;
104
101 #region Events 105 #region Events
102 106
103 public event GenericMessage OnGenericMessage; 107 public event GenericMessage OnGenericMessage;
@@ -122,7 +126,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
122 public event ObjectAttach OnObjectAttach; 126 public event ObjectAttach OnObjectAttach;
123 public event ObjectDeselect OnObjectDetach; 127 public event ObjectDeselect OnObjectDetach;
124 public event ObjectDrop OnObjectDrop; 128 public event ObjectDrop OnObjectDrop;
125 public event GenericCall2 OnCompleteMovementToRegion; 129 public event GenericCall1 OnCompleteMovementToRegion;
130 public event UpdateAgent OnPreAgentUpdate;
126 public event UpdateAgent OnAgentUpdate; 131 public event UpdateAgent OnAgentUpdate;
127 public event AgentRequestSit OnAgentRequestSit; 132 public event AgentRequestSit OnAgentRequestSit;
128 public event AgentSit OnAgentSit; 133 public event AgentSit OnAgentSit;
@@ -353,6 +358,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
353 private bool m_SendLogoutPacketWhenClosing = true; 358 private bool m_SendLogoutPacketWhenClosing = true;
354 private AgentUpdateArgs lastarg; 359 private AgentUpdateArgs lastarg;
355 private bool m_IsActive = true; 360 private bool m_IsActive = true;
361 private bool m_IsLoggingOut = false;
356 362
357 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 363 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
358 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 364 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@@ -416,6 +422,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
416 get { return m_IsActive; } 422 get { return m_IsActive; }
417 set { m_IsActive = value; } 423 set { m_IsActive = value; }
418 } 424 }
425 public bool IsLoggingOut
426 {
427 get { return m_IsLoggingOut; }
428 set { m_IsLoggingOut = value; }
429 }
430
419 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } 431 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
420 432
421 #endregion Properties 433 #endregion Properties
@@ -466,6 +478,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
466 478
467 public void SetDebugPacketLevel(int newDebug) 479 public void SetDebugPacketLevel(int newDebug)
468 { 480 {
481 m_debugPacketLevel = newDebug;
469 } 482 }
470 483
471 #region Client Methods 484 #region Client Methods
@@ -2512,6 +2525,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2512 2525
2513 public void SendAsset(AssetRequestToClient req) 2526 public void SendAsset(AssetRequestToClient req)
2514 { 2527 {
2528 if (req.AssetInf.Data == null)
2529 {
2530 m_log.ErrorFormat("Cannot send asset {0} ({1}), asset data is null",
2531 req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
2532 return;
2533 }
2534
2515 //m_log.Debug("sending asset " + req.RequestAssetID); 2535 //m_log.Debug("sending asset " + req.RequestAssetID);
2516 TransferInfoPacket Transfer = new TransferInfoPacket(); 2536 TransferInfoPacket Transfer = new TransferInfoPacket();
2517 Transfer.TransferInfo.ChannelType = 2; 2537 Transfer.TransferInfo.ChannelType = 2;
@@ -4051,10 +4071,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4051 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); 4071 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
4052 edata.CovenantID = covenant; 4072 edata.CovenantID = covenant;
4053 edata.CovenantTimestamp = 0; 4073 edata.CovenantTimestamp = 0;
4054 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 4074 edata.EstateOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
4055 edata.EstateOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
4056 else
4057 edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
4058 edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName); 4075 edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName);
4059 einfopack.Data = edata; 4076 einfopack.Data = edata;
4060 OutPacket(einfopack, ThrottleOutPacketType.Task); 4077 OutPacket(einfopack, ThrottleOutPacketType.Task);
@@ -4075,8 +4092,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4075 4092
4076 //Sending Estate Settings 4093 //Sending Estate Settings
4077 returnblock[0].Parameter = Utils.StringToBytes(estateName); 4094 returnblock[0].Parameter = Utils.StringToBytes(estateName);
4078 // TODO: remove this cruft once MasterAvatar is fully deprecated
4079 //
4080 returnblock[1].Parameter = Utils.StringToBytes(estateOwner.ToString()); 4095 returnblock[1].Parameter = Utils.StringToBytes(estateOwner.ToString());
4081 returnblock[2].Parameter = Utils.StringToBytes(estateID.ToString()); 4096 returnblock[2].Parameter = Utils.StringToBytes(estateID.ToString());
4082 4097
@@ -4866,7 +4881,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4866 UpdateAgent handlerAgentUpdate = OnAgentUpdate; 4881 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
4867 lastarg = arg; // save this set of arguments for nexttime 4882 lastarg = arg; // save this set of arguments for nexttime
4868 if (handlerAgentUpdate != null) 4883 if (handlerAgentUpdate != null)
4884 {
4885 OnPreAgentUpdate(this, arg);
4869 OnAgentUpdate(this, arg); 4886 OnAgentUpdate(this, arg);
4887 }
4870 4888
4871 handlerAgentUpdate = null; 4889 handlerAgentUpdate = null;
4872 } 4890 }
@@ -5505,6 +5523,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5505 // for the client session anyway, in order to protect ourselves against bad code in plugins 5523 // for the client session anyway, in order to protect ourselves against bad code in plugins
5506 try 5524 try
5507 { 5525 {
5526
5508 byte[] visualparams = new byte[appear.VisualParam.Length]; 5527 byte[] visualparams = new byte[appear.VisualParam.Length];
5509 for (int i = 0; i < appear.VisualParam.Length; i++) 5528 for (int i = 0; i < appear.VisualParam.Length; i++)
5510 visualparams[i] = appear.VisualParam[i].ParamValue; 5529 visualparams[i] = appear.VisualParam[i].ParamValue;
@@ -5715,10 +5734,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5715 5734
5716 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) 5735 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
5717 { 5736 {
5718 GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; 5737 GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
5719 if (handlerCompleteMovementToRegion != null) 5738 if (handlerCompleteMovementToRegion != null)
5720 { 5739 {
5721 handlerCompleteMovementToRegion(); 5740 handlerCompleteMovementToRegion(sender);
5722 } 5741 }
5723 handlerCompleteMovementToRegion = null; 5742 handlerCompleteMovementToRegion = null;
5724 5743
@@ -7038,7 +7057,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7038 assetRequestItem = invService.GetItem(assetRequestItem); 7057 assetRequestItem = invService.GetItem(assetRequestItem);
7039 if (assetRequestItem == null) 7058 if (assetRequestItem == null)
7040 { 7059 {
7041 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 7060 ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>();
7061 if (lib != null)
7062 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
7042 if (assetRequestItem == null) 7063 if (assetRequestItem == null)
7043 return true; 7064 return true;
7044 } 7065 }
@@ -10928,7 +10949,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10928 LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length); 10949 LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length);
10929 #endregion BinaryStats 10950 #endregion BinaryStats
10930 10951
10931 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); 10952 OutPacket(packet, throttlePacketType, true);
10932 } 10953 }
10933 10954
10934 /// <summary> 10955 /// <summary>
@@ -10941,6 +10962,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10941 /// handles splitting manually</param> 10962 /// handles splitting manually</param>
10942 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) 10963 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting)
10943 { 10964 {
10965 if (m_debugPacketLevel >= 255)
10966 m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
10967
10944 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); 10968 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
10945 } 10969 }
10946 10970
@@ -11012,10 +11036,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11012 /// <param name="Pack">OpenMetaverse.packet</param> 11036 /// <param name="Pack">OpenMetaverse.packet</param>
11013 public void ProcessInPacket(Packet Pack) 11037 public void ProcessInPacket(Packet Pack)
11014 { 11038 {
11015// m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack); 11039 if (m_debugPacketLevel >= 255)
11040 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
11016 11041
11017 if (!ProcessPacketMethod(Pack)) 11042 if (!ProcessPacketMethod(Pack))
11018 m_log.Warn("[CLIENT]: unhandled packet " + Pack); 11043 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type);
11019 11044
11020 PacketPool.Instance.ReturnPacket(Pack); 11045 PacketPool.Instance.ReturnPacket(Pack);
11021 } 11046 }
@@ -11333,6 +11358,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11333 const uint m_maxPacketSize = 600; 11358 const uint m_maxPacketSize = 600;
11334 int numPackets = 1; 11359 int numPackets = 1;
11335 11360
11361 if (data == null)
11362 return 0;
11363
11336 if (data.LongLength > m_maxPacketSize) 11364 if (data.LongLength > m_maxPacketSize)
11337 { 11365 {
11338 // over max number of bytes so split up file 11366 // over max number of bytes so split up file
@@ -11578,5 +11606,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11578 packet.PropertiesData.LanguagesText = Utils.StringToBytes(languages); 11606 packet.PropertiesData.LanguagesText = Utils.StringToBytes(languages);
11579 OutPacket(packet, ThrottleOutPacketType.Task); 11607 OutPacket(packet, ThrottleOutPacketType.Task);
11580 } 11608 }
11609
11610 public void SendChangeUserRights(UUID agentID, UUID friendID, int rights)
11611 {
11612 ChangeUserRightsPacket packet = (ChangeUserRightsPacket)PacketPool.Instance.GetPacket(PacketType.ChangeUserRights);
11613
11614 packet.AgentData = new ChangeUserRightsPacket.AgentDataBlock();
11615 packet.AgentData.AgentID = agentID;
11616
11617 packet.Rights = new ChangeUserRightsPacket.RightsBlock[1];
11618 packet.Rights[0] = new ChangeUserRightsPacket.RightsBlock();
11619 packet.Rights[0].AgentRelated = friendID;
11620 packet.Rights[0].RelatedRights = rights;
11621
11622 OutPacket(packet, ThrottleOutPacketType.Task);
11623 }
11624
11625 public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId)
11626 {
11627 ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog);
11628 dialog.Data.ObjectID = objectId;
11629 dialog.Data.ChatChannel = chatChannel;
11630 dialog.Data.ImageID = UUID.Zero;
11631 dialog.Data.ObjectName = Util.StringToBytes256(objectname);
11632 // this is the username of the *owner*
11633 dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName);
11634 dialog.Data.LastName = Util.StringToBytes256(ownerLastName);
11635 dialog.Data.Message = Util.StringToBytes256(message);
11636
11637
11638 ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1];
11639 buttons[0] = new ScriptDialogPacket.ButtonsBlock();
11640 buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!");
11641 dialog.Buttons = buttons;
11642 OutPacket(dialog, ThrottleOutPacketType.Task);
11643 }
11581 } 11644 }
11582} 11645}