diff options
34 files changed, 1260 insertions, 429 deletions
diff --git a/.nant/local.include b/.nant/local.include index 29674ab..114c12d 100644 --- a/.nant/local.include +++ b/.nant/local.include | |||
@@ -85,6 +85,8 @@ | |||
85 | </exec> | 85 | </exec> |
86 | <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" /> | 86 | <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" /> |
87 | 87 | ||
88 | <delete dir="%temp%"/> | ||
89 | |||
88 | </target> | 90 | </target> |
89 | 91 | ||
90 | <target name="test-cov" depends="build"> | 92 | <target name="test-cov" depends="build"> |
diff --git a/OpenSim/Data/IGridUserData.cs b/OpenSim/Data/IGridUserData.cs new file mode 100644 index 0000000..abd2cef --- /dev/null +++ b/OpenSim/Data/IGridUserData.cs | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Data | ||
34 | { | ||
35 | // This MUST be a ref type! | ||
36 | public class GridUserData | ||
37 | { | ||
38 | public string UserID; | ||
39 | public Dictionary<string, string> Data; | ||
40 | } | ||
41 | |||
42 | /// <summary> | ||
43 | /// An interface for connecting to the user grid datastore | ||
44 | /// </summary> | ||
45 | public interface IGridUserData | ||
46 | { | ||
47 | GridUserData GetGridUserData(string userID); | ||
48 | bool StoreGridUserData(GridUserData data); | ||
49 | } | ||
50 | } \ No newline at end of file | ||
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index b170dde..756b42d 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -197,8 +197,7 @@ namespace OpenSim.Data.MySQL | |||
197 | public virtual T[] Get(string where) | 197 | public virtual T[] Get(string where) |
198 | { | 198 | { |
199 | using (MySqlCommand cmd = new MySqlCommand()) | 199 | using (MySqlCommand cmd = new MySqlCommand()) |
200 | { | 200 | { |
201 | |||
202 | string query = String.Format("select * from {0} where {1}", | 201 | string query = String.Format("select * from {0} where {1}", |
203 | m_Realm, where); | 202 | m_Realm, where); |
204 | 203 | ||
diff --git a/OpenSim/Data/MySQL/MySQLGridUserData.cs b/OpenSim/Data/MySQL/MySQLGridUserData.cs new file mode 100644 index 0000000..15834d2 --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLGridUserData.cs | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using MySql.Data.MySqlClient; | ||
37 | |||
38 | namespace OpenSim.Data.MySQL | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A MySQL Interface for user grid data | ||
42 | /// </summary> | ||
43 | public class MySQLGridUserData : MySQLGenericTableHandler<GridUserData>, IGridUserData | ||
44 | { | ||
45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "UserGrid") {} | ||
48 | |||
49 | public GridUserData GetGridUserData(string userID) | ||
50 | { | ||
51 | GridUserData[] ret = Get("UserID", userID); | ||
52 | |||
53 | if (ret.Length == 0) | ||
54 | return null; | ||
55 | |||
56 | return ret[0]; | ||
57 | } | ||
58 | |||
59 | public bool StoreGridUserData(GridUserData data) | ||
60 | { | ||
61 | return Store(data); | ||
62 | } | ||
63 | } | ||
64 | } \ No newline at end of file | ||
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..9fc4595 100644 --- a/OpenSim/Data/Null/NullPresenceData.cs +++ b/OpenSim/Data/Null/NullPresenceData.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | ||
32 | using log4net; | ||
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
33 | using OpenSim.Data; | 35 | using 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>(); |
@@ -47,21 +51,17 @@ namespace OpenSim.Data.Null | |||
47 | Instance = this; | 51 | Instance = this; |
48 | 52 | ||
49 | //Console.WriteLine("[XXX] NullRegionData constructor"); | 53 | //Console.WriteLine("[XXX] NullRegionData constructor"); |
50 | // Let's stick in a test presence | ||
51 | PresenceData p = new PresenceData(); | ||
52 | p.SessionID = UUID.Zero; | ||
53 | p.UserID = UUID.Zero.ToString(); | ||
54 | p.Data = new Dictionary<string, string>(); | ||
55 | p.Data["Online"] = true.ToString(); | ||
56 | m_presenceData.Add(UUID.Zero, p); | ||
57 | } | 54 | } |
58 | } | 55 | } |
59 | 56 | ||
60 | public bool Store(PresenceData data) | 57 | public bool Store(PresenceData data) |
61 | { | 58 | { |
62 | if (Instance != this) | 59 | if (Instance != this) |
63 | return Instance.Store(data); | 60 | return Instance.Store(data); |
64 | 61 | ||
62 | // m_log.DebugFormat("[NULL PRESENCE DATA]: Storing presence {0}", data.UserID); | ||
63 | // Console.WriteLine("HOME for " + data.UserID + " is " + (data.Data.ContainsKey("HomeRegionID") ? data.Data["HomeRegionID"] : "Not found")); | ||
64 | |||
65 | m_presenceData[data.SessionID] = data; | 65 | m_presenceData[data.SessionID] = data; |
66 | return true; | 66 | return true; |
67 | } | 67 | } |
@@ -100,6 +100,7 @@ namespace OpenSim.Data.Null | |||
100 | { | 100 | { |
101 | if (Instance != this) | 101 | if (Instance != this) |
102 | return Instance.ReportAgent(sessionID, regionID, position, lookAt); | 102 | return Instance.ReportAgent(sessionID, regionID, position, lookAt); |
103 | |||
103 | if (m_presenceData.ContainsKey(sessionID)) | 104 | if (m_presenceData.ContainsKey(sessionID)) |
104 | { | 105 | { |
105 | m_presenceData[sessionID].RegionID = regionID; | 106 | m_presenceData[sessionID].RegionID = regionID; |
@@ -112,7 +113,7 @@ namespace OpenSim.Data.Null | |||
112 | } | 113 | } |
113 | 114 | ||
114 | public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | 115 | public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) |
115 | { | 116 | { |
116 | if (Instance != this) | 117 | if (Instance != this) |
117 | return Instance.SetHomeLocation(userID, regionID, position, lookAt); | 118 | return Instance.SetHomeLocation(userID, regionID, position, lookAt); |
118 | 119 | ||
@@ -121,27 +122,40 @@ namespace OpenSim.Data.Null | |||
121 | { | 122 | { |
122 | if (p.UserID == userID) | 123 | if (p.UserID == userID) |
123 | { | 124 | { |
125 | // m_log.DebugFormat( | ||
126 | // "[NULL PRESENCE DATA]: Setting home location {0} {1} {2} for {3}", | ||
127 | // regionID, position, lookAt, p.UserID); | ||
128 | |||
124 | p.Data["HomeRegionID"] = regionID.ToString(); | 129 | p.Data["HomeRegionID"] = regionID.ToString(); |
125 | p.Data["HomePosition"] = position.ToString(); | 130 | p.Data["HomePosition"] = position.ToString(); |
126 | p.Data["HomeLookAt"] = lookAt.ToString(); | 131 | p.Data["HomeLookAt"] = lookAt.ToString(); |
127 | foundone = true; | 132 | foundone = true; |
128 | } | 133 | } |
129 | } | 134 | } |
130 | 135 | ||
131 | return foundone; | 136 | return foundone; |
132 | } | 137 | } |
133 | 138 | ||
134 | public PresenceData[] Get(string field, string data) | 139 | public PresenceData[] Get(string field, string data) |
135 | { | 140 | { |
136 | if (Instance != this) | 141 | if (Instance != this) |
137 | return Instance.Get(field, data); | 142 | return Instance.Get(field, data); |
138 | 143 | ||
144 | // m_log.DebugFormat( | ||
145 | // "[NULL PRESENCE DATA]: Getting presence data for field {0} with parameter {1}", field, data); | ||
146 | |||
139 | List<PresenceData> presences = new List<PresenceData>(); | 147 | List<PresenceData> presences = new List<PresenceData>(); |
140 | if (field == "UserID") | 148 | if (field == "UserID") |
141 | { | 149 | { |
142 | foreach (PresenceData p in m_presenceData.Values) | 150 | foreach (PresenceData p in m_presenceData.Values) |
143 | if (p.UserID == data) | 151 | { |
144 | presences.Add(p); | 152 | if (p.UserID == data) |
153 | { | ||
154 | presences.Add(p); | ||
155 | // Console.WriteLine("HOME for " + p.UserID + " is " + (p.Data.ContainsKey("HomeRegionID") ? p.Data["HomeRegionID"] : "Not found")); | ||
156 | } | ||
157 | } | ||
158 | |||
145 | return presences.ToArray(); | 159 | return presences.ToArray(); |
146 | } | 160 | } |
147 | else if (field == "SessionID") | 161 | else if (field == "SessionID") |
@@ -180,36 +194,46 @@ namespace OpenSim.Data.Null | |||
180 | } | 194 | } |
181 | 195 | ||
182 | public void Prune(string userID) | 196 | public void Prune(string userID) |
183 | { | 197 | { |
184 | if (Instance != this) | 198 | if (Instance != this) |
185 | { | 199 | { |
186 | Instance.Prune(userID); | 200 | Instance.Prune(userID); |
187 | return; | 201 | return; |
188 | } | 202 | } |
189 | 203 | ||
204 | // m_log.DebugFormat("[NULL PRESENCE DATA]: Prune called for {0}", userID); | ||
205 | |||
190 | List<UUID> deleteSessions = new List<UUID>(); | 206 | List<UUID> deleteSessions = new List<UUID>(); |
191 | int online = 0; | 207 | int online = 0; |
192 | 208 | ||
193 | foreach (KeyValuePair<UUID, PresenceData> kvp in m_presenceData) | 209 | foreach (KeyValuePair<UUID, PresenceData> kvp in m_presenceData) |
194 | { | 210 | { |
211 | // m_log.DebugFormat("Online: {0}", kvp.Value.Data["Online"]); | ||
212 | |||
195 | bool on = false; | 213 | bool on = false; |
196 | if (bool.TryParse(kvp.Value.Data["Online"], out on) && on) | 214 | if (bool.TryParse(kvp.Value.Data["Online"], out on) && on) |
197 | online++; | 215 | online++; |
198 | else | 216 | else |
199 | deleteSessions.Add(kvp.Key); | 217 | deleteSessions.Add(kvp.Key); |
200 | } | 218 | } |
219 | |||
220 | // m_log.DebugFormat("[NULL PRESENCE DATA]: online [{0}], deleteSession.Count [{1}]", online, deleteSessions.Count); | ||
221 | |||
222 | // Leave one session behind so that we can pick up details such as home location | ||
201 | if (online == 0 && deleteSessions.Count > 0) | 223 | if (online == 0 && deleteSessions.Count > 0) |
202 | deleteSessions.RemoveAt(0); | 224 | deleteSessions.RemoveAt(0); |
203 | 225 | ||
204 | foreach (UUID s in deleteSessions) | 226 | foreach (UUID s in deleteSessions) |
205 | m_presenceData.Remove(s); | 227 | m_presenceData.Remove(s); |
206 | |||
207 | } | 228 | } |
208 | 229 | ||
209 | public bool Delete(string field, string data) | 230 | public bool Delete(string field, string data) |
210 | { | 231 | { |
232 | // m_log.DebugFormat( | ||
233 | // "[NULL PRESENCE DATA]: Deleting presence data for field {0} with parameter {1}", field, data); | ||
234 | |||
211 | if (Instance != this) | 235 | if (Instance != this) |
212 | return Delete(field, data); | 236 | return Instance.Delete(field, data); |
213 | 237 | ||
214 | List<UUID> presences = new List<UUID>(); | 238 | List<UUID> presences = new List<UUID>(); |
215 | if (field == "UserID") | 239 | if (field == "UserID") |
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index 9d5c30a..81d82be 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs | |||
@@ -1,10 +1,15 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
3 | using System.Reflection; | ||
4 | using log4net; | ||
2 | using OpenMetaverse; | 5 | using OpenMetaverse; |
3 | 6 | ||
4 | namespace OpenSim.Framework | 7 | namespace OpenSim.Framework |
5 | { | 8 | { |
6 | public static class SLUtil | 9 | public static class SLUtil |
7 | { | 10 | { |
11 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
12 | |||
8 | #region SL / file extension / content-type conversions | 13 | #region SL / file extension / content-type conversions |
9 | 14 | ||
10 | public static string SLAssetTypeToContentType(int assetType) | 15 | public static string SLAssetTypeToContentType(int assetType) |
@@ -181,5 +186,107 @@ namespace OpenSim.Framework | |||
181 | } | 186 | } |
182 | 187 | ||
183 | #endregion SL / file extension / content-type conversions | 188 | #endregion SL / file extension / content-type conversions |
189 | |||
190 | /// <summary> | ||
191 | /// Parse a notecard in Linden format to a string of ordinary text. | ||
192 | /// </summary> | ||
193 | /// <param name="rawInput"></param> | ||
194 | /// <returns></returns> | ||
195 | public static string ParseNotecardToString(string rawInput) | ||
196 | { | ||
197 | string[] output = ParseNotecardToList(rawInput).ToArray(); | ||
198 | |||
199 | // foreach (string line in output) | ||
200 | // m_log.DebugFormat("[PARSE NOTECARD]: ParseNotecardToString got line {0}", line); | ||
201 | |||
202 | return string.Join("\n", output); | ||
203 | } | ||
204 | |||
205 | /// <summary> | ||
206 | /// Parse a notecard in Linden format to a list of ordinary lines. | ||
207 | /// </summary> | ||
208 | /// <param name="rawInput"></param> | ||
209 | /// <returns></returns> | ||
210 | public static List<string> ParseNotecardToList(string rawInput) | ||
211 | { | ||
212 | string[] input = rawInput.Replace("\r", "").Split('\n'); | ||
213 | int idx = 0; | ||
214 | int level = 0; | ||
215 | List<string> output = new List<string>(); | ||
216 | string[] words; | ||
217 | |||
218 | while (idx < input.Length) | ||
219 | { | ||
220 | if (input[idx] == "{") | ||
221 | { | ||
222 | level++; | ||
223 | idx++; | ||
224 | continue; | ||
225 | } | ||
226 | |||
227 | if (input[idx]== "}") | ||
228 | { | ||
229 | level--; | ||
230 | idx++; | ||
231 | continue; | ||
232 | } | ||
233 | |||
234 | switch (level) | ||
235 | { | ||
236 | case 0: | ||
237 | words = input[idx].Split(' '); // Linden text ver | ||
238 | // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard) | ||
239 | if (words.Length < 3) | ||
240 | return output; | ||
241 | |||
242 | int version = int.Parse(words[3]); | ||
243 | if (version != 2) | ||
244 | return output; | ||
245 | break; | ||
246 | case 1: | ||
247 | words = input[idx].Split(' '); | ||
248 | if (words[0] == "LLEmbeddedItems") | ||
249 | break; | ||
250 | if (words[0] == "Text") | ||
251 | { | ||
252 | int len = int.Parse(words[2]); | ||
253 | idx++; | ||
254 | |||
255 | int count = -1; | ||
256 | |||
257 | while (count < len) | ||
258 | { | ||
259 | // int l = input[idx].Length; | ||
260 | string ln = input[idx]; | ||
261 | |||
262 | int need = len-count-1; | ||
263 | if (ln.Length > need) | ||
264 | ln = ln.Substring(0, need); | ||
265 | |||
266 | // m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln); | ||
267 | output.Add(ln); | ||
268 | count += ln.Length + 1; | ||
269 | idx++; | ||
270 | } | ||
271 | |||
272 | return output; | ||
273 | } | ||
274 | break; | ||
275 | case 2: | ||
276 | words = input[idx].Split(' '); // count | ||
277 | if (words[0] == "count") | ||
278 | { | ||
279 | int c = int.Parse(words[1]); | ||
280 | if (c > 0) | ||
281 | return output; | ||
282 | break; | ||
283 | } | ||
284 | break; | ||
285 | } | ||
286 | idx++; | ||
287 | } | ||
288 | |||
289 | return output; | ||
290 | } | ||
184 | } | 291 | } |
185 | } | 292 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 655c5ca..4ca6595 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs | |||
@@ -42,6 +42,8 @@ namespace OpenSim | |||
42 | /// </summary> | 42 | /// </summary> |
43 | public class ConfigurationLoader | 43 | public class ConfigurationLoader |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
45 | /// <summary> | 47 | /// <summary> |
46 | /// Various Config settings the region needs to start | 48 | /// Various Config settings the region needs to start |
47 | /// Physics Engine, Mesh Engine, GridMode, PhysicsPrim allowed, Neighbor, | 49 | /// Physics Engine, Mesh Engine, GridMode, PhysicsPrim allowed, Neighbor, |
@@ -61,17 +63,6 @@ namespace OpenSim | |||
61 | protected NetworkServersInfo m_networkServersInfo; | 63 | protected NetworkServersInfo m_networkServersInfo; |
62 | 64 | ||
63 | /// <summary> | 65 | /// <summary> |
64 | /// Console logger | ||
65 | /// </summary> | ||
66 | private static readonly ILog m_log = | ||
67 | LogManager.GetLogger( | ||
68 | MethodBase.GetCurrentMethod().DeclaringType); | ||
69 | |||
70 | public ConfigurationLoader() | ||
71 | { | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// Loads the region configuration | 66 | /// Loads the region configuration |
76 | /// </summary> | 67 | /// </summary> |
77 | /// <param name="argvSource">Parameters passed into the process when started</param> | 68 | /// <param name="argvSource">Parameters passed into the process when started</param> |
@@ -164,12 +155,12 @@ namespace OpenSim | |||
164 | m_config.Source = new IniConfigSource(); | 155 | m_config.Source = new IniConfigSource(); |
165 | m_config.Source.Merge(DefaultConfig()); | 156 | m_config.Source.Merge(DefaultConfig()); |
166 | 157 | ||
167 | m_log.Info("[CONFIG] Reading configuration settings"); | 158 | m_log.Info("[CONFIG]: Reading configuration settings"); |
168 | 159 | ||
169 | if (sources.Count == 0) | 160 | if (sources.Count == 0) |
170 | { | 161 | { |
171 | m_log.FatalFormat("[CONFIG] Could not load any configuration"); | 162 | 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?"); | 163 | m_log.FatalFormat("[CONFIG]: Did you copy the OpenSim.ini.example file to OpenSim.ini?"); |
173 | Environment.Exit(1); | 164 | Environment.Exit(1); |
174 | } | 165 | } |
175 | 166 | ||
@@ -182,13 +173,12 @@ namespace OpenSim | |||
182 | 173 | ||
183 | if (!iniFileExists) | 174 | if (!iniFileExists) |
184 | { | 175 | { |
185 | m_log.FatalFormat("[CONFIG] Could not load any configuration"); | 176 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); |
186 | m_log.FatalFormat("[CONFIG] Configuration exists, but there was an error loading it!"); | 177 | m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); |
187 | Environment.Exit(1); | 178 | Environment.Exit(1); |
188 | } | 179 | } |
189 | 180 | ||
190 | // Make sure command line options take precedence | 181 | // Make sure command line options take precedence |
191 | // | ||
192 | m_config.Source.Merge(argvSource); | 182 | m_config.Source.Merge(argvSource); |
193 | 183 | ||
194 | ReadConfigSettings(); | 184 | ReadConfigSettings(); |
@@ -257,20 +247,17 @@ namespace OpenSim | |||
257 | 247 | ||
258 | if (!IsUri(iniPath)) | 248 | if (!IsUri(iniPath)) |
259 | { | 249 | { |
260 | m_log.InfoFormat("[CONFIG] Reading configuration file {0}", | 250 | m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); |
261 | Path.GetFullPath(iniPath)); | ||
262 | 251 | ||
263 | m_config.Source.Merge(new IniConfigSource(iniPath)); | 252 | m_config.Source.Merge(new IniConfigSource(iniPath)); |
264 | success = true; | 253 | success = true; |
265 | } | 254 | } |
266 | else | 255 | else |
267 | { | 256 | { |
268 | m_log.InfoFormat("[CONFIG] {0} is a http:// URI, fetching ...", | 257 | m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", iniPath); |
269 | iniPath); | ||
270 | 258 | ||
271 | // The ini file path is a http URI | 259 | // The ini file path is a http URI |
272 | // Try to read it | 260 | // Try to read it |
273 | // | ||
274 | try | 261 | try |
275 | { | 262 | { |
276 | XmlReader r = XmlReader.Create(iniPath); | 263 | XmlReader r = XmlReader.Create(iniPath); |
@@ -281,7 +268,7 @@ namespace OpenSim | |||
281 | } | 268 | } |
282 | catch (Exception e) | 269 | catch (Exception e) |
283 | { | 270 | { |
284 | m_log.FatalFormat("[CONFIG] Exception reading config from URI {0}\n" + e.ToString(), iniPath); | 271 | m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), iniPath); |
285 | Environment.Exit(1); | 272 | Environment.Exit(1); |
286 | } | 273 | } |
287 | } | 274 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 55d9c9c..6232c48 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -144,6 +144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
144 | /// <summary>A reference to the LLUDPServer that is managing this client</summary> | 144 | /// <summary>A reference to the LLUDPServer that is managing this client</summary> |
145 | private readonly LLUDPServer m_udpServer; | 145 | private readonly LLUDPServer m_udpServer; |
146 | 146 | ||
147 | /// <summary>Caches packed throttle information</summary> | ||
148 | private byte[] m_packedThrottles; | ||
149 | |||
147 | private int m_defaultRTO = 3000; | 150 | private int m_defaultRTO = 3000; |
148 | private int m_maxRTO = 60000; | 151 | private int m_maxRTO = 60000; |
149 | 152 | ||
@@ -350,21 +353,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
350 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; | 353 | bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; |
351 | bucket.DripRate = texture; | 354 | bucket.DripRate = texture; |
352 | bucket.MaxBurst = texture; | 355 | bucket.MaxBurst = texture; |
356 | |||
357 | // Reset the packed throttles cached data | ||
358 | m_packedThrottles = null; | ||
353 | } | 359 | } |
354 | 360 | ||
355 | public byte[] GetThrottlesPacked() | 361 | public byte[] GetThrottlesPacked() |
356 | { | 362 | { |
357 | byte[] data = new byte[7 * 4]; | 363 | byte[] data = m_packedThrottles; |
358 | int i = 0; | 364 | |
359 | 365 | if (data == null) | |
360 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate), 0, data, i, 4); i += 4; | 366 | { |
361 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate), 0, data, i, 4); i += 4; | 367 | data = new byte[7 * 4]; |
362 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate), 0, data, i, 4); i += 4; | 368 | int i = 0; |
363 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate), 0, data, i, 4); i += 4; | 369 | |
364 | Buffer.BlockCopy(Utils.FloatToBytes((float)(m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate) + | 370 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate), 0, data, i, 4); i += 4; |
365 | m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate), 0, data, i, 4); i += 4; | 371 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate), 0, data, i, 4); i += 4; |
366 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate), 0, data, i, 4); i += 4; | 372 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate), 0, data, i, 4); i += 4; |
367 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate), 0, data, i, 4); i += 4; | 373 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate), 0, data, i, 4); i += 4; |
374 | Buffer.BlockCopy(Utils.FloatToBytes((float)(m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate) + | ||
375 | m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate), 0, data, i, 4); i += 4; | ||
376 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate), 0, data, i, 4); i += 4; | ||
377 | Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate), 0, data, i, 4); i += 4; | ||
378 | |||
379 | m_packedThrottles = data; | ||
380 | } | ||
368 | 381 | ||
369 | return data; | 382 | return data; |
370 | } | 383 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs new file mode 100644 index 0000000..d458364 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using Nini.Config; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | |||
38 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | ||
39 | { | ||
40 | public class AttachmentsModule : IAttachmentsModule, IRegionModule | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | protected Scene m_scene = null; | ||
45 | |||
46 | public void Initialise(Scene scene, IConfigSource source) | ||
47 | { | ||
48 | scene.RegisterModuleInterface<IAttachmentsModule>(this); | ||
49 | m_scene = scene; | ||
50 | } | ||
51 | |||
52 | public void PostInitialise() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public void Close() | ||
57 | { | ||
58 | } | ||
59 | |||
60 | public string Name | ||
61 | { | ||
62 | get { return "Attachments Module"; } | ||
63 | } | ||
64 | |||
65 | public bool IsSharedModule | ||
66 | { | ||
67 | get { return false; } | ||
68 | } | ||
69 | |||
70 | public bool AttachObject( | ||
71 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) | ||
72 | { | ||
73 | SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); | ||
74 | if (group != null) | ||
75 | { | ||
76 | if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) | ||
77 | { | ||
78 | // If the attachment point isn't the same as the one previously used | ||
79 | // set it's offset position = 0 so that it appears on the attachment point | ||
80 | // and not in a weird location somewhere unknown. | ||
81 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) | ||
82 | { | ||
83 | attachPos = Vector3.Zero; | ||
84 | } | ||
85 | |||
86 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | ||
87 | if (AttachmentPt == 0) | ||
88 | { | ||
89 | // Check object for stored attachment point | ||
90 | AttachmentPt = (uint)group.GetAttachmentPoint(); | ||
91 | } | ||
92 | |||
93 | // if we still didn't find a suitable attachment point....... | ||
94 | if (AttachmentPt == 0) | ||
95 | { | ||
96 | // Stick it on left hand with Zero Offset from the attachment point. | ||
97 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | ||
98 | attachPos = Vector3.Zero; | ||
99 | } | ||
100 | |||
101 | group.SetAttachmentPoint((byte)AttachmentPt); | ||
102 | group.AbsolutePosition = attachPos; | ||
103 | |||
104 | // Saves and gets itemID | ||
105 | UUID itemId; | ||
106 | |||
107 | if (group.GetFromItemID() == UUID.Zero) | ||
108 | { | ||
109 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); | ||
110 | } | ||
111 | else | ||
112 | { | ||
113 | itemId = group.GetFromItemID(); | ||
114 | } | ||
115 | |||
116 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); | ||
117 | |||
118 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | ||
119 | |||
120 | // In case it is later dropped again, don't let | ||
121 | // it get cleaned up | ||
122 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | ||
123 | group.HasGroupChanged = false; | ||
124 | } | ||
125 | else | ||
126 | { | ||
127 | remoteClient.SendAgentAlertMessage( | ||
128 | "You don't have sufficient permissions to attach this object", false); | ||
129 | |||
130 | return false; | ||
131 | } | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | m_log.DebugFormat("[ATTACHMENTS MODULE]: AttachObject found no such scene object {0}", objectLocalID); | ||
136 | return false; | ||
137 | } | ||
138 | |||
139 | return true; | ||
140 | } | ||
141 | |||
142 | public UUID SetAttachmentInventoryStatus( | ||
143 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
144 | { | ||
145 | m_log.DebugFormat( | ||
146 | "[ATTACHMENTS MODULEY]: Updating inventory of {0} to show attachment of {1} (item ID {2})", | ||
147 | remoteClient.Name, att.Name, itemID); | ||
148 | |||
149 | if (!att.IsDeleted) | ||
150 | AttachmentPt = att.RootPart.AttachmentPoint; | ||
151 | |||
152 | ScenePresence presence; | ||
153 | if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
154 | { | ||
155 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
156 | item = m_scene.InventoryService.GetItem(item); | ||
157 | |||
158 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
159 | } | ||
160 | |||
161 | return att.UUID; | ||
162 | } | ||
163 | |||
164 | /// <summary> | ||
165 | /// Update the user inventory to reflect an attachment | ||
166 | /// </summary> | ||
167 | /// <param name="remoteClient"></param> | ||
168 | /// <param name="AttachmentPt"></param> | ||
169 | /// <param name="itemID"></param> | ||
170 | /// <param name="att"></param> | ||
171 | public void SetAttachmentInventoryStatus( | ||
172 | IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | ||
173 | { | ||
174 | // m_log.DebugFormat( | ||
175 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", | ||
176 | // att.Name, remoteClient.Name, AttachmentPt, itemID); | ||
177 | |||
178 | if (UUID.Zero == itemID) | ||
179 | { | ||
180 | m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment. Error inventory item ID."); | ||
181 | return; | ||
182 | } | ||
183 | |||
184 | if (0 == AttachmentPt) | ||
185 | { | ||
186 | m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment. Error attachment point."); | ||
187 | return; | ||
188 | } | ||
189 | |||
190 | if (null == att.RootPart) | ||
191 | { | ||
192 | m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment for a prim without the rootpart!"); | ||
193 | return; | ||
194 | } | ||
195 | |||
196 | ScenePresence presence; | ||
197 | if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
198 | { | ||
199 | // XXYY!! | ||
200 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
201 | item = m_scene.InventoryService.GetItem(item); | ||
202 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | ||
203 | |||
204 | if (m_scene.AvatarFactory != null) | ||
205 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) | ||
210 | { | ||
211 | ScenePresence presence; | ||
212 | if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
213 | { | ||
214 | presence.Appearance.DetachAttachment(itemID); | ||
215 | |||
216 | // Save avatar attachment information | ||
217 | if (m_scene.AvatarFactory != null) | ||
218 | { | ||
219 | m_log.Debug("[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID); | ||
220 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | DetachSingleAttachmentToInv(itemID, remoteClient); | ||
225 | } | ||
226 | |||
227 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | ||
228 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | ||
229 | protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | ||
230 | { | ||
231 | if (itemID == UUID.Zero) // If this happened, someone made a mistake.... | ||
232 | return; | ||
233 | |||
234 | // We can NOT use the dictionries here, as we are looking | ||
235 | // for an entity by the fromAssetID, which is NOT the prim UUID | ||
236 | List<EntityBase> detachEntities = m_scene.GetEntities(); | ||
237 | SceneObjectGroup group; | ||
238 | |||
239 | foreach (EntityBase entity in detachEntities) | ||
240 | { | ||
241 | if (entity is SceneObjectGroup) | ||
242 | { | ||
243 | group = (SceneObjectGroup)entity; | ||
244 | if (group.GetFromItemID() == itemID) | ||
245 | { | ||
246 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | ||
247 | group.DetachToInventoryPrep(); | ||
248 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | ||
249 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); | ||
250 | m_scene.DeleteSceneObject(group, false); | ||
251 | return; | ||
252 | } | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs new file mode 100644 index 0000000..d5fae23 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Region.Framework.Interfaces; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | |||
38 | using OpenMetaverse; | ||
39 | |||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | ||
41 | { | ||
42 | public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private IGridUserService m_service; | ||
47 | |||
48 | private bool m_Enabled = false; | ||
49 | |||
50 | public Type ReplaceableInterface | ||
51 | { | ||
52 | get { return null; } | ||
53 | } | ||
54 | |||
55 | public string Name | ||
56 | { | ||
57 | get { return "LocalGridUserServicesConnector"; } | ||
58 | } | ||
59 | |||
60 | public void Initialise(IConfigSource source) | ||
61 | { | ||
62 | IConfig moduleConfig = source.Configs["Modules"]; | ||
63 | if (moduleConfig != null) | ||
64 | { | ||
65 | string name = moduleConfig.GetString("GridUserServices", ""); | ||
66 | if (name == Name) | ||
67 | { | ||
68 | IConfig userConfig = source.Configs["GridUserService"]; | ||
69 | if (userConfig == null) | ||
70 | { | ||
71 | m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: GridUserService missing from ini files"); | ||
72 | return; | ||
73 | } | ||
74 | |||
75 | string serviceDll = userConfig.GetString("LocalServiceModule", String.Empty); | ||
76 | |||
77 | if (serviceDll == String.Empty) | ||
78 | { | ||
79 | m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: No LocalServiceModule named in section GridUserService"); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | Object[] args = new Object[] { source }; | ||
84 | m_service = ServerUtils.LoadPlugin<IGridUserService>(serviceDll, args); | ||
85 | |||
86 | if (m_service == null) | ||
87 | { | ||
88 | m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: Can't load GridUser service"); | ||
89 | return; | ||
90 | } | ||
91 | m_Enabled = true; | ||
92 | m_log.Info("[LOCAL GRID USER SERVICE CONNECTOR]: Local GridUser connector enabled"); | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | |||
97 | public void PostInitialise() | ||
98 | { | ||
99 | if (!m_Enabled) | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | public void Close() | ||
104 | { | ||
105 | if (!m_Enabled) | ||
106 | return; | ||
107 | } | ||
108 | |||
109 | public void AddRegion(Scene scene) | ||
110 | { | ||
111 | if (!m_Enabled) | ||
112 | return; | ||
113 | |||
114 | scene.RegisterModuleInterface<IGridUserService>(m_service); | ||
115 | } | ||
116 | |||
117 | public void RemoveRegion(Scene scene) | ||
118 | { | ||
119 | if (!m_Enabled) | ||
120 | return; | ||
121 | } | ||
122 | |||
123 | public void RegionLoaded(Scene scene) | ||
124 | { | ||
125 | if (!m_Enabled) | ||
126 | return; | ||
127 | } | ||
128 | |||
129 | public GridUserInfo GetGridUserInfo(string userID) | ||
130 | { | ||
131 | return m_service.GetGridUserInfo(userID); | ||
132 | } | ||
133 | |||
134 | public bool StoreGridUserInfo(GridUserInfo info) | ||
135 | { | ||
136 | return m_service.StoreGridUserInfo(info); | ||
137 | } | ||
138 | } | ||
139 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs index d78daf9..c402a3f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs | |||
@@ -47,7 +47,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
47 | private bool m_Enabled = false; | 47 | private bool m_Enabled = false; |
48 | 48 | ||
49 | private PresenceDetector m_PresenceDetector; | 49 | private PresenceDetector m_PresenceDetector; |
50 | private IPresenceService m_PresenceService; | 50 | |
51 | /// <summary> | ||
52 | /// Underlying presence service. Do not use directly. | ||
53 | /// </summary> | ||
54 | public IPresenceService m_PresenceService; | ||
51 | 55 | ||
52 | public LocalPresenceServicesConnector() | 56 | public LocalPresenceServicesConnector() |
53 | { | 57 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs index ca42461..292ff8e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs | |||
@@ -59,6 +59,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
59 | config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 59 | config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
60 | 60 | ||
61 | m_LocalConnector = new LocalPresenceServicesConnector(config); | 61 | m_LocalConnector = new LocalPresenceServicesConnector(config); |
62 | |||
63 | // Let's stick in a test presence | ||
64 | m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); | ||
62 | } | 65 | } |
63 | 66 | ||
64 | /// <summary> | 67 | /// <summary> |
@@ -68,6 +71,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
68 | public void TestPresenceV0_1() | 71 | public void TestPresenceV0_1() |
69 | { | 72 | { |
70 | SetUp(); | 73 | SetUp(); |
74 | |||
75 | // Let's stick in a test presence | ||
76 | /* | ||
77 | PresenceData p = new PresenceData(); | ||
78 | p.SessionID = UUID.Zero; | ||
79 | p.UserID = UUID.Zero.ToString(); | ||
80 | p.Data = new Dictionary<string, string>(); | ||
81 | p.Data["Online"] = true.ToString(); | ||
82 | m_presenceData.Add(UUID.Zero, p); | ||
83 | */ | ||
71 | 84 | ||
72 | string user1 = UUID.Zero.ToString(); | 85 | string user1 = UUID.Zero.ToString(); |
73 | UUID session1 = UUID.Zero; | 86 | UUID session1 = UUID.Zero; |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs new file mode 100644 index 0000000..367ff3d --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Interfaces | ||
34 | { | ||
35 | public interface IAttachmentsModule | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Attach an object to an avatar. | ||
39 | /// </summary> | ||
40 | /// <param name="controllingClient"></param> | ||
41 | /// <param name="localID"></param> | ||
42 | /// <param name="attachPoint"></param> | ||
43 | /// <param name="rot"></param> | ||
44 | /// <param name="pos"></param> | ||
45 | /// <param name="silent"></param> | ||
46 | /// <returns>true if the object was successfully attached, false otherwise</returns> | ||
47 | bool AttachObject( | ||
48 | IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Update the user inventory to the attachment of an item | ||
52 | /// </summary> | ||
53 | /// <param name="att"></param> | ||
54 | /// <param name="remoteClient"></param> | ||
55 | /// <param name="itemID"></param> | ||
56 | /// <param name="AttachmentPt"></param> | ||
57 | /// <returns></returns> | ||
58 | UUID SetAttachmentInventoryStatus( | ||
59 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt); | ||
60 | |||
61 | /// <summary> | ||
62 | /// Update the user inventory to show a detach. | ||
63 | /// </summary> | ||
64 | /// <param name="itemID"> | ||
65 | /// A <see cref="UUID"/> | ||
66 | /// </param> | ||
67 | /// <param name="remoteClient"> | ||
68 | /// A <see cref="IClientAPI"/> | ||
69 | /// </param> | ||
70 | void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); | ||
71 | } | ||
72 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 3cce53d..1650946 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/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9cbaffc..eb51019 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1862,39 +1862,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1862 | 1862 | ||
1863 | if (att == null) | 1863 | if (att == null) |
1864 | { | 1864 | { |
1865 | DetachSingleAttachmentToInv(itemID, remoteClient); | 1865 | AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient); |
1866 | return UUID.Zero; | 1866 | return UUID.Zero; |
1867 | } | 1867 | } |
1868 | 1868 | ||
1869 | return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt); | 1869 | return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); |
1870 | } | ||
1871 | |||
1872 | /// <summary> | ||
1873 | /// Update the user inventory to reflect an attachment | ||
1874 | /// </summary> | ||
1875 | /// <param name="att"></param> | ||
1876 | /// <param name="remoteClient"></param> | ||
1877 | /// <param name="itemID"></param> | ||
1878 | /// <param name="AttachmentPt"></param> | ||
1879 | /// <returns></returns> | ||
1880 | public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
1881 | { | ||
1882 | m_log.DebugFormat( | ||
1883 | "[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})", | ||
1884 | remoteClient.Name, att.Name, itemID); | ||
1885 | |||
1886 | if (!att.IsDeleted) | ||
1887 | AttachmentPt = att.RootPart.AttachmentPoint; | ||
1888 | |||
1889 | ScenePresence presence; | ||
1890 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
1891 | { | ||
1892 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
1893 | item = InventoryService.GetItem(item); | ||
1894 | |||
1895 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
1896 | } | ||
1897 | return att.UUID; | ||
1898 | } | 1870 | } |
1899 | 1871 | ||
1900 | public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, | 1872 | public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, |
@@ -1906,65 +1878,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1906 | } | 1878 | } |
1907 | } | 1879 | } |
1908 | 1880 | ||
1909 | /// <summary> | ||
1910 | /// Attach an object. | ||
1911 | /// </summary> | ||
1912 | /// <param name="controllingClient"></param> | ||
1913 | /// <param name="localID"></param> | ||
1914 | /// <param name="attachPoint"></param> | ||
1915 | /// <param name="rot"></param> | ||
1916 | /// <param name="pos"></param> | ||
1917 | /// <param name="silent"></param> | ||
1918 | /// <returns>true if the object was successfully attached, false otherwise</returns> | ||
1919 | public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) | ||
1920 | { | ||
1921 | return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); | ||
1922 | } | ||
1923 | |||
1924 | /// <summary> | ||
1925 | /// This registers the item as attached in a user's inventory | ||
1926 | /// </summary> | ||
1927 | /// <param name="remoteClient"></param> | ||
1928 | /// <param name="AttachmentPt"></param> | ||
1929 | /// <param name="itemID"></param> | ||
1930 | /// <param name="att"></param> | ||
1931 | public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | ||
1932 | { | ||
1933 | // m_log.DebugFormat( | ||
1934 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", | ||
1935 | // att.Name, remoteClient.Name, AttachmentPt, itemID); | ||
1936 | |||
1937 | if (UUID.Zero == itemID) | ||
1938 | { | ||
1939 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); | ||
1940 | return; | ||
1941 | } | ||
1942 | |||
1943 | if (0 == AttachmentPt) | ||
1944 | { | ||
1945 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point."); | ||
1946 | return; | ||
1947 | } | ||
1948 | |||
1949 | if (null == att.RootPart) | ||
1950 | { | ||
1951 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!"); | ||
1952 | return; | ||
1953 | } | ||
1954 | |||
1955 | ScenePresence presence; | ||
1956 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
1957 | { | ||
1958 | // XXYY!! | ||
1959 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
1960 | item = InventoryService.GetItem(item); | ||
1961 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | ||
1962 | |||
1963 | if (m_AvatarFactory != null) | ||
1964 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
1965 | } | ||
1966 | } | ||
1967 | |||
1968 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) | 1881 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) |
1969 | { | 1882 | { |
1970 | SceneObjectPart part = GetSceneObjectPart(itemID); | 1883 | SceneObjectPart part = GetSceneObjectPart(itemID); |
@@ -1995,24 +1908,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1995 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); | 1908 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); |
1996 | } | 1909 | } |
1997 | 1910 | ||
1998 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | ||
1999 | { | ||
2000 | ScenePresence presence; | ||
2001 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
2002 | { | ||
2003 | presence.Appearance.DetachAttachment(itemID); | ||
2004 | |||
2005 | // Save avatar attachment information | ||
2006 | if (m_AvatarFactory != null) | ||
2007 | { | ||
2008 | m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID); | ||
2009 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
2010 | } | ||
2011 | } | ||
2012 | |||
2013 | m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient); | ||
2014 | } | ||
2015 | |||
2016 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 1911 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
2017 | { | 1912 | { |
2018 | EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); | 1913 | EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a84f966..388bc99 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -307,6 +307,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
307 | 307 | ||
308 | protected IXMLRPC m_xmlrpcModule; | 308 | protected IXMLRPC m_xmlrpcModule; |
309 | protected IWorldComm m_worldCommModule; | 309 | protected IWorldComm m_worldCommModule; |
310 | public IAttachmentsModule AttachmentsModule { get; set; } | ||
310 | protected IAvatarFactory m_AvatarFactory; | 311 | protected IAvatarFactory m_AvatarFactory; |
311 | public IAvatarFactory AvatarFactory | 312 | public IAvatarFactory AvatarFactory |
312 | { | 313 | { |
@@ -1146,10 +1147,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1146 | 1147 | ||
1147 | public int GetInaccurateNeighborCount() | 1148 | public int GetInaccurateNeighborCount() |
1148 | { | 1149 | { |
1149 | lock (m_neighbours) | 1150 | return m_neighbours.Count; |
1150 | { | ||
1151 | return m_neighbours.Count; | ||
1152 | } | ||
1153 | } | 1151 | } |
1154 | 1152 | ||
1155 | // This is the method that shuts down the scene. | 1153 | // This is the method that shuts down the scene. |
@@ -1229,6 +1227,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1229 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); | 1227 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); |
1230 | XferManager = RequestModuleInterface<IXfer>(); | 1228 | XferManager = RequestModuleInterface<IXfer>(); |
1231 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); | 1229 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); |
1230 | AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); | ||
1232 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); | 1231 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); |
1233 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1232 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
1234 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); | 1233 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); |
@@ -2432,9 +2431,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2432 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 2431 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
2433 | m_log.DebugFormat( | 2432 | m_log.DebugFormat( |
2434 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2433 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2434 | |||
2435 | if (AttachmentsModule != null) | ||
2436 | AttachmentsModule.AttachObject( | ||
2437 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); | ||
2435 | 2438 | ||
2436 | AttachObject( | ||
2437 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); | ||
2438 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2439 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2439 | grp.SendGroupFullUpdate(); | 2440 | grp.SendGroupFullUpdate(); |
2440 | } | 2441 | } |
@@ -2669,10 +2670,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2669 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) | 2670 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) |
2670 | { | 2671 | { |
2671 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | 2672 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; |
2672 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; | 2673 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; |
2673 | client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; | ||
2674 | client.OnObjectAttach += m_sceneGraph.AttachObject; | 2674 | client.OnObjectAttach += m_sceneGraph.AttachObject; |
2675 | client.OnObjectDetach += m_sceneGraph.DetachObject; | 2675 | client.OnObjectDetach += m_sceneGraph.DetachObject; |
2676 | |||
2677 | if (AttachmentsModule != null) | ||
2678 | client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; | ||
2676 | } | 2679 | } |
2677 | 2680 | ||
2678 | public virtual void SubscribeToClientTeleportEvents(IClientAPI client) | 2681 | public virtual void SubscribeToClientTeleportEvents(IClientAPI client) |
@@ -2719,8 +2722,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2719 | } | 2722 | } |
2720 | 2723 | ||
2721 | protected virtual void UnsubscribeToClientEvents(IClientAPI client) | 2724 | protected virtual void UnsubscribeToClientEvents(IClientAPI client) |
2722 | { | 2725 | { |
2723 | |||
2724 | } | 2726 | } |
2725 | 2727 | ||
2726 | /// <summary> | 2728 | /// <summary> |
@@ -2742,7 +2744,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2742 | 2744 | ||
2743 | UnSubscribeToClientNetworkEvents(client); | 2745 | UnSubscribeToClientNetworkEvents(client); |
2744 | 2746 | ||
2745 | |||
2746 | // EventManager.TriggerOnNewClient(client); | 2747 | // EventManager.TriggerOnNewClient(client); |
2747 | } | 2748 | } |
2748 | 2749 | ||
@@ -2822,12 +2823,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2822 | } | 2823 | } |
2823 | 2824 | ||
2824 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) | 2825 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) |
2825 | { | 2826 | { |
2826 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; | ||
2827 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; | 2827 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; |
2828 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; | 2828 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; |
2829 | client.OnObjectAttach -= m_sceneGraph.AttachObject; | 2829 | client.OnObjectAttach -= m_sceneGraph.AttachObject; |
2830 | client.OnObjectDetach -= m_sceneGraph.DetachObject; | 2830 | client.OnObjectDetach -= m_sceneGraph.DetachObject; |
2831 | |||
2832 | if (AttachmentsModule != null) | ||
2833 | client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; | ||
2831 | } | 2834 | } |
2832 | 2835 | ||
2833 | public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) | 2836 | public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index cac768e..4e41b07 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -476,7 +476,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
476 | if (group != null) | 476 | if (group != null) |
477 | { | 477 | { |
478 | //group.DetachToGround(); | 478 | //group.DetachToGround(); |
479 | m_parentScene.DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient); | 479 | m_parentScene.AttachmentsModule.ShowDetachInUserInventory(group.GetFromItemID(), remoteClient); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | 482 | ||
@@ -528,7 +528,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
528 | return; | 528 | return; |
529 | 529 | ||
530 | // Calls attach with a Zero position | 530 | // Calls attach with a Zero position |
531 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) | 531 | if (m_parentScene.AttachmentsModule.AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) |
532 | { | 532 | { |
533 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | 533 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); |
534 | 534 | ||
@@ -571,8 +571,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
571 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | 571 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) |
572 | tainted = true; | 572 | tainted = true; |
573 | 573 | ||
574 | AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | 574 | m_parentScene.AttachmentsModule.AttachObject( |
575 | remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | ||
575 | //objatt.ScheduleGroupForFullUpdate(); | 576 | //objatt.ScheduleGroupForFullUpdate(); |
577 | |||
576 | if (tainted) | 578 | if (tainted) |
577 | objatt.HasGroupChanged = true; | 579 | objatt.HasGroupChanged = true; |
578 | 580 | ||
@@ -596,131 +598,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
596 | return null; | 598 | return null; |
597 | } | 599 | } |
598 | 600 | ||
599 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | ||
600 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | ||
601 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | ||
602 | { | ||
603 | if (itemID == UUID.Zero) // If this happened, someone made a mistake.... | ||
604 | return; | ||
605 | |||
606 | // We can NOT use the dictionries here, as we are looking | ||
607 | // for an entity by the fromAssetID, which is NOT the prim UUID | ||
608 | // | ||
609 | List<EntityBase> detachEntities = GetEntities(); | ||
610 | SceneObjectGroup group; | ||
611 | |||
612 | foreach (EntityBase entity in detachEntities) | ||
613 | { | ||
614 | if (entity is SceneObjectGroup) | ||
615 | { | ||
616 | group = (SceneObjectGroup)entity; | ||
617 | if (group.GetFromItemID() == itemID) | ||
618 | { | ||
619 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); | ||
620 | bool hasScripts = false; | ||
621 | foreach (SceneObjectPart part in group.Children.Values) | ||
622 | { | ||
623 | if (part.Inventory.ContainsScripts()) | ||
624 | { | ||
625 | hasScripts = true; | ||
626 | break; | ||
627 | } | ||
628 | } | ||
629 | |||
630 | if (hasScripts) // Allow the object to execute the attach(NULL_KEY) event | ||
631 | System.Threading.Thread.Sleep(100); | ||
632 | group.DetachToInventoryPrep(); | ||
633 | m_log.Debug("[DETACH]: Saving attachpoint: " + | ||
634 | ((uint)group.GetAttachmentPoint()).ToString()); | ||
635 | m_parentScene.UpdateKnownItem(remoteClient, group, | ||
636 | group.GetFromItemID(), group.OwnerID); | ||
637 | m_parentScene.DeleteSceneObject(group, false); | ||
638 | return; | ||
639 | } | ||
640 | } | ||
641 | } | ||
642 | } | ||
643 | |||
644 | /// <summary> | ||
645 | /// Attach a scene object to an avatar. | ||
646 | /// </summary> | ||
647 | /// <param name="remoteClient"></param> | ||
648 | /// <param name="objectLocalID"></param> | ||
649 | /// <param name="AttachmentPt"></param> | ||
650 | /// <param name="rot"></param> | ||
651 | /// <param name="attachPos"></param> | ||
652 | /// <param name="silent"></param> | ||
653 | /// <returns>true if the attachment was successful, false otherwise</returns> | ||
654 | protected internal bool AttachObject( | ||
655 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) | ||
656 | { | ||
657 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); | ||
658 | if (group != null) | ||
659 | { | ||
660 | if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) | ||
661 | { | ||
662 | // If the attachment point isn't the same as the one previously used | ||
663 | // set it's offset position = 0 so that it appears on the attachment point | ||
664 | // and not in a weird location somewhere unknown. | ||
665 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) | ||
666 | { | ||
667 | attachPos = Vector3.Zero; | ||
668 | } | ||
669 | |||
670 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | ||
671 | if (AttachmentPt == 0) | ||
672 | { | ||
673 | // Check object for stored attachment point | ||
674 | AttachmentPt = (uint)group.GetAttachmentPoint(); | ||
675 | } | ||
676 | |||
677 | // if we still didn't find a suitable attachment point....... | ||
678 | if (AttachmentPt == 0) | ||
679 | { | ||
680 | // Stick it on left hand with Zero Offset from the attachment point. | ||
681 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | ||
682 | attachPos = Vector3.Zero; | ||
683 | } | ||
684 | |||
685 | group.SetAttachmentPoint((byte)AttachmentPt); | ||
686 | group.AbsolutePosition = attachPos; | ||
687 | |||
688 | // Saves and gets itemID | ||
689 | UUID itemId; | ||
690 | |||
691 | if (group.GetFromItemID() == UUID.Zero) | ||
692 | { | ||
693 | m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); | ||
694 | } | ||
695 | else | ||
696 | { | ||
697 | itemId = group.GetFromItemID(); | ||
698 | } | ||
699 | |||
700 | m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); | ||
701 | |||
702 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | ||
703 | // In case it is later dropped again, don't let | ||
704 | // it get cleaned up | ||
705 | // | ||
706 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | ||
707 | group.HasGroupChanged = false; | ||
708 | } | ||
709 | else | ||
710 | { | ||
711 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); | ||
712 | return false; | ||
713 | } | ||
714 | } | ||
715 | else | ||
716 | { | ||
717 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); | ||
718 | return false; | ||
719 | } | ||
720 | |||
721 | return true; | ||
722 | } | ||
723 | |||
724 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 601 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) |
725 | { | 602 | { |
726 | ScenePresence newAvatar = null; | 603 | ScenePresence newAvatar = null; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index badf782..e0d0fe1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4732,5 +4732,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4732 | m_log.Error("[Physics] " + ex); | 4732 | m_log.Error("[Physics] " + ex); |
4733 | } | 4733 | } |
4734 | } | 4734 | } |
4735 | |||
4736 | public Color4 GetTextColor() | ||
4737 | { | ||
4738 | return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A)); | ||
4739 | } | ||
4735 | } | 4740 | } |
4736 | } | 4741 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 013285f..836622d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -641,7 +641,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
641 | m_items[item.ItemID] = item; | 641 | m_items[item.ItemID] = item; |
642 | m_inventorySerial++; | 642 | m_inventorySerial++; |
643 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 643 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
644 | |||
645 | HasInventoryChanged = true; | 644 | HasInventoryChanged = true; |
646 | m_part.ParentGroup.HasGroupChanged = true; | 645 | m_part.ParentGroup.HasGroupChanged = true; |
647 | m_items.LockItemsForWrite(false); | 646 | m_items.LockItemsForWrite(false); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9dbe332..93e66e0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2872,6 +2872,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2872 | if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance || | 2872 | if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance || |
2873 | Util.GetDistanceTo(CameraPosition, m_lastChildAgentUpdateCamPosition) >= Scene.ChildReprioritizationDistance) | 2873 | Util.GetDistanceTo(CameraPosition, m_lastChildAgentUpdateCamPosition) >= Scene.ChildReprioritizationDistance) |
2874 | { | 2874 | { |
2875 | m_lastChildAgentUpdatePosition = AbsolutePosition; | ||
2876 | m_lastChildAgentUpdateCamPosition = CameraPosition; | ||
2877 | |||
2875 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 2878 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); |
2876 | cadu.ActiveGroupID = UUID.Zero.Guid; | 2879 | cadu.ActiveGroupID = UUID.Zero.Guid; |
2877 | cadu.AgentID = UUID.Guid; | 2880 | cadu.AgentID = UUID.Guid; |
@@ -2880,8 +2883,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2880 | Vector3 tempCameraCenter = m_CameraCenter; | 2883 | Vector3 tempCameraCenter = m_CameraCenter; |
2881 | cadu.cameraPosition = tempCameraCenter; | 2884 | cadu.cameraPosition = tempCameraCenter; |
2882 | cadu.drawdistance = m_DrawDistance; | 2885 | cadu.drawdistance = m_DrawDistance; |
2883 | if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID))) | ||
2884 | cadu.godlevel = m_godlevel; | ||
2885 | cadu.GroupAccess = 0; | 2886 | cadu.GroupAccess = 0; |
2886 | cadu.Position = AbsolutePosition; | 2887 | cadu.Position = AbsolutePosition; |
2887 | cadu.regionHandle = m_rootRegionHandle; | 2888 | cadu.regionHandle = m_rootRegionHandle; |
@@ -2904,9 +2905,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2904 | agentpos.CopyFrom(cadu); | 2905 | agentpos.CopyFrom(cadu); |
2905 | 2906 | ||
2906 | m_scene.SendOutChildAgentUpdates(agentpos, this); | 2907 | m_scene.SendOutChildAgentUpdates(agentpos, this); |
2907 | |||
2908 | m_lastChildAgentUpdatePosition = AbsolutePosition; | ||
2909 | m_lastChildAgentUpdateCamPosition = CameraPosition; | ||
2910 | } | 2908 | } |
2911 | } | 2909 | } |
2912 | 2910 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3f9c026..4661488 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -53,7 +53,6 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | |||
53 | using OpenSim.Region.ScriptEngine.Interfaces; | 53 | using OpenSim.Region.ScriptEngine.Interfaces; |
54 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 54 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
55 | using OpenSim.Services.Interfaces; | 55 | using OpenSim.Services.Interfaces; |
56 | using OpenSim.Services.Interfaces; | ||
57 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 56 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
58 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | 57 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; |
59 | using PrimType = OpenSim.Region.Framework.Scenes.PrimType; | 58 | using PrimType = OpenSim.Region.Framework.Scenes.PrimType; |
@@ -3066,9 +3065,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3066 | 3065 | ||
3067 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3066 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
3068 | 3067 | ||
3069 | m_ScriptEngine.World.AttachObject(presence.ControllingClient, | 3068 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3070 | grp.LocalId, (uint)attachment, Quaternion.Identity, | 3069 | if (attachmentsModule != null) |
3071 | Vector3.Zero, false); | 3070 | attachmentsModule.AttachObject( |
3071 | presence.ControllingClient, grp.LocalId, | ||
3072 | (uint)attachment, Quaternion.Identity, Vector3.Zero, false); | ||
3072 | } | 3073 | } |
3073 | } | 3074 | } |
3074 | 3075 | ||
@@ -3105,8 +3106,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3105 | 3106 | ||
3106 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3107 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
3107 | 3108 | ||
3108 | m_ScriptEngine.World.DetachSingleAttachmentToInv(itemID, | 3109 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3109 | presence.ControllingClient); | 3110 | if (attachmentsModule != null) |
3111 | attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); | ||
3110 | } | 3112 | } |
3111 | } | 3113 | } |
3112 | 3114 | ||
@@ -5598,12 +5600,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5598 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) | 5600 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) |
5599 | { | 5601 | { |
5600 | m_host.AddScriptLPS(1); | 5602 | m_host.AddScriptLPS(1); |
5603 | |||
5604 | SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate); | ||
5605 | } | ||
5606 | |||
5607 | public void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
5608 | { | ||
5609 | m_host.AddScriptLPS(1); | ||
5610 | |||
5611 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
5612 | |||
5613 | foreach (var part in parts) | ||
5614 | { | ||
5615 | SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); | ||
5616 | } | ||
5617 | } | ||
5618 | |||
5619 | private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
5620 | { | ||
5621 | |||
5601 | Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); | 5622 | Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); |
5602 | pTexAnim.Flags = (Primitive.TextureAnimMode)mode; | 5623 | pTexAnim.Flags = (Primitive.TextureAnimMode)mode; |
5603 | 5624 | ||
5604 | //ALL_SIDES | 5625 | //ALL_SIDES |
5605 | if (face == ScriptBaseClass.ALL_SIDES) | 5626 | if (face == ScriptBaseClass.ALL_SIDES) |
5606 | face = 255; | 5627 | face = 255; |
5607 | 5628 | ||
5608 | pTexAnim.Face = (uint)face; | 5629 | pTexAnim.Face = (uint)face; |
5609 | pTexAnim.Length = (float)length; | 5630 | pTexAnim.Length = (float)length; |
@@ -5612,9 +5633,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5612 | pTexAnim.SizeY = (uint)sizey; | 5633 | pTexAnim.SizeY = (uint)sizey; |
5613 | pTexAnim.Start = (float)start; | 5634 | pTexAnim.Start = (float)start; |
5614 | 5635 | ||
5615 | m_host.AddTextureAnimation(pTexAnim); | 5636 | part.AddTextureAnimation(pTexAnim); |
5616 | m_host.SendFullUpdateToAllClients(); | 5637 | part.SendFullUpdateToAllClients(); |
5617 | m_host.ParentGroup.HasGroupChanged = true; | 5638 | part.ParentGroup.HasGroupChanged = true; |
5618 | } | 5639 | } |
5619 | 5640 | ||
5620 | public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, | 5641 | public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, |
@@ -6011,13 +6032,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6011 | return ps; | 6032 | return ps; |
6012 | } | 6033 | } |
6013 | 6034 | ||
6035 | public void llLinkParticleSystem(int linknumber, LSL_List rules) | ||
6036 | { | ||
6037 | m_host.AddScriptLPS(1); | ||
6038 | |||
6039 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
6040 | |||
6041 | foreach (var part in parts) | ||
6042 | { | ||
6043 | SetParticleSystem(part, rules); | ||
6044 | } | ||
6045 | } | ||
6046 | |||
6014 | public void llParticleSystem(LSL_List rules) | 6047 | public void llParticleSystem(LSL_List rules) |
6015 | { | 6048 | { |
6016 | m_host.AddScriptLPS(1); | 6049 | m_host.AddScriptLPS(1); |
6050 | SetParticleSystem(m_host, rules); | ||
6051 | } | ||
6052 | |||
6053 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules) { | ||
6054 | |||
6055 | |||
6017 | if (rules.Length == 0) | 6056 | if (rules.Length == 0) |
6018 | { | 6057 | { |
6019 | m_host.RemoveParticleSystem(); | 6058 | part.RemoveParticleSystem(); |
6020 | m_host.ParentGroup.HasGroupChanged = true; | 6059 | part.ParentGroup.HasGroupChanged = true; |
6021 | } | 6060 | } |
6022 | else | 6061 | else |
6023 | { | 6062 | { |
@@ -6128,7 +6167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6128 | } | 6167 | } |
6129 | else | 6168 | else |
6130 | { | 6169 | { |
6131 | prules.Target = m_host.UUID; | 6170 | prules.Target = part.UUID; |
6132 | } | 6171 | } |
6133 | break; | 6172 | break; |
6134 | 6173 | ||
@@ -6154,10 +6193,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6154 | } | 6193 | } |
6155 | prules.CRC = 1; | 6194 | prules.CRC = 1; |
6156 | 6195 | ||
6157 | m_host.AddNewParticleSystem(prules); | 6196 | part.AddNewParticleSystem(prules); |
6158 | m_host.ParentGroup.HasGroupChanged = true; | 6197 | part.ParentGroup.HasGroupChanged = true; |
6159 | } | 6198 | } |
6160 | m_host.SendFullUpdateToAllClients(); | 6199 | part.SendFullUpdateToAllClients(); |
6161 | } | 6200 | } |
6162 | 6201 | ||
6163 | public void llGroundRepel(double height, int water, double tau) | 6202 | public void llGroundRepel(double height, int water, double tau) |
@@ -6966,6 +7005,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6966 | SetPrimParams(part, rules); | 7005 | SetPrimParams(part, rules); |
6967 | } | 7006 | } |
6968 | 7007 | ||
7008 | public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) | ||
7009 | { | ||
7010 | llSetLinkPrimitiveParams(linknumber, rules); | ||
7011 | } | ||
7012 | |||
6969 | protected void SetPrimParams(SceneObjectPart part, LSL_List rules) | 7013 | protected void SetPrimParams(SceneObjectPart part, LSL_List rules) |
6970 | { | 7014 | { |
6971 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 7015 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
@@ -7325,6 +7369,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7325 | int style = rules.GetLSLIntegerItem(idx++); | 7369 | int style = rules.GetLSLIntegerItem(idx++); |
7326 | SetTexGen(part, face, style); | 7370 | SetTexGen(part, face, style); |
7327 | break; | 7371 | break; |
7372 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
7373 | if (remain < 3) | ||
7374 | return; | ||
7375 | string primText = rules.GetLSLStringItem(idx++); | ||
7376 | LSL_Vector primTextColor = rules.GetVector3Item(idx++); | ||
7377 | LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); | ||
7378 | Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f), | ||
7379 | Util.Clip((float)primTextColor.y, 0.0f, 1.0f), | ||
7380 | Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); | ||
7381 | part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); | ||
7382 | |||
7383 | break; | ||
7328 | } | 7384 | } |
7329 | } | 7385 | } |
7330 | } | 7386 | } |
@@ -7568,6 +7624,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7568 | return GetLinkPrimitiveParams(m_host, rules); | 7624 | return GetLinkPrimitiveParams(m_host, rules); |
7569 | } | 7625 | } |
7570 | 7626 | ||
7627 | public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) | ||
7628 | { | ||
7629 | m_host.AddScriptLPS(1); | ||
7630 | |||
7631 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
7632 | |||
7633 | LSL_List res = new LSL_List(); | ||
7634 | |||
7635 | foreach (var part in parts) | ||
7636 | { | ||
7637 | LSL_List partRes = GetLinkPrimitiveParams(part, rules); | ||
7638 | res += partRes; | ||
7639 | } | ||
7640 | |||
7641 | return res; | ||
7642 | } | ||
7643 | |||
7571 | public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) | 7644 | public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) |
7572 | { | 7645 | { |
7573 | LSL_List res = new LSL_List(); | 7646 | LSL_List res = new LSL_List(); |
@@ -7951,6 +8024,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7951 | res.Add(new LSL_Float(primglow)); | 8024 | res.Add(new LSL_Float(primglow)); |
7952 | } | 8025 | } |
7953 | break; | 8026 | break; |
8027 | case (int)ScriptBaseClass.PRIM_TEXT: | ||
8028 | Color4 textColor = part.GetTextColor(); | ||
8029 | res.Add(part.Text); | ||
8030 | res.Add(new LSL_Vector(textColor.R, | ||
8031 | textColor.G, | ||
8032 | textColor.B)); | ||
8033 | res.Add(new LSL_Float(textColor.A)); | ||
8034 | break; | ||
7954 | } | 8035 | } |
7955 | } | 8036 | } |
7956 | return res; | 8037 | return res; |
@@ -10050,90 +10131,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10050 | 10131 | ||
10051 | Notecard nc = new Notecard(); | 10132 | Notecard nc = new Notecard(); |
10052 | nc.lastRef = DateTime.Now; | 10133 | nc.lastRef = DateTime.Now; |
10053 | nc.text = ParseText(text.Replace("\r", "").Split('\n')); | 10134 | nc.text = SLUtil.ParseNotecardToList(text).ToArray(); |
10054 | m_Notecards[assetID] = nc; | 10135 | m_Notecards[assetID] = nc; |
10055 | } | 10136 | } |
10056 | } | 10137 | } |
10057 | 10138 | ||
10058 | protected static string[] ParseText(string[] input) | ||
10059 | { | ||
10060 | int idx = 0; | ||
10061 | int level = 0; | ||
10062 | List<string> output = new List<string>(); | ||
10063 | string[] words; | ||
10064 | |||
10065 | while (idx < input.Length) | ||
10066 | { | ||
10067 | if (input[idx] == "{") | ||
10068 | { | ||
10069 | level++; | ||
10070 | idx++; | ||
10071 | continue; | ||
10072 | } | ||
10073 | |||
10074 | if (input[idx]== "}") | ||
10075 | { | ||
10076 | level--; | ||
10077 | idx++; | ||
10078 | continue; | ||
10079 | } | ||
10080 | |||
10081 | switch (level) | ||
10082 | { | ||
10083 | case 0: | ||
10084 | words = input[idx].Split(' '); // Linden text ver | ||
10085 | // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard) | ||
10086 | if (words.Length < 3) | ||
10087 | return new String[0]; | ||
10088 | |||
10089 | int version = int.Parse(words[3]); | ||
10090 | if (version != 2) | ||
10091 | return new String[0]; | ||
10092 | break; | ||
10093 | case 1: | ||
10094 | words = input[idx].Split(' '); | ||
10095 | if (words[0] == "LLEmbeddedItems") | ||
10096 | break; | ||
10097 | if (words[0] == "Text") | ||
10098 | { | ||
10099 | int len = int.Parse(words[2]); | ||
10100 | idx++; | ||
10101 | |||
10102 | int count = -1; | ||
10103 | |||
10104 | while (count < len) | ||
10105 | { | ||
10106 | // int l = input[idx].Length; | ||
10107 | string ln = input[idx]; | ||
10108 | |||
10109 | int need = len-count-1; | ||
10110 | if (ln.Length > need) | ||
10111 | ln = ln.Substring(0, need); | ||
10112 | |||
10113 | output.Add(ln); | ||
10114 | count += ln.Length + 1; | ||
10115 | idx++; | ||
10116 | } | ||
10117 | |||
10118 | return output.ToArray(); | ||
10119 | } | ||
10120 | break; | ||
10121 | case 2: | ||
10122 | words = input[idx].Split(' '); // count | ||
10123 | if (words[0] == "count") | ||
10124 | { | ||
10125 | int c = int.Parse(words[1]); | ||
10126 | if (c > 0) | ||
10127 | return new String[0]; | ||
10128 | break; | ||
10129 | } | ||
10130 | break; | ||
10131 | } | ||
10132 | idx++; | ||
10133 | } | ||
10134 | return output.ToArray(); | ||
10135 | } | ||
10136 | |||
10137 | public static bool IsCached(UUID assetID) | 10139 | public static bool IsCached(UUID assetID) |
10138 | { | 10140 | { |
10139 | lock (m_Notecards) | 10141 | lock (m_Notecards) |
@@ -10189,4 +10191,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10189 | } | 10191 | } |
10190 | } | 10192 | } |
10191 | } | 10193 | } |
10192 | } | 10194 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index a74e8da..7ab04a3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
135 | LSL_Key llGetLinkKey(int linknum); | 135 | LSL_Key llGetLinkKey(int linknum); |
136 | LSL_String llGetLinkName(int linknum); | 136 | LSL_String llGetLinkName(int linknum); |
137 | LSL_Integer llGetLinkNumber(); | 137 | LSL_Integer llGetLinkNumber(); |
138 | LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); | ||
138 | LSL_Integer llGetListEntryType(LSL_List src, int index); | 139 | LSL_Integer llGetListEntryType(LSL_List src, int index); |
139 | LSL_Integer llGetListLength(LSL_List src); | 140 | LSL_Integer llGetListLength(LSL_List src); |
140 | LSL_Vector llGetLocalPos(); | 141 | LSL_Vector llGetLocalPos(); |
@@ -206,6 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
206 | void llInstantMessage(string user, string message); | 207 | void llInstantMessage(string user, string message); |
207 | LSL_String llIntegerToBase64(int number); | 208 | LSL_String llIntegerToBase64(int number); |
208 | LSL_String llKey2Name(string id); | 209 | LSL_String llKey2Name(string id); |
210 | void llLinkParticleSystem(int linknum, LSL_List rules); | ||
209 | LSL_String llList2CSV(LSL_List src); | 211 | LSL_String llList2CSV(LSL_List src); |
210 | LSL_Float llList2Float(LSL_List src, int index); | 212 | LSL_Float llList2Float(LSL_List src, int index); |
211 | LSL_Integer llList2Integer(LSL_List src, int index); | 213 | LSL_Integer llList2Integer(LSL_List src, int index); |
@@ -322,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
322 | void llSetLinkColor(int linknumber, LSL_Vector color, int face); | 324 | void llSetLinkColor(int linknumber, LSL_Vector color, int face); |
323 | void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); | 325 | void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); |
324 | void llSetLinkTexture(int linknumber, string texture, int face); | 326 | void llSetLinkTexture(int linknumber, string texture, int face); |
327 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | ||
325 | void llSetLocalRot(LSL_Rotation rot); | 328 | void llSetLocalRot(LSL_Rotation rot); |
326 | void llSetObjectDesc(string desc); | 329 | void llSetObjectDesc(string desc); |
327 | void llSetObjectName(string name); | 330 | void llSetObjectName(string name); |
@@ -330,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
330 | void llSetPayPrice(int price, LSL_List quick_pay_buttons); | 333 | void llSetPayPrice(int price, LSL_List quick_pay_buttons); |
331 | void llSetPos(LSL_Vector pos); | 334 | void llSetPos(LSL_Vector pos); |
332 | void llSetPrimitiveParams(LSL_List rules); | 335 | void llSetPrimitiveParams(LSL_List rules); |
336 | void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); | ||
333 | void llSetPrimURL(string url); | 337 | void llSetPrimURL(string url); |
334 | void llSetRemoteScriptAccessPin(int pin); | 338 | void llSetRemoteScriptAccessPin(int pin); |
335 | void llSetRot(LSL_Rotation rot); | 339 | void llSetRot(LSL_Rotation rot); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 7cf82b2..ee35fa4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -313,6 +313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
313 | public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake | 313 | public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake |
314 | public const int PRIM_POINT_LIGHT = 23; // Huh? | 314 | public const int PRIM_POINT_LIGHT = 23; // Huh? |
315 | public const int PRIM_GLOW = 25; | 315 | public const int PRIM_GLOW = 25; |
316 | public const int PRIM_TEXT = 26; | ||
316 | public const int PRIM_TEXGEN_DEFAULT = 0; | 317 | public const int PRIM_TEXGEN_DEFAULT = 0; |
317 | public const int PRIM_TEXGEN_PLANAR = 1; | 318 | public const int PRIM_TEXGEN_PLANAR = 1; |
318 | 319 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index a28e97b..3339995 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -674,6 +674,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
674 | return m_LSL_Functions.llGetPrimitiveParams(rules); | 674 | return m_LSL_Functions.llGetPrimitiveParams(rules); |
675 | } | 675 | } |
676 | 676 | ||
677 | public LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules) | ||
678 | { | ||
679 | return m_LSL_Functions.llGetLinkPrimitiveParams(linknum, rules); | ||
680 | } | ||
681 | |||
677 | public LSL_Integer llGetRegionAgentCount() | 682 | public LSL_Integer llGetRegionAgentCount() |
678 | { | 683 | { |
679 | return m_LSL_Functions.llGetRegionAgentCount(); | 684 | return m_LSL_Functions.llGetRegionAgentCount(); |
@@ -889,6 +894,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
889 | return m_LSL_Functions.llKey2Name(id); | 894 | return m_LSL_Functions.llKey2Name(id); |
890 | } | 895 | } |
891 | 896 | ||
897 | public void llLinkParticleSystem(int linknum, LSL_List rules) | ||
898 | { | ||
899 | m_LSL_Functions.llLinkParticleSystem(linknum, rules); | ||
900 | } | ||
901 | |||
892 | public LSL_String llList2CSV(LSL_List src) | 902 | public LSL_String llList2CSV(LSL_List src) |
893 | { | 903 | { |
894 | return m_LSL_Functions.llList2CSV(src); | 904 | return m_LSL_Functions.llList2CSV(src); |
@@ -1468,6 +1478,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1468 | m_LSL_Functions.llSetLinkTexture(linknumber, texture, face); | 1478 | m_LSL_Functions.llSetLinkTexture(linknumber, texture, face); |
1469 | } | 1479 | } |
1470 | 1480 | ||
1481 | public void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
1482 | { | ||
1483 | m_LSL_Functions.llSetLinkTextureAnim(linknum, mode, face, sizex, sizey, start, length, rate); | ||
1484 | } | ||
1485 | |||
1471 | public void llSetLocalRot(LSL_Rotation rot) | 1486 | public void llSetLocalRot(LSL_Rotation rot) |
1472 | { | 1487 | { |
1473 | m_LSL_Functions.llSetLocalRot(rot); | 1488 | m_LSL_Functions.llSetLocalRot(rot); |
@@ -1508,6 +1523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1508 | m_LSL_Functions.llSetPrimitiveParams(rules); | 1523 | m_LSL_Functions.llSetPrimitiveParams(rules); |
1509 | } | 1524 | } |
1510 | 1525 | ||
1526 | public void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules) | ||
1527 | { | ||
1528 | m_LSL_Functions.llSetLinkPrimitiveParamsFast(linknum, rules); | ||
1529 | } | ||
1530 | |||
1511 | public void llSetPrimURL(string url) | 1531 | public void llSetPrimURL(string url) |
1512 | { | 1532 | { |
1513 | m_LSL_Functions.llSetPrimURL(url); | 1533 | m_LSL_Functions.llSetPrimURL(url); |
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs new file mode 100644 index 0000000..ce88236 --- /dev/null +++ b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Services.Connectors | ||
31 | { | ||
32 | public class GridUserServiceConnector | ||
33 | { | ||
34 | public GridUserServiceConnector() | ||
35 | { | ||
36 | } | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs new file mode 100644 index 0000000..a7c2c6f --- /dev/null +++ b/OpenSim/Services/Interfaces/IGridUserService.cs | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Records user information specific to a grid but which is not part of a user's account. | ||
36 | /// </summary> | ||
37 | public class GridUserInfo | ||
38 | { | ||
39 | public string UserID; | ||
40 | public UUID HomeRegionID; | ||
41 | public Vector3 HomePosition; | ||
42 | public Vector3 HomeLookAt; | ||
43 | |||
44 | public GridUserInfo() {} | ||
45 | |||
46 | public GridUserInfo(Dictionary<string, object> kvp) | ||
47 | { | ||
48 | if (kvp.ContainsKey("UserID")) | ||
49 | UserID = kvp["UserID"].ToString(); | ||
50 | if (kvp.ContainsKey("HomeRegionID")) | ||
51 | UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID); | ||
52 | if (kvp.ContainsKey("HomePosition")) | ||
53 | Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition); | ||
54 | if (kvp.ContainsKey("HomeLookAt")) | ||
55 | Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt); | ||
56 | } | ||
57 | |||
58 | public Dictionary<string, object> ToKeyValuePairs() | ||
59 | { | ||
60 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
61 | result["UserID"] = UserID; | ||
62 | result["HomeRegionID"] = HomeRegionID.ToString(); | ||
63 | result["HomePosition"] = HomePosition.ToString(); | ||
64 | result["HomeLookAt"] = HomeLookAt.ToString(); | ||
65 | |||
66 | return result; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | public interface IGridUserService | ||
71 | { | ||
72 | GridUserInfo GetGridUserInfo(string userID); | ||
73 | bool StoreGridUserInfo(GridUserInfo info); | ||
74 | } | ||
75 | } \ 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 | { |
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs new file mode 100644 index 0000000..36cce75 --- /dev/null +++ b/OpenSim/Services/UserAccountService/GridUserService.cs | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
36 | |||
37 | using OpenMetaverse; | ||
38 | using log4net; | ||
39 | |||
40 | namespace OpenSim.Services.UserAccountService | ||
41 | { | ||
42 | public class GridUserService : GridUserServiceBase, IGridUserService | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | public GridUserService(IConfigSource config) : base(config) | ||
47 | { | ||
48 | m_log.Debug("[USER GRID SERVICE]: Starting user grid service"); | ||
49 | } | ||
50 | |||
51 | public GridUserInfo GetGridUserInfo(string userID) | ||
52 | { | ||
53 | GridUserData d = m_Database.GetGridUserData(userID); | ||
54 | |||
55 | GridUserInfo info = new GridUserInfo(); | ||
56 | info.UserID = d.UserID; | ||
57 | info.HomeRegionID = new UUID(d.Data["HomeRegionID"]); | ||
58 | info.HomePosition = Vector3.Parse(d.Data["HomePosition"]); | ||
59 | info.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]); | ||
60 | |||
61 | return info; | ||
62 | } | ||
63 | |||
64 | public bool StoreGridUserInfo(GridUserInfo info) | ||
65 | { | ||
66 | GridUserData d = new GridUserData(); | ||
67 | |||
68 | d.Data["UserID"] = info.UserID; | ||
69 | d.Data["HomeRegionID"] = info.HomeRegionID.ToString(); | ||
70 | d.Data["HomePosition"] = info.HomePosition.ToString(); | ||
71 | d.Data["HomeLookAt"] = info.HomeLookAt.ToString(); | ||
72 | |||
73 | return m_Database.StoreGridUserData(d); | ||
74 | } | ||
75 | } | ||
76 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/UserAccountService/GridUserServiceBase.cs b/OpenSim/Services/UserAccountService/GridUserServiceBase.cs new file mode 100644 index 0000000..990cb63 --- /dev/null +++ b/OpenSim/Services/UserAccountService/GridUserServiceBase.cs | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Services.Base; | ||
35 | |||
36 | namespace OpenSim.Services.UserAccountService | ||
37 | { | ||
38 | public class GridUserServiceBase : ServiceBase | ||
39 | { | ||
40 | protected IGridUserData m_Database = null; | ||
41 | |||
42 | public GridUserServiceBase(IConfigSource config) : base(config) | ||
43 | { | ||
44 | string dllName = String.Empty; | ||
45 | string connString = String.Empty; | ||
46 | string realm = "GridUser"; | ||
47 | |||
48 | // | ||
49 | // Try reading the [DatabaseService] section, if it exists | ||
50 | // | ||
51 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
52 | if (dbConfig != null) | ||
53 | { | ||
54 | if (dllName == String.Empty) | ||
55 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
56 | if (connString == String.Empty) | ||
57 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
58 | } | ||
59 | |||
60 | // | ||
61 | // [GridUsetService] section overrides [DatabaseService], if it exists | ||
62 | // | ||
63 | IConfig presenceConfig = config.Configs["GridUserService"]; | ||
64 | if (presenceConfig != null) | ||
65 | { | ||
66 | dllName = presenceConfig.GetString("StorageProvider", dllName); | ||
67 | connString = presenceConfig.GetString("ConnectionString", connString); | ||
68 | realm = presenceConfig.GetString("Realm", realm); | ||
69 | } | ||
70 | |||
71 | // | ||
72 | // We tried, but this doesn't exist. We can't proceed. | ||
73 | // | ||
74 | if (dllName.Equals(String.Empty)) | ||
75 | throw new Exception("No StorageProvider configured"); | ||
76 | |||
77 | m_Database = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, realm }); | ||
78 | if (m_Database == null) | ||
79 | throw new Exception("Could not find a storage interface in the given module " + dllName); | ||
80 | } | ||
81 | } | ||
82 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index ca6e44a..82c34e7 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -280,7 +280,7 @@ namespace OpenSim.Services.UserAccountService | |||
280 | if (null == account) | 280 | if (null == account) |
281 | { | 281 | { |
282 | account = new UserAccount(UUID.Zero, firstName, lastName, email); | 282 | account = new UserAccount(UUID.Zero, firstName, lastName, email); |
283 | if (account.ServiceURLs == null) | 283 | if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) |
284 | { | 284 | { |
285 | account.ServiceURLs = new Dictionary<string, object>(); | 285 | account.ServiceURLs = new Dictionary<string, object>(); |
286 | account.ServiceURLs["HomeURI"] = string.Empty; | 286 | account.ServiceURLs["HomeURI"] = string.Empty; |
diff --git a/bin/BclExtras.dll b/bin/BclExtras.dll deleted file mode 100644 index 505cf01..0000000 --- a/bin/BclExtras.dll +++ /dev/null | |||
Binary files differ | |||
diff --git a/bin/BclExtras35.dll b/bin/BclExtras35.dll new file mode 100644 index 0000000..7a7480a --- /dev/null +++ b/bin/BclExtras35.dll | |||
Binary files differ | |||
diff --git a/prebuild.xml b/prebuild.xml index dab3512..6850b50 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -158,7 +158,7 @@ | |||
158 | <Reference name="System.Data"/> | 158 | <Reference name="System.Data"/> |
159 | <Reference name="System.Drawing"/> | 159 | <Reference name="System.Drawing"/> |
160 | <Reference name="System.Web"/> | 160 | <Reference name="System.Web"/> |
161 | <Reference name="BclExtras.dll"/> | 161 | <Reference name="BclExtras35.dll"/> |
162 | <Reference name="OpenMetaverseTypes.dll"/> | 162 | <Reference name="OpenMetaverseTypes.dll"/> |
163 | <Reference name="OpenMetaverse.dll"/> | 163 | <Reference name="OpenMetaverse.dll"/> |
164 | <Reference name="OpenMetaverse.StructuredData.dll"/> | 164 | <Reference name="OpenMetaverse.StructuredData.dll"/> |
@@ -1635,7 +1635,7 @@ | |||
1635 | <Reference name="OpenSim.Region.ClientStack"/> | 1635 | <Reference name="OpenSim.Region.ClientStack"/> |
1636 | <Reference name="OpenSim.Region.Physics.Manager"/> | 1636 | <Reference name="OpenSim.Region.Physics.Manager"/> |
1637 | <Reference name="OpenSim.Services.Interfaces"/> | 1637 | <Reference name="OpenSim.Services.Interfaces"/> |
1638 | <Reference name="BclExtras.dll"/> | 1638 | <Reference name="BclExtras35.dll"/> |
1639 | <Reference name="XMLRPC.dll"/> | 1639 | <Reference name="XMLRPC.dll"/> |
1640 | <Reference name="Nini.dll" /> | 1640 | <Reference name="Nini.dll" /> |
1641 | <Reference name="log4net.dll"/> | 1641 | <Reference name="log4net.dll"/> |