diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/SLUtil.cs | 282 | ||||
-rw-r--r-- | OpenSim/Region/Application/ConfigurationLoader.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 83 |
5 files changed, 307 insertions, 108 deletions
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs new file mode 100644 index 0000000..ff5f8b9 --- /dev/null +++ b/OpenSim/Framework/SLUtil.cs | |||
@@ -0,0 +1,282 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using OpenMetaverse; | ||
4 | |||
5 | namespace OpenSim.Framework | ||
6 | { | ||
7 | public static class SLUtil | ||
8 | { | ||
9 | #region SL / file extension / content-type conversions | ||
10 | |||
11 | public static string SLAssetTypeToContentType(int assetType) | ||
12 | { | ||
13 | switch ((AssetType)assetType) | ||
14 | { | ||
15 | case AssetType.Texture: | ||
16 | return "image/x-j2c"; | ||
17 | case AssetType.Sound: | ||
18 | return "application/ogg"; | ||
19 | case AssetType.CallingCard: | ||
20 | return "application/vnd.ll.callingcard"; | ||
21 | case AssetType.Landmark: | ||
22 | return "application/vnd.ll.landmark"; | ||
23 | case AssetType.Clothing: | ||
24 | return "application/vnd.ll.clothing"; | ||
25 | case AssetType.Object: | ||
26 | return "application/vnd.ll.primitive"; | ||
27 | case AssetType.Notecard: | ||
28 | return "application/vnd.ll.notecard"; | ||
29 | case AssetType.Folder: | ||
30 | return "application/vnd.ll.folder"; | ||
31 | case AssetType.RootFolder: | ||
32 | return "application/vnd.ll.rootfolder"; | ||
33 | case AssetType.LSLText: | ||
34 | return "application/vnd.ll.lsltext"; | ||
35 | case AssetType.LSLBytecode: | ||
36 | return "application/vnd.ll.lslbyte"; | ||
37 | case AssetType.TextureTGA: | ||
38 | case AssetType.ImageTGA: | ||
39 | return "image/tga"; | ||
40 | case AssetType.Bodypart: | ||
41 | return "application/vnd.ll.bodypart"; | ||
42 | case AssetType.TrashFolder: | ||
43 | return "application/vnd.ll.trashfolder"; | ||
44 | case AssetType.SnapshotFolder: | ||
45 | return "application/vnd.ll.snapshotfolder"; | ||
46 | case AssetType.LostAndFoundFolder: | ||
47 | return "application/vnd.ll.lostandfoundfolder"; | ||
48 | case AssetType.SoundWAV: | ||
49 | return "audio/x-wav"; | ||
50 | case AssetType.ImageJPEG: | ||
51 | return "image/jpeg"; | ||
52 | case AssetType.Animation: | ||
53 | return "application/vnd.ll.animation"; | ||
54 | case AssetType.Gesture: | ||
55 | return "application/vnd.ll.gesture"; | ||
56 | case AssetType.Simstate: | ||
57 | return "application/x-metaverse-simstate"; | ||
58 | case AssetType.Unknown: | ||
59 | default: | ||
60 | return "application/octet-stream"; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public static sbyte ContentTypeToSLAssetType(string contentType) | ||
65 | { | ||
66 | switch (contentType) | ||
67 | { | ||
68 | case "image/x-j2c": | ||
69 | case "image/jp2": | ||
70 | return (sbyte)AssetType.Texture; | ||
71 | case "application/ogg": | ||
72 | return (sbyte)AssetType.Sound; | ||
73 | case "application/vnd.ll.callingcard": | ||
74 | case "application/x-metaverse-callingcard": | ||
75 | return (sbyte)AssetType.CallingCard; | ||
76 | case "application/vnd.ll.landmark": | ||
77 | case "application/x-metaverse-landmark": | ||
78 | return (sbyte)AssetType.Landmark; | ||
79 | case "application/vnd.ll.clothing": | ||
80 | case "application/x-metaverse-clothing": | ||
81 | return (sbyte)AssetType.Clothing; | ||
82 | case "application/vnd.ll.primitive": | ||
83 | case "application/x-metaverse-primitive": | ||
84 | return (sbyte)AssetType.Object; | ||
85 | case "application/vnd.ll.notecard": | ||
86 | case "application/x-metaverse-notecard": | ||
87 | return (sbyte)AssetType.Notecard; | ||
88 | case "application/vnd.ll.folder": | ||
89 | return (sbyte)AssetType.Folder; | ||
90 | case "application/vnd.ll.rootfolder": | ||
91 | return (sbyte)AssetType.RootFolder; | ||
92 | case "application/vnd.ll.lsltext": | ||
93 | case "application/x-metaverse-lsl": | ||
94 | return (sbyte)AssetType.LSLText; | ||
95 | case "application/vnd.ll.lslbyte": | ||
96 | case "application/x-metaverse-lso": | ||
97 | return (sbyte)AssetType.LSLBytecode; | ||
98 | case "image/tga": | ||
99 | // Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA | ||
100 | return (sbyte)AssetType.ImageTGA; | ||
101 | case "application/vnd.ll.bodypart": | ||
102 | case "application/x-metaverse-bodypart": | ||
103 | return (sbyte)AssetType.Bodypart; | ||
104 | case "application/vnd.ll.trashfolder": | ||
105 | return (sbyte)AssetType.TrashFolder; | ||
106 | case "application/vnd.ll.snapshotfolder": | ||
107 | return (sbyte)AssetType.SnapshotFolder; | ||
108 | case "application/vnd.ll.lostandfoundfolder": | ||
109 | return (sbyte)AssetType.LostAndFoundFolder; | ||
110 | case "audio/x-wav": | ||
111 | return (sbyte)AssetType.SoundWAV; | ||
112 | case "image/jpeg": | ||
113 | return (sbyte)AssetType.ImageJPEG; | ||
114 | case "application/vnd.ll.animation": | ||
115 | case "application/x-metaverse-animation": | ||
116 | return (sbyte)AssetType.Animation; | ||
117 | case "application/vnd.ll.gesture": | ||
118 | case "application/x-metaverse-gesture": | ||
119 | return (sbyte)AssetType.Gesture; | ||
120 | case "application/x-metaverse-simstate": | ||
121 | return (sbyte)AssetType.Simstate; | ||
122 | case "application/octet-stream": | ||
123 | default: | ||
124 | return (sbyte)AssetType.Unknown; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | public static sbyte ContentTypeToSLInvType(string contentType) | ||
129 | { | ||
130 | switch (contentType) | ||
131 | { | ||
132 | case "image/x-j2c": | ||
133 | case "image/jp2": | ||
134 | case "image/tga": | ||
135 | case "image/jpeg": | ||
136 | return (sbyte)InventoryType.Texture; | ||
137 | case "application/ogg": | ||
138 | case "audio/x-wav": | ||
139 | return (sbyte)InventoryType.Sound; | ||
140 | case "application/vnd.ll.callingcard": | ||
141 | case "application/x-metaverse-callingcard": | ||
142 | return (sbyte)InventoryType.CallingCard; | ||
143 | case "application/vnd.ll.landmark": | ||
144 | case "application/x-metaverse-landmark": | ||
145 | return (sbyte)InventoryType.Landmark; | ||
146 | case "application/vnd.ll.clothing": | ||
147 | case "application/x-metaverse-clothing": | ||
148 | case "application/vnd.ll.bodypart": | ||
149 | case "application/x-metaverse-bodypart": | ||
150 | return (sbyte)InventoryType.Wearable; | ||
151 | case "application/vnd.ll.primitive": | ||
152 | case "application/x-metaverse-primitive": | ||
153 | return (sbyte)InventoryType.Object; | ||
154 | case "application/vnd.ll.notecard": | ||
155 | case "application/x-metaverse-notecard": | ||
156 | return (sbyte)InventoryType.Notecard; | ||
157 | case "application/vnd.ll.folder": | ||
158 | return (sbyte)InventoryType.Folder; | ||
159 | case "application/vnd.ll.rootfolder": | ||
160 | return (sbyte)InventoryType.RootCategory; | ||
161 | case "application/vnd.ll.lsltext": | ||
162 | case "application/x-metaverse-lsl": | ||
163 | case "application/vnd.ll.lslbyte": | ||
164 | case "application/x-metaverse-lso": | ||
165 | return (sbyte)InventoryType.LSL; | ||
166 | case "application/vnd.ll.trashfolder": | ||
167 | case "application/vnd.ll.snapshotfolder": | ||
168 | case "application/vnd.ll.lostandfoundfolder": | ||
169 | return (sbyte)InventoryType.Folder; | ||
170 | case "application/vnd.ll.animation": | ||
171 | case "application/x-metaverse-animation": | ||
172 | return (sbyte)InventoryType.Animation; | ||
173 | case "application/vnd.ll.gesture": | ||
174 | case "application/x-metaverse-gesture": | ||
175 | return (sbyte)InventoryType.Gesture; | ||
176 | case "application/x-metaverse-simstate": | ||
177 | return (sbyte)InventoryType.Snapshot; | ||
178 | case "application/octet-stream": | ||
179 | default: | ||
180 | return (sbyte)InventoryType.Unknown; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | #endregion SL / file extension / content-type conversions | ||
185 | |||
186 | /// <summary> | ||
187 | /// Parse a notecard in Linden format to a string of ordinary text. | ||
188 | /// </summary> | ||
189 | /// <param name="rawInput"></param> | ||
190 | /// <returns></returns> | ||
191 | public static string ParseNotecardToString(string rawInput) | ||
192 | { | ||
193 | return string.Join("\n", ParseNotecardToList(rawInput).ToArray()); | ||
194 | } | ||
195 | |||
196 | /// <summary> | ||
197 | /// Parse a notecard in Linden format to a list of ordinary lines. | ||
198 | /// </summary> | ||
199 | /// <param name="rawInput"></param> | ||
200 | /// <returns></returns> | ||
201 | public static List<string> ParseNotecardToList(string rawInput) | ||
202 | { | ||
203 | string[] input = rawInput.Replace("\r", "").Split('\n'); | ||
204 | int idx = 0; | ||
205 | int level = 0; | ||
206 | List<string> output = new List<string>(); | ||
207 | string[] words; | ||
208 | |||
209 | while (idx < input.Length) | ||
210 | { | ||
211 | if (input[idx] == "{") | ||
212 | { | ||
213 | level++; | ||
214 | idx++; | ||
215 | continue; | ||
216 | } | ||
217 | |||
218 | if (input[idx]== "}") | ||
219 | { | ||
220 | level--; | ||
221 | idx++; | ||
222 | continue; | ||
223 | } | ||
224 | |||
225 | switch (level) | ||
226 | { | ||
227 | case 0: | ||
228 | words = input[idx].Split(' '); // Linden text ver | ||
229 | // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard) | ||
230 | if (words.Length < 3) | ||
231 | return output; | ||
232 | |||
233 | int version = int.Parse(words[3]); | ||
234 | if (version != 2) | ||
235 | return output; | ||
236 | break; | ||
237 | case 1: | ||
238 | words = input[idx].Split(' '); | ||
239 | if (words[0] == "LLEmbeddedItems") | ||
240 | break; | ||
241 | if (words[0] == "Text") | ||
242 | { | ||
243 | int len = int.Parse(words[2]); | ||
244 | idx++; | ||
245 | |||
246 | int count = -1; | ||
247 | |||
248 | while (count < len) | ||
249 | { | ||
250 | // int l = input[idx].Length; | ||
251 | string ln = input[idx]; | ||
252 | |||
253 | int need = len-count-1; | ||
254 | if (ln.Length > need) | ||
255 | ln = ln.Substring(0, need); | ||
256 | |||
257 | output.Add(ln); | ||
258 | count += ln.Length + 1; | ||
259 | idx++; | ||
260 | } | ||
261 | |||
262 | return output; | ||
263 | } | ||
264 | break; | ||
265 | case 2: | ||
266 | words = input[idx].Split(' '); // count | ||
267 | if (words[0] == "count") | ||
268 | { | ||
269 | int c = int.Parse(words[1]); | ||
270 | if (c > 0) | ||
271 | return output; | ||
272 | break; | ||
273 | } | ||
274 | break; | ||
275 | } | ||
276 | idx++; | ||
277 | } | ||
278 | |||
279 | return output; | ||
280 | } | ||
281 | } | ||
282 | } \ No newline at end of file | ||
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 |