aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-08-15 18:22:16 +0200
committerMelanie2012-08-15 18:22:16 +0200
commitda0f6b926fdc40cf729bfc3ace4367758adf8f93 (patch)
treec12a5a6bd9dce82563129653067ad9118c8b314a /OpenSim
parentFix and finish the extra parameters storage system for MySQL (diff)
downloadopensim-SC-da0f6b926fdc40cf729bfc3ace4367758adf8f93.zip
opensim-SC-da0f6b926fdc40cf729bfc3ace4367758adf8f93.tar.gz
opensim-SC-da0f6b926fdc40cf729bfc3ace4367758adf8f93.tar.bz2
opensim-SC-da0f6b926fdc40cf729bfc3ace4367758adf8f93.tar.xz
Add support for the extra params to scene and the event manager
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs39
2 files changed, 62 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 7cb3811..eee5960 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -217,6 +217,9 @@ namespace OpenSim.Region.Framework.Scenes
217 /// </remarks> 217 /// </remarks>
218 public event NewScript OnNewScript; 218 public event NewScript OnNewScript;
219 219
220 public delegate void ExtraSettingChangedDelegate(Scene scene, string name, string value);
221 public event ExtraSettingChangedDelegate OnExtraSettingChanged;
222
220 public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) 223 public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
221 { 224 {
222 NewScript handlerNewScript = OnNewScript; 225 NewScript handlerNewScript = OnNewScript;
@@ -2616,5 +2619,25 @@ namespace OpenSim.Region.Framework.Scenes
2616 } 2619 }
2617 } 2620 }
2618 2621
2622 public void TriggerExtraSettingChanged(Scene scene, string name, string val)
2623 {
2624 ExtraSettingChangedDelegate handler = OnExtraSettingChanged;
2625
2626 if (handler != null)
2627 {
2628 foreach (ExtraSettingChangedDelegate d in handler.GetInvocationList())
2629 {
2630 try
2631 {
2632 d(scene, name, val);
2633 }
2634 catch (Exception e)
2635 {
2636 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for ExtraSettingChanged failed - continuing {0} - {1}",
2637 e.Message, e.StackTrace);
2638 }
2639 }
2640 }
2641 }
2619 } 2642 }
2620} 2643}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 79ebc6e..a5f0bff 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5854,5 +5854,44 @@ Environment.Exit(1);
5854 5854
5855 callback(asset); 5855 callback(asset);
5856 } 5856 }
5857
5858 public string GetExtraSetting(string name)
5859 {
5860 string val;
5861
5862 if (!m_extraSettings.TryGetValue(name, out val))
5863 return String.Empty;
5864
5865 return val;
5866 }
5867
5868 public void StoreExtraSetting(string name, string val)
5869 {
5870 string oldVal;
5871
5872 if (m_extraSettings.TryGetValue(name, out oldVal))
5873 {
5874 if (oldVal == val)
5875 return;
5876 }
5877
5878 m_extraSettings[name] = val;
5879
5880 m_SimulationDataService.SaveExtra(RegionInfo.RegionID, name, val);
5881
5882 m_eventManager.TriggerExtraSettingChanged(this, name, val);
5883 }
5884
5885 public void RemoveExtraSetting(string name)
5886 {
5887 if (!m_extraSettings.ContainsKey(name))
5888 return;
5889
5890 m_extraSettings.Remove(name);
5891
5892 m_SimulationDataService.RemoveExtra(RegionInfo.RegionID, name);
5893
5894 m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty);
5895 }
5857 } 5896 }
5858} 5897}