aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs7
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs43
7 files changed, 13 insertions, 83 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 42dbedc..143af48 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -77,8 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces
77 /// <param name="itemID">The item ID of the script.</param> 77 /// <param name="itemID">The item ID of the script.</param>
78 bool GetScriptState(UUID itemID); 78 bool GetScriptState(UUID itemID);
79 79
80 void SetRunEnable(UUID instanceID, bool enable);
81
82 void SaveAllState(); 80 void SaveAllState();
83 81
84 /// <summary> 82 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9776a82..98b8fcc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2298,24 +2298,10 @@ namespace OpenSim.Region.Framework.Scenes
2298 if (part == null) 2298 if (part == null)
2299 return; 2299 return;
2300 2300
2301 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
2302
2303 if (running) 2301 if (running)
2304 {
2305 foreach (IScriptModule engine in engines)
2306 {
2307 engine.SetRunEnable(itemID, true);
2308 }
2309 EventManager.TriggerStartScript(part.LocalId, itemID); 2302 EventManager.TriggerStartScript(part.LocalId, itemID);
2310 }
2311 else 2303 else
2312 {
2313 foreach (IScriptModule engine in engines)
2314 {
2315 engine.SetRunEnable(itemID, false);
2316 }
2317 EventManager.TriggerStopScript(part.LocalId, itemID); 2304 EventManager.TriggerStopScript(part.LocalId, itemID);
2318 }
2319 } 2305 }
2320 2306
2321 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 2307 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index ec13b6c..b04f6b6 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -64,16 +64,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
64 bool Running { get; set; } 64 bool Running { get; set; }
65 65
66 /// <summary> 66 /// <summary>
67 /// Gets or sets a value indicating whether this
68 /// <see cref="OpenSim.Region.ScriptEngine.Interfaces.IScriptInstance"/> is run.
69 /// For viewer script editor control
70 /// </summary>
71 /// <value>
72 /// <c>true</c> if run; otherwise, <c>false</c>.
73 /// </value>
74 bool Run { get; set; }
75
76 /// <summary>
77 /// Is the script suspended? 67 /// Is the script suspended?
78 /// </summary> 68 /// </summary>
79 bool Suspended { get; set; } 69 bool Suspended { get; set; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 8d92ba5..983eed2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -122,8 +122,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
122 122
123 public bool Running { get; set; } 123 public bool Running { get; set; }
124 124
125 public bool Run { get; set; }
126
127 public bool Suspended 125 public bool Suspended
128 { 126 {
129 get { return m_Suspended; } 127 get { return m_Suspended; }
@@ -219,7 +217,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
219 m_postOnRez = postOnRez; 217 m_postOnRez = postOnRez;
220 m_AttachedAvatar = part.ParentGroup.AttachedAvatar; 218 m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
221 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; 219 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
222 Run = true;
223 220
224 if (part != null) 221 if (part != null)
225 { 222 {
@@ -360,9 +357,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
360 357
361 if (m_startedFromSavedState) 358 if (m_startedFromSavedState)
362 { 359 {
363 if (!Run)
364 return;
365
366 Start(); 360 Start();
367 if (m_postOnRez) 361 if (m_postOnRez)
368 { 362 {
@@ -395,9 +389,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
395 } 389 }
396 else 390 else
397 { 391 {
398 if (!Run)
399 return;
400
401 Start(); 392 Start();
402 PostEvent(new EventParams("state_entry", 393 PostEvent(new EventParams("state_entry",
403 new Object[0], new DetectParams[0])); 394 new Object[0], new DetectParams[0]));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
index 797bce3..bcdc7bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
@@ -55,7 +55,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
55 public static string Serialize(ScriptInstance instance) 55 public static string Serialize(ScriptInstance instance)
56 { 56 {
57 bool running = instance.Running; 57 bool running = instance.Running;
58 bool enabled = instance.Run;
59 58
60 XmlDocument xmldoc = new XmlDocument(); 59 XmlDocument xmldoc = new XmlDocument();
61 60
@@ -78,12 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
78 77
79 rootElement.AppendChild(run); 78 rootElement.AppendChild(run);
80 79
81 XmlElement run_enable = xmldoc.CreateElement("", "Run", "");
82 run_enable.AppendChild(xmldoc.CreateTextNode(
83 enabled.ToString()));
84
85 rootElement.AppendChild(run_enable);
86
87 Dictionary<string, Object> vars = instance.GetVars(); 80 Dictionary<string, Object> vars = instance.GetVars();
88 81
89 XmlElement variables = xmldoc.CreateElement("", "Variables", ""); 82 XmlElement variables = xmldoc.CreateElement("", "Variables", "");
@@ -232,7 +225,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
232 { 225 {
233 object varValue; 226 object varValue;
234 XmlNodeList partL = rootNode.ChildNodes; 227 XmlNodeList partL = rootNode.ChildNodes;
235 instance.Run = true;
236 228
237 foreach (XmlNode part in partL) 229 foreach (XmlNode part in partL)
238 { 230 {
@@ -244,9 +236,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
244 case "Running": 236 case "Running":
245 instance.Running=bool.Parse(part.InnerText); 237 instance.Running=bool.Parse(part.InnerText);
246 break; 238 break;
247 case "Run":
248 instance.Run = bool.Parse(part.InnerText);
249 break;
250 case "Variables": 239 case "Variables":
251 XmlNodeList varL = part.ChildNodes; 240 XmlNodeList varL = part.ChildNodes;
252 foreach (XmlNode var in varL) 241 foreach (XmlNode var in varL)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index d763063..35a0200 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1632,13 +1632,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1632 } 1632 }
1633 } 1633 }
1634 1634
1635 public void SetRunEnable(UUID instanceID, bool enable)
1636 {
1637 IScriptInstance instance = GetInstance(instanceID);
1638 if (instance != null)
1639 instance.Run = enable;
1640 }
1641
1642 public bool GetScriptState(UUID itemID) 1635 public bool GetScriptState(UUID itemID)
1643 { 1636 {
1644 IScriptInstance instance = GetInstance(itemID); 1637 IScriptInstance instance = GetInstance(itemID);
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index faf746f..c11ea02 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -57,7 +57,12 @@ namespace OpenSim.Region.UserStatistics
57 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 58
59 private static SqliteConnection dbConn; 59 private static SqliteConnection dbConn;
60
61 /// <summary>
62 /// User statistics sessions keyed by agent ID
63 /// </summary>
60 private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>(); 64 private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>();
65
61 private List<Scene> m_scenes = new List<Scene>(); 66 private List<Scene> m_scenes = new List<Scene>();
62 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>(); 67 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
63 private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>(); 68 private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>();
@@ -308,49 +313,41 @@ namespace OpenSim.Region.UserStatistics
308 scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps; 313 scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps;
309 scene.EventManager.OnClientClosed += OnClientClosed; 314 scene.EventManager.OnClientClosed += OnClientClosed;
310 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; 315 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
311 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
312 } 316 }
313 } 317 }
314 } 318 }
315 319
316 private void OnMakeRootAgent(ScenePresence agent) 320 private void OnMakeRootAgent(ScenePresence agent)
317 { 321 {
318 UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle);
319
320 lock (m_sessions) 322 lock (m_sessions)
321 { 323 {
324 UserSessionID uid;
325
322 if (!m_sessions.ContainsKey(agent.UUID)) 326 if (!m_sessions.ContainsKey(agent.UUID))
323 { 327 {
324 UserSessionData usd = UserSessionUtil.newUserSessionData(); 328 UserSessionData usd = UserSessionUtil.newUserSessionData();
325 329 uid = new UserSessionID();
326 UserSessionID uid = new UserSessionID();
327 uid.name_f = agent.Firstname; 330 uid.name_f = agent.Firstname;
328 uid.name_l = agent.Lastname; 331 uid.name_l = agent.Lastname;
329 uid.region_id = regionUUID;
330 uid.session_id = agent.ControllingClient.SessionId;
331 uid.session_data = usd; 332 uid.session_data = usd;
332 333
333 m_sessions.Add(agent.UUID, uid); 334 m_sessions.Add(agent.UUID, uid);
334 } 335 }
335 else 336 else
336 { 337 {
337 UserSessionID uid = m_sessions[agent.UUID]; 338 uid = m_sessions[agent.UUID];
338 uid.region_id = regionUUID;
339 uid.session_id = agent.ControllingClient.SessionId;
340 m_sessions[agent.UUID] = uid;
341 } 339 }
342 }
343 }
344 340
345 private void OnMakeChildAgent(ScenePresence agent) 341 uid.region_id = agent.Scene.RegionInfo.RegionID;
346 { 342 uid.session_id = agent.ControllingClient.SessionId;
343 }
347 } 344 }
348 345
349 private void OnClientClosed(UUID agentID, Scene scene) 346 private void OnClientClosed(UUID agentID, Scene scene)
350 { 347 {
351 lock (m_sessions) 348 lock (m_sessions)
352 { 349 {
353 if (m_sessions.ContainsKey(agentID)) 350 if (m_sessions.ContainsKey(agentID) && m_sessions[agentID].region_id == scene.RegionInfo.RegionID)
354 { 351 {
355 m_sessions.Remove(agentID); 352 m_sessions.Remove(agentID);
356 } 353 }
@@ -395,20 +392,6 @@ namespace OpenSim.Region.UserStatistics
395 return encoding.GetString(buffer); 392 return encoding.GetString(buffer);
396 } 393 }
397 394
398 private UUID GetRegionUUIDFromHandle(ulong regionhandle)
399 {
400 lock (m_scenes)
401 {
402 foreach (Scene scene in m_scenes)
403 {
404 if (scene.RegionInfo.RegionHandle == regionhandle)
405 return scene.RegionInfo.RegionID;
406 }
407 }
408
409 return UUID.Zero;
410 }
411
412 /// <summary> 395 /// <summary>
413 /// Callback for a viewerstats cap 396 /// Callback for a viewerstats cap
414 /// </summary> 397 /// </summary>