aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-10-26 21:13:01 +0100
committerMelanie2012-10-26 21:13:01 +0100
commit26cc57b6cafda5168baab49cabe34d96f01dbd6d (patch)
tree94e078a75ab68825e64b15498f67d82988858dc9
parentMerge branch 'master' into careminster (diff)
parentminor: Make the error thrown logged when a simulator in grid mode is trying t... (diff)
downloadopensim-SC-26cc57b6cafda5168baab49cabe34d96f01dbd6d.zip
opensim-SC-26cc57b6cafda5168baab49cabe34d96f01dbd6d.tar.gz
opensim-SC-26cc57b6cafda5168baab49cabe34d96f01dbd6d.tar.bz2
opensim-SC-26cc57b6cafda5168baab49cabe34d96f01dbd6d.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs3
-rw-r--r--OpenSim/Framework/Client/IClientChat.cs7
-rw-r--r--OpenSim/Framework/Console/ConsoleUtil.cs246
-rw-r--r--OpenSim/Framework/IClientAPI.cs16
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs36
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs154
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs133
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs173
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldComm.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs57
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs17
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs10
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs27
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs3
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs10
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs4
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs20
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs98
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/ScriptException.cs40
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs70
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs184
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs3
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs10
-rw-r--r--bin/assets/CollisionSoundsAssetSet/CollisionSoundsAssetSet.xml12
-rwxr-xr-xbin/lib32/BulletSim.dllbin598016 -> 598016 bytes
-rwxr-xr-xbin/lib32/libBulletSim.sobin2772750 -> 2772770 bytes
-rwxr-xr-xbin/lib64/BulletSim.dllbin764416 -> 764416 bytes
-rwxr-xr-xbin/lib64/libBulletSim.sobin3031835 -> 3031859 bytes
47 files changed, 1116 insertions, 448 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index c5d9641..1638541 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -358,6 +358,9 @@ namespace OpenSim.Framework
358 SetVisualParams(visualParams); 358 SetVisualParams(visualParams);
359 } 359 }
360 360
361 /// <summary>
362 /// Set avatar height by a calculation based on their visual parameters.
363 /// </summary>
361 public virtual void SetHeight() 364 public virtual void SetHeight()
362 { 365 {
363 // Start with shortest possible female avatar height 366 // Start with shortest possible female avatar height
diff --git a/OpenSim/Framework/Client/IClientChat.cs b/OpenSim/Framework/Client/IClientChat.cs
index 078ea9b..86b1faa 100644
--- a/OpenSim/Framework/Client/IClientChat.cs
+++ b/OpenSim/Framework/Client/IClientChat.cs
@@ -33,7 +33,8 @@ namespace OpenSim.Framework.Client
33 { 33 {
34 event ChatMessage OnChatFromClient; 34 event ChatMessage OnChatFromClient;
35 35
36 void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, 36 void SendChatMessage(
37 byte audible); 37 string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
38 byte audible);
38 } 39 }
39} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
index a7cf0c0..16a63e0 100644
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ b/OpenSim/Framework/Console/ConsoleUtil.cs
@@ -27,88 +27,202 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Linq; 31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using log4net; 33using log4net;
33using OpenMetaverse; 34using OpenMetaverse;
34 35
35public class ConsoleUtil 36namespace OpenSim.Framework.Console
36{ 37{
37// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38 public class ConsoleUtil
38
39 public const string MinRawConsoleVectorValue = "-~";
40 public const string MaxRawConsoleVectorValue = "~";
41
42 public const string VectorSeparator = ",";
43 public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
44
45 /// <summary>
46 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
47 /// </summary>
48 /// <param name='rawConsoleVector'>/param>
49 /// <param name='vector'></param>
50 /// <returns></returns>
51 public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector)
52 { 39 {
53 return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector); 40 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 }
55 41
56 /// <summary> 42 public const int LocalIdNotFound = 0;
57 /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3 43
58 /// </summary> 44 /// <summary>
59 /// <param name='rawConsoleVector'>/param> 45 /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section
60 /// <param name='vector'></param> 46 /// rather than in each help summary.
61 /// <returns></returns> 47 /// </summary>
62 public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector) 48 public const string CoordHelp
63 { 49 = @"Each component of the coord is comma separated. There must be no spaces between the commas.
64 return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector); 50 If you don't care about the z component you can simply omit it.
65 } 51 If you don't care about the x or y components then you can leave them blank (though a comma is still required)
52 If you want to specify the maxmimum value of a component then you can use ~ instead of a number
53 If you want to specify the minimum value of a component then you can use -~ instead of a number
54 e.g.
55 delete object pos 20,20,20 to 40,40,40
56 delete object pos 20,20 to 40,40
57 delete object pos ,20,20 to ,40,40
58 delete object pos ,,30 to ,,~
59 delete object pos ,,-~ to ,,30";
60
61 public const string MinRawConsoleVectorValue = "-~";
62 public const string MaxRawConsoleVectorValue = "~";
63
64 public const string VectorSeparator = ",";
65 public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
66 66
67 /// <summary> 67 /// <summary>
68 /// Convert a vector input from the console to an OpenMetaverse.Vector3 68 /// Check if the given file path exists.
69 /// </summary> 69 /// </summary>
70 /// <param name='rawConsoleVector'> 70 /// <remarks>If not, warning is printed to the given console.</remarks>
71 /// A string in the form <x>,<y>,<z> where there is no space between values. 71 /// <returns>true if the file does not exist, false otherwise.</returns>
72 /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value 72 /// <param name='console'></param>
73 /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40) 73 /// <param name='path'></param>
74 /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue 74 public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
75 /// Other than that, component values must be numeric. 75 {
76 /// </param> 76 if (File.Exists(path))
77 /// <param name='blankComponentFunc'></param> 77 {
78 /// <param name='vector'></param> 78 console.OutputFormat("File {0} already exists. Please move or remove it.", path);
79 /// <returns></returns> 79 return false;
80 public static bool TryParseConsoleVector( 80 }
81 string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector3 vector)
82 {
83 List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
84 81
85 if (components.Count < 1 || components.Count > 3) 82 return true;
83 }
84
85 /// <summary>
86 /// Try to parse a console UUID from the console.
87 /// </summary>
88 /// <remarks>
89 /// Will complain to the console if parsing fails.
90 /// </remarks>
91 /// <returns></returns>
92 /// <param name='console'>If null then no complaint is printed.</param>
93 /// <param name='rawUuid'></param>
94 /// <param name='uuid'></param>
95 public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid)
86 { 96 {
87 vector = Vector3.Zero; 97 if (!UUID.TryParse(rawUuid, out uuid))
88 return false; 98 {
99 if (console != null)
100 console.OutputFormat("{0} is not a valid uuid", rawUuid);
101
102 return false;
103 }
104
105 return true;
89 } 106 }
90 107
91 for (int i = components.Count; i < 3; i++) 108 public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId)
92 components.Add(""); 109 {
110 if (!uint.TryParse(rawLocalId, out localId))
111 {
112 if (console != null)
113 console.OutputFormat("{0} is not a valid local id", localId);
114
115 return false;
116 }
93 117
94 List<string> semiDigestedComponents 118 if (localId == 0)
95 = components.ConvertAll<string>( 119 {
96 c => 120 if (console != null)
97 { 121 console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId);
98 if (c == "")
99 return blankComponentFunc.Invoke(c);
100 else if (c == MaxRawConsoleVectorValue)
101 return float.MaxValue.ToString();
102 else if (c == MinRawConsoleVectorValue)
103 return float.MinValue.ToString();
104 else
105 return c;
106 });
107 122
108 string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray()); 123 return false;
124 }
109 125
110// m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); 126 return true;
127 }
128
129 /// <summary>
130 /// Tries to parse the input as either a UUID or a local ID.
131 /// </summary>
132 /// <returns>true if parsing succeeded, false otherwise.</returns>
133 /// <param name='console'></param>
134 /// <param name='rawId'></param>
135 /// <param name='uuid'></param>
136 /// <param name='localId'>
137 /// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded.
138 /// </param>
139 public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId)
140 {
141 if (TryParseConsoleUuid(null, rawId, out uuid))
142 {
143 localId = LocalIdNotFound;
144 return true;
145 }
146
147 if (TryParseConsoleLocalId(null, rawId, out localId))
148 {
149 return true;
150 }
111 151
112 return Vector3.TryParse(semiDigestedConsoleVector, out vector); 152 if (console != null)
153 console.OutputFormat("{0} is not a valid UUID or local id", rawId);
154
155 return false;
156 }
157
158 /// <summary>
159 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
160 /// </summary>
161 /// <param name='rawConsoleVector'>/param>
162 /// <param name='vector'></param>
163 /// <returns></returns>
164 public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector)
165 {
166 return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector);
167 }
168
169 /// <summary>
170 /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3
171 /// </summary>
172 /// <param name='rawConsoleVector'>/param>
173 /// <param name='vector'></param>
174 /// <returns></returns>
175 public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector)
176 {
177 return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector);
178 }
179
180 /// <summary>
181 /// Convert a vector input from the console to an OpenMetaverse.Vector3
182 /// </summary>
183 /// <param name='rawConsoleVector'>
184 /// A string in the form <x>,<y>,<z> where there is no space between values.
185 /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value
186 /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40)
187 /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue
188 /// Other than that, component values must be numeric.
189 /// </param>
190 /// <param name='blankComponentFunc'></param>
191 /// <param name='vector'></param>
192 /// <returns></returns>
193 public static bool TryParseConsoleVector(
194 string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector3 vector)
195 {
196 List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
197
198 if (components.Count < 1 || components.Count > 3)
199 {
200 vector = Vector3.Zero;
201 return false;
202 }
203
204 for (int i = components.Count; i < 3; i++)
205 components.Add("");
206
207 List<string> semiDigestedComponents
208 = components.ConvertAll<string>(
209 c =>
210 {
211 if (c == "")
212 return blankComponentFunc.Invoke(c);
213 else if (c == MaxRawConsoleVectorValue)
214 return float.MaxValue.ToString();
215 else if (c == MinRawConsoleVectorValue)
216 return float.MinValue.ToString();
217 else
218 return c;
219 });
220
221 string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray());
222
223 // m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector);
224
225 return Vector3.TryParse(semiDigestedConsoleVector, out vector);
226 }
113 } 227 }
114} \ No newline at end of file 228} \ No newline at end of file
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index e95149d..a1df637 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1112,8 +1112,20 @@ namespace OpenSim.Framework
1112 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); 1112 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
1113 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); 1113 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
1114 1114
1115 void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, 1115 /// <summary>
1116 byte audible); 1116 /// Send chat to the viewer.
1117 /// </summary>
1118 /// <param name='message'></param>
1119 /// <param name='type'></param>
1120 /// <param name='fromPos'></param>
1121 /// <param name='fromName'></param>
1122 /// <param name='fromAgentID'></param>
1123 /// <param name='ownerID'></param>
1124 /// <param name='source'></param>
1125 /// <param name='audible'></param>
1126 void SendChatMessage(
1127 string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
1128 byte audible);
1117 1129
1118 void SendInstantMessage(GridInstantMessage im); 1130 void SendInstantMessage(GridInstantMessage im);
1119 1131
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index b410a0e..7232383 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -621,7 +621,7 @@ namespace OpenSim
621 if (account == null) 621 if (account == null)
622 { 622 {
623 m_log.ErrorFormat( 623 m_log.ErrorFormat(
624 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); 624 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first at the grid level.");
625 } 625 }
626 else 626 else
627 { 627 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 67ce48e..3c65647 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -846,8 +846,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
846 OutPacket(mov, ThrottleOutPacketType.Unknown); 846 OutPacket(mov, ThrottleOutPacketType.Unknown);
847 } 847 }
848 848
849 public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, 849 public void SendChatMessage(
850 UUID fromAgentID, byte source, byte audible) 850 string message, byte type, Vector3 fromPos, string fromName,
851 UUID fromAgentID, UUID ownerID, byte source, byte audible)
851 { 852 {
852 ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); 853 ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
853 reply.ChatData.Audible = audible; 854 reply.ChatData.Audible = audible;
@@ -856,7 +857,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
856 reply.ChatData.SourceType = source; 857 reply.ChatData.SourceType = source;
857 reply.ChatData.Position = fromPos; 858 reply.ChatData.Position = fromPos;
858 reply.ChatData.FromName = Util.StringToBytes256(fromName); 859 reply.ChatData.FromName = Util.StringToBytes256(fromName);
859 reply.ChatData.OwnerID = fromAgentID; 860 reply.ChatData.OwnerID = ownerID;
860 reply.ChatData.SourceID = fromAgentID; 861 reply.ChatData.SourceID = fromAgentID;
861 862
862 OutPacket(reply, ThrottleOutPacketType.Unknown); 863 OutPacket(reply, ThrottleOutPacketType.Unknown);
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index dbbb0ae..4407e40 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -197,6 +197,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
197 string fromName = c.From; 197 string fromName = c.From;
198 string fromNamePrefix = ""; 198 string fromNamePrefix = "";
199 UUID fromID = UUID.Zero; 199 UUID fromID = UUID.Zero;
200 UUID ownerID = UUID.Zero;
200 string message = c.Message; 201 string message = c.Message;
201 IScene scene = c.Scene; 202 IScene scene = c.Scene;
202 UUID destination = c.Destination; 203 UUID destination = c.Destination;
@@ -224,11 +225,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
224 fromNamePrefix = m_adminPrefix; 225 fromNamePrefix = m_adminPrefix;
225 } 226 }
226 destination = UUID.Zero; // Avatars cant "SayTo" 227 destination = UUID.Zero; // Avatars cant "SayTo"
228 ownerID = c.Sender.AgentId;
229
227 break; 230 break;
228 231
229 case ChatSourceType.Object: 232 case ChatSourceType.Object:
230 fromID = c.SenderUUID; 233 fromID = c.SenderUUID;
231 234
235 if (c.SenderObject != null && c.SenderObject is SceneObjectPart)
236 ownerID = ((SceneObjectPart)c.SenderObject).OwnerID;
237
232 break; 238 break;
233 } 239 }
234 240
@@ -262,8 +268,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
262 // objects on a parcel with access restrictions 268 // objects on a parcel with access restrictions
263 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) 269 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
264 { 270 {
265 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) 271 if (destination != UUID.Zero)
266 receiverIDs.Add(presence.UUID); 272 {
273 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, ownerID, fromNamePrefix + fromName, c.Type, message, sourceType, true))
274 receiverIDs.Add(presence.UUID);
275 }
276 else
277 {
278 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, ownerID, fromNamePrefix + fromName, c.Type, message, sourceType, false))
279 receiverIDs.Add(presence.UUID);
280 }
267 } 281 }
268 } 282 }
269 } 283 }
@@ -324,7 +338,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
324 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) 338 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
325 return; 339 return;
326 340
327 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 341 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, fromID,
328 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 342 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
329 receiverIDs.Add(client.AgentId); 343 receiverIDs.Add(client.AgentId);
330 } 344 }
@@ -341,15 +355,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
341 /// <param name="fromPos"></param> 355 /// <param name="fromPos"></param>
342 /// <param name="regionPos">/param> 356 /// <param name="regionPos">/param>
343 /// <param name="fromAgentID"></param> 357 /// <param name="fromAgentID"></param>
358 /// <param name='ownerID'>
359 /// Owner of the message. For at least some messages from objects, this has to be correctly filled with the owner's UUID.
360 /// This is the case for script error messages in viewer 3 since LLViewer change EXT-7762
361 /// </param>
344 /// <param name="fromName"></param> 362 /// <param name="fromName"></param>
345 /// <param name="type"></param> 363 /// <param name="type"></param>
346 /// <param name="message"></param> 364 /// <param name="message"></param>
347 /// <param name="src"></param> 365 /// <param name="src"></param>
348 /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a 366 /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a
349 /// precondition</returns> 367 /// precondition</returns>
350 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, 368 protected virtual bool TrySendChatMessage(
351 UUID fromAgentID, string fromName, ChatTypeEnum type, 369 ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
352 string message, ChatSourceType src) 370 UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type,
371 string message, ChatSourceType src, bool ignoreDistance)
353 { 372 {
354 // don't send chat to child agents 373 // don't send chat to child agents
355 if (presence.IsChildAgent) return false; 374 if (presence.IsChildAgent) return false;
@@ -369,8 +388,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
369 } 388 }
370 389
371 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView 390 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
372 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 391 presence.ControllingClient.SendChatMessage(
373 fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); 392 message, (byte) type, fromPos, fromName,
393 fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully);
374 394
375 return true; 395 return true;
376 } 396 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 7d1fe68..a32afd5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -35,6 +35,7 @@ using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Console;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
@@ -209,6 +210,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
209 Guid id, string firstName, string lastName, string invPath, string pass, string savePath, 210 Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
210 Dictionary<string, object> options) 211 Dictionary<string, object> options)
211 { 212 {
213 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath))
214 return false;
215
212 if (m_scenes.Count > 0) 216 if (m_scenes.Count > 0)
213 { 217 {
214 UserAccount userInfo = GetUserInfo(firstName, lastName, pass); 218 UserAccount userInfo = GetUserInfo(firstName, lastName, pass);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 21dff4b..ecaab44 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -38,15 +38,15 @@ using OpenSim.Services.Interfaces;
38 38
39namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer 39namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
40{ 40{
41 public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule 41 public class InventoryTransferModule : ISharedRegionModule
42 { 42 {
43 private static readonly ILog m_log 43 private static readonly ILog m_log
44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 /// <summary> 46 /// <summary>
47 private List<Scene> m_Scenelist = new List<Scene>(); 47 private List<Scene> m_Scenelist = new List<Scene>();
48 private Dictionary<UUID, Scene> m_AgentRegions = 48// private Dictionary<UUID, Scene> m_AgentRegions =
49 new Dictionary<UUID, Scene>(); 49// new Dictionary<UUID, Scene>();
50 50
51 private IMessageTransferModule m_TransferModule = null; 51 private IMessageTransferModule m_TransferModule = null;
52 private bool m_Enabled = true; 52 private bool m_Enabled = true;
@@ -76,12 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
76 76
77 m_Scenelist.Add(scene); 77 m_Scenelist.Add(scene);
78 78
79 scene.RegisterModuleInterface<IInventoryTransferModule>(this); 79// scene.RegisterModuleInterface<IInventoryTransferModule>(this);
80 80
81 scene.EventManager.OnNewClient += OnNewClient; 81 scene.EventManager.OnNewClient += OnNewClient;
82 scene.EventManager.OnClientClosed += ClientLoggedOut; 82// scene.EventManager.OnClientClosed += ClientLoggedOut;
83 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 83 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
84 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; 84// scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
85 } 85 }
86 86
87 public void RegionLoaded(Scene scene) 87 public void RegionLoaded(Scene scene)
@@ -96,9 +96,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
96 96
97 m_Scenelist.Clear(); 97 m_Scenelist.Clear();
98 scene.EventManager.OnNewClient -= OnNewClient; 98 scene.EventManager.OnNewClient -= OnNewClient;
99 scene.EventManager.OnClientClosed -= ClientLoggedOut; 99// scene.EventManager.OnClientClosed -= ClientLoggedOut;
100 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 100 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
101 scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; 101// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
102 } 102 }
103 } 103 }
104 } 104 }
@@ -106,9 +106,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
106 public void RemoveRegion(Scene scene) 106 public void RemoveRegion(Scene scene)
107 { 107 {
108 scene.EventManager.OnNewClient -= OnNewClient; 108 scene.EventManager.OnNewClient -= OnNewClient;
109 scene.EventManager.OnClientClosed -= ClientLoggedOut; 109// scene.EventManager.OnClientClosed -= ClientLoggedOut;
110 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 110 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
111 scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; 111// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
112 m_Scenelist.Remove(scene); 112 m_Scenelist.Remove(scene);
113 } 113 }
114 114
@@ -138,10 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
138 client.OnInstantMessage += OnInstantMessage; 138 client.OnInstantMessage += OnInstantMessage;
139 } 139 }
140 140
141 protected void OnSetRootAgentScene(UUID id, Scene scene) 141// protected void OnSetRootAgentScene(UUID id, Scene scene)
142 { 142// {
143 m_AgentRegions[id] = scene; 143// m_AgentRegions[id] = scene;
144 } 144// }
145 145
146 private Scene FindClientScene(UUID agentId) 146 private Scene FindClientScene(UUID agentId)
147 { 147 {
@@ -465,69 +465,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
465 } 465 }
466 } 466 }
467 467
468 public bool NeedSceneCacheClear(UUID agentID, Scene scene) 468// public bool NeedSceneCacheClear(UUID agentID, Scene scene)
469 { 469// {
470 if (!m_AgentRegions.ContainsKey(agentID)) 470// if (!m_AgentRegions.ContainsKey(agentID))
471 { 471// {
472 // Since we can get here two ways, we need to scan 472// // Since we can get here two ways, we need to scan
473 // the scenes here. This is somewhat more expensive 473// // the scenes here. This is somewhat more expensive
474 // but helps avoid a nasty bug 474// // but helps avoid a nasty bug
475 // 475// //
476 476//
477 foreach (Scene s in m_Scenelist) 477// foreach (Scene s in m_Scenelist)
478 { 478// {
479 ScenePresence presence; 479// ScenePresence presence;
480 480//
481 if (s.TryGetScenePresence(agentID, out presence)) 481// if (s.TryGetScenePresence(agentID, out presence))
482 { 482// {
483 // If the agent is in this scene, then we 483// // If the agent is in this scene, then we
484 // are being called twice in a single 484// // are being called twice in a single
485 // teleport. This is wasteful of cycles 485// // teleport. This is wasteful of cycles
486 // but harmless due to this 2nd level check 486// // but harmless due to this 2nd level check
487 // 487// //
488 // If the agent is found in another scene 488// // If the agent is found in another scene
489 // then the list wasn't current 489// // then the list wasn't current
490 // 490// //
491 // If the agent is totally unknown, then what 491// // If the agent is totally unknown, then what
492 // are we even doing here?? 492// // are we even doing here??
493 // 493// //
494 if (s == scene) 494// if (s == scene)
495 { 495// {
496 //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); 496// //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName);
497 return true; 497// return true;
498 } 498// }
499 else 499// else
500 { 500// {
501 //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); 501// //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName);
502 return false; 502// return false;
503 } 503// }
504 } 504// }
505 } 505// }
506 //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); 506// //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName);
507 return true; 507// return true;
508 } 508// }
509 509//
510 // The agent is left in current Scene, so we must be 510// // The agent is left in current Scene, so we must be
511 // going to another instance 511// // going to another instance
512 // 512// //
513 if (m_AgentRegions[agentID] == scene) 513// if (m_AgentRegions[agentID] == scene)
514 { 514// {
515 //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); 515// //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName);
516 m_AgentRegions.Remove(agentID); 516// m_AgentRegions.Remove(agentID);
517 return true; 517// return true;
518 } 518// }
519 519//
520 // Another region has claimed the agent 520// // Another region has claimed the agent
521 // 521// //
522 //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); 522// //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName);
523 return false; 523// return false;
524 } 524// }
525 525//
526 public void ClientLoggedOut(UUID agentID, Scene scene) 526// public void ClientLoggedOut(UUID agentID, Scene scene)
527 { 527// {
528 if (m_AgentRegions.ContainsKey(agentID)) 528// if (m_AgentRegions.ContainsKey(agentID))
529 m_AgentRegions.Remove(agentID); 529// m_AgentRegions.Remove(agentID);
530 } 530// }
531 531
532 /// <summary> 532 /// <summary>
533 /// 533 ///
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ffc362f..31e6ce9 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -677,13 +677,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
677 sp.Reset(); 677 sp.Reset();
678 } 678 }
679 679
680 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 680 // Commented pending deletion since this method no longer appears to do anything at all
681 if (sp.Scene.NeedSceneCacheClear(sp.UUID)) 681// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
682 { 682// if (sp.Scene.NeedSceneCacheClear(sp.UUID))
683 m_log.DebugFormat( 683// {
684 "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", 684// m_log.DebugFormat(
685 sp.UUID); 685// "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
686 } 686// sp.UUID);
687// }
687 688
688 m_entityTransferStateMachine.ResetFromTransit(sp.UUID); 689 m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
689 } 690 }
@@ -1222,11 +1223,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1222 // the user may change their profile information in other region, 1223 // the user may change their profile information in other region,
1223 // so the userinfo in UserProfileCache is not reliable any more, delete it 1224 // so the userinfo in UserProfileCache is not reliable any more, delete it
1224 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 1225 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1225 if (agent.Scene.NeedSceneCacheClear(agent.UUID)) 1226// if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1226 { 1227// {
1227 m_log.DebugFormat( 1228// m_log.DebugFormat(
1228 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); 1229// "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1229 } 1230// }
1230 1231
1231 //m_log.Debug("AFTER CROSS"); 1232 //m_log.Debug("AFTER CROSS");
1232 //Scene.DumpChildrenSeeds(UUID); 1233 //Scene.DumpChildrenSeeds(UUID);
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 07bb291..e167e31 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text.RegularExpressions;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -172,12 +173,42 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
172 /// <param name="hostID">UUID of the SceneObjectPart</param> 173 /// <param name="hostID">UUID of the SceneObjectPart</param>
173 /// <param name="channel">channel to listen on</param> 174 /// <param name="channel">channel to listen on</param>
174 /// <param name="name">name to filter on</param> 175 /// <param name="name">name to filter on</param>
175 /// <param name="id">key to filter on (user given, could be totally faked)</param> 176 /// <param name="id">
177 /// key to filter on (user given, could be totally faked)
178 /// </param>
179 /// <param name="msg">msg to filter on</param>
180 /// <returns>number of the scripts handle</returns>
181 public int Listen(uint localID, UUID itemID, UUID hostID, int channel,
182 string name, UUID id, string msg)
183 {
184 return m_listenerManager.AddListener(localID, itemID, hostID,
185 channel, name, id, msg);
186 }
187
188 /// <summary>
189 /// Create a listen event callback with the specified filters.
190 /// The parameters localID,itemID are needed to uniquely identify
191 /// the script during 'peek' time. Parameter hostID is needed to
192 /// determine the position of the script.
193 /// </summary>
194 /// <param name="localID">localID of the script engine</param>
195 /// <param name="itemID">UUID of the script engine</param>
196 /// <param name="hostID">UUID of the SceneObjectPart</param>
197 /// <param name="channel">channel to listen on</param>
198 /// <param name="name">name to filter on</param>
199 /// <param name="id">
200 /// key to filter on (user given, could be totally faked)
201 /// </param>
176 /// <param name="msg">msg to filter on</param> 202 /// <param name="msg">msg to filter on</param>
203 /// <param name="regexBitfield">
204 /// Bitfield indicating which strings should be processed as regex.
205 /// </param>
177 /// <returns>number of the scripts handle</returns> 206 /// <returns>number of the scripts handle</returns>
178 public int Listen(uint localID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg) 207 public int Listen(uint localID, UUID itemID, UUID hostID, int channel,
208 string name, UUID id, string msg, int regexBitfield)
179 { 209 {
180 return m_listenerManager.AddListener(localID, itemID, hostID, channel, name, id, msg); 210 return m_listenerManager.AddListener(localID, itemID, hostID,
211 channel, name, id, msg, regexBitfield);
181 } 212 }
182 213
183 /// <summary> 214 /// <summary>
@@ -326,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
326 if (channel == 0) 357 if (channel == 0)
327 { 358 {
328 // Channel 0 goes to viewer ONLY 359 // Channel 0 goes to viewer ONLY
329 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false, false, target); 360 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, target, false, false);
330 return true; 361 return true;
331 } 362 }
332 363
@@ -470,15 +501,25 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
470 m_curlisteners = 0; 501 m_curlisteners = 0;
471 } 502 }
472 503
473 public int AddListener(uint localID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg) 504 public int AddListener(uint localID, UUID itemID, UUID hostID,
505 int channel, string name, UUID id, string msg)
506 {
507 return AddListener(localID, itemID, hostID, channel, name, id,
508 msg, 0);
509 }
510
511 public int AddListener(uint localID, UUID itemID, UUID hostID,
512 int channel, string name, UUID id, string msg,
513 int regexBitfield)
474 { 514 {
475 // do we already have a match on this particular filter event? 515 // do we already have a match on this particular filter event?
476 List<ListenerInfo> coll = GetListeners(itemID, channel, name, id, msg); 516 List<ListenerInfo> coll = GetListeners(itemID, channel, name, id,
517 msg);
477 518
478 if (coll.Count > 0) 519 if (coll.Count > 0)
479 { 520 {
480 // special case, called with same filter settings, return same handle 521 // special case, called with same filter settings, return same
481 // (2008-05-02, tested on 1.21.1 server, still holds) 522 // handle (2008-05-02, tested on 1.21.1 server, still holds)
482 return coll[0].GetHandle(); 523 return coll[0].GetHandle();
483 } 524 }
484 525
@@ -490,7 +531,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
490 531
491 if (newHandle > 0) 532 if (newHandle > 0)
492 { 533 {
493 ListenerInfo li = new ListenerInfo(newHandle, localID, itemID, hostID, channel, name, id, msg); 534 ListenerInfo li = new ListenerInfo(newHandle, localID,
535 itemID, hostID, channel, name, id, msg,
536 regexBitfield);
494 537
495 List<ListenerInfo> listeners; 538 List<ListenerInfo> listeners;
496 if (!m_listeners.TryGetValue(channel,out listeners)) 539 if (!m_listeners.TryGetValue(channel,out listeners))
@@ -631,6 +674,22 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
631 return -1; 674 return -1;
632 } 675 }
633 676
677 /// These are duplicated from ScriptBaseClass
678 /// http://opensimulator.org/mantis/view.php?id=6106#c21945
679 #region Constants for the bitfield parameter of osListenRegex
680
681 /// <summary>
682 /// process name parameter as regex
683 /// </summary>
684 public const int OS_LISTEN_REGEX_NAME = 0x1;
685
686 /// <summary>
687 /// process message parameter as regex
688 /// </summary>
689 public const int OS_LISTEN_REGEX_MESSAGE = 0x2;
690
691 #endregion
692
634 // Theres probably a more clever and efficient way to 693 // Theres probably a more clever and efficient way to
635 // do this, maybe with regex. 694 // do this, maybe with regex.
636 // PM2008: Ha, one could even be smart and define a specialized Enumerator. 695 // PM2008: Ha, one could even be smart and define a specialized Enumerator.
@@ -656,7 +715,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
656 { 715 {
657 continue; 716 continue;
658 } 717 }
659 if (li.GetName().Length > 0 && !li.GetName().Equals(name)) 718 if (li.GetName().Length > 0 && (
719 ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && !li.GetName().Equals(name)) ||
720 ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && !Regex.IsMatch(name, li.GetName()))
721 ))
660 { 722 {
661 continue; 723 continue;
662 } 724 }
@@ -664,7 +726,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
664 { 726 {
665 continue; 727 continue;
666 } 728 }
667 if (li.GetMessage().Length > 0 && !li.GetMessage().Equals(msg)) 729 if (li.GetMessage().Length > 0 && (
730 ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && !li.GetMessage().Equals(msg)) ||
731 ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && !Regex.IsMatch(msg, li.GetMessage()))
732 ))
668 { 733 {
669 continue; 734 continue;
670 } 735 }
@@ -697,10 +762,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
697 { 762 {
698 int idx = 0; 763 int idx = 0;
699 Object[] item = new Object[6]; 764 Object[] item = new Object[6];
765 int dataItemLength = 6;
700 766
701 while (idx < data.Length) 767 while (idx < data.Length)
702 { 768 {
703 Array.Copy(data, idx, item, 0, 6); 769 dataItemLength = (idx + 7 == data.Length || (idx + 7 < data.Length && data[idx + 7] is bool)) ? 7 : 6;
770 item = new Object[dataItemLength];
771 Array.Copy(data, idx, item, 0, dataItemLength);
704 772
705 ListenerInfo info = 773 ListenerInfo info =
706 ListenerInfo.FromData(localID, itemID, hostID, item); 774 ListenerInfo.FromData(localID, itemID, hostID, item);
@@ -712,12 +780,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
712 m_listeners[(int)item[2]].Add(info); 780 m_listeners[(int)item[2]].Add(info);
713 } 781 }
714 782
715 idx+=6; 783 idx+=dataItemLength;
716 } 784 }
717 } 785 }
718 } 786 }
719 787
720 public class ListenerInfo: IWorldCommListenerInfo 788 public class ListenerInfo : IWorldCommListenerInfo
721 { 789 {
722 private bool m_active; // Listener is active or not 790 private bool m_active; // Listener is active or not
723 private int m_handle; // Assigned handle of this listener 791 private int m_handle; // Assigned handle of this listener
@@ -731,16 +799,29 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
731 799
732 public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message) 800 public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message)
733 { 801 {
734 Initialise(handle, localID, ItemID, hostID, channel, name, id, message); 802 Initialise(handle, localID, ItemID, hostID, channel, name, id,
803 message, 0);
804 }
805
806 public ListenerInfo(int handle, uint localID, UUID ItemID,
807 UUID hostID, int channel, string name, UUID id,
808 string message, int regexBitfield)
809 {
810 Initialise(handle, localID, ItemID, hostID, channel, name, id,
811 message, regexBitfield);
735 } 812 }
736 813
737 public ListenerInfo(ListenerInfo li, string name, UUID id, string message) 814 public ListenerInfo(ListenerInfo li, string name, UUID id, string message)
738 { 815 {
739 Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message); 816 Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, 0);
817 }
818
819 public ListenerInfo(ListenerInfo li, string name, UUID id, string message, int regexBitfield)
820 {
821 Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, regexBitfield);
740 } 822 }
741 823
742 private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, 824 private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message, int regexBitfield)
743 UUID id, string message)
744 { 825 {
745 m_active = true; 826 m_active = true;
746 m_handle = handle; 827 m_handle = handle;
@@ -751,11 +832,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
751 m_name = name; 832 m_name = name;
752 m_id = id; 833 m_id = id;
753 m_message = message; 834 m_message = message;
835 RegexBitfield = regexBitfield;
754 } 836 }
755 837
756 public Object[] GetSerializationData() 838 public Object[] GetSerializationData()
757 { 839 {
758 Object[] data = new Object[6]; 840 Object[] data = new Object[7];
759 841
760 data[0] = m_active; 842 data[0] = m_active;
761 data[1] = m_handle; 843 data[1] = m_handle;
@@ -763,16 +845,19 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
763 data[3] = m_name; 845 data[3] = m_name;
764 data[4] = m_id; 846 data[4] = m_id;
765 data[5] = m_message; 847 data[5] = m_message;
848 data[6] = RegexBitfield;
766 849
767 return data; 850 return data;
768 } 851 }
769 852
770 public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data) 853 public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data)
771 { 854 {
772 ListenerInfo linfo = new ListenerInfo((int)data[1], localID, 855 ListenerInfo linfo = new ListenerInfo((int)data[1], localID, ItemID, hostID, (int)data[2], (string)data[3], (UUID)data[4], (string)data[5]);
773 ItemID, hostID, (int)data[2], (string)data[3], 856 linfo.m_active = (bool)data[0];
774 (UUID)data[4], (string)data[5]); 857 if (data.Length >= 7)
775 linfo.m_active=(bool)data[0]; 858 {
859 linfo.RegexBitfield = (int)data[6];
860 }
776 861
777 return linfo; 862 return linfo;
778 } 863 }
@@ -831,5 +916,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
831 { 916 {
832 return m_id; 917 return m_id;
833 } 918 }
919
920 public int RegexBitfield { get; private set; }
834 } 921 }
835} 922}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
index a66ed88..d8dace2 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
110 lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX; 110 lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX;
111 } 111 }
112 112
113 Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastY - firstY + 1), (int)(lastX - firstX + 1)); 113 Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastX - firstX + 1), (int)(lastY - firstY + 1));
114 114
115 115
116 // Calculate the subdirectory in which each region will be stored in the archive 116 // Calculate the subdirectory in which each region will be stored in the archive
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 2a87dc2..970487a 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -32,6 +32,8 @@ using System.Reflection;
32using log4net; 32using log4net;
33using NDesk.Options; 33using NDesk.Options;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework;
36using OpenSim.Framework.Console;
35using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
37 39
@@ -117,7 +119,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
117// 119//
118// foreach (string param in mainParams) 120// foreach (string param in mainParams)
119// m_log.DebugFormat("GOT PARAM [{0}]", param); 121// m_log.DebugFormat("GOT PARAM [{0}]", param);
120 122
121 if (mainParams.Count > 2) 123 if (mainParams.Count > 2)
122 { 124 {
123 DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); 125 DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty);
@@ -150,14 +152,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
150 152
151 List<string> mainParams = ops.Parse(cmdparams); 153 List<string> mainParams = ops.Parse(cmdparams);
152 154
155 string path;
153 if (mainParams.Count > 2) 156 if (mainParams.Count > 2)
154 { 157 path = mainParams[2];
155 ArchiveRegion(mainParams[2], options);
156 }
157 else 158 else
158 { 159 path = DEFAULT_OAR_BACKUP_FILENAME;
159 ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, options); 160
160 } 161 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, path))
162 return;
163
164 ArchiveRegion(path, options);
161 } 165 }
162 166
163 public void ArchiveRegion(string savePath, Dictionary<string, object> options) 167 public void ArchiveRegion(string savePath, Dictionary<string, object> options)
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 87241e1..b2c9bce 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -27,10 +27,12 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Linq; 31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
35using System.Xml;
34using log4net; 36using log4net;
35using Mono.Addins; 37using Mono.Addins;
36using NDesk.Options; 38using NDesk.Options;
@@ -41,6 +43,7 @@ using OpenSim.Framework.Console;
41using OpenSim.Framework.Monitoring; 43using OpenSim.Framework.Monitoring;
42using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.Framework.Scenes.Serialization;
44 47
45namespace OpenSim.Region.CoreModules.World.Objects.Commands 48namespace OpenSim.Region.CoreModules.World.Objects.Commands
46{ 49{
@@ -96,9 +99,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
96 HandleDeleteObject); 99 HandleDeleteObject);
97 100
98 m_console.Commands.AddCommand( 101 m_console.Commands.AddCommand(
99 "Objects", false, "delete object uuid", 102 "Objects", false, "delete object id",
100 "delete object uuid <UUID>", 103 "delete object id <UUID-or-localID>",
101 "Delete a scene object by uuid", 104 "Delete a scene object by uuid or localID",
102 HandleDeleteObject); 105 HandleDeleteObject);
103 106
104 m_console.Commands.AddCommand( 107 m_console.Commands.AddCommand(
@@ -122,28 +125,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
122 "delete object pos", 125 "delete object pos",
123 "delete object pos <start-coord> to <end-coord>", 126 "delete object pos <start-coord> to <end-coord>",
124 "Delete scene objects within the given area.", 127 "Delete scene objects within the given area.",
125 "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 128 ConsoleUtil.CoordHelp,
126 + "If you don't care about the z component you can simply omit it.\n"
127 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
128 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
129 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
130 + "e.g.\n"
131 + "delete object pos 20,20,20 to 40,40,40\n"
132 + "delete object pos 20,20 to 40,40\n"
133 + "delete object pos ,20,20 to ,40,40\n"
134 + "delete object pos ,,30 to ,,~\n"
135 + "delete object pos ,,-~ to ,,30",
136 HandleDeleteObject); 129 HandleDeleteObject);
137 130
138 m_console.Commands.AddCommand( 131 m_console.Commands.AddCommand(
139 "Objects", 132 "Objects",
140 false, 133 false,
141 "show object uuid", 134 "show object id",
142 "show object uuid [--full] <UUID>", 135 "show object id [--full] <UUID-or-localID>",
143 "Show details of a scene object with the given UUID", 136 "Show details of a scene object with the given UUID or localID",
144 "The --full option will print out information on all the parts of the object.\n" 137 "The --full option will print out information on all the parts of the object.\n"
145 + "For yet more detailed part information, use the \"show part\" commands.", 138 + "For yet more detailed part information, use the \"show part\" commands.",
146 HandleShowObjectByUuid); 139 HandleShowObjectById);
147 140
148 m_console.Commands.AddCommand( 141 m_console.Commands.AddCommand(
149 "Objects", 142 "Objects",
@@ -164,25 +157,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
164 "Show details of scene objects within the given area.", 157 "Show details of scene objects within the given area.",
165 "The --full option will print out information on all the parts of the object.\n" 158 "The --full option will print out information on all the parts of the object.\n"
166 + "For yet more detailed part information, use the \"show part\" commands.\n" 159 + "For yet more detailed part information, use the \"show part\" commands.\n"
167 + "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 160 + ConsoleUtil.CoordHelp,
168 + "If you don't care about the z component you can simply omit it.\n"
169 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
170 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
171 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
172 + "e.g.\n"
173 + "show object pos 20,20,20 to 40,40,40\n"
174 + "show object pos 20,20 to 40,40\n"
175 + "show object pos ,20,20 to ,40,40\n"
176 + "show object pos ,,30 to ,,~\n"
177 + "show object pos ,,-~ to ,,30",
178 HandleShowObjectByPos); 161 HandleShowObjectByPos);
179 162
180 m_console.Commands.AddCommand( 163 m_console.Commands.AddCommand(
181 "Objects", 164 "Objects",
182 false, 165 false,
183 "show part uuid", 166 "show part id",
184 "show part uuid <UUID>", 167 "show part id <UUID-or-localID>",
185 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); 168 "Show details of a scene object part with the given UUID or localID", HandleShowPartById);
186 169
187 m_console.Commands.AddCommand( 170 m_console.Commands.AddCommand(
188 "Objects", 171 "Objects",
@@ -190,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
190 "show part name", 173 "show part name",
191 "show part name [--regex] <name>", 174 "show part name [--regex] <name>",
192 "Show details of scene object parts with the given name.", 175 "Show details of scene object parts with the given name.",
193 "If --regex is specified then the name is treatead as a regular expression", 176 "If --regex is specified then the name is treated as a regular expression",
194 HandleShowPartByName); 177 HandleShowPartByName);
195 178
196 m_console.Commands.AddCommand( 179 m_console.Commands.AddCommand(
@@ -199,18 +182,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
199 "show part pos", 182 "show part pos",
200 "show part pos <start-coord> to <end-coord>", 183 "show part pos <start-coord> to <end-coord>",
201 "Show details of scene object parts within the given area.", 184 "Show details of scene object parts within the given area.",
202 "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 185 ConsoleUtil.CoordHelp,
203 + "If you don't care about the z component you can simply omit it.\n"
204 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
205 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
206 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
207 + "e.g.\n"
208 + "show object pos 20,20,20 to 40,40,40\n"
209 + "show object pos 20,20 to 40,40\n"
210 + "show object pos ,20,20 to ,40,40\n"
211 + "show object pos ,,30 to ,,~\n"
212 + "show object pos ,,-~ to ,,30",
213 HandleShowPartByPos); 186 HandleShowPartByPos);
187
188 m_console.Commands.AddCommand(
189 "Objects",
190 false,
191 "dump object id",
192 "dump object id <UUID-or-localID>",
193 "Dump the formatted serialization of the given object to the file <UUID>.xml",
194 "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n"
195 + "To locate the UUID or localID in the first place, you need to use the other show object commands.\n"
196 + "If a local ID is given then the filename used is still that for the UUID",
197 HandleDumpObjectById);
214 } 198 }
215 199
216 public void RemoveRegion(Scene scene) 200 public void RemoveRegion(Scene scene)
@@ -265,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
265 m_console.OutputFormat(sb.ToString()); 249 m_console.OutputFormat(sb.ToString());
266 } 250 }
267 251
268 private void HandleShowObjectByUuid(string module, string[] cmdparams) 252 private void HandleShowObjectById(string module, string[] cmdparams)
269 { 253 {
270 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 254 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
271 return; 255 return;
@@ -281,14 +265,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
281 return; 265 return;
282 } 266 }
283 267
284 UUID objectUuid; 268 UUID uuid;
285 if (!UUID.TryParse(mainParams[3], out objectUuid)) 269 uint localId;
286 { 270 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out uuid, out localId))
287 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
288 return; 271 return;
289 }
290 272
291 SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); 273 SceneObjectGroup so;
274
275 if (localId != ConsoleUtil.LocalIdNotFound)
276 so = m_scene.GetSceneObjectGroup(localId);
277 else
278 so = m_scene.GetSceneObjectGroup(uuid);
292 279
293 if (so == null) 280 if (so == null)
294 { 281 {
@@ -365,7 +352,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
365 OutputSogsToConsole(searchPredicate, showFull); 352 OutputSogsToConsole(searchPredicate, showFull);
366 } 353 }
367 354
368 private void HandleShowPartByUuid(string module, string[] cmdparams) 355 private void HandleShowPartById(string module, string[] cmdparams)
369 { 356 {
370 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 357 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
371 return; 358 return;
@@ -378,18 +365,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
378 365
379 if (mainParams.Count < 4) 366 if (mainParams.Count < 4)
380 { 367 {
381 m_console.OutputFormat("Usage: show part uuid [--full] <uuid>"); 368 m_console.OutputFormat("Usage: show part id [--full] <UUID-or-localID>");
382 return; 369 return;
383 } 370 }
384 371
385 UUID objectUuid; 372 UUID objectUuid;
386 if (!UUID.TryParse(mainParams[3], out objectUuid)) 373 uint localId;
387 { 374 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out objectUuid, out localId))
388 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
389 return; 375 return;
390 }
391 376
392 SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); 377 SceneObjectPart sop;
378 if (localId == ConsoleUtil.LocalIdNotFound)
379 sop = m_scene.GetSceneObjectPart(objectUuid);
380 else
381 sop = m_scene.GetSceneObjectPart(localId);
393 382
394 if (sop == null) 383 if (sop == null)
395 { 384 {
@@ -477,6 +466,51 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
477 OutputSopsToConsole(searchPredicate, true); 466 OutputSopsToConsole(searchPredicate, true);
478 } 467 }
479 468
469 private void HandleDumpObjectById(string module, string[] cmdparams)
470 {
471 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
472 return;
473
474 if (cmdparams.Length < 4)
475 {
476 m_console.OutputFormat("Usage: dump object id <UUID-or-localID>");
477 return;
478 }
479
480 UUID objectUuid;
481 uint localId;
482 if (!ConsoleUtil.TryParseConsoleId(m_console, cmdparams[3], out objectUuid, out localId))
483 return;
484
485 SceneObjectGroup so;
486 if (localId == ConsoleUtil.LocalIdNotFound)
487 so = m_scene.GetSceneObjectGroup(objectUuid);
488 else
489 so = m_scene.GetSceneObjectGroup(localId);
490
491 if (so == null)
492 {
493// m_console.OutputFormat("No part found with uuid {0}", objectUuid);
494 return;
495 }
496
497 // In case we found it via local ID.
498 objectUuid = so.UUID;
499
500 string fileName = string.Format("{0}.xml", objectUuid);
501
502 if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName))
503 return;
504
505 using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8))
506 {
507 xtw.Formatting = Formatting.Indented;
508 SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true);
509 }
510
511 m_console.OutputFormat("Object dumped to file {0}", fileName);
512 }
513
480 /// <summary> 514 /// <summary>
481 /// Append a scene object report to an input StringBuilder 515 /// Append a scene object report to an input StringBuilder
482 /// </summary> 516 /// </summary>
@@ -641,19 +675,24 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
641 675
642 break; 676 break;
643 677
644 case "uuid": 678 case "id":
645 if (!UUID.TryParse(o, out match)) 679 UUID uuid;
680 uint localId;
681 if (!ConsoleUtil.TryParseConsoleId(m_console, o, out uuid, out localId))
646 return; 682 return;
647 683
648 requireConfirmation = false; 684 requireConfirmation = false;
649 deletes = new List<SceneObjectGroup>(); 685 deletes = new List<SceneObjectGroup>();
650 686
651 m_scene.ForEachSOG(delegate (SceneObjectGroup g) 687 SceneObjectGroup so;
652 { 688 if (localId == ConsoleUtil.LocalIdNotFound)
653 if (g.UUID == match && !g.IsAttachment) 689 so = m_scene.GetSceneObjectGroup(uuid);
654 deletes.Add(g); 690 else
655 }); 691 so = m_scene.GetSceneObjectGroup(localId);
656 692
693 if (!so.IsAttachment)
694 deletes.Add(so);
695
657 // if (deletes.Count == 0) 696 // if (deletes.Count == 0)
658 // m_console.OutputFormat("No objects were found with uuid {0}", match); 697 // m_console.OutputFormat("No objects were found with uuid {0}", match);
659 698
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
index e8e375e..20e0199 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
@@ -45,6 +45,13 @@ namespace OpenSim.Region.Framework.Interfaces
45 void Deactivate(); 45 void Deactivate();
46 void Activate(); 46 void Activate();
47 UUID GetID(); 47 UUID GetID();
48
49 /// <summary>
50 /// Bitfield indicating which strings should be processed as regex.
51 /// 1 corresponds to IWorldCommListenerInfo::GetName()
52 /// 2 corresponds to IWorldCommListenerInfo::GetMessage()
53 /// </summary>
54 int RegexBitfield { get; }
48 } 55 }
49 56
50 public interface IWorldComm 57 public interface IWorldComm
@@ -60,7 +67,7 @@ namespace OpenSim.Region.Framework.Interfaces
60 /// the script during 'peek' time. Parameter hostID is needed to 67 /// the script during 'peek' time. Parameter hostID is needed to
61 /// determine the position of the script. 68 /// determine the position of the script.
62 /// </summary> 69 /// </summary>
63 /// <param name="localID">localID of the script engine</param> 70 /// <param name="LocalID">localID of the script engine</param>
64 /// <param name="itemID">UUID of the script engine</param> 71 /// <param name="itemID">UUID of the script engine</param>
65 /// <param name="hostID">UUID of the SceneObjectPart</param> 72 /// <param name="hostID">UUID of the SceneObjectPart</param>
66 /// <param name="channel">channel to listen on</param> 73 /// <param name="channel">channel to listen on</param>
@@ -70,6 +77,23 @@ namespace OpenSim.Region.Framework.Interfaces
70 /// <returns>number of the scripts handle</returns> 77 /// <returns>number of the scripts handle</returns>
71 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); 78 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg);
72 79
80 /// <summary>
81 /// Create a listen event callback with the specified filters.
82 /// The parameters localID,itemID are needed to uniquely identify
83 /// the script during 'peek' time. Parameter hostID is needed to
84 /// determine the position of the script.
85 /// </summary>
86 /// <param name="LocalID">localID of the script engine</param>
87 /// <param name="itemID">UUID of the script engine</param>
88 /// <param name="hostID">UUID of the SceneObjectPart</param>
89 /// <param name="channel">channel to listen on</param>
90 /// <param name="name">name to filter on</param>
91 /// <param name="id">key to filter on (user given, could be totally faked)</param>
92 /// <param name="msg">msg to filter on</param>
93 /// <param name="regexBitfield">Bitfield indicating which strings should be processed as regex.</param>
94 /// <returns>number of the scripts handle</returns>
95 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg, int regexBitfield);
96
73 /// <summary> 97 /// <summary>
74 /// This method scans over the objects which registered an interest in listen callbacks. 98 /// This method scans over the objects which registered an interest in listen callbacks.
75 /// For everyone it finds, it checks if it fits the given filter. If it does, then 99 /// For everyone it finds, it checks if it fits the given filter. If it does, then
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index ad421ee..9ed4f47 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
87 { 87 {
88 if (m_defaultAnimation.AnimID == animID) 88 if (m_defaultAnimation.AnimID == animID)
89 { 89 {
90 m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); 90 m_defaultAnimation = new OpenSim.Framework.Animation(animID, 1, UUID.Zero);
91 } 91 }
92 else if (HasAnimation(animID)) 92 else if (HasAnimation(animID))
93 { 93 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 16c0d25..ce6415a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -38,8 +38,20 @@ namespace OpenSim.Region.Framework.Scenes
38{ 38{
39 public partial class Scene 39 public partial class Scene
40 { 40 {
41 /// <summary>
42 /// Send chat to listeners.
43 /// </summary>
44 /// <param name='message'></param>
45 /// <param name='type'>/param>
46 /// <param name='channel'></param>
47 /// <param name='fromPos'></param>
48 /// <param name='fromName'></param>
49 /// <param name='fromID'></param>
50 /// <param name='targetID'></param>
51 /// <param name='fromAgent'></param>
52 /// <param name='broadcast'></param>
41 public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, 53 public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
42 UUID fromID, bool fromAgent, bool broadcast, UUID destination) 54 UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
43 { 55 {
44 OSChatMessage args = new OSChatMessage(); 56 OSChatMessage args = new OSChatMessage();
45 57
@@ -49,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
49 args.Position = fromPos; 61 args.Position = fromPos;
50 args.SenderUUID = fromID; 62 args.SenderUUID = fromID;
51 args.Scene = this; 63 args.Scene = this;
52 args.Destination = destination; 64 args.Destination = targetID;
53 65
54 if (fromAgent) 66 if (fromAgent)
55 { 67 {
@@ -66,6 +78,10 @@ namespace OpenSim.Region.Framework.Scenes
66 args.From = fromName; 78 args.From = fromName;
67 //args. 79 //args.
68 80
81// m_log.DebugFormat(
82// "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}",
83// args.Message.Replace("\n", "\\n"), args.Channel, args.Type, fromName, broadcast);
84
69 if (broadcast) 85 if (broadcast)
70 EventManager.TriggerOnChatBroadcast(this, args); 86 EventManager.TriggerOnChatBroadcast(this, args);
71 else 87 else
@@ -75,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes
75 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, 91 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
76 UUID fromID, bool fromAgent, bool broadcast) 92 UUID fromID, bool fromAgent, bool broadcast)
77 { 93 {
78 SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, broadcast, UUID.Zero); 94 SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast);
79 } 95 }
80 96
81 /// <summary> 97 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 45d512b..218d4e4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1300,6 +1300,12 @@ namespace OpenSim.Region.Framework.Scenes
1300 // This is the method that shuts down the scene. 1300 // This is the method that shuts down the scene.
1301 public override void Close() 1301 public override void Close()
1302 { 1302 {
1303 if (m_shuttingDown)
1304 {
1305 m_log.WarnFormat("[SCENE]: Ignoring close request because already closing {0}", Name);
1306 return;
1307 }
1308
1303 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); 1309 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
1304 1310
1305 StatsReporter.Close(); 1311 StatsReporter.Close();
@@ -1343,6 +1349,14 @@ namespace OpenSim.Region.Framework.Scenes
1343 1349
1344 m_sceneGraph.Close(); 1350 m_sceneGraph.Close();
1345 1351
1352 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
1353 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
1354
1355 base.Close();
1356
1357 // XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence.
1358 // Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can
1359 // attempt to reference a null or disposed physics scene.
1346 if (PhysicsScene != null) 1360 if (PhysicsScene != null)
1347 { 1361 {
1348 PhysicsScene phys = PhysicsScene; 1362 PhysicsScene phys = PhysicsScene;
@@ -1351,12 +1365,6 @@ namespace OpenSim.Region.Framework.Scenes
1351 phys.Dispose(); 1365 phys.Dispose();
1352 phys = null; 1366 phys = null;
1353 } 1367 }
1354
1355 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
1356 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
1357
1358 // call the base class Close method.
1359 base.Close();
1360 } 1368 }
1361 1369
1362 /// <summary> 1370 /// <summary>
@@ -3595,9 +3603,10 @@ namespace OpenSim.Region.Framework.Scenes
3595 if (closeChildAgents && CapsModule != null) 3603 if (closeChildAgents && CapsModule != null)
3596 CapsModule.RemoveCaps(agentID); 3604 CapsModule.RemoveCaps(agentID);
3597 3605
3598 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3606// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3599 // this method is doing is HORRIBLE!!! 3607// // this method is doing is HORRIBLE!!!
3600 avatar.Scene.NeedSceneCacheClear(avatar.UUID); 3608 // Commented pending deletion since this method no longer appears to do anything at all
3609// avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3601 3610
3602 if (closeChildAgents && !isChildAgent) 3611 if (closeChildAgents && !isChildAgent)
3603 { 3612 {
@@ -4899,13 +4908,24 @@ namespace OpenSim.Region.Framework.Scenes
4899 /// Get a group via its UUID 4908 /// Get a group via its UUID
4900 /// </summary> 4909 /// </summary>
4901 /// <param name="fullID"></param> 4910 /// <param name="fullID"></param>
4902 /// <returns>null if no group with that name exists</returns> 4911 /// <returns>null if no group with that id exists</returns>
4903 public SceneObjectGroup GetSceneObjectGroup(UUID fullID) 4912 public SceneObjectGroup GetSceneObjectGroup(UUID fullID)
4904 { 4913 {
4905 return m_sceneGraph.GetSceneObjectGroup(fullID); 4914 return m_sceneGraph.GetSceneObjectGroup(fullID);
4906 } 4915 }
4907 4916
4908 /// <summary> 4917 /// <summary>
4918 /// Get a group via its local ID
4919 /// </summary>
4920 /// <remarks>This will only return a group if the local ID matches a root part</remarks>
4921 /// <param name="localID"></param>
4922 /// <returns>null if no group with that id exists</returns>
4923 public SceneObjectGroup GetSceneObjectGroup(uint localID)
4924 {
4925 return m_sceneGraph.GetSceneObjectGroup(localID);
4926 }
4927
4928 /// <summary>
4909 /// Get a group by name from the scene (will return the first 4929 /// Get a group by name from the scene (will return the first
4910 /// found, if there are more than one prim with the same name) 4930 /// found, if there are more than one prim with the same name)
4911 /// </summary> 4931 /// </summary>
@@ -5065,14 +5085,15 @@ namespace OpenSim.Region.Framework.Scenes
5065 client.SendRegionHandle(regionID, handle); 5085 client.SendRegionHandle(regionID, handle);
5066 } 5086 }
5067 5087
5068 public bool NeedSceneCacheClear(UUID agentID) 5088// Commented pending deletion since this method no longer appears to do anything at all
5069 { 5089// public bool NeedSceneCacheClear(UUID agentID)
5070 IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); 5090// {
5071 if (inv == null) 5091// IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>();
5072 return true; 5092// if (inv == null)
5073 5093// return true;
5074 return inv.NeedSceneCacheClear(agentID, this); 5094//
5075 } 5095// return inv.NeedSceneCacheClear(agentID, this);
5096// }
5076 5097
5077 public void CleanTempObjects() 5098 public void CleanTempObjects()
5078 { 5099 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 1beb584..e599e90 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1063,6 +1063,30 @@ namespace OpenSim.Region.Framework.Scenes
1063 } 1063 }
1064 1064
1065 /// <summary> 1065 /// <summary>
1066 /// Get a group in the scene
1067 /// </summary>
1068 /// <remarks>
1069 /// This will only return a group if the local ID matches the root part, not other parts.
1070 /// </remarks>
1071 /// <param name="localID">Local id of the root part of the group</param>
1072 /// <returns>null if no such group was found</returns>
1073 protected internal SceneObjectGroup GetSceneObjectGroup(uint localID)
1074 {
1075 lock (SceneObjectGroupsByLocalPartID)
1076 {
1077 if (SceneObjectGroupsByLocalPartID.ContainsKey(localID))
1078 {
1079 SceneObjectGroup so = SceneObjectGroupsByLocalPartID[localID];
1080
1081 if (so.LocalId == localID)
1082 return so;
1083 }
1084 }
1085
1086 return null;
1087 }
1088
1089 /// <summary>
1066 /// Get a group by name from the scene (will return the first 1090 /// Get a group by name from the scene (will return the first
1067 /// found, if there are more than one prim with the same name) 1091 /// found, if there are more than one prim with the same name)
1068 /// </summary> 1092 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index adb3d38..5be826d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.Framework.Scenes
69 public ScriptControlled eventControls; 69 public ScriptControlled eventControls;
70 } 70 }
71 71
72 public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); 72 public delegate void SendCoarseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
73 73
74 public class ScenePresence : EntityBase, IScenePresence 74 public class ScenePresence : EntityBase, IScenePresence
75 { 75 {
@@ -188,7 +188,7 @@ namespace OpenSim.Region.Framework.Scenes
188 /// </summary> 188 /// </summary>
189 public bool SitGround { get; private set; } 189 public bool SitGround { get; private set; }
190 190
191 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 191 private SendCoarseLocationsMethod m_sendCoarseLocationsMethod;
192 192
193 //private Vector3 m_requestedSitOffset = new Vector3(); 193 //private Vector3 m_requestedSitOffset = new Vector3();
194 194
@@ -711,7 +711,7 @@ namespace OpenSim.Region.Framework.Scenes
711 AttachmentsSyncLock = new Object(); 711 AttachmentsSyncLock = new Object();
712 AllowMovement = true; 712 AllowMovement = true;
713 IsChildAgent = true; 713 IsChildAgent = true;
714 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 714 m_sendCoarseLocationsMethod = SendCoarseLocationsDefault;
715 Animator = new ScenePresenceAnimator(this); 715 Animator = new ScenePresenceAnimator(this);
716 PresenceType = type; 716 PresenceType = type;
717 DrawDistance = world.DefaultDrawDistance; 717 DrawDistance = world.DefaultDrawDistance;
@@ -2629,17 +2629,17 @@ namespace OpenSim.Region.Framework.Scenes
2629 2629
2630 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2630 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2631 { 2631 {
2632 SendCourseLocationsMethod d = m_sendCourseLocationsMethod; 2632 SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod;
2633 if (d != null) 2633 if (d != null)
2634 { 2634 {
2635 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); 2635 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
2636 } 2636 }
2637 } 2637 }
2638 2638
2639 public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) 2639 public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d)
2640 { 2640 {
2641 if (d != null) 2641 if (d != null)
2642 m_sendCourseLocationsMethod = d; 2642 m_sendCoarseLocationsMethod = d;
2643 } 2643 }
2644 2644
2645 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2645 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@@ -2843,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
2843 #region Significant Movement Method 2843 #region Significant Movement Method
2844 2844
2845 /// <summary> 2845 /// <summary>
2846 /// This checks for a significant movement and sends a courselocationchange update 2846 /// This checks for a significant movement and sends a coarselocationchange update
2847 /// </summary> 2847 /// </summary>
2848 protected void CheckForSignificantMovement() 2848 protected void CheckForSignificantMovement()
2849 { 2849 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index d722a09..ac3da1e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -65,5 +65,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
65 65
66 Assert.That(scene.Frame, Is.EqualTo(1)); 66 Assert.That(scene.Frame, Is.EqualTo(1));
67 } 67 }
68
69 [Test]
70 public void TestShutdownScene()
71 {
72 TestHelpers.InMethod();
73
74 Scene scene = new SceneHelpers().SetupScene();
75 scene.Close();
76
77 Assert.That(scene.ShuttingDown, Is.True);
78 Assert.That(scene.Active, Is.False);
79
80 // Trying to update a shutdown scene should result in no update
81 scene.Update(1);
82
83 Assert.That(scene.Frame, Is.EqualTo(0));
84 }
68 } 85 }
69} \ No newline at end of file 86} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index f3382b2..c363fd3 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -958,7 +958,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
958 958
959 } 959 }
960 960
961 public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, byte audible) 961 public void SendChatMessage(
962 string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, byte audible)
962 { 963 {
963 if (audible > 0 && message.Length > 0) 964 if (audible > 0 && message.Length > 0)
964 IRC_SendChannelPrivmsg(fromName, message); 965 IRC_SendChannelPrivmsg(fromName, message);
diff --git a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
index 41ec14f..7639c6c 100644
--- a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
@@ -127,6 +127,9 @@ namespace OpenSim.Region.OptionalModules.Asset
127 } 127 }
128 128
129 string fileName = rawAssetId; 129 string fileName = rawAssetId;
130
131 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, fileName))
132 return;
130 133
131 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) 134 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
132 { 135 {
diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
index e22618d..5c3be29 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
@@ -546,8 +546,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
546 c.SenderUUID = UUID.Zero; 546 c.SenderUUID = UUID.Zero;
547 c.Scene = agent.Scene; 547 c.Scene = agent.Scene;
548 548
549 agent.ControllingClient.SendChatMessage(msg, (byte) ChatTypeEnum.Say, PosOfGod, m_whoami, UUID.Zero, 549 agent.ControllingClient.SendChatMessage(
550 (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully); 550 msg, (byte) ChatTypeEnum.Say, PosOfGod, m_whoami, UUID.Zero, UUID.Zero,
551 (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
551 } 552 }
552 553
553 private static void checkStringParameters(XmlRpcRequest request, string[] param) 554 private static void checkStringParameters(XmlRpcRequest request, string[] param)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 66fc216..5471afa 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -607,13 +607,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
607 { 607 {
608 } 608 }
609 609
610 public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, 610 public virtual void SendChatMessage(
611 UUID fromAgentID, byte source, byte audible) 611 string message, byte type, Vector3 fromPos, string fromName,
612 UUID fromAgentID, UUID ownerID, byte source, byte audible)
612 { 613 {
613 } 614 }
614 615
615 public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName, 616 public virtual void SendChatMessage(
616 UUID fromAgentID, byte source, byte audible) 617 byte[] message, byte type, Vector3 fromPos, string fromName,
618 UUID fromAgentID, UUID ownerID, byte source, byte audible)
617 { 619 {
618 } 620 }
619 621
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 07dd613..a041ba8 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -105,7 +105,7 @@ public class BSCharacter : BSPhysObject
105 shapeData.Position = _position; 105 shapeData.Position = _position;
106 shapeData.Rotation = _orientation; 106 shapeData.Rotation = _orientation;
107 shapeData.Velocity = _velocity; 107 shapeData.Velocity = _velocity;
108 shapeData.Size = Scale; 108 shapeData.Size = Scale; // capsule is a native shape but scale is not just <1,1,1>
109 shapeData.Scale = Scale; 109 shapeData.Scale = Scale;
110 shapeData.Mass = _mass; 110 shapeData.Mass = _mass;
111 shapeData.Buoyancy = _buoyancy; 111 shapeData.Buoyancy = _buoyancy;
@@ -144,7 +144,9 @@ public class BSCharacter : BSPhysObject
144 ForcePosition = _position; 144 ForcePosition = _position;
145 // Set the velocity and compute the proper friction 145 // Set the velocity and compute the proper friction
146 ForceVelocity = _velocity; 146 ForceVelocity = _velocity;
147
147 BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.avatarRestitution); 148 BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.avatarRestitution);
149 BulletSimAPI.SetMargin2(BSShape.ptr, PhysicsScene.Params.collisionMargin);
148 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); 150 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale);
149 BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); 151 BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold);
150 if (PhysicsScene.Params.ccdMotionThreshold > 0f) 152 if (PhysicsScene.Params.ccdMotionThreshold > 0f)
@@ -156,11 +158,15 @@ public class BSCharacter : BSPhysObject
156 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw); 158 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw);
157 BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); 159 BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia);
158 160
161 // Make so capsule does not fall over
162 BulletSimAPI.SetAngularFactorV2(BSBody.ptr, OMV.Vector3.Zero);
163
159 BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); 164 BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT);
160 165
161 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); 166 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr);
162 167
163 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); 168 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG);
169 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_DEACTIVATION);
164 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); 170 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr);
165 171
166 // Do this after the object has been added to the world 172 // Do this after the object has been added to the world
@@ -175,11 +181,13 @@ public class BSCharacter : BSPhysObject
175 } 181 }
176 // No one calls this method so I don't know what it could possibly mean 182 // No one calls this method so I don't know what it could possibly mean
177 public override bool Stopped { get { return false; } } 183 public override bool Stopped { get { return false; } }
184
178 public override OMV.Vector3 Size { 185 public override OMV.Vector3 Size {
179 get 186 get
180 { 187 {
181 // Avatar capsule size is kept in the scale parameter. 188 // Avatar capsule size is kept in the scale parameter.
182 return _size; 189 // return _size;
190 return new OMV.Vector3(Scale.X * 2f, Scale.Y * 2f, Scale.Z);
183 } 191 }
184 192
185 set { 193 set {
@@ -199,7 +207,9 @@ public class BSCharacter : BSPhysObject
199 207
200 } 208 }
201 } 209 }
210
202 public override OMV.Vector3 Scale { get; set; } 211 public override OMV.Vector3 Scale { get; set; }
212
203 public override PrimitiveBaseShape Shape 213 public override PrimitiveBaseShape Shape
204 { 214 {
205 set { BaseShape = value; } 215 set { BaseShape = value; }
@@ -264,7 +274,7 @@ public class BSCharacter : BSPhysObject
264 274
265 275
266 // Check that the current position is sane and, if not, modify the position to make it so. 276 // Check that the current position is sane and, if not, modify the position to make it so.
267 // Check for being below terrain and being out of bounds. 277 // Check for being below terrain or on water.
268 // Returns 'true' of the position was made sane by some action. 278 // Returns 'true' of the position was made sane by some action.
269 private bool PositionSanityCheck() 279 private bool PositionSanityCheck()
270 { 280 {
@@ -335,7 +345,7 @@ public class BSCharacter : BSPhysObject
335 } 345 }
336 346
337 // Avatars don't do vehicles 347 // Avatars don't do vehicles
338 public override int VehicleType { get { return 0; } set { return; } } 348 public override int VehicleType { get { return (int)Vehicle.TYPE_NONE; } set { return; } }
339 public override void VehicleFloatParam(int param, float value) { } 349 public override void VehicleFloatParam(int param, float value) { }
340 public override void VehicleVectorParam(int param, OMV.Vector3 value) {} 350 public override void VehicleVectorParam(int param, OMV.Vector3 value) {}
341 public override void VehicleRotationParam(int param, OMV.Quaternion rotation) { } 351 public override void VehicleRotationParam(int param, OMV.Quaternion rotation) { }
@@ -588,9 +598,8 @@ public class BSCharacter : BSPhysObject
588 newScale.X = PhysicsScene.Params.avatarCapsuleRadius; 598 newScale.X = PhysicsScene.Params.avatarCapsuleRadius;
589 newScale.Y = PhysicsScene.Params.avatarCapsuleRadius; 599 newScale.Y = PhysicsScene.Params.avatarCapsuleRadius;
590 600
591 // From the total height, remote the capsule half spheres that are at each end 601 // From the total height, remove the capsule half spheres that are at each end
592 newScale.Z = (size.Z * 2f) - Math.Min(newScale.X, newScale.Y); 602 newScale.Z = size.Z- (newScale.X + newScale.Y);
593 // newScale.Z = (size.Z * 2f);
594 Scale = newScale; 603 Scale = newScale;
595 } 604 }
596 605
@@ -636,7 +645,7 @@ public class BSCharacter : BSPhysObject
636 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, avVel); 645 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, avVel);
637 } 646 }
638 647
639 // Tell the linkset about this 648 // Tell the linkset about value changes
640 Linkset.UpdateProperties(this); 649 Linkset.UpdateProperties(this);
641 650
642 // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. 651 // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index e686f2f..db0c99e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -692,7 +692,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
692 { 692 {
693 if (_taintedObjects.Count > 0) // save allocating new list if there is nothing to process 693 if (_taintedObjects.Count > 0) // save allocating new list if there is nothing to process
694 { 694 {
695 // swizzle a new list into the list location so we can process what's there
696 int taintCount = m_taintsToProcessPerStep; 695 int taintCount = m_taintsToProcessPerStep;
697 TaintCallbackEntry oneCallback = new TaintCallbackEntry(); 696 TaintCallbackEntry oneCallback = new TaintCallbackEntry();
698 while (_taintedObjects.Count > 0 && taintCount-- > 0) 697 while (_taintedObjects.Count > 0 && taintCount-- > 0)
@@ -711,7 +710,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
711 { 710 {
712 try 711 try
713 { 712 {
714 DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, oneCallback.ident); // DEBUG DEBUG DEBUG 713 DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, oneCallback.ident);
715 oneCallback.callback(); 714 oneCallback.callback();
716 } 715 }
717 catch (Exception e) 716 catch (Exception e)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index b1833c5..30fa50a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -338,6 +338,7 @@ public class BSShapeCollection : IDisposable
338 ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR, 338 ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR,
339 ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); 339 ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback);
340 DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.BSShape); 340 DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.BSShape);
341 ret = true;
341 haveShape = true; 342 haveShape = true;
342 } 343 }
343 // If the prim attributes are simple, this could be a simple Bullet native shape 344 // If the prim attributes are simple, this could be a simple Bullet native shape
@@ -411,15 +412,14 @@ public class BSShapeCollection : IDisposable
411 ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey, 412 ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey,
412 ShapeDestructionCallback shapeCallback) 413 ShapeDestructionCallback shapeCallback)
413 { 414 {
415 // release any previous shape
416 DereferenceShape(prim.BSShape, true, shapeCallback);
414 417
415 shapeData.Type = shapeType; 418 shapeData.Type = shapeType;
416 // Bullet native objects are scaled by the Bullet engine so pass the size in 419 // Bullet native objects are scaled by the Bullet engine so pass the size in
417 prim.Scale = shapeData.Size; 420 prim.Scale = shapeData.Size;
418 shapeData.Scale = shapeData.Size; 421 shapeData.Scale = shapeData.Size;
419 422
420 // release any previous shape
421 DereferenceShape(prim.BSShape, true, shapeCallback);
422
423 BulletShape newShape = BuildPhysicalNativeShape(shapeType, shapeData, shapeKey); 423 BulletShape newShape = BuildPhysicalNativeShape(shapeType, shapeData, shapeKey);
424 424
425 // Don't need to do a 'ReferenceShape()' here because native shapes are not shared. 425 // Don't need to do a 'ReferenceShape()' here because native shapes are not shared.
@@ -443,7 +443,8 @@ public class BSShapeCollection : IDisposable
443 if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) 443 if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR)
444 { 444 {
445 newShape = new BulletShape( 445 newShape = new BulletShape(
446 BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1.0f, 1.0f, nativeShapeData.Scale), shapeType); 446 BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, nativeShapeData.Scale)
447 , shapeType);
447 DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", nativeShapeData.ID, nativeShapeData.Scale); 448 DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", nativeShapeData.ID, nativeShapeData.Scale);
448 } 449 }
449 else 450 else
@@ -790,7 +791,6 @@ public class BSShapeCollection : IDisposable
790 // If the collisionObject is not the correct type for solidness, rebuild what's there 791 // If the collisionObject is not the correct type for solidness, rebuild what's there
791 mustRebuild = true; 792 mustRebuild = true;
792 } 793 }
793
794 } 794 }
795 795
796 if (mustRebuild || forceRebuild) 796 if (mustRebuild || forceRebuild)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index ae267e3..880859a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -333,8 +333,8 @@ public class BSTerrainManager
333 333
334 // Make sure the new shape is processed. 334 // Make sure the new shape is processed.
335 // BulletSimAPI.Activate2(mapInfo.terrainBody.ptr, true); 335 // BulletSimAPI.Activate2(mapInfo.terrainBody.ptr, true);
336 BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.ISLAND_SLEEPING); 336 // BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.ISLAND_SLEEPING);
337 // BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION); 337 BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION);
338 338
339 m_terrainModified = true; 339 m_terrainModified = true;
340 }; 340 };
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 190fca0..905540d 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -719,21 +719,21 @@ namespace OpenSim.Region.RegionCombinerModule
719 rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn); 719 rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
720 720
721 // Sets up the CoarseLocationUpdate forwarder for this root region 721 // Sets up the CoarseLocationUpdate forwarder for this root region
722 scene.EventManager.OnNewPresence += SetCourseLocationDelegate; 722 scene.EventManager.OnNewPresence += SetCoarseLocationDelegate;
723 723
724 // Adds this root region to a dictionary of regions that are connectable 724 // Adds this root region to a dictionary of regions that are connectable
725 m_regions.Add(scene.RegionInfo.originRegionID, rootConn); 725 m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
726 } 726 }
727 } 727 }
728 728
729 private void SetCourseLocationDelegate(ScenePresence presence) 729 private void SetCoarseLocationDelegate(ScenePresence presence)
730 { 730 {
731 presence.SetSendCourseLocationMethod(SendCourseLocationUpdates); 731 presence.SetSendCoarseLocationMethod(SendCoarseLocationUpdates);
732 } 732 }
733 733
734 // This delegate was refactored for non-combined regions. 734 // This delegate was refactored for non-combined regions.
735 // This combined region version will not use the pre-compiled lists of locations and ids 735 // This combined region version will not use the pre-compiled lists of locations and ids
736 private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 736 private void SendCoarseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
737 { 737 {
738 RegionConnections connectiondata = null; 738 RegionConnections connectiondata = null;
739 lock (m_regions) 739 lock (m_regions)
@@ -756,18 +756,18 @@ namespace OpenSim.Region.RegionCombinerModule
756 } 756 }
757 }); 757 });
758 758
759 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); 759 DistributeCoarseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
760 } 760 }
761 761
762 private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids, 762 private void DistributeCoarseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
763 RegionConnections connectiondata, ScenePresence rootPresence) 763 RegionConnections connectiondata, ScenePresence rootPresence)
764 { 764 {
765 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray(); 765 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
766 //List<IClientAPI> clients = new List<IClientAPI>(); 766 //List<IClientAPI> clients = new List<IClientAPI>();
767 Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>(); 767 Dictionary<Vector2, RegionCoarseLocationStruct> updates = new Dictionary<Vector2, RegionCoarseLocationStruct>();
768 768
769 // Root Region entry 769 // Root Region entry
770 RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct(); 770 RegionCoarseLocationStruct rootupdatedata = new RegionCoarseLocationStruct();
771 rootupdatedata.Locations = new List<Vector3>(); 771 rootupdatedata.Locations = new List<Vector3>();
772 rootupdatedata.Uuids = new List<UUID>(); 772 rootupdatedata.Uuids = new List<UUID>();
773 rootupdatedata.Offset = Vector2.Zero; 773 rootupdatedata.Offset = Vector2.Zero;
@@ -781,7 +781,7 @@ namespace OpenSim.Region.RegionCombinerModule
781 foreach (RegionData regiondata in rdata) 781 foreach (RegionData regiondata in rdata)
782 { 782 {
783 Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y); 783 Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
784 RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); 784 RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
785 updatedata.Locations = new List<Vector3>(); 785 updatedata.Locations = new List<Vector3>();
786 updatedata.Uuids = new List<UUID>(); 786 updatedata.Uuids = new List<UUID>();
787 updatedata.Offset = offset; 787 updatedata.Offset = offset;
@@ -807,7 +807,7 @@ namespace OpenSim.Region.RegionCombinerModule
807 if (!updates.ContainsKey(offset)) 807 if (!updates.ContainsKey(offset))
808 { 808 {
809 // This shouldn't happen 809 // This shouldn't happen
810 RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct(); 810 RegionCoarseLocationStruct updatedata = new RegionCoarseLocationStruct();
811 updatedata.Locations = new List<Vector3>(); 811 updatedata.Locations = new List<Vector3>();
812 updatedata.Uuids = new List<UUID>(); 812 updatedata.Uuids = new List<UUID>();
813 updatedata.Offset = offset; 813 updatedata.Offset = offset;
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs
index 53a678f..224ac99 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs
@@ -33,7 +33,7 @@ using OpenSim.Framework;
33namespace OpenSim.Region.RegionCombinerModule 33namespace OpenSim.Region.RegionCombinerModule
34{ 34{
35 35
36 struct RegionCourseLocationStruct 36 struct RegionCoarseLocationStruct
37 { 37 {
38 public List<Vector3> Locations; 38 public List<Vector3> Locations;
39 public List<UUID> Uuids; 39 public List<UUID> Uuids;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index de49d6d..8d8df1d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -11578,12 +11578,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11578 11578
11579 internal void Deprecated(string command) 11579 internal void Deprecated(string command)
11580 { 11580 {
11581 throw new Exception("Command deprecated: " + command); 11581 throw new ScriptException("Command deprecated: " + command);
11582 } 11582 }
11583 11583
11584 internal void LSLError(string msg) 11584 internal void LSLError(string msg)
11585 { 11585 {
11586 throw new Exception("LSL Runtime Error: " + msg); 11586 throw new ScriptException("LSL Runtime Error: " + msg);
11587 } 11587 }
11588 11588
11589 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); 11589 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 6809c09..8f34833 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -95,13 +95,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
95 95
96 internal void MODError(string msg) 96 internal void MODError(string msg)
97 { 97 {
98 throw new Exception("MOD Runtime Error: " + msg); 98 throw new ScriptException("MOD Runtime Error: " + msg);
99 } 99 }
100 100
101 // 101 /// <summary>
102 //Dumps an error message on the debug console. 102 /// Dumps an error message on the debug console.
103 // 103 /// </summary>
104 104 /// <param name='message'></param>
105 internal void MODShoutError(string message) 105 internal void MODShoutError(string message)
106 { 106 {
107 if (message.Length > 1023) 107 if (message.Length > 1023)
@@ -359,20 +359,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
359 result[i] = (string)(LSL_String)plist[i]; 359 result[i] = (string)(LSL_String)plist[i];
360 else if (plist[i] is LSL_Integer) 360 else if (plist[i] is LSL_Integer)
361 result[i] = (int)(LSL_Integer)plist[i]; 361 result[i] = (int)(LSL_Integer)plist[i];
362 // The int check exists because of the many plain old int script constants in ScriptBase which
363 // are not LSL_Integers.
364 else if (plist[i] is int)
365 result[i] = plist[i];
362 else if (plist[i] is LSL_Float) 366 else if (plist[i] is LSL_Float)
363 result[i] = (float)(LSL_Float)plist[i]; 367 result[i] = (float)(LSL_Float)plist[i];
364 else if (plist[i] is LSL_Key) 368 else if (plist[i] is LSL_Key)
365 result[i] = new UUID((LSL_Key)plist[i]); 369 result[i] = new UUID((LSL_Key)plist[i]);
366 else if (plist[i] is LSL_Rotation) 370 else if (plist[i] is LSL_Rotation)
367 { 371 result[i] = (Quaternion)((LSL_Rotation)plist[i]);
368 result[i] = (OpenMetaverse.Quaternion)(
369 (LSL_Rotation)plist[i]);
370 }
371 else if (plist[i] is LSL_Vector) 372 else if (plist[i] is LSL_Vector)
372 { 373 result[i] = (Vector3)((LSL_Vector)plist[i]);
373 result[i] = (OpenMetaverse.Vector3)(
374 (LSL_Vector)plist[i]);
375 }
376 else 374 else
377 MODError(String.Format("{0}: unknown LSL list element type", fname)); 375 MODError(String.Format("{0}: unknown LSL list element type", fname));
378 } 376 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 17277d7..51c8c7e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -218,7 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
218 } 218 }
219 else 219 else
220 { 220 {
221 throw new Exception("OSSL Runtime Error: " + msg); 221 throw new ScriptException("OSSL Runtime Error: " + msg);
222 } 222 }
223 } 223 }
224 224
@@ -1789,18 +1789,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1789 protected string LoadNotecard(string notecardNameOrUuid) 1789 protected string LoadNotecard(string notecardNameOrUuid)
1790 { 1790 {
1791 UUID assetID = CacheNotecard(notecardNameOrUuid); 1791 UUID assetID = CacheNotecard(notecardNameOrUuid);
1792 StringBuilder notecardData = new StringBuilder();
1793 1792
1794 for (int count = 0; count < NotecardCache.GetLines(assetID); count++) 1793 if (assetID != UUID.Zero)
1795 { 1794 {
1796 string line = NotecardCache.GetLine(assetID, count) + "\n"; 1795 StringBuilder notecardData = new StringBuilder();
1797 1796
1798// m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); 1797 for (int count = 0; count < NotecardCache.GetLines(assetID); count++)
1799 1798 {
1800 notecardData.Append(line); 1799 string line = NotecardCache.GetLine(assetID, count) + "\n";
1800
1801 // m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line);
1802
1803 notecardData.Append(line);
1804 }
1805
1806 return notecardData.ToString();
1801 } 1807 }
1802 1808
1803 return notecardData.ToString(); 1809 return null;
1804 } 1810 }
1805 1811
1806 /// <summary> 1812 /// <summary>
@@ -2373,11 +2379,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2373 return UUID.Zero.ToString(); 2379 return UUID.Zero.ToString();
2374 } 2380 }
2375 } 2381 }
2382 else
2383 {
2384 OSSLError(string.Format("osNpcCreate: Notecard reference '{0}' not found.", notecard));
2385 }
2376 } 2386 }
2377 2387
2378 if (appearance == null)
2379 return new LSL_Key(UUID.Zero.ToString());
2380
2381 UUID ownerID = UUID.Zero; 2388 UUID ownerID = UUID.Zero;
2382 if (owned) 2389 if (owned)
2383 ownerID = m_host.OwnerID; 2390 ownerID = m_host.OwnerID;
@@ -2446,6 +2453,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2446 return; 2453 return;
2447 2454
2448 string appearanceSerialized = LoadNotecard(notecard); 2455 string appearanceSerialized = LoadNotecard(notecard);
2456
2457 if (appearanceSerialized == null)
2458 OSSLError(string.Format("osNpcCreate: Notecard reference '{0}' not found.", notecard));
2459
2449 OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); 2460 OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
2450// OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); 2461// OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized);
2451// Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); 2462// Console.WriteLine("appearanceSerialized {0}", appearanceSerialized);
@@ -3691,5 +3702,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3691 3702
3692 DropAttachmentAt(false, pos, rot); 3703 DropAttachmentAt(false, pos, rot);
3693 } 3704 }
3705
3706 public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield)
3707 {
3708 CheckThreatLevel(ThreatLevel.Low, "osListenRegex");
3709 m_host.AddScriptLPS(1);
3710 UUID keyID;
3711 UUID.TryParse(ID, out keyID);
3712
3713 // if we want the name to be used as a regular expression, ensure it is valid first.
3714 if ((regexBitfield & ScriptBaseClass.OS_LISTEN_REGEX_NAME) == ScriptBaseClass.OS_LISTEN_REGEX_NAME)
3715 {
3716 try
3717 {
3718 Regex.IsMatch("", name);
3719 }
3720 catch (Exception)
3721 {
3722 OSSLShoutError("Name regex is invalid.");
3723 return -1;
3724 }
3725 }
3726
3727 // if we want the msg to be used as a regular expression, ensure it is valid first.
3728 if ((regexBitfield & ScriptBaseClass.OS_LISTEN_REGEX_MESSAGE) == ScriptBaseClass.OS_LISTEN_REGEX_MESSAGE)
3729 {
3730 try
3731 {
3732 Regex.IsMatch("", msg);
3733 }
3734 catch (Exception)
3735 {
3736 OSSLShoutError("Message regex is invalid.");
3737 return -1;
3738 }
3739 }
3740
3741 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
3742 return (wComm == null) ? -1 : wComm.Listen(
3743 m_host.LocalId,
3744 m_item.ItemID,
3745 m_host.UUID,
3746 channelID,
3747 name,
3748 keyID,
3749 msg,
3750 regexBitfield
3751 );
3752 }
3753
3754 public LSL_Integer osRegexIsMatch(string input, string pattern)
3755 {
3756 CheckThreatLevel(ThreatLevel.Low, "osRegexIsMatch");
3757 m_host.AddScriptLPS(1);
3758 try
3759 {
3760 return Regex.IsMatch(input, pattern) ? 1 : 0;
3761 }
3762 catch (Exception)
3763 {
3764 OSSLShoutError("Possible invalid regular expression detected.");
3765 return 0;
3766 }
3767 }
3694 } 3768 }
3695} 3769}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index b1fbed5..c447d1f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -418,5 +418,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
418 /// <param name="pos"></param> 418 /// <param name="pos"></param>
419 /// <param name="rot"></param> 419 /// <param name="rot"></param>
420 void osForceDropAttachmentAt(vector pos, rotation rot); 420 void osForceDropAttachmentAt(vector pos, rotation rot);
421
422 /// <summary>
423 /// Identical to llListen except for a bitfield which indicates which
424 /// string parameters should be parsed as regex patterns.
425 /// </summary>
426 /// <param name="channelID"></param>
427 /// <param name="name"></param>
428 /// <param name="ID"></param>
429 /// <param name="msg"></param>
430 /// <param name="regexBitfield">
431 /// OS_LISTEN_REGEX_NAME
432 /// OS_LISTEN_REGEX_MESSAGE
433 /// </param>
434 /// <returns></returns>
435 LSL_Integer osListenRegex(int channelID, string name, string ID,
436 string msg, int regexBitfield);
437
438 /// <summary>
439 /// Wraps to bool Regex.IsMatch(string input, string pattern)
440 /// </summary>
441 /// <param name="input">string to test for match</param>
442 /// <param name="regex">string to use as pattern</param>
443 /// <returns>boolean</returns>
444 LSL_Integer osRegexIsMatch(string input, string pattern);
421 } 445 }
422} 446}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index bf66eb6..0dd5a57 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -741,5 +741,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
741 public const int KFM_CMD_PLAY = 0; 741 public const int KFM_CMD_PLAY = 0;
742 public const int KFM_CMD_STOP = 1; 742 public const int KFM_CMD_STOP = 1;
743 public const int KFM_CMD_PAUSE = 2; 743 public const int KFM_CMD_PAUSE = 2;
744
745 /// <summary>
746 /// process name parameter as regex
747 /// </summary>
748 public const int OS_LISTEN_REGEX_NAME = 0x1;
749
750 /// <summary>
751 /// process message parameter as regex
752 /// </summary>
753 public const int OS_LISTEN_REGEX_MESSAGE = 0x2;
744 } 754 }
745} 755}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index dee1b28..afa9ae0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -992,5 +992,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
992 { 992 {
993 m_OSSL_Functions.osForceDropAttachmentAt(pos, rot); 993 m_OSSL_Functions.osForceDropAttachmentAt(pos, rot);
994 } 994 }
995
996 public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield)
997 {
998 return m_OSSL_Functions.osListenRegex(channelID, name, ID, msg, regexBitfield);
999 }
1000
1001 public LSL_Integer osRegexIsMatch(string input, string pattern)
1002 {
1003 return m_OSSL_Functions.osRegexIsMatch(input, pattern);
1004 }
995 } 1005 }
996} 1006}
diff --git a/OpenSim/Region/ScriptEngine/Shared/ScriptException.cs b/OpenSim/Region/ScriptEngine/Shared/ScriptException.cs
new file mode 100644
index 0000000..ae67fc5
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/ScriptException.cs
@@ -0,0 +1,40 @@
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 OpenSimulator 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 System;
29
30namespace OpenSim.Region.ScriptEngine.Shared
31{
32 public class ScriptException : Exception
33 {
34 public ScriptException() : base() {}
35
36 public ScriptException(string message) : base(message) {}
37
38 public ScriptException(string message, Exception innerException) : base(message, innerException) {}
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
index c8718d9..c401794 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -75,76 +75,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
75 m_engine.AddRegion(m_scene); 75 m_engine.AddRegion(m_scene);
76 } 76 }
77 77
78 /// <summary>
79 /// Test creation of an NPC where the appearance data comes from a notecard
80 /// </summary>
81 [Test]
82 public void TestOsNpcCreateUsingAppearanceFromNotecard()
83 {
84 TestHelpers.InMethod();
85// log4net.Config.XmlConfigurator.Configure();
86
87 // Store an avatar with a different height from default in a notecard.
88 UUID userId = TestHelpers.ParseTail(0x1);
89 float newHeight = 1.9f;
90
91 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
92 sp.Appearance.AvatarHeight = newHeight;
93 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
94 SceneObjectPart part = so.RootPart;
95 m_scene.AddSceneObject(so);
96
97 OSSL_Api osslApi = new OSSL_Api();
98 osslApi.Initialize(m_engine, part, null);
99
100 string notecardName = "appearanceNc";
101 osslApi.osOwnerSaveAppearance(notecardName);
102
103 // Try creating a bot using the appearance in the notecard.
104 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName);
105 Assert.That(npcRaw, Is.Not.Null);
106
107 UUID npcId = new UUID(npcRaw);
108 ScenePresence npc = m_scene.GetScenePresence(npcId);
109 Assert.That(npc, Is.Not.Null);
110 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
111 }
112
113 /// <summary>
114 /// Test creation of an NPC where the appearance data comes from an avatar already in the region.
115 /// </summary>
116 [Test]
117 public void TestOsNpcCreateUsingAppearanceFromAvatar()
118 {
119 TestHelpers.InMethod();
120// TestHelpers.EnableLogging();
121
122 // Store an avatar with a different height from default in a notecard.
123 UUID userId = TestHelpers.ParseTail(0x1);
124 float newHeight = 1.9f;
125
126 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
127 sp.Appearance.AvatarHeight = newHeight;
128 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
129 SceneObjectPart part = so.RootPart;
130 m_scene.AddSceneObject(so);
131
132 OSSL_Api osslApi = new OSSL_Api();
133 osslApi.Initialize(m_engine, part, null);
134
135 string notecardName = "appearanceNc";
136 osslApi.osOwnerSaveAppearance(notecardName);
137
138 // Try creating a bot using the existing avatar's appearance
139 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), sp.UUID.ToString());
140 Assert.That(npcRaw, Is.Not.Null);
141
142 UUID npcId = new UUID(npcRaw);
143 ScenePresence npc = m_scene.GetScenePresence(npcId);
144 Assert.That(npc, Is.Not.Null);
145 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
146 }
147
148 [Test] 78 [Test]
149 public void TestOsOwnerSaveAppearance() 79 public void TestOsOwnerSaveAppearance()
150 { 80 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index 25679a6..b49bcc2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -36,6 +36,7 @@ using OpenMetaverse;
36using OpenMetaverse.Assets; 36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Avatar.Attachments;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory; 40using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.OptionalModules.World.NPC; 41using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
@@ -71,7 +72,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
71 config.Set("Enabled", "true"); 72 config.Set("Enabled", "true");
72 73
73 m_scene = new SceneHelpers().SetupScene(); 74 m_scene = new SceneHelpers().SetupScene();
74 SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); 75 SceneHelpers.SetupSceneModules(
76 m_scene, initConfigSource, new AvatarFactoryModule(), new AttachmentsModule(), new NPCModule());
75 77
76 m_engine = new XEngine.XEngine(); 78 m_engine = new XEngine.XEngine();
77 m_engine.Initialise(initConfigSource); 79 m_engine.Initialise(initConfigSource);
@@ -79,13 +81,191 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
79 } 81 }
80 82
81 /// <summary> 83 /// <summary>
84 /// Test creation of an NPC where the appearance data comes from a notecard
85 /// </summary>
86 [Test]
87 public void TestOsNpcCreateUsingAppearanceFromNotecard()
88 {
89 TestHelpers.InMethod();
90
91 // Store an avatar with a different height from default in a notecard.
92 UUID userId = TestHelpers.ParseTail(0x1);
93 float newHeight = 1.9f;
94
95 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
96 sp.Appearance.AvatarHeight = newHeight;
97 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
98 SceneObjectPart part = so.RootPart;
99 m_scene.AddSceneObject(so);
100
101 OSSL_Api osslApi = new OSSL_Api();
102 osslApi.Initialize(m_engine, part, null);
103
104 string notecardName = "appearanceNc";
105 osslApi.osOwnerSaveAppearance(notecardName);
106
107 // Try creating a bot using the appearance in the notecard.
108 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName);
109 Assert.That(npcRaw, Is.Not.Null);
110
111 UUID npcId = new UUID(npcRaw);
112 ScenePresence npc = m_scene.GetScenePresence(npcId);
113 Assert.That(npc, Is.Not.Null);
114 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
115 }
116
117 [Test]
118 public void TestOsNpcCreateNotExistingNotecard()
119 {
120 TestHelpers.InMethod();
121
122 UUID userId = TestHelpers.ParseTail(0x1);
123
124 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
125 m_scene.AddSceneObject(so);
126
127 OSSL_Api osslApi = new OSSL_Api();
128 osslApi.Initialize(m_engine, so.RootPart, null);
129
130 string npcRaw;
131 bool gotExpectedException = false;
132 try
133 {
134 npcRaw
135 = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name");
136 }
137 catch (ScriptException)
138 {
139 gotExpectedException = true;
140 }
141
142 Assert.That(gotExpectedException, Is.True);
143 }
144
145 /// <summary>
146 /// Test creation of an NPC where the appearance data comes from an avatar already in the region.
147 /// </summary>
148 [Test]
149 public void TestOsNpcCreateUsingAppearanceFromAvatar()
150 {
151 TestHelpers.InMethod();
152// TestHelpers.EnableLogging();
153
154 // Store an avatar with a different height from default in a notecard.
155 UUID userId = TestHelpers.ParseTail(0x1);
156 float newHeight = 1.9f;
157
158 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
159 sp.Appearance.AvatarHeight = newHeight;
160 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
161 SceneObjectPart part = so.RootPart;
162 m_scene.AddSceneObject(so);
163
164 OSSL_Api osslApi = new OSSL_Api();
165 osslApi.Initialize(m_engine, part, null);
166
167 string notecardName = "appearanceNc";
168 osslApi.osOwnerSaveAppearance(notecardName);
169
170 // Try creating a bot using the existing avatar's appearance
171 string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), sp.UUID.ToString());
172 Assert.That(npcRaw, Is.Not.Null);
173
174 UUID npcId = new UUID(npcRaw);
175 ScenePresence npc = m_scene.GetScenePresence(npcId);
176 Assert.That(npc, Is.Not.Null);
177 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
178 }
179
180 [Test]
181 public void TestOsNpcLoadAppearance()
182 {
183 TestHelpers.InMethod();
184
185 // Store an avatar with a different height from default in a notecard.
186 UUID userId = TestHelpers.ParseTail(0x1);
187 float firstHeight = 1.9f;
188 float secondHeight = 2.1f;
189 string firstAppearanceNcName = "appearanceNc1";
190 string secondAppearanceNcName = "appearanceNc2";
191
192 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
193 sp.Appearance.AvatarHeight = firstHeight;
194 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
195 SceneObjectPart part = so.RootPart;
196 m_scene.AddSceneObject(so);
197
198 OSSL_Api osslApi = new OSSL_Api();
199 osslApi.Initialize(m_engine, part, null);
200
201 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
202
203 string npcRaw
204 = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName);
205
206 // Create a second appearance notecard with a different height
207 sp.Appearance.AvatarHeight = secondHeight;
208 osslApi.osOwnerSaveAppearance(secondAppearanceNcName);
209
210 osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName);
211
212 UUID npcId = new UUID(npcRaw);
213 ScenePresence npc = m_scene.GetScenePresence(npcId);
214 Assert.That(npc, Is.Not.Null);
215 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(secondHeight));
216 }
217
218 [Test]
219 public void TestOsNpcLoadAppearanceNotExistingNotecard()
220 {
221 TestHelpers.InMethod();
222
223 // Store an avatar with a different height from default in a notecard.
224 UUID userId = TestHelpers.ParseTail(0x1);
225 float firstHeight = 1.9f;
226 float secondHeight = 2.1f;
227 string firstAppearanceNcName = "appearanceNc1";
228 string secondAppearanceNcName = "appearanceNc2";
229
230 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
231 sp.Appearance.AvatarHeight = firstHeight;
232 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
233 SceneObjectPart part = so.RootPart;
234 m_scene.AddSceneObject(so);
235
236 OSSL_Api osslApi = new OSSL_Api();
237 osslApi.Initialize(m_engine, part, null);
238
239 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
240
241 string npcRaw
242 = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName);
243
244 bool gotExpectedException = false;
245 try
246 {
247 osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName);
248 }
249 catch (ScriptException)
250 {
251 gotExpectedException = true;
252 }
253
254 Assert.That(gotExpectedException, Is.True);
255
256 UUID npcId = new UUID(npcRaw);
257 ScenePresence npc = m_scene.GetScenePresence(npcId);
258 Assert.That(npc, Is.Not.Null);
259 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(firstHeight));
260 }
261
262 /// <summary>
82 /// Test removal of an owned NPC. 263 /// Test removal of an owned NPC.
83 /// </summary> 264 /// </summary>
84 [Test] 265 [Test]
85 public void TestOsNpcRemoveOwned() 266 public void TestOsNpcRemoveOwned()
86 { 267 {
87 TestHelpers.InMethod(); 268 TestHelpers.InMethod();
88// log4net.Config.XmlConfigurator.Configure();
89 269
90 // Store an avatar with a different height from default in a notecard. 270 // Store an avatar with a different height from default in a notecard.
91 UUID userId = TestHelpers.ParseTail(0x1); 271 UUID userId = TestHelpers.ParseTail(0x1);
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index 46b0c67..4123f49 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -141,6 +141,9 @@ namespace OpenSim.Server.Handlers.Asset
141 } 141 }
142 142
143 string fileName = rawAssetId; 143 string fileName = rawAssetId;
144
145 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, fileName))
146 return;
144 147
145 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) 148 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
146 { 149 {
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 87ca944..ebdfb4f 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -531,13 +531,9 @@ namespace OpenSim.Tests.Common.Mock
531 { 531 {
532 } 532 }
533 533
534 public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, 534 public virtual void SendChatMessage(
535 UUID fromAgentID, byte source, byte audible) 535 string message, byte type, Vector3 fromPos, string fromName,
536 { 536 UUID fromAgentID, UUID ownerID, byte source, byte audible)
537 }
538
539 public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName,
540 UUID fromAgentID, byte source, byte audible)
541 { 537 {
542 } 538 }
543 539
diff --git a/bin/assets/CollisionSoundsAssetSet/CollisionSoundsAssetSet.xml b/bin/assets/CollisionSoundsAssetSet/CollisionSoundsAssetSet.xml
index 7498ae0..b570c55 100644
--- a/bin/assets/CollisionSoundsAssetSet/CollisionSoundsAssetSet.xml
+++ b/bin/assets/CollisionSoundsAssetSet/CollisionSoundsAssetSet.xml
@@ -303,37 +303,37 @@
303 <Key Name="fileName" Value="snd_TerrainStone.ogg" /> 303 <Key Name="fileName" Value="snd_TerrainStone.ogg" />
304 </Section> 304 </Section>
305 <Section Name="snd_TerrainMetal"> 305 <Section Name="snd_TerrainMetal">
306 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807200c9a66" /> 306 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807201c9a66" />
307 <Key Name="name" Value="snd_TerrainMetal" /> 307 <Key Name="name" Value="snd_TerrainMetal" />
308 <Key Name="assetType" Value="1" /> 308 <Key Name="assetType" Value="1" />
309 <Key Name="fileName" Value="snd_TerrainMetal.ogg" /> 309 <Key Name="fileName" Value="snd_TerrainMetal.ogg" />
310 </Section> 310 </Section>
311 <Section Name="snd_TerrainGlass"> 311 <Section Name="snd_TerrainGlass">
312 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807200c9a66" /> 312 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807202c9a66" />
313 <Key Name="name" Value="snd_TerrainGlass" /> 313 <Key Name="name" Value="snd_TerrainGlass" />
314 <Key Name="assetType" Value="1" /> 314 <Key Name="assetType" Value="1" />
315 <Key Name="fileName" Value="snd_TerrainGlass.ogg" /> 315 <Key Name="fileName" Value="snd_TerrainGlass.ogg" />
316 </Section> 316 </Section>
317 <Section Name="snd_TerrainWood"> 317 <Section Name="snd_TerrainWood">
318 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807200c9a66" /> 318 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807203c9a66" />
319 <Key Name="name" Value="snd_TerrainWood" /> 319 <Key Name="name" Value="snd_TerrainWood" />
320 <Key Name="assetType" Value="1" /> 320 <Key Name="assetType" Value="1" />
321 <Key Name="fileName" Value="snd_TerrainWood.ogg" /> 321 <Key Name="fileName" Value="snd_TerrainWood.ogg" />
322 </Section> 322 </Section>
323 <Section Name="snd_TerrainFlesh"> 323 <Section Name="snd_TerrainFlesh">
324 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807200c9a66" /> 324 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807204c9a66" />
325 <Key Name="name" Value="snd_TerrainFlesh" /> 325 <Key Name="name" Value="snd_TerrainFlesh" />
326 <Key Name="assetType" Value="1" /> 326 <Key Name="assetType" Value="1" />
327 <Key Name="fileName" Value="snd_TerrainFlesh.ogg" /> 327 <Key Name="fileName" Value="snd_TerrainFlesh.ogg" />
328 </Section> 328 </Section>
329 <Section Name="snd_TerrainPlastic"> 329 <Section Name="snd_TerrainPlastic">
330 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807200c9a66" /> 330 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807205c9a66" />
331 <Key Name="name" Value="snd_TerrainPlastic" /> 331 <Key Name="name" Value="snd_TerrainPlastic" />
332 <Key Name="assetType" Value="1" /> 332 <Key Name="assetType" Value="1" />
333 <Key Name="fileName" Value="snd_TerrainPlastic.ogg" /> 333 <Key Name="fileName" Value="snd_TerrainPlastic.ogg" />
334 </Section> 334 </Section>
335 <Section Name="snd_TerrainRubber"> 335 <Section Name="snd_TerrainRubber">
336 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807200c9a66" /> 336 <Key Name="assetID" Value="be7295c0-a158-11e1-b3dd-0807206c9a66" />
337 <Key Name="name" Value="snd_TerrainRubber" /> 337 <Key Name="name" Value="snd_TerrainRubber" />
338 <Key Name="assetType" Value="1" /> 338 <Key Name="assetType" Value="1" />
339 <Key Name="fileName" Value="snd_TerrainRubber.ogg" /> 339 <Key Name="fileName" Value="snd_TerrainRubber.ogg" />
diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll
index f976efe..fbc83e6 100755
--- a/bin/lib32/BulletSim.dll
+++ b/bin/lib32/BulletSim.dll
Binary files differ
diff --git a/bin/lib32/libBulletSim.so b/bin/lib32/libBulletSim.so
index a00bc3a..65d3805 100755
--- a/bin/lib32/libBulletSim.so
+++ b/bin/lib32/libBulletSim.so
Binary files differ
diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll
index acaa9c8..936368a 100755
--- a/bin/lib64/BulletSim.dll
+++ b/bin/lib64/BulletSim.dll
Binary files differ
diff --git a/bin/lib64/libBulletSim.so b/bin/lib64/libBulletSim.so
index 996ea21..82fbad6 100755
--- a/bin/lib64/libBulletSim.so
+++ b/bin/lib64/libBulletSim.so
Binary files differ