aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLPresenceData.cs4
-rw-r--r--OpenSim/Data/Null/NullPresenceData.cs51
-rw-r--r--OpenSim/Framework/SLUtil.cs99
-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
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs31
8 files changed, 195 insertions, 123 deletions
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs
index fcbe3d6..68a68af 100644
--- a/OpenSim/Data/MySQL/MySQLPresenceData.cs
+++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Data.MySQL
122 cmd.CommandText = String.Format("select * from {0} where UserID=?UserID", m_Realm); 122 cmd.CommandText = String.Format("select * from {0} where UserID=?UserID", m_Realm);
123 123
124 cmd.Parameters.AddWithValue("?UserID", userID); 124 cmd.Parameters.AddWithValue("?UserID", userID);
125; 125
126 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 126 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
127 { 127 {
128 dbcon.Open(); 128 dbcon.Open();
@@ -131,7 +131,6 @@ namespace OpenSim.Data.MySQL
131 131
132 using (IDataReader reader = cmd.ExecuteReader()) 132 using (IDataReader reader = cmd.ExecuteReader())
133 { 133 {
134
135 List<UUID> deleteSessions = new List<UUID>(); 134 List<UUID> deleteSessions = new List<UUID>();
136 int online = 0; 135 int online = 0;
137 136
@@ -143,6 +142,7 @@ namespace OpenSim.Data.MySQL
143 deleteSessions.Add(new UUID(reader["SessionID"].ToString())); 142 deleteSessions.Add(new UUID(reader["SessionID"].ToString()));
144 } 143 }
145 144
145 // Leave one session behind so that we can pick up details such as home location
146 if (online == 0 && deleteSessions.Count > 0) 146 if (online == 0 && deleteSessions.Count > 0)
147 deleteSessions.RemoveAt(0); 147 deleteSessions.RemoveAt(0);
148 148
diff --git a/OpenSim/Data/Null/NullPresenceData.cs b/OpenSim/Data/Null/NullPresenceData.cs
index 5f78691..2ceb0c6 100644
--- a/OpenSim/Data/Null/NullPresenceData.cs
+++ b/OpenSim/Data/Null/NullPresenceData.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenSim.Framework; 34using OpenSim.Framework;
33using OpenSim.Data; 35using OpenSim.Data;
@@ -36,6 +38,8 @@ namespace OpenSim.Data.Null
36{ 38{
37 public class NullPresenceData : IPresenceData 39 public class NullPresenceData : IPresenceData
38 { 40 {
41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
39 private static NullPresenceData Instance; 43 private static NullPresenceData Instance;
40 44
41 Dictionary<UUID, PresenceData> m_presenceData = new Dictionary<UUID, PresenceData>(); 45 Dictionary<UUID, PresenceData> m_presenceData = new Dictionary<UUID, PresenceData>();
@@ -48,20 +52,25 @@ namespace OpenSim.Data.Null
48 52
49 //Console.WriteLine("[XXX] NullRegionData constructor"); 53 //Console.WriteLine("[XXX] NullRegionData constructor");
50 // Let's stick in a test presence 54 // Let's stick in a test presence
55 /*
51 PresenceData p = new PresenceData(); 56 PresenceData p = new PresenceData();
52 p.SessionID = UUID.Zero; 57 p.SessionID = UUID.Zero;
53 p.UserID = UUID.Zero.ToString(); 58 p.UserID = UUID.Zero.ToString();
54 p.Data = new Dictionary<string, string>(); 59 p.Data = new Dictionary<string, string>();
55 p.Data["Online"] = true.ToString(); 60 p.Data["Online"] = true.ToString();
56 m_presenceData.Add(UUID.Zero, p); 61 m_presenceData.Add(UUID.Zero, p);
62 */
57 } 63 }
58 } 64 }
59 65
60 public bool Store(PresenceData data) 66 public bool Store(PresenceData data)
61 { 67 {
62 if (Instance != this) 68 if (Instance != this)
63 return Instance.Store(data); 69 return Instance.Store(data);
64 70
71// m_log.DebugFormat("[NULL PRESENCE DATA]: Storing presence {0}", data.UserID);
72// Console.WriteLine("HOME for " + data.UserID + " is " + (data.Data.ContainsKey("HomeRegionID") ? data.Data["HomeRegionID"] : "Not found"));
73
65 m_presenceData[data.SessionID] = data; 74 m_presenceData[data.SessionID] = data;
66 return true; 75 return true;
67 } 76 }
@@ -100,6 +109,7 @@ namespace OpenSim.Data.Null
100 { 109 {
101 if (Instance != this) 110 if (Instance != this)
102 return Instance.ReportAgent(sessionID, regionID, position, lookAt); 111 return Instance.ReportAgent(sessionID, regionID, position, lookAt);
112
103 if (m_presenceData.ContainsKey(sessionID)) 113 if (m_presenceData.ContainsKey(sessionID))
104 { 114 {
105 m_presenceData[sessionID].RegionID = regionID; 115 m_presenceData[sessionID].RegionID = regionID;
@@ -112,7 +122,7 @@ namespace OpenSim.Data.Null
112 } 122 }
113 123
114 public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) 124 public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
115 { 125 {
116 if (Instance != this) 126 if (Instance != this)
117 return Instance.SetHomeLocation(userID, regionID, position, lookAt); 127 return Instance.SetHomeLocation(userID, regionID, position, lookAt);
118 128
@@ -121,27 +131,40 @@ namespace OpenSim.Data.Null
121 { 131 {
122 if (p.UserID == userID) 132 if (p.UserID == userID)
123 { 133 {
134// m_log.DebugFormat(
135// "[NULL PRESENCE DATA]: Setting home location {0} {1} {2} for {3}",
136// regionID, position, lookAt, p.UserID);
137
124 p.Data["HomeRegionID"] = regionID.ToString(); 138 p.Data["HomeRegionID"] = regionID.ToString();
125 p.Data["HomePosition"] = position.ToString(); 139 p.Data["HomePosition"] = position.ToString();
126 p.Data["HomeLookAt"] = lookAt.ToString(); 140 p.Data["HomeLookAt"] = lookAt.ToString();
127 foundone = true; 141 foundone = true;
128 } 142 }
129 } 143 }
130 144
131 return foundone; 145 return foundone;
132 } 146 }
133 147
134 public PresenceData[] Get(string field, string data) 148 public PresenceData[] Get(string field, string data)
135 { 149 {
136 if (Instance != this) 150 if (Instance != this)
137 return Instance.Get(field, data); 151 return Instance.Get(field, data);
138 152
153// m_log.DebugFormat(
154// "[NULL PRESENCE DATA]: Getting presence data for field {0} with parameter {1}", field, data);
155
139 List<PresenceData> presences = new List<PresenceData>(); 156 List<PresenceData> presences = new List<PresenceData>();
140 if (field == "UserID") 157 if (field == "UserID")
141 { 158 {
142 foreach (PresenceData p in m_presenceData.Values) 159 foreach (PresenceData p in m_presenceData.Values)
143 if (p.UserID == data) 160 {
144 presences.Add(p); 161 if (p.UserID == data)
162 {
163 presences.Add(p);
164// Console.WriteLine("HOME for " + p.UserID + " is " + (p.Data.ContainsKey("HomeRegionID") ? p.Data["HomeRegionID"] : "Not found"));
165 }
166 }
167
145 return presences.ToArray(); 168 return presences.ToArray();
146 } 169 }
147 else if (field == "SessionID") 170 else if (field == "SessionID")
@@ -180,36 +203,46 @@ namespace OpenSim.Data.Null
180 } 203 }
181 204
182 public void Prune(string userID) 205 public void Prune(string userID)
183 { 206 {
184 if (Instance != this) 207 if (Instance != this)
185 { 208 {
186 Instance.Prune(userID); 209 Instance.Prune(userID);
187 return; 210 return;
188 } 211 }
189 212
213// m_log.DebugFormat("[NULL PRESENCE DATA]: Prune called for {0}", userID);
214
190 List<UUID> deleteSessions = new List<UUID>(); 215 List<UUID> deleteSessions = new List<UUID>();
191 int online = 0; 216 int online = 0;
192 217
193 foreach (KeyValuePair<UUID, PresenceData> kvp in m_presenceData) 218 foreach (KeyValuePair<UUID, PresenceData> kvp in m_presenceData)
194 { 219 {
220// m_log.DebugFormat("Online: {0}", kvp.Value.Data["Online"]);
221
195 bool on = false; 222 bool on = false;
196 if (bool.TryParse(kvp.Value.Data["Online"], out on) && on) 223 if (bool.TryParse(kvp.Value.Data["Online"], out on) && on)
197 online++; 224 online++;
198 else 225 else
199 deleteSessions.Add(kvp.Key); 226 deleteSessions.Add(kvp.Key);
200 } 227 }
228
229// m_log.DebugFormat("[NULL PRESENCE DATA]: online [{0}], deleteSession.Count [{1}]", online, deleteSessions.Count);
230
231 // Leave one session behind so that we can pick up details such as home location
201 if (online == 0 && deleteSessions.Count > 0) 232 if (online == 0 && deleteSessions.Count > 0)
202 deleteSessions.RemoveAt(0); 233 deleteSessions.RemoveAt(0);
203 234
204 foreach (UUID s in deleteSessions) 235 foreach (UUID s in deleteSessions)
205 m_presenceData.Remove(s); 236 m_presenceData.Remove(s);
206
207 } 237 }
208 238
209 public bool Delete(string field, string data) 239 public bool Delete(string field, string data)
210 { 240 {
241// m_log.DebugFormat(
242// "[NULL PRESENCE DATA]: Deleting presence data for field {0} with parameter {1}", field, data);
243
211 if (Instance != this) 244 if (Instance != this)
212 return Delete(field, data); 245 return Instance.Delete(field, data);
213 246
214 List<UUID> presences = new List<UUID>(); 247 List<UUID> presences = new List<UUID>();
215 if (field == "UserID") 248 if (field == "UserID")
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index 9d5c30a..ff5f8b9 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -1,4 +1,5 @@
1using System; 1using System;
2using System.Collections.Generic;
2using OpenMetaverse; 3using OpenMetaverse;
3 4
4namespace OpenSim.Framework 5namespace OpenSim.Framework
@@ -181,5 +182,101 @@ namespace OpenSim.Framework
181 } 182 }
182 183
183 #endregion SL / file extension / content-type conversions 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 }
184 } 281 }
185} 282} \ No newline at end of file
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index 655c5ca..8f19417 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 ac04462..f0d346f 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -110,21 +110,24 @@ namespace OpenSim.Region.Framework.Scenes
110 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; 110 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
111 111
112 /// <summary> 112 /// <summary>
113 /// Called when an object is touched/grabbed. 113 /// Fired when an object is touched/grabbed.
114 /// </summary> 114 /// </summary>
115 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of 115 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
116 /// the root part. 116 /// the root part.
117 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
118 public event ObjectGrabDelegate OnObjectGrab; 117 public event ObjectGrabDelegate OnObjectGrab;
118 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
119 119
120 public event ObjectGrabDelegate OnObjectGrabbing; 120 public event ObjectGrabDelegate OnObjectGrabbing;
121 public event ObjectDeGrabDelegate OnObjectDeGrab; 121 public event ObjectDeGrabDelegate OnObjectDeGrab;
122 public event ScriptResetDelegate OnScriptReset; 122 public event ScriptResetDelegate OnScriptReset;
123 123
124 public event OnPermissionErrorDelegate OnPermissionError; 124 public event OnPermissionErrorDelegate OnPermissionError;
125 125
126 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); 126 /// <summary>
127 /// Fired when a new script is created.
128 /// </summary>
127 public event NewRezScript OnRezScript; 129 public event NewRezScript OnRezScript;
130 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
128 131
129 public delegate void RemoveScript(uint localID, UUID itemID); 132 public delegate void RemoveScript(uint localID, UUID itemID);
130 public event RemoveScript OnRemoveScript; 133 public event RemoveScript OnRemoveScript;
@@ -166,38 +169,35 @@ namespace OpenSim.Region.Framework.Scenes
166 169
167 public delegate void ClientClosed(UUID clientID, Scene scene); 170 public delegate void ClientClosed(UUID clientID, Scene scene);
168 171
169 public event ClientClosed OnClientClosed; 172 public event ClientClosed OnClientClosed;
170
171 public delegate void ScriptChangedEvent(uint localID, uint change);
172 173
174 /// <summary>
175 /// This is fired when a scene object property that a script might be interested in (such as color, scale or
176 /// inventory) changes. Only enough information is sent for the LSL changed event
177 /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed)
178 /// </summary>
173 public event ScriptChangedEvent OnScriptChangedEvent; 179 public event ScriptChangedEvent OnScriptChangedEvent;
180 public delegate void ScriptChangedEvent(uint localID, uint change);
174 181
175 public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed); 182 public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed);
176
177 public event ScriptControlEvent OnScriptControlEvent; 183 public event ScriptControlEvent OnScriptControlEvent;
178 184
179 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 185 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
180
181 public event ScriptAtTargetEvent OnScriptAtTargetEvent; 186 public event ScriptAtTargetEvent OnScriptAtTargetEvent;
182 187
183 public delegate void ScriptNotAtTargetEvent(uint localID); 188 public delegate void ScriptNotAtTargetEvent(uint localID);
184
185 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; 189 public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
186 190
187 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); 191 public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
188
189 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; 192 public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
190 193
191 public delegate void ScriptNotAtRotTargetEvent(uint localID); 194 public delegate void ScriptNotAtRotTargetEvent(uint localID);
192
193 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; 195 public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
194 196
195 public delegate void ScriptColliding(uint localID, ColliderArgs colliders); 197 public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
196
197 public event ScriptColliding OnScriptColliderStart; 198 public event ScriptColliding OnScriptColliderStart;
198 public event ScriptColliding OnScriptColliding; 199 public event ScriptColliding OnScriptColliding;
199 public event ScriptColliding OnScriptCollidingEnd; 200 public event ScriptColliding OnScriptCollidingEnd;
200
201 public event ScriptColliding OnScriptLandColliderStart; 201 public event ScriptColliding OnScriptLandColliderStart;
202 public event ScriptColliding OnScriptLandColliding; 202 public event ScriptColliding OnScriptLandColliding;
203 public event ScriptColliding OnScriptLandColliderEnd; 203 public event ScriptColliding OnScriptLandColliderEnd;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 04e3221..77bf6fe 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -637,7 +637,6 @@ namespace OpenSim.Region.Framework.Scenes
637 m_items[item.ItemID] = item; 637 m_items[item.ItemID] = item;
638 m_inventorySerial++; 638 m_inventorySerial++;
639 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 639 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
640
641 HasInventoryChanged = true; 640 HasInventoryChanged = true;
642 m_part.ParentGroup.HasGroupChanged = true; 641 m_part.ParentGroup.HasGroupChanged = true;
643 642
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index dc4249c..974f91b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9705,90 +9705,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9705 9705
9706 Notecard nc = new Notecard(); 9706 Notecard nc = new Notecard();
9707 nc.lastRef = DateTime.Now; 9707 nc.lastRef = DateTime.Now;
9708 nc.text = ParseText(text.Replace("\r", "").Split('\n')); 9708 nc.text = SLUtil.ParseNotecardToList(text).ToArray();
9709 m_Notecards[assetID] = nc; 9709 m_Notecards[assetID] = nc;
9710 } 9710 }
9711 } 9711 }
9712 9712
9713 protected static string[] ParseText(string[] input)
9714 {
9715 int idx = 0;
9716 int level = 0;
9717 List<string> output = new List<string>();
9718 string[] words;
9719
9720 while (idx < input.Length)
9721 {
9722 if (input[idx] == "{")
9723 {
9724 level++;
9725 idx++;
9726 continue;
9727 }
9728
9729 if (input[idx]== "}")
9730 {
9731 level--;
9732 idx++;
9733 continue;
9734 }
9735
9736 switch (level)
9737 {
9738 case 0:
9739 words = input[idx].Split(' '); // Linden text ver
9740 // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
9741 if (words.Length < 3)
9742 return new String[0];
9743
9744 int version = int.Parse(words[3]);
9745 if (version != 2)
9746 return new String[0];
9747 break;
9748 case 1:
9749 words = input[idx].Split(' ');
9750 if (words[0] == "LLEmbeddedItems")
9751 break;
9752 if (words[0] == "Text")
9753 {
9754 int len = int.Parse(words[2]);
9755 idx++;
9756
9757 int count = -1;
9758
9759 while (count < len)
9760 {
9761 // int l = input[idx].Length;
9762 string ln = input[idx];
9763
9764 int need = len-count-1;
9765 if (ln.Length > need)
9766 ln = ln.Substring(0, need);
9767
9768 output.Add(ln);
9769 count += ln.Length + 1;
9770 idx++;
9771 }
9772
9773 return output.ToArray();
9774 }
9775 break;
9776 case 2:
9777 words = input[idx].Split(' '); // count
9778 if (words[0] == "count")
9779 {
9780 int c = int.Parse(words[1]);
9781 if (c > 0)
9782 return new String[0];
9783 break;
9784 }
9785 break;
9786 }
9787 idx++;
9788 }
9789 return output.ToArray();
9790 }
9791
9792 public static bool IsCached(UUID assetID) 9713 public static bool IsCached(UUID assetID)
9793 { 9714 {
9794 lock (m_Notecards) 9715 lock (m_Notecards)
@@ -9844,4 +9765,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9844 } 9765 }
9845 } 9766 }
9846 } 9767 }
9847} 9768} \ No newline at end of file
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index ee93f73..ae729f8 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -279,7 +279,31 @@ namespace OpenSim.Services.LLLoginService
279 279
280 GridRegion region = null; 280 GridRegion region = null;
281 281
282 if (pinfo.HomeRegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.HomeRegionID)) == null) 282 bool tryDefaults = false;
283
284 if (pinfo.HomeRegionID.Equals(UUID.Zero))
285 {
286 m_log.WarnFormat(
287 "[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
288 account.FirstName, account.LastName);
289
290 tryDefaults = true;
291 }
292 else
293 {
294 region = m_GridService.GetRegionByUUID(account.ScopeID, pinfo.HomeRegionID);
295
296 if (null == region)
297 {
298 m_log.WarnFormat(
299 "[LLOGIN SERVICE]: User {0} {1} has a recorded home region of {2} but this cannot be found by the grid service",
300 account.FirstName, account.LastName, pinfo.HomeRegionID);
301
302 tryDefaults = true;
303 }
304 }
305
306 if (tryDefaults)
283 { 307 {
284 List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); 308 List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID);
285 if (defaults != null && defaults.Count > 0) 309 if (defaults != null && defaults.Count > 0)
@@ -288,7 +312,8 @@ namespace OpenSim.Services.LLLoginService
288 where = "safe"; 312 where = "safe";
289 } 313 }
290 else 314 else
291 m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a home set and this grid does not have default locations.", 315 m_log.WarnFormat(
316 "[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations.",
292 account.FirstName, account.LastName); 317 account.FirstName, account.LastName);
293 } 318 }
294 319
@@ -318,8 +343,8 @@ namespace OpenSim.Services.LLLoginService
318 position = pinfo.Position; 343 position = pinfo.Position;
319 lookAt = pinfo.LookAt; 344 lookAt = pinfo.LookAt;
320 } 345 }
346
321 return region; 347 return region;
322
323 } 348 }
324 else 349 else
325 { 350 {