aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-10-15 20:24:44 +0000
committerJustin Clarke Casey2008-10-15 20:24:44 +0000
commit98fdf504d9833dc8a58b141765378a1167d2c680 (patch)
tree63ad48dd1c5f902dd1d4e834126a79f290670405 /OpenSim/Region
parent* minor: comment out persisting prim inventory log messages (diff)
downloadopensim-SC_OLD-98fdf504d9833dc8a58b141765378a1167d2c680.zip
opensim-SC_OLD-98fdf504d9833dc8a58b141765378a1167d2c680.tar.gz
opensim-SC_OLD-98fdf504d9833dc8a58b141765378a1167d2c680.tar.bz2
opensim-SC_OLD-98fdf504d9833dc8a58b141765378a1167d2c680.tar.xz
* Truncate outgoing media and music urls to 254 characters.
* Hopefully this will resolve http://opensimulator.org/mantis/view.php?id=2383
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs18
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs52
2 files changed, 58 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 198d660..2d6508a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2474,15 +2474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2474 outPacket.ObjectData[0].FullID = objectID; 2474 outPacket.ObjectData[0].FullID = objectID;
2475 outPacket.ObjectData[0].OwnerID = ownerID; 2475 outPacket.ObjectData[0].OwnerID = ownerID;
2476 2476
2477 // Anything more than 254 will cause libsecondlife to barf 2477 outPacket.ObjectData[0].Text = LLUtil.StringToPacketBytes(text);
2478 // (libsl 1550) adds an \0 on the Utils.StringToBytes conversion if it isn't present
2479 if (text.Length > 254)
2480 {
2481 text = text.Remove(254);
2482 }
2483
2484 outPacket.ObjectData[0].Text = Utils.StringToBytes(text);
2485
2486 outPacket.ObjectData[0].TextColor[0] = color[0]; 2478 outPacket.ObjectData[0].TextColor[0] = color[0];
2487 outPacket.ObjectData[0].TextColor[1] = color[1]; 2479 outPacket.ObjectData[0].TextColor[1] = color[1];
2488 outPacket.ObjectData[0].TextColor[2] = color[2]; 2480 outPacket.ObjectData[0].TextColor[2] = color[2];
@@ -2943,6 +2935,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2943 updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; 2935 updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned;
2944 updatePacket.ParcelData.LandingType = (byte)landData.LandingType; 2936 updatePacket.ParcelData.LandingType = (byte)landData.LandingType;
2945 updatePacket.ParcelData.LocalID = landData.LocalID; 2937 updatePacket.ParcelData.LocalID = landData.LocalID;
2938
2946 if (landData.Area > 0) 2939 if (landData.Area > 0)
2947 { 2940 {
2948 updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; 2941 updatePacket.ParcelData.MaxPrims = parcelObjectCapacity;
@@ -2951,10 +2944,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2951 { 2944 {
2952 updatePacket.ParcelData.MaxPrims = 0; 2945 updatePacket.ParcelData.MaxPrims = 0;
2953 } 2946 }
2947
2954 updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; 2948 updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale;
2955 updatePacket.ParcelData.MediaID = landData.MediaID; 2949 updatePacket.ParcelData.MediaID = landData.MediaID;
2956 updatePacket.ParcelData.MediaURL = Utils.StringToBytes(landData.MediaURL); 2950 updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL);
2957 updatePacket.ParcelData.MusicURL = Utils.StringToBytes(landData.MusicURL); 2951 updatePacket.ParcelData.MusicURL = LLUtil.StringToPacketBytes(landData.MusicURL);
2958 updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name); 2952 updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name);
2959 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented 2953 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
2960 updatePacket.ParcelData.OtherCount = 0; //unemplemented 2954 updatePacket.ParcelData.OtherCount = 0; //unemplemented
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
new file mode 100644
index 0000000..d704967
--- /dev/null
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
@@ -0,0 +1,52 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using System;
30
31namespace OpenSim.Region.ClientStack.LindenUDP
32{
33 public class LLUtil
34 {
35 /// <summary>
36 /// Convert a string to bytes suitable for use in an LL UDP packet.
37 /// </summary>
38 /// <param name="s">Truncated to 254 characters if necessary</param>
39 /// <returns></returns>
40 public static byte[] StringToPacketBytes(string s)
41 {
42 // Anything more than 254 will cause libsecondlife to barf
43 // (libsl 1550) adds an \0 on the Utils.StringToBytes conversion if it isn't present
44 if (s.Length > 254)
45 {
46 s = s.Remove(254);
47 }
48
49 return Utils.StringToBytes(s);
50 }
51 }
52}