aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-03-04 20:08:25 +0000
committerJustin Clark-Casey (justincc)2010-05-20 22:43:05 +0100
commit76238715e3c8f4ba22cdd6dd09a282a0b52bad4d (patch)
tree427ca679e947a1e58a6742fbe044dd4793839c6b /OpenSim/Region
parentMake "nant distbin" remove BUILDING.txt (diff)
downloadopensim-SC-76238715e3c8f4ba22cdd6dd09a282a0b52bad4d.zip
opensim-SC-76238715e3c8f4ba22cdd6dd09a282a0b52bad4d.tar.gz
opensim-SC-76238715e3c8f4ba22cdd6dd09a282a0b52bad4d.tar.bz2
opensim-SC-76238715e3c8f4ba22cdd6dd09a282a0b52bad4d.tar.xz
move linden notecard parsing from LSL_Api.cs to SLUtil so that region modules can use it
backport from master
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs83
4 files changed, 25 insertions, 108 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index 21edcc5..da77a2b 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -164,12 +164,12 @@ namespace OpenSim
164 m_config.Source = new IniConfigSource(); 164 m_config.Source = new IniConfigSource();
165 m_config.Source.Merge(DefaultConfig()); 165 m_config.Source.Merge(DefaultConfig());
166 166
167 m_log.Info("[CONFIG] Reading configuration settings"); 167 m_log.Info("[CONFIG]: Reading configuration settings");
168 168
169 if (sources.Count == 0) 169 if (sources.Count == 0)
170 { 170 {
171 m_log.FatalFormat("[CONFIG] Could not load any configuration"); 171 m_log.FatalFormat("[CONFIG]: Could not load any configuration");
172 m_log.FatalFormat("[CONFIG] Did you copy the OpenSim.ini.example file to OpenSim.ini?"); 172 m_log.FatalFormat("[CONFIG]: Did you copy the OpenSim.ini.example file to OpenSim.ini?");
173 Environment.Exit(1); 173 Environment.Exit(1);
174 } 174 }
175 175
@@ -182,8 +182,8 @@ namespace OpenSim
182 182
183 if (!iniFileExists) 183 if (!iniFileExists)
184 { 184 {
185 m_log.FatalFormat("[CONFIG] Could not load any configuration"); 185 m_log.FatalFormat("[CONFIG]: Could not load any configuration");
186 m_log.FatalFormat("[CONFIG] Configuration exists, but there was an error loading it!"); 186 m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
187 Environment.Exit(1); 187 Environment.Exit(1);
188 } 188 }
189 189
@@ -257,20 +257,17 @@ namespace OpenSim
257 257
258 if (!IsUri(iniPath)) 258 if (!IsUri(iniPath))
259 { 259 {
260 m_log.InfoFormat("[CONFIG] Reading configuration file {0}", 260 m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath));
261 Path.GetFullPath(iniPath));
262 261
263 m_config.Source.Merge(new IniConfigSource(iniPath)); 262 m_config.Source.Merge(new IniConfigSource(iniPath));
264 success = true; 263 success = true;
265 } 264 }
266 else 265 else
267 { 266 {
268 m_log.InfoFormat("[CONFIG] {0} is a http:// URI, fetching ...", 267 m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", iniPath);
269 iniPath);
270 268
271 // The ini file path is a http URI 269 // The ini file path is a http URI
272 // Try to read it 270 // Try to read it
273 //
274 try 271 try
275 { 272 {
276 XmlReader r = XmlReader.Create(iniPath); 273 XmlReader r = XmlReader.Create(iniPath);
@@ -281,7 +278,7 @@ namespace OpenSim
281 } 278 }
282 catch (Exception e) 279 catch (Exception e)
283 { 280 {
284 m_log.FatalFormat("[CONFIG] Exception reading config from URI {0}\n" + e.ToString(), iniPath); 281 m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), iniPath);
285 Environment.Exit(1); 282 Environment.Exit(1);
286 } 283 }
287 } 284 }
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 57e1c37..4365ece 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -107,21 +107,24 @@ namespace OpenSim.Region.Framework.Scenes
107 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; 107 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
108 108
109 /// <summary> 109 /// <summary>
110 /// Called when an object is touched/grabbed. 110 /// Fired when an object is touched/grabbed.
111 /// </summary> 111 /// </summary>
112 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of 112 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
113 /// the root part. 113 /// the root part.
114 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
115 public event ObjectGrabDelegate OnObjectGrab; 114 public event ObjectGrabDelegate OnObjectGrab;
115 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
116 116
117 public event ObjectGrabDelegate OnObjectGrabbing; 117 public event ObjectGrabDelegate OnObjectGrabbing;
118 public event ObjectDeGrabDelegate OnObjectDeGrab; 118 public event ObjectDeGrabDelegate OnObjectDeGrab;
119 public event ScriptResetDelegate OnScriptReset; 119 public event ScriptResetDelegate OnScriptReset;
120 120
121 public event OnPermissionErrorDelegate OnPermissionError; 121 public event OnPermissionErrorDelegate OnPermissionError;
122 122
123 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); 123 /// <summary>
124 /// Fired when a new script is created.
125 /// </summary>
124 public event NewRezScript OnRezScript; 126 public event NewRezScript OnRezScript;
127 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
125 128
126 public delegate void RemoveScript(uint localID, UUID itemID); 129 public delegate void RemoveScript(uint localID, UUID itemID);
127 public event RemoveScript OnRemoveScript; 130 public event RemoveScript OnRemoveScript;
@@ -163,38 +166,35 @@ namespace OpenSim.Region.Framework.Scenes
163 166
164 public delegate void ClientClosed(UUID clientID, Scene scene); 167 public delegate void ClientClosed(UUID clientID, Scene scene);
165 168
166 public event ClientClosed OnClientClosed; 169 public event ClientClosed OnClientClosed;
167
168 public delegate void ScriptChangedEvent(uint localID, uint change);
169 170
171 /// <summary>
172 /// This is fired when a scene object property that a script might be interested in (such as color, scale or
173 /// inventory) changes. Only enough information is sent for the LSL changed event
174 /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed)
175 /// </summary>
170 public event ScriptChangedEvent OnScriptChangedEvent; 176 public event ScriptChangedEvent OnScriptChangedEvent;
177 public delegate void ScriptChangedEvent(uint localID, uint change);
171 178
172 public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed); 179 public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed);
173
174 public event ScriptControlEvent OnScriptControlEvent; 180 public event ScriptControlEvent OnScriptControlEvent;
175 181
176 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 182 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
177
178 public event ScriptAtTargetEvent OnScriptAtTargetEvent; 183 public event ScriptAtTargetEvent OnScriptAtTargetEvent;
179 184
180 public delegate void ScriptNotAtTargetEvent(uint localID); 185 public delegate void ScriptNotAtTargetEvent(uint localID);
181
182 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; 186 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
183 187
184 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); 188 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
185
186 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; 189 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
187 190
188 public delegate void ScriptNotAtRotTargetEvent(uint localID); 191 public delegate void ScriptNotAtRotTargetEvent(uint localID);
189
190 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; 192 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
191 193
192 public delegate void ScriptColliding(uint localID, ColliderArgs colliders); 194 public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
193
194 public event ScriptColliding OnScriptColliderStart; 195 public event ScriptColliding OnScriptColliderStart;
195 public event ScriptColliding OnScriptColliding; 196 public event ScriptColliding OnScriptColliding;
196 public event ScriptColliding OnScriptCollidingEnd; 197 public event ScriptColliding OnScriptCollidingEnd;
197
198 public event ScriptColliding OnScriptLandColliderStart; 198 public event ScriptColliding OnScriptLandColliderStart;
199 public event ScriptColliding OnScriptLandColliding; 199 public event ScriptColliding OnScriptLandColliding;
200 public event ScriptColliding OnScriptLandColliderEnd; 200 public event ScriptColliding OnScriptLandColliderEnd;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index a555eae..21ca1de 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -638,7 +638,6 @@ namespace OpenSim.Region.Framework.Scenes
638 m_items[item.ItemID] = item; 638 m_items[item.ItemID] = item;
639 m_inventorySerial++; 639 m_inventorySerial++;
640 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 640 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
641
642 HasInventoryChanged = true; 641 HasInventoryChanged = true;
643 m_part.ParentGroup.HasGroupChanged = true; 642 m_part.ParentGroup.HasGroupChanged = true;
644 643
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3b2c9b1..e4e087f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9784,90 +9784,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9784 9784
9785 Notecard nc = new Notecard(); 9785 Notecard nc = new Notecard();
9786 nc.lastRef = DateTime.Now; 9786 nc.lastRef = DateTime.Now;
9787 nc.text = ParseText(text.Replace("\r", "").Split('\n')); 9787 nc.text = SLUtil.ParseNotecardToList(text).ToArray();
9788 m_Notecards[assetID] = nc; 9788 m_Notecards[assetID] = nc;
9789 } 9789 }
9790 } 9790 }
9791 9791
9792 protected static string[] ParseText(string[] input)
9793 {
9794 int idx = 0;
9795 int level = 0;
9796 List<string> output = new List<string>();
9797 string[] words;
9798
9799 while (idx < input.Length)
9800 {
9801 if (input[idx] == "{")
9802 {
9803 level++;
9804 idx++;
9805 continue;
9806 }
9807
9808 if (input[idx]== "}")
9809 {
9810 level--;
9811 idx++;
9812 continue;
9813 }
9814
9815 switch (level)
9816 {
9817 case 0:
9818 words = input[idx].Split(' '); // Linden text ver
9819 // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
9820 if (words.Length < 3)
9821 return new String[0];
9822
9823 int version = int.Parse(words[3]);
9824 if (version != 2)
9825 return new String[0];
9826 break;
9827 case 1:
9828 words = input[idx].Split(' ');
9829 if (words[0] == "LLEmbeddedItems")
9830 break;
9831 if (words[0] == "Text")
9832 {
9833 int len = int.Parse(words[2]);
9834 idx++;
9835
9836 int count = -1;
9837
9838 while (count < len)
9839 {
9840 // int l = input[idx].Length;
9841 string ln = input[idx];
9842
9843 int need = len-count-1;
9844 if (ln.Length > need)
9845 ln = ln.Substring(0, need);
9846
9847 output.Add(ln);
9848 count += ln.Length + 1;
9849 idx++;
9850 }
9851
9852 return output.ToArray();
9853 }
9854 break;
9855 case 2:
9856 words = input[idx].Split(' '); // count
9857 if (words[0] == "count")
9858 {
9859 int c = int.Parse(words[1]);
9860 if (c > 0)
9861 return new String[0];
9862 break;
9863 }
9864 break;
9865 }
9866 idx++;
9867 }
9868 return output.ToArray();
9869 }
9870
9871 public static bool IsCached(UUID assetID) 9792 public static bool IsCached(UUID assetID)
9872 { 9793 {
9873 lock (m_Notecards) 9794 lock (m_Notecards)
@@ -9923,4 +9844,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9923 } 9844 }
9924 } 9845 }
9925 } 9846 }
9926} 9847} \ No newline at end of file