aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-12-06 06:36:49 +0000
committerAdam Frisby2007-12-06 06:36:49 +0000
commit9e5f7fb41540df3daf288b36e577b78666816e61 (patch)
treefd60526a418062214eb8efdd54f41096474c395d
parentminor cleanup of Scene.cs (parameter naming, function documentation stubs, du... (diff)
downloadopensim-SC-9e5f7fb41540df3daf288b36e577b78666816e61.zip
opensim-SC-9e5f7fb41540df3daf288b36e577b78666816e61.tar.gz
opensim-SC-9e5f7fb41540df3daf288b36e577b78666816e61.tar.bz2
opensim-SC-9e5f7fb41540df3daf288b36e577b78666816e61.tar.xz
* Removed lots of scurrilous uses of ASCII/UTF8.GetBytes for making packet strings. BAD PROGRAMMER BAD. Use Helpers.StringToField instead. >_>
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs26
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs8
2 files changed, 14 insertions, 20 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 3198731..724fccc 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -687,7 +687,6 @@ namespace OpenSim.Region.ClientStack
687 /// <param name="regionInfo"></param> 687 /// <param name="regionInfo"></param>
688 public void SendRegionHandshake(RegionInfo regionInfo) 688 public void SendRegionHandshake(RegionInfo regionInfo)
689 { 689 {
690 Encoding _enc = Encoding.ASCII;
691 RegionHandshakePacket handshake = new RegionHandshakePacket(); 690 RegionHandshakePacket handshake = new RegionHandshakePacket();
692 691
693 handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor; 692 handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor;
@@ -703,10 +702,8 @@ namespace OpenSim.Region.ClientStack
703 handshake.RegionInfo.SimAccess = (byte) regionInfo.EstateSettings.simAccess; 702 handshake.RegionInfo.SimAccess = (byte) regionInfo.EstateSettings.simAccess;
704 handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight; 703 handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight;
705 704
706
707 handshake.RegionInfo.RegionFlags = (uint) regionInfo.EstateSettings.regionFlags; 705 handshake.RegionInfo.RegionFlags = (uint) regionInfo.EstateSettings.regionFlags;
708 706 handshake.RegionInfo.SimName = Helpers.StringToField(regionInfo.RegionName);
709 handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0");
710 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; 707 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID;
711 handshake.RegionInfo.TerrainBase0 = regionInfo.EstateSettings.terrainBase0; 708 handshake.RegionInfo.TerrainBase0 = regionInfo.EstateSettings.terrainBase0;
712 handshake.RegionInfo.TerrainBase1 = regionInfo.EstateSettings.terrainBase1; 709 handshake.RegionInfo.TerrainBase1 = regionInfo.EstateSettings.terrainBase1;
@@ -762,14 +759,13 @@ namespace OpenSim.Region.ClientStack
762 759
763 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 760 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
764 { 761 {
765 Encoding enc = Encoding.ASCII;
766 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); 762 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
767 reply.ChatData.Audible = 1; 763 reply.ChatData.Audible = 1;
768 reply.ChatData.Message = message; 764 reply.ChatData.Message = message;
769 reply.ChatData.ChatType = type; 765 reply.ChatData.ChatType = type;
770 reply.ChatData.SourceType = 1; 766 reply.ChatData.SourceType = 1;
771 reply.ChatData.Position = fromPos; 767 reply.ChatData.Position = fromPos;
772 reply.ChatData.FromName = enc.GetBytes(fromName + "\0"); 768 reply.ChatData.FromName = Helpers.StringToField(fromName);
773 reply.ChatData.OwnerID = fromAgentID; 769 reply.ChatData.OwnerID = fromAgentID;
774 reply.ChatData.SourceID = fromAgentID; 770 reply.ChatData.SourceID = fromAgentID;
775 771
@@ -785,12 +781,10 @@ namespace OpenSim.Region.ClientStack
785 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, 781 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
786 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) 782 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
787 { 783 {
788 Encoding enc = Encoding.ASCII;
789 Encoding encUTF8 = Encoding.UTF8;
790 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); 784 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
791 msg.AgentData.AgentID = fromAgent; 785 msg.AgentData.AgentID = fromAgent;
792 msg.AgentData.SessionID = fromAgentSession; 786 msg.AgentData.SessionID = fromAgentSession;
793 msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); 787 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
794 msg.MessageBlock.Dialog = dialog; 788 msg.MessageBlock.Dialog = dialog;
795 msg.MessageBlock.FromGroup = false; 789 msg.MessageBlock.FromGroup = false;
796 msg.MessageBlock.ID = imSessionID; 790 msg.MessageBlock.ID = imSessionID;
@@ -800,7 +794,7 @@ namespace OpenSim.Region.ClientStack
800 msg.MessageBlock.RegionID = LLUUID.Random(); 794 msg.MessageBlock.RegionID = LLUUID.Random();
801 msg.MessageBlock.Timestamp = timeStamp; 795 msg.MessageBlock.Timestamp = timeStamp;
802 msg.MessageBlock.ToAgentID = toAgent; 796 msg.MessageBlock.ToAgentID = toAgent;
803 msg.MessageBlock.Message = encUTF8.GetBytes(message + "\0"); 797 msg.MessageBlock.Message = Helpers.StringToField(message);
804 msg.MessageBlock.BinaryBucket = new byte[0]; 798 msg.MessageBlock.BinaryBucket = new byte[0];
805 799
806 OutPacket(msg, ThrottleOutPacketType.Task); 800 OutPacket(msg, ThrottleOutPacketType.Task);
@@ -1083,14 +1077,14 @@ namespace OpenSim.Region.ClientStack
1083 descend.ItemData[i].CreatorID = item.creatorsID; 1077 descend.ItemData[i].CreatorID = item.creatorsID;
1084 descend.ItemData[i].BaseMask = item.inventoryBasePermissions; 1078 descend.ItemData[i].BaseMask = item.inventoryBasePermissions;
1085 descend.ItemData[i].CreationDate = 1000; 1079 descend.ItemData[i].CreationDate = 1000;
1086 descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription + "\0"); 1080 descend.ItemData[i].Description = Helpers.StringToField(item.inventoryDescription);
1087 descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions; 1081 descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions;
1088 descend.ItemData[i].Flags = 1; 1082 descend.ItemData[i].Flags = 1;
1089 descend.ItemData[i].FolderID = item.parentFolderID; 1083 descend.ItemData[i].FolderID = item.parentFolderID;
1090 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 1084 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1091 descend.ItemData[i].GroupMask = 0; 1085 descend.ItemData[i].GroupMask = 0;
1092 descend.ItemData[i].InvType = (sbyte) item.invType; 1086 descend.ItemData[i].InvType = (sbyte) item.invType;
1093 descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0"); 1087 descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName);
1094 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; 1088 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
1095 descend.ItemData[i].OwnerID = item.avatarID; 1089 descend.ItemData[i].OwnerID = item.avatarID;
1096 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; 1090 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
@@ -1159,14 +1153,14 @@ namespace OpenSim.Region.ClientStack
1159 inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; 1153 inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions;
1160 inventoryReply.InventoryData[0].CreationDate = 1154 inventoryReply.InventoryData[0].CreationDate =
1161 (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 1155 (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
1162 inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); 1156 inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.inventoryDescription);
1163 inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; 1157 inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions;
1164 inventoryReply.InventoryData[0].Flags = 0; 1158 inventoryReply.InventoryData[0].Flags = 0;
1165 inventoryReply.InventoryData[0].FolderID = item.parentFolderID; 1159 inventoryReply.InventoryData[0].FolderID = item.parentFolderID;
1166 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 1160 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1167 inventoryReply.InventoryData[0].GroupMask = 0; 1161 inventoryReply.InventoryData[0].GroupMask = 0;
1168 inventoryReply.InventoryData[0].InvType = (sbyte) item.invType; 1162 inventoryReply.InventoryData[0].InvType = (sbyte) item.invType;
1169 inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); 1163 inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.inventoryName);
1170 inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; 1164 inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions;
1171 inventoryReply.InventoryData[0].OwnerID = item.avatarID; 1165 inventoryReply.InventoryData[0].OwnerID = item.avatarID;
1172 inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; 1166 inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions;
@@ -1200,14 +1194,14 @@ namespace OpenSim.Region.ClientStack
1200 InventoryReply.InventoryData[0].CreatorID = Item.creatorsID; 1194 InventoryReply.InventoryData[0].CreatorID = Item.creatorsID;
1201 InventoryReply.InventoryData[0].BaseMask = Item.inventoryBasePermissions; 1195 InventoryReply.InventoryData[0].BaseMask = Item.inventoryBasePermissions;
1202 InventoryReply.InventoryData[0].CreationDate = 1000; 1196 InventoryReply.InventoryData[0].CreationDate = 1000;
1203 InventoryReply.InventoryData[0].Description = enc.GetBytes(Item.inventoryDescription + "\0"); 1197 InventoryReply.InventoryData[0].Description = Helpers.StringToField(Item.inventoryDescription);
1204 InventoryReply.InventoryData[0].EveryoneMask = Item.inventoryEveryOnePermissions; 1198 InventoryReply.InventoryData[0].EveryoneMask = Item.inventoryEveryOnePermissions;
1205 InventoryReply.InventoryData[0].Flags = 0; 1199 InventoryReply.InventoryData[0].Flags = 0;
1206 InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; 1200 InventoryReply.InventoryData[0].FolderID = Item.parentFolderID;
1207 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 1201 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1208 InventoryReply.InventoryData[0].GroupMask = 0; 1202 InventoryReply.InventoryData[0].GroupMask = 0;
1209 InventoryReply.InventoryData[0].InvType = (sbyte) Item.invType; 1203 InventoryReply.InventoryData[0].InvType = (sbyte) Item.invType;
1210 InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); 1204 InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.inventoryName);
1211 InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; 1205 InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions;
1212 InventoryReply.InventoryData[0].OwnerID = Item.avatarID; 1206 InventoryReply.InventoryData[0].OwnerID = Item.avatarID;
1213 InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; 1207 InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index d2cf2a3..bcee5c7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1038,11 +1038,11 @@ namespace OpenSim.Region.Environment.Scenes
1038 proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID; 1038 proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
1039 proper.ObjectData[0].ObjectID = UUID; 1039 proper.ObjectData[0].ObjectID = UUID;
1040 proper.ObjectData[0].OwnerID = m_rootPart.OwnerID; 1040 proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
1041 proper.ObjectData[0].TouchName = enc.GetBytes(m_rootPart.TouchName + "\0"); 1041 proper.ObjectData[0].TouchName = Helpers.StringToField(m_rootPart.TouchName);
1042 proper.ObjectData[0].TextureID = new byte[0]; 1042 proper.ObjectData[0].TextureID = new byte[0];
1043 proper.ObjectData[0].SitName = enc.GetBytes(m_rootPart.SitName + "\0"); 1043 proper.ObjectData[0].SitName = Helpers.StringToField(m_rootPart.SitName);
1044 proper.ObjectData[0].Name = enc.GetBytes(m_rootPart.Name + "\0"); 1044 proper.ObjectData[0].Name = Helpers.StringToField(m_rootPart.Name);
1045 proper.ObjectData[0].Description = enc.GetBytes(m_rootPart.Description + "\0"); 1045 proper.ObjectData[0].Description = Helpers.StringToField(m_rootPart.Description);
1046 proper.ObjectData[0].OwnerMask = m_rootPart.OwnerMask; 1046 proper.ObjectData[0].OwnerMask = m_rootPart.OwnerMask;
1047 proper.ObjectData[0].NextOwnerMask = m_rootPart.NextOwnerMask; 1047 proper.ObjectData[0].NextOwnerMask = m_rootPart.NextOwnerMask;
1048 proper.ObjectData[0].GroupMask = m_rootPart.GroupMask; 1048 proper.ObjectData[0].GroupMask = m_rootPart.GroupMask;