diff options
-rw-r--r-- | CONTRIBUTORS.txt | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Console/LocalConsole.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs | 286 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 164 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | 55 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 6 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 40 | ||||
-rw-r--r-- | prebuild.xml | 1 |
14 files changed, 474 insertions, 136 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index fa79ea7..1d080ff 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -134,6 +134,7 @@ what it is today. | |||
134 | * Micheil Merlin | 134 | * Micheil Merlin |
135 | * Mike Osias (IBM) | 135 | * Mike Osias (IBM) |
136 | * Mike Pitman (IBM) | 136 | * Mike Pitman (IBM) |
137 | * mikemig | ||
137 | * mikkopa/_someone - RealXtend | 138 | * mikkopa/_someone - RealXtend |
138 | * Misterblue | 139 | * Misterblue |
139 | * Mircea Kitsune | 140 | * Mircea Kitsune |
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index a967db6..260a86f 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs | |||
@@ -46,6 +46,11 @@ namespace OpenSim.Framework.Console | |||
46 | // private readonly object m_syncRoot = new object(); | 46 | // private readonly object m_syncRoot = new object(); |
47 | private const string LOGLEVEL_NONE = "(none)"; | 47 | private const string LOGLEVEL_NONE = "(none)"; |
48 | 48 | ||
49 | // Used to extract categories for colourization. | ||
50 | private Regex m_categoryRegex | ||
51 | = new Regex( | ||
52 | @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)", RegexOptions.Singleline | RegexOptions.Compiled); | ||
53 | |||
49 | private int m_cursorYPosition = -1; | 54 | private int m_cursorYPosition = -1; |
50 | private int m_cursorXPosition = 0; | 55 | private int m_cursorXPosition = 0; |
51 | private StringBuilder m_commandLine = new StringBuilder(); | 56 | private StringBuilder m_commandLine = new StringBuilder(); |
@@ -280,11 +285,8 @@ namespace OpenSim.Framework.Console | |||
280 | string outText = text; | 285 | string outText = text; |
281 | 286 | ||
282 | if (level != LOGLEVEL_NONE) | 287 | if (level != LOGLEVEL_NONE) |
283 | { | 288 | { |
284 | string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)"; | 289 | MatchCollection matches = m_categoryRegex.Matches(text); |
285 | |||
286 | Regex RE = new Regex(regex, RegexOptions.Multiline); | ||
287 | MatchCollection matches = RE.Matches(text); | ||
288 | 290 | ||
289 | if (matches.Count == 1) | 291 | if (matches.Count == 1) |
290 | { | 292 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs new file mode 100644 index 0000000..7b8c418 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs | |||
@@ -0,0 +1,286 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using log4net.Config; | ||
31 | using Nini.Config; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Region.CoreModules.Avatar.Chat; | ||
38 | using OpenSim.Region.CoreModules.Framework; | ||
39 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
40 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Services.Interfaces; | ||
43 | using OpenSim.Tests.Common; | ||
44 | using OpenSim.Tests.Common.Mock; | ||
45 | |||
46 | namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests | ||
47 | { | ||
48 | [TestFixture] | ||
49 | public class ChatModuleTests : OpenSimTestCase | ||
50 | { | ||
51 | [TestFixtureSetUp] | ||
52 | public void FixtureInit() | ||
53 | { | ||
54 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
55 | // We must do this here so that child agent positions are updated in a predictable manner. | ||
56 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
57 | } | ||
58 | |||
59 | [TestFixtureTearDown] | ||
60 | public void TearDown() | ||
61 | { | ||
62 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
63 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
64 | // tests really shouldn't). | ||
65 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
66 | } | ||
67 | |||
68 | private void SetupNeighbourRegions(TestScene sceneA, TestScene sceneB) | ||
69 | { | ||
70 | // XXX: HTTP server is not (and should not be) necessary for this test, though it's absence makes the | ||
71 | // CapabilitiesModule complain when it can't set up HTTP endpoints. | ||
72 | // BaseHttpServer httpServer = new BaseHttpServer(99999); | ||
73 | // MainServer.AddHttpServer(httpServer); | ||
74 | // MainServer.Instance = httpServer; | ||
75 | |||
76 | // We need entity transfer modules so that when sp2 logs into the east region, the region calls | ||
77 | // EntityTransferModuleto set up a child agent on the west region. | ||
78 | // XXX: However, this is not an entity transfer so is misleading. | ||
79 | EntityTransferModule etmA = new EntityTransferModule(); | ||
80 | EntityTransferModule etmB = new EntityTransferModule(); | ||
81 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
82 | |||
83 | IConfigSource config = new IniConfigSource(); | ||
84 | config.AddConfig("Chat"); | ||
85 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
86 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
87 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
88 | |||
89 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
90 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, new ChatModule()); | ||
91 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB, new ChatModule()); | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// Tests chat between neighbour regions on the east-west axis | ||
96 | /// </summary> | ||
97 | /// <remarks> | ||
98 | /// Really, this is a combination of a child agent position update test and a chat range test. These need | ||
99 | /// to be separated later on. | ||
100 | /// </remarks> | ||
101 | [Test] | ||
102 | public void TestInterRegionChatDistanceEastWest() | ||
103 | { | ||
104 | TestHelpers.InMethod(); | ||
105 | // TestHelpers.EnableLogging(); | ||
106 | |||
107 | UUID sp1Uuid = TestHelpers.ParseTail(0x11); | ||
108 | UUID sp2Uuid = TestHelpers.ParseTail(0x12); | ||
109 | |||
110 | Vector3 sp1Position = new Vector3(6, 128, 20); | ||
111 | Vector3 sp2Position = new Vector3(250, 128, 20); | ||
112 | |||
113 | SceneHelpers sh = new SceneHelpers(); | ||
114 | TestScene sceneWest = sh.SetupScene("sceneWest", TestHelpers.ParseTail(0x1), 1000, 1000); | ||
115 | TestScene sceneEast = sh.SetupScene("sceneEast", TestHelpers.ParseTail(0x2), 1001, 1000); | ||
116 | |||
117 | SetupNeighbourRegions(sceneWest, sceneEast); | ||
118 | |||
119 | ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneEast, sp1Uuid); | ||
120 | TestClient sp1Client = (TestClient)sp1.ControllingClient; | ||
121 | |||
122 | // If we don't set agents to flying, test will go wrong as they instantly fall to z = 0. | ||
123 | // TODO: May need to create special complete no-op test physics module rather than basic physics, since | ||
124 | // physics is irrelevant to this test. | ||
125 | sp1.Flying = true; | ||
126 | |||
127 | // When sp1 logs in to sceneEast, it sets up a child agent in sceneWest and informs the sp2 client to | ||
128 | // make the connection. For this test, will simplify this chain by making the connection directly. | ||
129 | ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneWest, sp1Uuid); | ||
130 | TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient; | ||
131 | |||
132 | sp1.AbsolutePosition = sp1Position; | ||
133 | |||
134 | ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneWest, sp2Uuid); | ||
135 | TestClient sp2Client = (TestClient)sp2.ControllingClient; | ||
136 | sp2.Flying = true; | ||
137 | |||
138 | ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneEast, sp2Uuid); | ||
139 | TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient; | ||
140 | |||
141 | sp2.AbsolutePosition = sp2Position; | ||
142 | |||
143 | // We must update the scenes in order to make the root new root agents trigger position updates in their | ||
144 | // children. | ||
145 | sceneWest.Update(1); | ||
146 | sceneEast.Update(1); | ||
147 | |||
148 | // Check child positions are correct. | ||
149 | Assert.AreEqual( | ||
150 | new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z), | ||
151 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
152 | |||
153 | Assert.AreEqual( | ||
154 | new Vector3(sp2Position.X - sceneWest.RegionInfo.RegionSizeX, sp2Position.Y, sp2Position.Z), | ||
155 | sp2ChildClient.SceneAgent.AbsolutePosition); | ||
156 | |||
157 | string receivedSp1ChatMessage = ""; | ||
158 | string receivedSp2ChatMessage = ""; | ||
159 | |||
160 | sp1ChildClient.OnReceivedChatMessage | ||
161 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message; | ||
162 | sp2ChildClient.OnReceivedChatMessage | ||
163 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message; | ||
164 | |||
165 | TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage); | ||
166 | TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage); | ||
167 | |||
168 | sp1Position = new Vector3(30, 128, 20); | ||
169 | sp1.AbsolutePosition = sp1Position; | ||
170 | sceneEast.Update(1); | ||
171 | |||
172 | // Check child position is correct. | ||
173 | Assert.AreEqual( | ||
174 | new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z), | ||
175 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
176 | |||
177 | TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage); | ||
178 | TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage); | ||
179 | } | ||
180 | |||
181 | /// <summary> | ||
182 | /// Tests chat between neighbour regions on the north-south axis | ||
183 | /// </summary> | ||
184 | /// <remarks> | ||
185 | /// Really, this is a combination of a child agent position update test and a chat range test. These need | ||
186 | /// to be separated later on. | ||
187 | /// </remarks> | ||
188 | [Test] | ||
189 | public void TestInterRegionChatDistanceNorthSouth() | ||
190 | { | ||
191 | TestHelpers.InMethod(); | ||
192 | // TestHelpers.EnableLogging(); | ||
193 | |||
194 | UUID sp1Uuid = TestHelpers.ParseTail(0x11); | ||
195 | UUID sp2Uuid = TestHelpers.ParseTail(0x12); | ||
196 | |||
197 | Vector3 sp1Position = new Vector3(128, 250, 20); | ||
198 | Vector3 sp2Position = new Vector3(128, 6, 20); | ||
199 | |||
200 | SceneHelpers sh = new SceneHelpers(); | ||
201 | TestScene sceneNorth = sh.SetupScene("sceneNorth", TestHelpers.ParseTail(0x1), 1000, 1000); | ||
202 | TestScene sceneSouth = sh.SetupScene("sceneSouth", TestHelpers.ParseTail(0x2), 1000, 1001); | ||
203 | |||
204 | SetupNeighbourRegions(sceneNorth, sceneSouth); | ||
205 | |||
206 | ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneNorth, sp1Uuid); | ||
207 | TestClient sp1Client = (TestClient)sp1.ControllingClient; | ||
208 | |||
209 | // If we don't set agents to flying, test will go wrong as they instantly fall to z = 0. | ||
210 | // TODO: May need to create special complete no-op test physics module rather than basic physics, since | ||
211 | // physics is irrelevant to this test. | ||
212 | sp1.Flying = true; | ||
213 | |||
214 | // When sp1 logs in to sceneEast, it sets up a child agent in sceneNorth and informs the sp2 client to | ||
215 | // make the connection. For this test, will simplify this chain by making the connection directly. | ||
216 | ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneSouth, sp1Uuid); | ||
217 | TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient; | ||
218 | |||
219 | sp1.AbsolutePosition = sp1Position; | ||
220 | |||
221 | ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneSouth, sp2Uuid); | ||
222 | TestClient sp2Client = (TestClient)sp2.ControllingClient; | ||
223 | sp2.Flying = true; | ||
224 | |||
225 | ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneNorth, sp2Uuid); | ||
226 | TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient; | ||
227 | |||
228 | sp2.AbsolutePosition = sp2Position; | ||
229 | |||
230 | // We must update the scenes in order to make the root new root agents trigger position updates in their | ||
231 | // children. | ||
232 | sceneNorth.Update(1); | ||
233 | sceneSouth.Update(1); | ||
234 | |||
235 | // Check child positions are correct. | ||
236 | Assert.AreEqual( | ||
237 | new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z), | ||
238 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
239 | |||
240 | Assert.AreEqual( | ||
241 | new Vector3(sp2Position.X, sp2Position.Y + sceneSouth.RegionInfo.RegionSizeY, sp2Position.Z), | ||
242 | sp2ChildClient.SceneAgent.AbsolutePosition); | ||
243 | |||
244 | string receivedSp1ChatMessage = ""; | ||
245 | string receivedSp2ChatMessage = ""; | ||
246 | |||
247 | sp1ChildClient.OnReceivedChatMessage | ||
248 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message; | ||
249 | sp2ChildClient.OnReceivedChatMessage | ||
250 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message; | ||
251 | |||
252 | TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage); | ||
253 | TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage); | ||
254 | |||
255 | sp1Position = new Vector3(30, 128, 20); | ||
256 | sp1.AbsolutePosition = sp1Position; | ||
257 | sceneNorth.Update(1); | ||
258 | |||
259 | // Check child position is correct. | ||
260 | Assert.AreEqual( | ||
261 | new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z), | ||
262 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
263 | |||
264 | TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage); | ||
265 | TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage); | ||
266 | } | ||
267 | |||
268 | private void TestUserInRange(TestClient speakClient, string testMessage, ref string receivedMessage) | ||
269 | { | ||
270 | receivedMessage = ""; | ||
271 | |||
272 | speakClient.Chat(0, ChatTypeEnum.Say, testMessage); | ||
273 | |||
274 | Assert.AreEqual(testMessage, receivedMessage); | ||
275 | } | ||
276 | |||
277 | private void TestUserOutOfRange(TestClient speakClient, string testMessage, ref string receivedMessage) | ||
278 | { | ||
279 | receivedMessage = ""; | ||
280 | |||
281 | speakClient.Chat(0, ChatTypeEnum.Say, testMessage); | ||
282 | |||
283 | Assert.AreNotEqual(testMessage, receivedMessage); | ||
284 | } | ||
285 | } | ||
286 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 7aa7123..2462ff8 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -428,7 +428,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
428 | /// <summary> | 428 | /// <summary> |
429 | /// delegate for sending a grid instant message asynchronously | 429 | /// delegate for sending a grid instant message asynchronously |
430 | /// </summary> | 430 | /// </summary> |
431 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID); | 431 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); |
432 | 432 | ||
433 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) | 433 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) |
434 | { | 434 | { |
@@ -442,138 +442,87 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
442 | { | 442 | { |
443 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; | 443 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; |
444 | 444 | ||
445 | d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d); | 445 | d.BeginInvoke(im, result, GridInstantMessageCompleted, d); |
446 | } | 446 | } |
447 | 447 | ||
448 | /// <summary> | 448 | /// <summary> |
449 | /// Recursive SendGridInstantMessage over XMLRPC method. | 449 | /// Internal SendGridInstantMessage over XMLRPC method. |
450 | /// This is called from within a dedicated thread. | ||
451 | /// The first time this is called, prevRegionHandle will be 0 Subsequent times this is called from | ||
452 | /// itself, prevRegionHandle will be the last region handle that we tried to send. | ||
453 | /// If the handles are the same, we look up the user's location using the grid. | ||
454 | /// If the handles are still the same, we end. The send failed. | ||
455 | /// </summary> | 450 | /// </summary> |
456 | /// <param name="prevRegionHandle"> | 451 | /// <remarks> |
457 | /// Pass in 0 the first time this method is called. It will be called recursively with the last | 452 | /// This is called from within a dedicated thread. |
458 | /// regionhandle tried | 453 | /// </remarks> |
459 | /// </param> | 454 | private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result) |
460 | protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | ||
461 | { | 455 | { |
462 | UUID toAgentID = new UUID(im.toAgentID); | 456 | UUID toAgentID = new UUID(im.toAgentID); |
463 | 457 | UUID regionID; | |
464 | PresenceInfo upd = null; | 458 | bool needToLookupAgent; |
465 | |||
466 | bool lookupAgent = false; | ||
467 | 459 | ||
468 | lock (m_UserRegionMap) | 460 | lock (m_UserRegionMap) |
461 | needToLookupAgent = !m_UserRegionMap.TryGetValue(toAgentID, out regionID); | ||
462 | |||
463 | while (true) | ||
469 | { | 464 | { |
470 | if (m_UserRegionMap.ContainsKey(toAgentID)) | 465 | if (needToLookupAgent) |
471 | { | 466 | { |
472 | upd = new PresenceInfo(); | 467 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); |
473 | upd.RegionID = m_UserRegionMap[toAgentID]; | ||
474 | 468 | ||
475 | // We need to compare the current regionhandle with the previous region handle | 469 | UUID foundRegionID = UUID.Zero; |
476 | // or the recursive loop will never end because it will never try to lookup the agent again | ||
477 | if (prevRegionID == upd.RegionID) | ||
478 | { | ||
479 | lookupAgent = true; | ||
480 | } | ||
481 | } | ||
482 | else | ||
483 | { | ||
484 | lookupAgent = true; | ||
485 | } | ||
486 | } | ||
487 | |||
488 | 470 | ||
489 | // Are we needing to look-up an agent? | 471 | if (presences != null) |
490 | if (lookupAgent) | ||
491 | { | ||
492 | // Non-cached user agent lookup. | ||
493 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); | ||
494 | if (presences != null && presences.Length > 0) | ||
495 | { | ||
496 | foreach (PresenceInfo p in presences) | ||
497 | { | 472 | { |
498 | if (p.RegionID != UUID.Zero) | 473 | foreach (PresenceInfo p in presences) |
499 | { | 474 | { |
500 | upd = p; | 475 | if (p.RegionID != UUID.Zero) |
501 | break; | 476 | { |
477 | foundRegionID = p.RegionID; | ||
478 | break; | ||
479 | } | ||
502 | } | 480 | } |
503 | } | 481 | } |
504 | } | ||
505 | 482 | ||
506 | if (upd != null) | 483 | // If not found or the found region is the same as the last lookup, then message is undeliverable |
507 | { | 484 | if (foundRegionID == UUID.Zero || foundRegionID == regionID) |
508 | // check if we've tried this before.. | 485 | break; |
509 | // This is one way to end the recursive loop | 486 | else |
510 | // | 487 | regionID = foundRegionID; |
511 | if (upd.RegionID == prevRegionID) | ||
512 | { | ||
513 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | ||
514 | HandleUndeliverableMessage(im, result); | ||
515 | return; | ||
516 | } | ||
517 | } | 488 | } |
518 | else | 489 | |
490 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, regionID); | ||
491 | if (reginfo == null) | ||
519 | { | 492 | { |
520 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | 493 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", regionID); |
521 | HandleUndeliverableMessage(im, result); | 494 | break; |
522 | return; | ||
523 | } | 495 | } |
524 | } | ||
525 | 496 | ||
526 | if (upd != null) | 497 | // Try to send the message to the agent via the retrieved region. |
527 | { | 498 | Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); |
528 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, | 499 | msgdata["region_handle"] = 0; |
529 | upd.RegionID); | 500 | bool imresult = doIMSending(reginfo, msgdata); |
530 | if (reginfo != null) | 501 | |
502 | // If the message delivery was successful, then cache the entry. | ||
503 | if (imresult) | ||
531 | { | 504 | { |
532 | Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); | 505 | lock (m_UserRegionMap) |
533 | // Not actually used anymore, left in for compatibility | ||
534 | // Remove at next interface change | ||
535 | // | ||
536 | msgdata["region_handle"] = 0; | ||
537 | bool imresult = doIMSending(reginfo, msgdata); | ||
538 | if (imresult) | ||
539 | { | ||
540 | // IM delivery successful, so store the Agent's location in our local cache. | ||
541 | lock (m_UserRegionMap) | ||
542 | { | ||
543 | if (m_UserRegionMap.ContainsKey(toAgentID)) | ||
544 | { | ||
545 | m_UserRegionMap[toAgentID] = upd.RegionID; | ||
546 | } | ||
547 | else | ||
548 | { | ||
549 | m_UserRegionMap.Add(toAgentID, upd.RegionID); | ||
550 | } | ||
551 | } | ||
552 | result(true); | ||
553 | } | ||
554 | else | ||
555 | { | 506 | { |
556 | // try again, but lookup user this time. | 507 | m_UserRegionMap[toAgentID] = regionID; |
557 | // Warning, this must call the Async version | ||
558 | // of this method or we'll be making thousands of threads | ||
559 | // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync | ||
560 | // The version that spawns the thread is SendGridInstantMessageViaXMLRPC | ||
561 | |||
562 | // This is recursive!!!!! | ||
563 | SendGridInstantMessageViaXMLRPCAsync(im, result, | ||
564 | upd.RegionID); | ||
565 | } | 508 | } |
509 | result(true); | ||
510 | return; | ||
566 | } | 511 | } |
567 | else | 512 | |
568 | { | 513 | // If we reach this point in the first iteration of the while, then we may have unsuccessfully tried |
569 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); | 514 | // to use a locally cached region ID. All subsequent attempts need to lookup agent details from |
570 | HandleUndeliverableMessage(im, result); | 515 | // the presence service. |
571 | } | 516 | needToLookupAgent = true; |
572 | } | ||
573 | else | ||
574 | { | ||
575 | HandleUndeliverableMessage(im, result); | ||
576 | } | 517 | } |
518 | |||
519 | // If we reached this point then the message was not deliverable. Remove the bad cache entry and | ||
520 | // signal the delivery failure. | ||
521 | lock (m_UserRegionMap) | ||
522 | m_UserRegionMap.Remove(toAgentID); | ||
523 | |||
524 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | ||
525 | HandleUndeliverableMessage(im, result); | ||
577 | } | 526 | } |
578 | 527 | ||
579 | /// <summary> | 528 | /// <summary> |
@@ -584,7 +533,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
584 | /// <returns>Bool if the message was successfully delivered at the other side.</returns> | 533 | /// <returns>Bool if the message was successfully delivered at the other side.</returns> |
585 | protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata) | 534 | protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata) |
586 | { | 535 | { |
587 | |||
588 | ArrayList SendParams = new ArrayList(); | 536 | ArrayList SendParams = new ArrayList(); |
589 | SendParams.Add(xmlrpcdata); | 537 | SendParams.Add(xmlrpcdata); |
590 | XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams); | 538 | XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3b8fbfd..7005c0a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4133,7 +4133,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4133 | /// <returns>true if we handled it.</returns> | 4133 | /// <returns>true if we handled it.</returns> |
4134 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) | 4134 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) |
4135 | { | 4135 | { |
4136 | //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); | 4136 | // m_log.DebugFormat( |
4137 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", | ||
4138 | // cAgentData.AgentID, Name, cAgentData.Position); | ||
4139 | |||
4137 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 4140 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); |
4138 | if (childAgentUpdate != null) | 4141 | if (childAgentUpdate != null) |
4139 | { | 4142 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 398d394..17f54c2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2754,7 +2754,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
2754 | part.AddSittingAvatar(this); | 2754 | part.AddSittingAvatar(this); |
2755 | 2755 | ||
2756 | cameraAtOffset = part.GetCameraAtOffset(); | 2756 | cameraAtOffset = part.GetCameraAtOffset(); |
2757 | |||
2758 | if (!part.IsRoot && cameraAtOffset == Vector3.Zero) | ||
2759 | cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset(); | ||
2760 | |||
2761 | bool cameraEyeOffsetFromRootForChild = false; | ||
2757 | cameraEyeOffset = part.GetCameraEyeOffset(); | 2762 | cameraEyeOffset = part.GetCameraEyeOffset(); |
2763 | |||
2764 | if (!part.IsRoot && cameraEyeOffset == Vector3.Zero) | ||
2765 | { | ||
2766 | cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); | ||
2767 | cameraEyeOffsetFromRootForChild = true; | ||
2768 | } | ||
2769 | |||
2770 | if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero) | ||
2771 | { | ||
2772 | if (!part.IsRoot) | ||
2773 | { | ||
2774 | cameraEyeOffset = cameraEyeOffset * part.RotationOffset; | ||
2775 | cameraAtOffset += part.OffsetPosition; | ||
2776 | } | ||
2777 | |||
2778 | cameraEyeOffset += part.OffsetPosition; | ||
2779 | } | ||
2780 | |||
2781 | // m_log.DebugFormat( | ||
2782 | // "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}", | ||
2783 | // cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name); | ||
2784 | |||
2758 | forceMouselook = part.GetForceMouselook(); | 2785 | forceMouselook = part.GetForceMouselook(); |
2759 | 2786 | ||
2760 | // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is | 2787 | // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 8e40561..f53adcb 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -147,6 +147,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
147 | terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; | 147 | terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; |
148 | 148 | ||
149 | float height = terrainHeight + actor.Size.Z; | 149 | float height = terrainHeight + actor.Size.Z; |
150 | // Console.WriteLine("height {0}, actorPosition {1}", height, actorPosition); | ||
150 | 151 | ||
151 | if (actor.Flying) | 152 | if (actor.Flying) |
152 | { | 153 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5590cd5..7d8821c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6846,12 +6846,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6846 | { | 6846 | { |
6847 | m_host.AddScriptLPS(1); | 6847 | m_host.AddScriptLPS(1); |
6848 | m_host.SetCameraEyeOffset(offset); | 6848 | m_host.SetCameraEyeOffset(offset); |
6849 | |||
6850 | if (m_host.ParentGroup.RootPart.GetCameraEyeOffset() == Vector3.Zero) | ||
6851 | m_host.ParentGroup.RootPart.SetCameraEyeOffset(offset); | ||
6849 | } | 6852 | } |
6850 | 6853 | ||
6851 | public void llSetCameraAtOffset(LSL_Vector offset) | 6854 | public void llSetCameraAtOffset(LSL_Vector offset) |
6852 | { | 6855 | { |
6853 | m_host.AddScriptLPS(1); | 6856 | m_host.AddScriptLPS(1); |
6854 | m_host.SetCameraAtOffset(offset); | 6857 | m_host.SetCameraAtOffset(offset); |
6858 | |||
6859 | if (m_host.ParentGroup.RootPart.GetCameraAtOffset() == Vector3.Zero) | ||
6860 | m_host.ParentGroup.RootPart.SetCameraAtOffset(offset); | ||
6855 | } | 6861 | } |
6856 | 6862 | ||
6857 | public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) | 6863 | public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 6aa717d..8b8e038 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
162 | m_braceCount++; | 162 | m_braceCount++; |
163 | 163 | ||
164 | // line number | 164 | // line number |
165 | m_CSharpLine += 3; | 165 | m_CSharpLine += 9; |
166 | 166 | ||
167 | // here's the payload | 167 | // here's the payload |
168 | retstr += GenerateLine(); | 168 | retstr += GenerateLine(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index b4640ef..1efe798 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -444,7 +444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
444 | // return compileScript; | 444 | // return compileScript; |
445 | // } | 445 | // } |
446 | 446 | ||
447 | private static string CreateCSCompilerScript( | 447 | public static string CreateCSCompilerScript( |
448 | string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) | 448 | string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) |
449 | { | 449 | { |
450 | compileScript = string.Format( | 450 | compileScript = string.Format( |
@@ -472,7 +472,7 @@ namespace SecondLife | |||
472 | return compileScript; | 472 | return compileScript; |
473 | } | 473 | } |
474 | 474 | ||
475 | private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) | 475 | public static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) |
476 | { | 476 | { |
477 | compileScript = String.Empty + | 477 | compileScript = String.Empty + |
478 | "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + | 478 | "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index 05a8756..badf82a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using Microsoft.CSharp; | 31 | using Microsoft.CSharp; |
32 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
34 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
34 | using OpenSim.Tests.Common; | 35 | using OpenSim.Tests.Common; |
35 | 36 | ||
36 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 37 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
@@ -66,9 +67,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
66 | m_CSCodeProvider = new CSharpCodeProvider(); | 67 | m_CSCodeProvider = new CSharpCodeProvider(); |
67 | m_compilerParameters = new CompilerParameters(); | 68 | m_compilerParameters = new CompilerParameters(); |
68 | 69 | ||
69 | string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory), "bin"); | 70 | string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory)); |
70 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); | 71 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); |
71 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); | 72 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); |
73 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); | ||
72 | m_compilerParameters.GenerateExecutable = false; | 74 | m_compilerParameters.GenerateExecutable = false; |
73 | } | 75 | } |
74 | 76 | ||
@@ -90,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
90 | /// Test the C# compiler error message can be mapped to the correct | 92 | /// Test the C# compiler error message can be mapped to the correct |
91 | /// line/column in the LSL source when an undeclared variable is used. | 93 | /// line/column in the LSL source when an undeclared variable is used. |
92 | /// </summary> | 94 | /// </summary> |
93 | //[Test] | 95 | [Test] |
94 | public void TestUseUndeclaredVariable() | 96 | public void TestUseUndeclaredVariable() |
95 | { | 97 | { |
96 | TestHelpers.InMethod(); | 98 | TestHelpers.InMethod(); |
@@ -106,25 +108,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
106 | }"; | 108 | }"; |
107 | 109 | ||
108 | CSCodeGenerator cg = new CSCodeGenerator(); | 110 | CSCodeGenerator cg = new CSCodeGenerator(); |
109 | string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + | 111 | string output = cg.Convert(input); |
110 | "namespace SecondLife { " + | 112 | |
111 | "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + | 113 | output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); |
112 | "public Script() { } " + | 114 | // System.Console.WriteLine(output); |
113 | cg.Convert(input) + | 115 | |
114 | "} }\n"; | ||
115 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; | 116 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; |
116 | 117 | ||
117 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | 118 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); |
118 | 119 | // | |
119 | Assert.AreEqual(new KeyValuePair<int, int>(5, 21), | 120 | // foreach (KeyValuePair<int, int> key in positionMap.Keys) |
120 | positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]); | 121 | // { |
122 | // KeyValuePair<int, int> val = positionMap[key]; | ||
123 | // | ||
124 | // System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value); | ||
125 | // } | ||
126 | // | ||
127 | // foreach (CompilerError compErr in m_compilerResults.Errors) | ||
128 | // { | ||
129 | // System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr); | ||
130 | // } | ||
131 | |||
132 | Assert.AreEqual( | ||
133 | new KeyValuePair<int, int>(5, 21), | ||
134 | positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]); | ||
121 | } | 135 | } |
122 | 136 | ||
123 | /// <summary> | 137 | /// <summary> |
124 | /// Test that a string can be cast to string and another string | 138 | /// Test that a string can be cast to string and another string |
125 | /// concatenated. | 139 | /// concatenated. |
126 | /// </summary> | 140 | /// </summary> |
127 | //[Test] | 141 | [Test] |
128 | public void TestCastAndConcatString() | 142 | public void TestCastAndConcatString() |
129 | { | 143 | { |
130 | TestHelpers.InMethod(); | 144 | TestHelpers.InMethod(); |
@@ -143,15 +157,20 @@ default | |||
143 | } | 157 | } |
144 | }"; | 158 | }"; |
145 | 159 | ||
160 | // System.Console.WriteLine(input); | ||
146 | CSCodeGenerator cg = new CSCodeGenerator(); | 161 | CSCodeGenerator cg = new CSCodeGenerator(); |
147 | string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + | 162 | string output = cg.Convert(input); |
148 | "namespace SecondLife { " + | 163 | |
149 | "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + | 164 | output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); |
150 | "public Script() { } " + | 165 | // System.Console.WriteLine(output); |
151 | cg.Convert(input) + | 166 | |
152 | "} }\n"; | ||
153 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | 167 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); |
154 | 168 | ||
169 | // foreach (CompilerError compErr in m_compilerResults.Errors) | ||
170 | // { | ||
171 | // System.Console.WriteLine("Error: {0}", compErr); | ||
172 | // } | ||
173 | |||
155 | Assert.AreEqual(0, m_compilerResults.Errors.Count); | 174 | Assert.AreEqual(0, m_compilerResults.Errors.Count); |
156 | } | 175 | } |
157 | } | 176 | } |
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 874ff62..342cd06 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -574,7 +574,11 @@ namespace OpenSim.Tests.Common | |||
574 | 574 | ||
575 | public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) | 575 | public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) |
576 | { | 576 | { |
577 | AgentCircuitData acd = GenerateAgentData(agentId); | 577 | return AddChildScenePresence(scene, GenerateAgentData(agentId)); |
578 | } | ||
579 | |||
580 | public static ScenePresence AddChildScenePresence(Scene scene, AgentCircuitData acd) | ||
581 | { | ||
578 | acd.child = true; | 582 | acd.child = true; |
579 | 583 | ||
580 | // XXX: ViaLogin may not be correct for child agents | 584 | // XXX: ViaLogin may not be correct for child agents |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index c2b0935..8eeaf99 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -62,14 +62,23 @@ namespace OpenSim.Tests.Common.Mock | |||
62 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; | 62 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; |
63 | public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; | 63 | public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; |
64 | public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; | 64 | public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; |
65 | |||
65 | public event Action<ISceneEntity, PrimUpdateFlags> OnReceivedEntityUpdate; | 66 | public event Action<ISceneEntity, PrimUpdateFlags> OnReceivedEntityUpdate; |
67 | |||
68 | public event OnReceivedChatMessageDelegate OnReceivedChatMessage; | ||
66 | public event Action<GridInstantMessage> OnReceivedInstantMessage; | 69 | public event Action<GridInstantMessage> OnReceivedInstantMessage; |
70 | |||
67 | public event Action<UUID> OnReceivedSendRebakeAvatarTextures; | 71 | public event Action<UUID> OnReceivedSendRebakeAvatarTextures; |
68 | 72 | ||
69 | public delegate void TestClientOnSendRegionTeleportDelegate( | 73 | public delegate void TestClientOnSendRegionTeleportDelegate( |
70 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | 74 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
71 | uint locationID, uint flags, string capsURL); | 75 | uint locationID, uint flags, string capsURL); |
72 | 76 | ||
77 | public delegate void OnReceivedChatMessageDelegate( | ||
78 | string message, byte type, Vector3 fromPos, string fromName, | ||
79 | UUID fromAgentID, UUID ownerID, byte source, byte audible); | ||
80 | |||
81 | |||
73 | // disable warning: public events, part of the public API | 82 | // disable warning: public events, part of the public API |
74 | #pragma warning disable 67 | 83 | #pragma warning disable 67 |
75 | 84 | ||
@@ -467,6 +476,34 @@ namespace OpenSim.Tests.Common.Mock | |||
467 | } | 476 | } |
468 | 477 | ||
469 | /// <summary> | 478 | /// <summary> |
479 | /// Trigger chat coming from this connection. | ||
480 | /// </summary> | ||
481 | /// <param name="channel"></param> | ||
482 | /// <param name="type"></param> | ||
483 | /// <param name="message"></param> | ||
484 | public bool Chat(int channel, ChatTypeEnum type, string message) | ||
485 | { | ||
486 | ChatMessage handlerChatFromClient = OnChatFromClient; | ||
487 | |||
488 | if (handlerChatFromClient != null) | ||
489 | { | ||
490 | OSChatMessage args = new OSChatMessage(); | ||
491 | args.Channel = channel; | ||
492 | args.From = Name; | ||
493 | args.Message = message; | ||
494 | args.Type = type; | ||
495 | |||
496 | args.Scene = Scene; | ||
497 | args.Sender = this; | ||
498 | args.SenderUUID = AgentId; | ||
499 | |||
500 | handlerChatFromClient(this, args); | ||
501 | } | ||
502 | |||
503 | return true; | ||
504 | } | ||
505 | |||
506 | /// <summary> | ||
470 | /// Attempt a teleport to the given region. | 507 | /// Attempt a teleport to the given region. |
471 | /// </summary> | 508 | /// </summary> |
472 | /// <param name="regionHandle"></param> | 509 | /// <param name="regionHandle"></param> |
@@ -550,6 +587,9 @@ namespace OpenSim.Tests.Common.Mock | |||
550 | string message, byte type, Vector3 fromPos, string fromName, | 587 | string message, byte type, Vector3 fromPos, string fromName, |
551 | UUID fromAgentID, UUID ownerID, byte source, byte audible) | 588 | UUID fromAgentID, UUID ownerID, byte source, byte audible) |
552 | { | 589 | { |
590 | // Console.WriteLine("mmm {0} {1} {2}", message, Name, AgentId); | ||
591 | if (OnReceivedChatMessage != null) | ||
592 | OnReceivedChatMessage(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible); | ||
553 | } | 593 | } |
554 | 594 | ||
555 | public void SendInstantMessage(GridInstantMessage im) | 595 | public void SendInstantMessage(GridInstantMessage im) |
diff --git a/prebuild.xml b/prebuild.xml index c35b98e..3da7639 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -3082,6 +3082,7 @@ | |||
3082 | <Match path="Asset/Tests" pattern="*.cs" recurse="true"/> | 3082 | <Match path="Asset/Tests" pattern="*.cs" recurse="true"/> |
3083 | <Match path="Avatar/Attachments/Tests" pattern="*.cs" recurse="true"/> | 3083 | <Match path="Avatar/Attachments/Tests" pattern="*.cs" recurse="true"/> |
3084 | <Match path="Avatar/AvatarFactory/Tests" pattern="*.cs" recurse="true"/> | 3084 | <Match path="Avatar/AvatarFactory/Tests" pattern="*.cs" recurse="true"/> |
3085 | <Match path="Avatar/Chat/Tests" pattern="*.cs" recurse="true"/> | ||
3085 | <Match path="Avatar/Friends/Tests" pattern="*.cs" recurse="true"/> | 3086 | <Match path="Avatar/Friends/Tests" pattern="*.cs" recurse="true"/> |
3086 | <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> | 3087 | <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> |
3087 | <Match path="Avatar/Inventory/Transfer/Tests" pattern="*.cs" recurse="true"/> | 3088 | <Match path="Avatar/Inventory/Transfer/Tests" pattern="*.cs" recurse="true"/> |