diff options
author | Melanie | 2013-06-11 01:03:15 +0100 |
---|---|---|
committer | Melanie | 2013-06-11 01:03:15 +0100 |
commit | a022ee576639c1bbceb5c4ba8de3cbd82e538bb3 (patch) | |
tree | fb0d2ee165b7c87e814fc35c6551a26c2c6a488a | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Check For NaN and Infinity in llRot2Axis/Angle Fixes mantis #6669 (diff) | |
download | opensim-SC-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.zip opensim-SC-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.tar.gz opensim-SC-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.tar.bz2 opensim-SC-a022ee576639c1bbceb5c4ba8de3cbd82e538bb3.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
Diffstat (limited to '')
18 files changed, 1128 insertions, 53 deletions
diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs index 7e0b112..cff7adf 100644 --- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs +++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs | |||
@@ -684,6 +684,9 @@ namespace OpenSim.Groups | |||
684 | { | 684 | { |
685 | serviceLocation = string.Empty; | 685 | serviceLocation = string.Empty; |
686 | name = string.Empty; | 686 | name = string.Empty; |
687 | if (groupID.Equals(UUID.Zero)) | ||
688 | return true; | ||
689 | |||
687 | ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty); | 690 | ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty); |
688 | if (group == null) | 691 | if (group == null) |
689 | { | 692 | { |
diff --git a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs index e7d38c2..79d6fc5 100644 --- a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs +++ b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs | |||
@@ -209,13 +209,10 @@ namespace OpenSim.Groups | |||
209 | public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d) | 209 | public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d) |
210 | { | 210 | { |
211 | GroupMembershipData activeGroup = d(); | 211 | GroupMembershipData activeGroup = d(); |
212 | if (activeGroup != null) | 212 | string cacheKey = "active-" + AgentID.ToString(); |
213 | { | 213 | lock (m_Cache) |
214 | string cacheKey = "active-" + AgentID.ToString(); | 214 | if (m_Cache.Contains(cacheKey)) |
215 | lock (m_Cache) | 215 | m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT); |
216 | if (m_Cache.Contains(cacheKey)) | ||
217 | m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT); | ||
218 | } | ||
219 | } | 216 | } |
220 | 217 | ||
221 | public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d) | 218 | public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d) |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index aa6203b..57b4667 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -174,6 +174,7 @@ namespace OpenSim.Capabilities.Handlers | |||
174 | 174 | ||
175 | newTexture.Flags = AssetFlags.Collectable; | 175 | newTexture.Flags = AssetFlags.Collectable; |
176 | newTexture.Temporary = true; | 176 | newTexture.Temporary = true; |
177 | newTexture.Local = true; | ||
177 | m_assetService.Store(newTexture); | 178 | m_assetService.Store(newTexture); |
178 | WriteTextureData(request, response, newTexture, format); | 179 | WriteTextureData(request, response, newTexture, format); |
179 | return true; | 180 | return true; |
diff --git a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations new file mode 100644 index 0000000..16581f6 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations | |||
@@ -0,0 +1,90 @@ | |||
1 | :VERSION 1 # ------------------------------- | ||
2 | |||
3 | begin; | ||
4 | |||
5 | CREATE TABLE IF NOT EXISTS classifieds ( | ||
6 | classifieduuid char(36) NOT NULL PRIMARY KEY, | ||
7 | creatoruuid char(36) NOT NULL, | ||
8 | creationdate int(20) NOT NULL, | ||
9 | expirationdate int(20) NOT NULL, | ||
10 | category varchar(20) NOT NULL, | ||
11 | name varchar(255) NOT NULL, | ||
12 | description text NOT NULL, | ||
13 | parceluuid char(36) NOT NULL, | ||
14 | parentestate int(11) NOT NULL, | ||
15 | snapshotuuid char(36) NOT NULL, | ||
16 | simname varchar(255) NOT NULL, | ||
17 | posglobal varchar(255) NOT NULL, | ||
18 | parcelname varchar(255) NOT NULL, | ||
19 | classifiedflags int(8) NOT NULL, | ||
20 | priceforlisting int(5) NOT NULL | ||
21 | ); | ||
22 | |||
23 | commit; | ||
24 | |||
25 | begin; | ||
26 | |||
27 | CREATE TABLE IF NOT EXISTS usernotes ( | ||
28 | useruuid varchar(36) NOT NULL, | ||
29 | targetuuid varchar(36) NOT NULL, | ||
30 | notes text NOT NULL, | ||
31 | UNIQUE (useruuid,targetuuid) ON CONFLICT REPLACE | ||
32 | ); | ||
33 | |||
34 | commit; | ||
35 | |||
36 | begin; | ||
37 | |||
38 | CREATE TABLE IF NOT EXISTS userpicks ( | ||
39 | pickuuid varchar(36) NOT NULL PRIMARY KEY, | ||
40 | creatoruuid varchar(36) NOT NULL, | ||
41 | toppick int NOT NULL, | ||
42 | parceluuid varchar(36) NOT NULL, | ||
43 | name varchar(255) NOT NULL, | ||
44 | description text NOT NULL, | ||
45 | snapshotuuid varchar(36) NOT NULL, | ||
46 | user varchar(255) NOT NULL, | ||
47 | originalname varchar(255) NOT NULL, | ||
48 | simname varchar(255) NOT NULL, | ||
49 | posglobal varchar(255) NOT NULL, | ||
50 | sortorder int(2) NOT NULL, | ||
51 | enabled int NOT NULL | ||
52 | ); | ||
53 | |||
54 | commit; | ||
55 | |||
56 | begin; | ||
57 | |||
58 | CREATE TABLE IF NOT EXISTS userprofile ( | ||
59 | useruuid varchar(36) NOT NULL PRIMARY KEY, | ||
60 | profilePartner varchar(36) NOT NULL, | ||
61 | profileAllowPublish binary(1) NOT NULL, | ||
62 | profileMaturePublish binary(1) NOT NULL, | ||
63 | profileURL varchar(255) NOT NULL, | ||
64 | profileWantToMask int(3) NOT NULL, | ||
65 | profileWantToText text NOT NULL, | ||
66 | profileSkillsMask int(3) NOT NULL, | ||
67 | profileSkillsText text NOT NULL, | ||
68 | profileLanguages text NOT NULL, | ||
69 | profileImage varchar(36) NOT NULL, | ||
70 | profileAboutText text NOT NULL, | ||
71 | profileFirstImage varchar(36) NOT NULL, | ||
72 | profileFirstText text NOT NULL | ||
73 | ); | ||
74 | |||
75 | commit; | ||
76 | |||
77 | :VERSION 2 # ------------------------------- | ||
78 | |||
79 | begin; | ||
80 | |||
81 | CREATE TABLE IF NOT EXISTS userdata ( | ||
82 | UserId char(36) NOT NULL, | ||
83 | TagId varchar(64) NOT NULL, | ||
84 | DataKey varchar(255), | ||
85 | DataVal varchar(255), | ||
86 | PRIMARY KEY (UserId,TagId) | ||
87 | ); | ||
88 | |||
89 | commit; | ||
90 | |||
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs new file mode 100644 index 0000000..cc1dac1 --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | |||
@@ -0,0 +1,904 @@ | |||
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 log4net; | ||
33 | #if CSharpSqlite | ||
34 | using Community.CsharpSqlite.Sqlite; | ||
35 | #else | ||
36 | using Mono.Data.Sqlite; | ||
37 | #endif | ||
38 | using OpenMetaverse; | ||
39 | using OpenMetaverse.StructuredData; | ||
40 | using OpenSim.Framework; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | |||
43 | namespace OpenSim.Data.SQLite | ||
44 | { | ||
45 | public class SQLiteUserProfilesData: IProfilesData | ||
46 | { | ||
47 | private static readonly ILog m_log = | ||
48 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private SqliteConnection m_connection; | ||
51 | private string m_connectionString; | ||
52 | |||
53 | private FieldInfo[] m_Fields; | ||
54 | private Dictionary<string, FieldInfo> m_FieldMap = | ||
55 | new Dictionary<string, FieldInfo>(); | ||
56 | |||
57 | protected virtual Assembly Assembly | ||
58 | { | ||
59 | get { return GetType().Assembly; } | ||
60 | } | ||
61 | |||
62 | public SQLiteUserProfilesData() | ||
63 | { | ||
64 | } | ||
65 | |||
66 | public SQLiteUserProfilesData(string connectionString) | ||
67 | { | ||
68 | Initialise(connectionString); | ||
69 | } | ||
70 | |||
71 | public void Initialise(string connectionString) | ||
72 | { | ||
73 | if (Util.IsWindows()) | ||
74 | Util.LoadArchSpecificWindowsDll("sqlite3.dll"); | ||
75 | |||
76 | m_connectionString = connectionString; | ||
77 | |||
78 | m_log.Info("[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString); | ||
79 | |||
80 | m_connection = new SqliteConnection(m_connectionString); | ||
81 | m_connection.Open(); | ||
82 | |||
83 | Migration m = new Migration(m_connection, Assembly, "UserProfiles"); | ||
84 | m.Update(); | ||
85 | } | ||
86 | |||
87 | private string[] FieldList | ||
88 | { | ||
89 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } | ||
90 | } | ||
91 | |||
92 | #region IProfilesData implementation | ||
93 | public OSDArray GetClassifiedRecords(UUID creatorId) | ||
94 | { | ||
95 | OSDArray data = new OSDArray(); | ||
96 | string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = :Id"; | ||
97 | IDataReader reader = null; | ||
98 | |||
99 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
100 | { | ||
101 | cmd.CommandText = query; | ||
102 | cmd.Parameters.AddWithValue(":Id", creatorId); | ||
103 | reader = cmd.ExecuteReader(); | ||
104 | } | ||
105 | |||
106 | while (reader.Read()) | ||
107 | { | ||
108 | OSDMap n = new OSDMap(); | ||
109 | UUID Id = UUID.Zero; | ||
110 | string Name = null; | ||
111 | try | ||
112 | { | ||
113 | UUID.TryParse(Convert.ToString( reader["classifieduuid"]), out Id); | ||
114 | Name = Convert.ToString(reader["name"]); | ||
115 | } | ||
116 | catch (Exception e) | ||
117 | { | ||
118 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
119 | ": UserAccount exception {0}", e.Message); | ||
120 | } | ||
121 | n.Add("classifieduuid", OSD.FromUUID(Id)); | ||
122 | n.Add("name", OSD.FromString(Name)); | ||
123 | data.Add(n); | ||
124 | } | ||
125 | |||
126 | reader.Close(); | ||
127 | |||
128 | return data; | ||
129 | } | ||
130 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) | ||
131 | { | ||
132 | string query = string.Empty; | ||
133 | |||
134 | query += "INSERT OR REPLACE INTO classifieds ("; | ||
135 | query += "`classifieduuid`,"; | ||
136 | query += "`creatoruuid`,"; | ||
137 | query += "`creationdate`,"; | ||
138 | query += "`expirationdate`,"; | ||
139 | query += "`category`,"; | ||
140 | query += "`name`,"; | ||
141 | query += "`description`,"; | ||
142 | query += "`parceluuid`,"; | ||
143 | query += "`parentestate`,"; | ||
144 | query += "`snapshotuuid`,"; | ||
145 | query += "`simname`,"; | ||
146 | query += "`posglobal`,"; | ||
147 | query += "`parcelname`,"; | ||
148 | query += "`classifiedflags`,"; | ||
149 | query += "`priceforlisting`) "; | ||
150 | query += "VALUES ("; | ||
151 | query += ":ClassifiedId,"; | ||
152 | query += ":CreatorId,"; | ||
153 | query += ":CreatedDate,"; | ||
154 | query += ":ExpirationDate,"; | ||
155 | query += ":Category,"; | ||
156 | query += ":Name,"; | ||
157 | query += ":Description,"; | ||
158 | query += ":ParcelId,"; | ||
159 | query += ":ParentEstate,"; | ||
160 | query += ":SnapshotId,"; | ||
161 | query += ":SimName,"; | ||
162 | query += ":GlobalPos,"; | ||
163 | query += ":ParcelName,"; | ||
164 | query += ":Flags,"; | ||
165 | query += ":ListingPrice ) "; | ||
166 | |||
167 | if(string.IsNullOrEmpty(ad.ParcelName)) | ||
168 | ad.ParcelName = "Unknown"; | ||
169 | if(ad.ParcelId == null) | ||
170 | ad.ParcelId = UUID.Zero; | ||
171 | if(string.IsNullOrEmpty(ad.Description)) | ||
172 | ad.Description = "No Description"; | ||
173 | |||
174 | DateTime epoch = new DateTime(1970, 1, 1); | ||
175 | DateTime now = DateTime.Now; | ||
176 | TimeSpan epochnow = now - epoch; | ||
177 | TimeSpan duration; | ||
178 | DateTime expiration; | ||
179 | TimeSpan epochexp; | ||
180 | |||
181 | if(ad.Flags == 2) | ||
182 | { | ||
183 | duration = new TimeSpan(7,0,0,0); | ||
184 | expiration = now.Add(duration); | ||
185 | epochexp = expiration - epoch; | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | duration = new TimeSpan(365,0,0,0); | ||
190 | expiration = now.Add(duration); | ||
191 | epochexp = expiration - epoch; | ||
192 | } | ||
193 | ad.CreationDate = (int)epochnow.TotalSeconds; | ||
194 | ad.ExpirationDate = (int)epochexp.TotalSeconds; | ||
195 | |||
196 | try { | ||
197 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
198 | { | ||
199 | cmd.CommandText = query; | ||
200 | cmd.Parameters.AddWithValue(":ClassifiedId", ad.ClassifiedId.ToString()); | ||
201 | cmd.Parameters.AddWithValue(":CreatorId", ad.CreatorId.ToString()); | ||
202 | cmd.Parameters.AddWithValue(":CreatedDate", ad.CreationDate.ToString()); | ||
203 | cmd.Parameters.AddWithValue(":ExpirationDate", ad.ExpirationDate.ToString()); | ||
204 | cmd.Parameters.AddWithValue(":Category", ad.Category.ToString()); | ||
205 | cmd.Parameters.AddWithValue(":Name", ad.Name.ToString()); | ||
206 | cmd.Parameters.AddWithValue(":Description", ad.Description.ToString()); | ||
207 | cmd.Parameters.AddWithValue(":ParcelId", ad.ParcelId.ToString()); | ||
208 | cmd.Parameters.AddWithValue(":ParentEstate", ad.ParentEstate.ToString()); | ||
209 | cmd.Parameters.AddWithValue(":SnapshotId", ad.SnapshotId.ToString ()); | ||
210 | cmd.Parameters.AddWithValue(":SimName", ad.SimName.ToString()); | ||
211 | cmd.Parameters.AddWithValue(":GlobalPos", ad.GlobalPos.ToString()); | ||
212 | cmd.Parameters.AddWithValue(":ParcelName", ad.ParcelName.ToString()); | ||
213 | cmd.Parameters.AddWithValue(":Flags", ad.Flags.ToString()); | ||
214 | cmd.Parameters.AddWithValue(":ListingPrice", ad.Price.ToString ()); | ||
215 | |||
216 | cmd.ExecuteNonQuery(); | ||
217 | } | ||
218 | } | ||
219 | catch (Exception e) | ||
220 | { | ||
221 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
222 | ": ClassifiedesUpdate exception {0}", e.Message); | ||
223 | result = e.Message; | ||
224 | return false; | ||
225 | } | ||
226 | return true; | ||
227 | } | ||
228 | public bool DeleteClassifiedRecord(UUID recordId) | ||
229 | { | ||
230 | string query = string.Empty; | ||
231 | |||
232 | query += "DELETE FROM classifieds WHERE "; | ||
233 | query += "classifieduuid = :ClasifiedId"; | ||
234 | |||
235 | try | ||
236 | { | ||
237 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
238 | { | ||
239 | cmd.CommandText = query; | ||
240 | cmd.Parameters.AddWithValue(":ClassifiedId", recordId.ToString()); | ||
241 | |||
242 | cmd.ExecuteNonQuery(); | ||
243 | } | ||
244 | } | ||
245 | catch (Exception e) | ||
246 | { | ||
247 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
248 | ": DeleteClassifiedRecord exception {0}", e.Message); | ||
249 | return false; | ||
250 | } | ||
251 | return true; | ||
252 | } | ||
253 | |||
254 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) | ||
255 | { | ||
256 | IDataReader reader = null; | ||
257 | string query = string.Empty; | ||
258 | |||
259 | query += "SELECT * FROM classifieds WHERE "; | ||
260 | query += "classifieduuid = :AdId"; | ||
261 | |||
262 | try | ||
263 | { | ||
264 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
265 | { | ||
266 | cmd.CommandText = query; | ||
267 | cmd.Parameters.AddWithValue(":AdId", ad.ClassifiedId.ToString()); | ||
268 | |||
269 | using (reader = cmd.ExecuteReader()) | ||
270 | { | ||
271 | if(reader.Read ()) | ||
272 | { | ||
273 | ad.CreatorId = new UUID(reader["creatoruuid"].ToString()); | ||
274 | ad.ParcelId = new UUID(reader["parceluuid"].ToString ()); | ||
275 | ad.SnapshotId = new UUID(reader["snapshotuuid"].ToString ()); | ||
276 | ad.CreationDate = Convert.ToInt32(reader["creationdate"]); | ||
277 | ad.ExpirationDate = Convert.ToInt32(reader["expirationdate"]); | ||
278 | ad.ParentEstate = Convert.ToInt32(reader["parentestate"]); | ||
279 | ad.Flags = (byte) Convert.ToUInt32(reader["classifiedflags"]); | ||
280 | ad.Category = Convert.ToInt32(reader["category"]); | ||
281 | ad.Price = Convert.ToInt16(reader["priceforlisting"]); | ||
282 | ad.Name = reader["name"].ToString(); | ||
283 | ad.Description = reader["description"].ToString(); | ||
284 | ad.SimName = reader["simname"].ToString(); | ||
285 | ad.GlobalPos = reader["posglobal"].ToString(); | ||
286 | ad.ParcelName = reader["parcelname"].ToString(); | ||
287 | } | ||
288 | } | ||
289 | } | ||
290 | } | ||
291 | catch (Exception e) | ||
292 | { | ||
293 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
294 | ": GetPickInfo exception {0}", e.Message); | ||
295 | } | ||
296 | return true; | ||
297 | } | ||
298 | |||
299 | public OSDArray GetAvatarPicks(UUID avatarId) | ||
300 | { | ||
301 | IDataReader reader = null; | ||
302 | string query = string.Empty; | ||
303 | |||
304 | query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; | ||
305 | query += "creatoruuid = :Id"; | ||
306 | OSDArray data = new OSDArray(); | ||
307 | |||
308 | try | ||
309 | { | ||
310 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
311 | { | ||
312 | cmd.CommandText = query; | ||
313 | cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); | ||
314 | |||
315 | using (reader = cmd.ExecuteReader()) | ||
316 | { | ||
317 | while (reader.Read()) | ||
318 | { | ||
319 | OSDMap record = new OSDMap(); | ||
320 | |||
321 | record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); | ||
322 | record.Add("name",OSD.FromString((string)reader["name"])); | ||
323 | data.Add(record); | ||
324 | } | ||
325 | } | ||
326 | } | ||
327 | } | ||
328 | catch (Exception e) | ||
329 | { | ||
330 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
331 | ": GetAvatarPicks exception {0}", e.Message); | ||
332 | } | ||
333 | return data; | ||
334 | } | ||
335 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) | ||
336 | { | ||
337 | IDataReader reader = null; | ||
338 | string query = string.Empty; | ||
339 | UserProfilePick pick = new UserProfilePick(); | ||
340 | |||
341 | query += "SELECT * FROM userpicks WHERE "; | ||
342 | query += "creatoruuid = :CreatorId AND "; | ||
343 | query += "pickuuid = :PickId"; | ||
344 | |||
345 | try | ||
346 | { | ||
347 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
348 | { | ||
349 | cmd.CommandText = query; | ||
350 | cmd.Parameters.AddWithValue(":CreatorId", avatarId.ToString()); | ||
351 | cmd.Parameters.AddWithValue(":PickId", pickId.ToString()); | ||
352 | |||
353 | using (reader = cmd.ExecuteReader()) | ||
354 | { | ||
355 | |||
356 | while (reader.Read()) | ||
357 | { | ||
358 | string description = (string)reader["description"]; | ||
359 | |||
360 | if (string.IsNullOrEmpty(description)) | ||
361 | description = "No description given."; | ||
362 | |||
363 | UUID.TryParse((string)reader["pickuuid"], out pick.PickId); | ||
364 | UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); | ||
365 | UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); | ||
366 | UUID.TryParse((string)reader["snapshotuuid"], out pick.SnapshotId); | ||
367 | pick.GlobalPos = (string)reader["posglobal"]; | ||
368 | bool.TryParse((string)reader["toppick"].ToString(), out pick.TopPick); | ||
369 | bool.TryParse((string)reader["enabled"].ToString(), out pick.Enabled); | ||
370 | pick.Name = (string)reader["name"]; | ||
371 | pick.Desc = description; | ||
372 | pick.User = (string)reader["user"]; | ||
373 | pick.OriginalName = (string)reader["originalname"]; | ||
374 | pick.SimName = (string)reader["simname"]; | ||
375 | pick.SortOrder = (int)reader["sortorder"]; | ||
376 | } | ||
377 | } | ||
378 | } | ||
379 | } | ||
380 | catch (Exception e) | ||
381 | { | ||
382 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
383 | ": GetPickInfo exception {0}", e.Message); | ||
384 | } | ||
385 | return pick; | ||
386 | } | ||
387 | |||
388 | public bool UpdatePicksRecord(UserProfilePick pick) | ||
389 | { | ||
390 | string query = string.Empty; | ||
391 | |||
392 | query += "INSERT OR REPLACE INTO userpicks ("; | ||
393 | query += "pickuuid, "; | ||
394 | query += "creatoruuid, "; | ||
395 | query += "toppick, "; | ||
396 | query += "parceluuid, "; | ||
397 | query += "name, "; | ||
398 | query += "description, "; | ||
399 | query += "snapshotuuid, "; | ||
400 | query += "user, "; | ||
401 | query += "originalname, "; | ||
402 | query += "simname, "; | ||
403 | query += "posglobal, "; | ||
404 | query += "sortorder, "; | ||
405 | query += "enabled ) "; | ||
406 | query += "VALUES ("; | ||
407 | query += ":PickId,"; | ||
408 | query += ":CreatorId,"; | ||
409 | query += ":TopPick,"; | ||
410 | query += ":ParcelId,"; | ||
411 | query += ":Name,"; | ||
412 | query += ":Desc,"; | ||
413 | query += ":SnapshotId,"; | ||
414 | query += ":User,"; | ||
415 | query += ":Original,"; | ||
416 | query += ":SimName,"; | ||
417 | query += ":GlobalPos,"; | ||
418 | query += ":SortOrder,"; | ||
419 | query += ":Enabled) "; | ||
420 | |||
421 | try | ||
422 | { | ||
423 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
424 | { | ||
425 | int top_pick; | ||
426 | int.TryParse(pick.TopPick.ToString(), out top_pick); | ||
427 | int enabled; | ||
428 | int.TryParse(pick.Enabled.ToString(), out enabled); | ||
429 | |||
430 | cmd.CommandText = query; | ||
431 | cmd.Parameters.AddWithValue(":PickId", pick.PickId.ToString()); | ||
432 | cmd.Parameters.AddWithValue(":CreatorId", pick.CreatorId.ToString()); | ||
433 | cmd.Parameters.AddWithValue(":TopPick", top_pick); | ||
434 | cmd.Parameters.AddWithValue(":ParcelId", pick.ParcelId.ToString()); | ||
435 | cmd.Parameters.AddWithValue(":Name", pick.Name.ToString()); | ||
436 | cmd.Parameters.AddWithValue(":Desc", pick.Desc.ToString()); | ||
437 | cmd.Parameters.AddWithValue(":SnapshotId", pick.SnapshotId.ToString()); | ||
438 | cmd.Parameters.AddWithValue(":User", pick.User.ToString()); | ||
439 | cmd.Parameters.AddWithValue(":Original", pick.OriginalName.ToString()); | ||
440 | cmd.Parameters.AddWithValue(":SimName",pick.SimName.ToString()); | ||
441 | cmd.Parameters.AddWithValue(":GlobalPos", pick.GlobalPos); | ||
442 | cmd.Parameters.AddWithValue(":SortOrder", pick.SortOrder.ToString ()); | ||
443 | cmd.Parameters.AddWithValue(":Enabled", enabled); | ||
444 | |||
445 | cmd.ExecuteNonQuery(); | ||
446 | } | ||
447 | } | ||
448 | catch (Exception e) | ||
449 | { | ||
450 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
451 | ": UpdateAvatarNotes exception {0}", e.Message); | ||
452 | return false; | ||
453 | } | ||
454 | return true; | ||
455 | } | ||
456 | |||
457 | public bool DeletePicksRecord(UUID pickId) | ||
458 | { | ||
459 | string query = string.Empty; | ||
460 | |||
461 | query += "DELETE FROM userpicks WHERE "; | ||
462 | query += "pickuuid = :PickId"; | ||
463 | |||
464 | try | ||
465 | { | ||
466 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
467 | { | ||
468 | cmd.CommandText = query; | ||
469 | cmd.Parameters.AddWithValue(":PickId", pickId.ToString()); | ||
470 | cmd.ExecuteNonQuery(); | ||
471 | } | ||
472 | } | ||
473 | catch (Exception e) | ||
474 | { | ||
475 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
476 | ": DeleteUserPickRecord exception {0}", e.Message); | ||
477 | return false; | ||
478 | } | ||
479 | return true; | ||
480 | } | ||
481 | |||
482 | public bool GetAvatarNotes(ref UserProfileNotes notes) | ||
483 | { | ||
484 | IDataReader reader = null; | ||
485 | string query = string.Empty; | ||
486 | |||
487 | query += "SELECT `notes` FROM usernotes WHERE "; | ||
488 | query += "useruuid = :Id AND "; | ||
489 | query += "targetuuid = :TargetId"; | ||
490 | OSDArray data = new OSDArray(); | ||
491 | |||
492 | try | ||
493 | { | ||
494 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
495 | { | ||
496 | cmd.CommandText = query; | ||
497 | cmd.Parameters.AddWithValue(":Id", notes.UserId.ToString()); | ||
498 | cmd.Parameters.AddWithValue(":TargetId", notes.TargetId.ToString()); | ||
499 | |||
500 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
501 | { | ||
502 | while (reader.Read()) | ||
503 | { | ||
504 | notes.Notes = OSD.FromString((string)reader["notes"]); | ||
505 | } | ||
506 | } | ||
507 | } | ||
508 | } | ||
509 | catch (Exception e) | ||
510 | { | ||
511 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
512 | ": GetAvatarNotes exception {0}", e.Message); | ||
513 | } | ||
514 | return true; | ||
515 | } | ||
516 | |||
517 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) | ||
518 | { | ||
519 | string query = string.Empty; | ||
520 | bool remove; | ||
521 | |||
522 | if(string.IsNullOrEmpty(note.Notes)) | ||
523 | { | ||
524 | remove = true; | ||
525 | query += "DELETE FROM usernotes WHERE "; | ||
526 | query += "useruuid=:UserId AND "; | ||
527 | query += "targetuuid=:TargetId"; | ||
528 | } | ||
529 | else | ||
530 | { | ||
531 | remove = false; | ||
532 | query += "INSERT OR REPLACE INTO usernotes VALUES ( "; | ||
533 | query += ":UserId,"; | ||
534 | query += ":TargetId,"; | ||
535 | query += ":Notes )"; | ||
536 | } | ||
537 | |||
538 | try | ||
539 | { | ||
540 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
541 | { | ||
542 | cmd.CommandText = query; | ||
543 | |||
544 | if(!remove) | ||
545 | cmd.Parameters.AddWithValue(":Notes", note.Notes); | ||
546 | cmd.Parameters.AddWithValue(":TargetId", note.TargetId.ToString ()); | ||
547 | cmd.Parameters.AddWithValue(":UserId", note.UserId.ToString()); | ||
548 | |||
549 | cmd.ExecuteNonQuery(); | ||
550 | } | ||
551 | } | ||
552 | catch (Exception e) | ||
553 | { | ||
554 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
555 | ": UpdateAvatarNotes exception {0}", e.Message); | ||
556 | return false; | ||
557 | } | ||
558 | return true; | ||
559 | } | ||
560 | |||
561 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) | ||
562 | { | ||
563 | IDataReader reader = null; | ||
564 | string query = string.Empty; | ||
565 | |||
566 | query += "SELECT * FROM userprofile WHERE "; | ||
567 | query += "useruuid = :Id"; | ||
568 | |||
569 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
570 | { | ||
571 | cmd.CommandText = query; | ||
572 | cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); | ||
573 | |||
574 | |||
575 | try | ||
576 | { | ||
577 | reader = cmd.ExecuteReader(); | ||
578 | } | ||
579 | catch(Exception e) | ||
580 | { | ||
581 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
582 | ": GetAvatarProperties exception {0}", e.Message); | ||
583 | result = e.Message; | ||
584 | return false; | ||
585 | } | ||
586 | if(reader != null && reader.Read()) | ||
587 | { | ||
588 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
589 | ": Getting data for {0}.", props.UserId); | ||
590 | |||
591 | props.WebUrl = (string)reader["profileURL"]; | ||
592 | UUID.TryParse((string)reader["profileImage"], out props.ImageId); | ||
593 | props.AboutText = (string)reader["profileAboutText"]; | ||
594 | UUID.TryParse((string)reader["profileFirstImage"], out props.FirstLifeImageId); | ||
595 | props.FirstLifeText = (string)reader["profileFirstText"]; | ||
596 | UUID.TryParse((string)reader["profilePartner"], out props.PartnerId); | ||
597 | props.WantToMask = (int)reader["profileWantToMask"]; | ||
598 | props.WantToText = (string)reader["profileWantToText"]; | ||
599 | props.SkillsMask = (int)reader["profileSkillsMask"]; | ||
600 | props.SkillsText = (string)reader["profileSkillsText"]; | ||
601 | props.Language = (string)reader["profileLanguages"]; | ||
602 | } | ||
603 | else | ||
604 | { | ||
605 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
606 | ": No data for {0}", props.UserId); | ||
607 | |||
608 | props.WebUrl = string.Empty; | ||
609 | props.ImageId = UUID.Zero; | ||
610 | props.AboutText = string.Empty; | ||
611 | props.FirstLifeImageId = UUID.Zero; | ||
612 | props.FirstLifeText = string.Empty; | ||
613 | props.PartnerId = UUID.Zero; | ||
614 | props.WantToMask = 0; | ||
615 | props.WantToText = string.Empty; | ||
616 | props.SkillsMask = 0; | ||
617 | props.SkillsText = string.Empty; | ||
618 | props.Language = string.Empty; | ||
619 | props.PublishProfile = false; | ||
620 | props.PublishMature = false; | ||
621 | |||
622 | query = "INSERT INTO userprofile ("; | ||
623 | query += "useruuid, "; | ||
624 | query += "profilePartner, "; | ||
625 | query += "profileAllowPublish, "; | ||
626 | query += "profileMaturePublish, "; | ||
627 | query += "profileURL, "; | ||
628 | query += "profileWantToMask, "; | ||
629 | query += "profileWantToText, "; | ||
630 | query += "profileSkillsMask, "; | ||
631 | query += "profileSkillsText, "; | ||
632 | query += "profileLanguages, "; | ||
633 | query += "profileImage, "; | ||
634 | query += "profileAboutText, "; | ||
635 | query += "profileFirstImage, "; | ||
636 | query += "profileFirstText) VALUES ("; | ||
637 | query += ":userId, "; | ||
638 | query += ":profilePartner, "; | ||
639 | query += ":profileAllowPublish, "; | ||
640 | query += ":profileMaturePublish, "; | ||
641 | query += ":profileURL, "; | ||
642 | query += ":profileWantToMask, "; | ||
643 | query += ":profileWantToText, "; | ||
644 | query += ":profileSkillsMask, "; | ||
645 | query += ":profileSkillsText, "; | ||
646 | query += ":profileLanguages, "; | ||
647 | query += ":profileImage, "; | ||
648 | query += ":profileAboutText, "; | ||
649 | query += ":profileFirstImage, "; | ||
650 | query += ":profileFirstText)"; | ||
651 | |||
652 | using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) | ||
653 | { | ||
654 | put.CommandText = query; | ||
655 | put.Parameters.AddWithValue(":userId", props.UserId.ToString()); | ||
656 | put.Parameters.AddWithValue(":profilePartner", props.PartnerId.ToString()); | ||
657 | put.Parameters.AddWithValue(":profileAllowPublish", props.PublishProfile); | ||
658 | put.Parameters.AddWithValue(":profileMaturePublish", props.PublishMature); | ||
659 | put.Parameters.AddWithValue(":profileURL", props.WebUrl); | ||
660 | put.Parameters.AddWithValue(":profileWantToMask", props.WantToMask); | ||
661 | put.Parameters.AddWithValue(":profileWantToText", props.WantToText); | ||
662 | put.Parameters.AddWithValue(":profileSkillsMask", props.SkillsMask); | ||
663 | put.Parameters.AddWithValue(":profileSkillsText", props.SkillsText); | ||
664 | put.Parameters.AddWithValue(":profileLanguages", props.Language); | ||
665 | put.Parameters.AddWithValue(":profileImage", props.ImageId.ToString()); | ||
666 | put.Parameters.AddWithValue(":profileAboutText", props.AboutText); | ||
667 | put.Parameters.AddWithValue(":profileFirstImage", props.FirstLifeImageId.ToString()); | ||
668 | put.Parameters.AddWithValue(":profileFirstText", props.FirstLifeText); | ||
669 | |||
670 | put.ExecuteNonQuery(); | ||
671 | } | ||
672 | } | ||
673 | } | ||
674 | return true; | ||
675 | } | ||
676 | |||
677 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) | ||
678 | { | ||
679 | string query = string.Empty; | ||
680 | |||
681 | query += "UPDATE userprofile SET "; | ||
682 | query += "profilePartner=:profilePartner, "; | ||
683 | query += "profileURL=:profileURL, "; | ||
684 | query += "profileImage=:image, "; | ||
685 | query += "profileAboutText=:abouttext,"; | ||
686 | query += "profileFirstImage=:firstlifeimage,"; | ||
687 | query += "profileFirstText=:firstlifetext "; | ||
688 | query += "WHERE useruuid=:uuid"; | ||
689 | |||
690 | try | ||
691 | { | ||
692 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
693 | { | ||
694 | cmd.CommandText = query; | ||
695 | cmd.Parameters.AddWithValue(":profileURL", props.WebUrl); | ||
696 | cmd.Parameters.AddWithValue(":profilePartner", props.PartnerId.ToString()); | ||
697 | cmd.Parameters.AddWithValue(":image", props.ImageId.ToString()); | ||
698 | cmd.Parameters.AddWithValue(":abouttext", props.AboutText); | ||
699 | cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); | ||
700 | cmd.Parameters.AddWithValue(":firstlifetext", props.FirstLifeText); | ||
701 | cmd.Parameters.AddWithValue(":uuid", props.UserId.ToString()); | ||
702 | |||
703 | cmd.ExecuteNonQuery(); | ||
704 | } | ||
705 | } | ||
706 | catch (Exception e) | ||
707 | { | ||
708 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
709 | ": AgentPropertiesUpdate exception {0}", e.Message); | ||
710 | |||
711 | return false; | ||
712 | } | ||
713 | return true; | ||
714 | } | ||
715 | |||
716 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) | ||
717 | { | ||
718 | string query = string.Empty; | ||
719 | |||
720 | query += "UPDATE userprofile SET "; | ||
721 | query += "profileWantToMask=:WantMask, "; | ||
722 | query += "profileWantToText=:WantText,"; | ||
723 | query += "profileSkillsMask=:SkillsMask,"; | ||
724 | query += "profileSkillsText=:SkillsText, "; | ||
725 | query += "profileLanguages=:Languages "; | ||
726 | query += "WHERE useruuid=:uuid"; | ||
727 | |||
728 | try | ||
729 | { | ||
730 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
731 | { | ||
732 | cmd.CommandText = query; | ||
733 | cmd.Parameters.AddWithValue(":WantMask", up.WantToMask); | ||
734 | cmd.Parameters.AddWithValue(":WantText", up.WantToText); | ||
735 | cmd.Parameters.AddWithValue(":SkillsMask", up.SkillsMask); | ||
736 | cmd.Parameters.AddWithValue(":SkillsText", up.SkillsText); | ||
737 | cmd.Parameters.AddWithValue(":Languages", up.Language); | ||
738 | cmd.Parameters.AddWithValue(":uuid", up.UserId.ToString()); | ||
739 | |||
740 | cmd.ExecuteNonQuery(); | ||
741 | } | ||
742 | } | ||
743 | catch (Exception e) | ||
744 | { | ||
745 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
746 | ": AgentInterestsUpdate exception {0}", e.Message); | ||
747 | result = e.Message; | ||
748 | return false; | ||
749 | } | ||
750 | return true; | ||
751 | } | ||
752 | public bool GetUserAppData(ref UserAppData props, ref string result) | ||
753 | { | ||
754 | IDataReader reader = null; | ||
755 | string query = string.Empty; | ||
756 | |||
757 | query += "SELECT * FROM `userdata` WHERE "; | ||
758 | query += "UserId = :Id AND "; | ||
759 | query += "TagId = :TagId"; | ||
760 | |||
761 | try | ||
762 | { | ||
763 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
764 | { | ||
765 | cmd.CommandText = query; | ||
766 | cmd.Parameters.AddWithValue(":Id", props.UserId.ToString()); | ||
767 | cmd.Parameters.AddWithValue (":TagId", props.TagId.ToString()); | ||
768 | |||
769 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
770 | { | ||
771 | if(reader.Read()) | ||
772 | { | ||
773 | props.DataKey = (string)reader["DataKey"]; | ||
774 | props.DataVal = (string)reader["DataVal"]; | ||
775 | } | ||
776 | else | ||
777 | { | ||
778 | query += "INSERT INTO userdata VALUES ( "; | ||
779 | query += ":UserId,"; | ||
780 | query += ":TagId,"; | ||
781 | query += ":DataKey,"; | ||
782 | query += ":DataVal) "; | ||
783 | |||
784 | using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) | ||
785 | { | ||
786 | put.Parameters.AddWithValue(":Id", props.UserId.ToString()); | ||
787 | put.Parameters.AddWithValue(":TagId", props.TagId.ToString()); | ||
788 | put.Parameters.AddWithValue(":DataKey", props.DataKey.ToString()); | ||
789 | put.Parameters.AddWithValue(":DataVal", props.DataVal.ToString()); | ||
790 | |||
791 | put.ExecuteNonQuery(); | ||
792 | } | ||
793 | } | ||
794 | } | ||
795 | } | ||
796 | } | ||
797 | catch (Exception e) | ||
798 | { | ||
799 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
800 | ": Requst application data exception {0}", e.Message); | ||
801 | result = e.Message; | ||
802 | return false; | ||
803 | } | ||
804 | return true; | ||
805 | } | ||
806 | public bool SetUserAppData(UserAppData props, ref string result) | ||
807 | { | ||
808 | string query = string.Empty; | ||
809 | |||
810 | query += "UPDATE userdata SET "; | ||
811 | query += "TagId = :TagId, "; | ||
812 | query += "DataKey = :DataKey, "; | ||
813 | query += "DataVal = :DataVal WHERE "; | ||
814 | query += "UserId = :UserId AND "; | ||
815 | query += "TagId = :TagId"; | ||
816 | |||
817 | try | ||
818 | { | ||
819 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
820 | { | ||
821 | cmd.CommandText = query; | ||
822 | cmd.Parameters.AddWithValue(":UserId", props.UserId.ToString()); | ||
823 | cmd.Parameters.AddWithValue(":TagId", props.TagId.ToString ()); | ||
824 | cmd.Parameters.AddWithValue(":DataKey", props.DataKey.ToString ()); | ||
825 | cmd.Parameters.AddWithValue(":DataVal", props.DataKey.ToString ()); | ||
826 | |||
827 | cmd.ExecuteNonQuery(); | ||
828 | } | ||
829 | } | ||
830 | catch (Exception e) | ||
831 | { | ||
832 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
833 | ": SetUserData exception {0}", e.Message); | ||
834 | return false; | ||
835 | } | ||
836 | return true; | ||
837 | } | ||
838 | public OSDArray GetUserImageAssets(UUID avatarId) | ||
839 | { | ||
840 | IDataReader reader = null; | ||
841 | OSDArray data = new OSDArray(); | ||
842 | string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = :Id"; | ||
843 | |||
844 | // Get classified image assets | ||
845 | |||
846 | |||
847 | try | ||
848 | { | ||
849 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
850 | { | ||
851 | cmd.CommandText = query; | ||
852 | cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); | ||
853 | |||
854 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
855 | { | ||
856 | while(reader.Read()) | ||
857 | { | ||
858 | data.Add(new OSDString((string)reader["snapshotuuid"].ToString())); | ||
859 | } | ||
860 | } | ||
861 | } | ||
862 | |||
863 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
864 | { | ||
865 | cmd.CommandText = query; | ||
866 | cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); | ||
867 | |||
868 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
869 | { | ||
870 | if(reader.Read()) | ||
871 | { | ||
872 | data.Add(new OSDString((string)reader["snapshotuuid"].ToString ())); | ||
873 | } | ||
874 | } | ||
875 | } | ||
876 | |||
877 | query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = :Id"; | ||
878 | |||
879 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
880 | { | ||
881 | cmd.CommandText = query; | ||
882 | cmd.Parameters.AddWithValue(":Id", avatarId.ToString()); | ||
883 | |||
884 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
885 | { | ||
886 | if(reader.Read()) | ||
887 | { | ||
888 | data.Add(new OSDString((string)reader["profileImage"].ToString ())); | ||
889 | data.Add(new OSDString((string)reader["profileFirstImage"].ToString ())); | ||
890 | } | ||
891 | } | ||
892 | } | ||
893 | } | ||
894 | catch (Exception e) | ||
895 | { | ||
896 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
897 | ": GetAvatarNotes exception {0}", e.Message); | ||
898 | } | ||
899 | return data; | ||
900 | } | ||
901 | #endregion | ||
902 | } | ||
903 | } | ||
904 | |||
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 74954cc..d29cc61 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -1850,8 +1850,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1850 | m_httpListener2.Start(64); | 1850 | m_httpListener2.Start(64); |
1851 | 1851 | ||
1852 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events | 1852 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events |
1853 | // m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); | ||
1854 | m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); | 1853 | m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); |
1854 | m_PollServiceManager.Start(); | ||
1855 | HTTPDRunning = true; | 1855 | HTTPDRunning = true; |
1856 | 1856 | ||
1857 | //HttpListenerContext context; | 1857 | //HttpListenerContext context; |
@@ -1904,7 +1904,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1904 | HTTPDRunning = false; | 1904 | HTTPDRunning = false; |
1905 | try | 1905 | try |
1906 | { | 1906 | { |
1907 | // m_PollServiceManager.Stop(); | 1907 | m_PollServiceManager.Stop(); |
1908 | 1908 | ||
1909 | m_httpListener2.ExceptionThrown -= httpServerException; | 1909 | m_httpListener2.ExceptionThrown -= httpServerException; |
1910 | //m_httpListener2.DisconnectHandler = null; | 1910 | //m_httpListener2.DisconnectHandler = null; |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 7628e23..c2254c4 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -203,14 +203,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
203 | m_server = pSrv; | 203 | m_server = pSrv; |
204 | m_WorkerThreadCount = pWorkerThreadCount; | 204 | m_WorkerThreadCount = pWorkerThreadCount; |
205 | m_workerThreads = new Thread[m_WorkerThreadCount]; | 205 | m_workerThreads = new Thread[m_WorkerThreadCount]; |
206 | } | ||
206 | 207 | ||
208 | public void Start() | ||
209 | { | ||
207 | //startup worker threads | 210 | //startup worker threads |
208 | for (uint i = 0; i < m_WorkerThreadCount; i++) | 211 | for (uint i = 0; i < m_WorkerThreadCount; i++) |
209 | { | 212 | { |
210 | m_workerThreads[i] | 213 | m_workerThreads[i] |
211 | = Watchdog.StartThread( | 214 | = Watchdog.StartThread( |
212 | PoolWorkerJob, | 215 | PoolWorkerJob, |
213 | String.Format("PollServiceWorkerThread{0}", i), | 216 | string.Format("PollServiceWorkerThread{0}:{1}", i, m_server.Port), |
214 | ThreadPriority.Normal, | 217 | ThreadPriority.Normal, |
215 | false, | 218 | false, |
216 | false, | 219 | false, |
@@ -220,7 +223,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
220 | 223 | ||
221 | m_retrysThread = Watchdog.StartThread( | 224 | m_retrysThread = Watchdog.StartThread( |
222 | this.CheckRetries, | 225 | this.CheckRetries, |
223 | "PollServiceWatcherThread", | 226 | string.Format("PollServiceWatcherThread:{0}", m_server.Port), |
224 | ThreadPriority.Normal, | 227 | ThreadPriority.Normal, |
225 | false, | 228 | false, |
226 | true, | 229 | true, |
@@ -228,7 +231,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
228 | 1000 * 60 * 10); | 231 | 1000 * 60 * 10); |
229 | } | 232 | } |
230 | 233 | ||
231 | |||
232 | private void ReQueueEvent(PollServiceHttpRequest req) | 234 | private void ReQueueEvent(PollServiceHttpRequest req) |
233 | { | 235 | { |
234 | if (m_running) | 236 | if (m_running) |
@@ -279,14 +281,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
279 | } | 281 | } |
280 | } | 282 | } |
281 | 283 | ||
282 | ~PollServiceRequestManager() | 284 | public void Stop() |
283 | { | 285 | { |
284 | m_running = false; | 286 | m_running = false; |
285 | // m_timeout = -10000; // cause all to expire | 287 | // m_timeout = -10000; // cause all to expire |
286 | Thread.Sleep(1000); // let the world move | 288 | Thread.Sleep(1000); // let the world move |
287 | 289 | ||
288 | foreach (Thread t in m_workerThreads) | 290 | foreach (Thread t in m_workerThreads) |
289 | Watchdog.AbortThread(t.ManagedThreadId); | 291 | Watchdog.AbortThread(t.ManagedThreadId); |
290 | 292 | ||
291 | try | 293 | try |
292 | { | 294 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index bf24030..2bb24ae 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | |||
@@ -57,6 +57,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
57 | 57 | ||
58 | public void Initialise(IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
59 | { | 59 | { |
60 | if(config.Configs["UserProfiles"] != null) | ||
61 | return; | ||
62 | |||
60 | m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); | 63 | m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); |
61 | m_Enabled = true; | 64 | m_Enabled = true; |
62 | } | 65 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index a97c9b4..322addd 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -130,6 +130,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
130 | 130 | ||
131 | if (profileConfig == null) | 131 | if (profileConfig == null) |
132 | { | 132 | { |
133 | m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration"); | ||
133 | Enabled = false; | 134 | Enabled = false; |
134 | return; | 135 | return; |
135 | } | 136 | } |
@@ -1316,7 +1317,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1316 | Stream rstream = webResponse.GetResponseStream(); | 1317 | Stream rstream = webResponse.GetResponseStream(); |
1317 | 1318 | ||
1318 | OSDMap response = new OSDMap(); | 1319 | OSDMap response = new OSDMap(); |
1319 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | 1320 | try |
1321 | { | ||
1322 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
1323 | } | ||
1324 | catch (Exception e) | ||
1325 | { | ||
1326 | m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); | ||
1327 | return false; | ||
1328 | } | ||
1329 | |||
1320 | if(response.ContainsKey("error")) | 1330 | if(response.ContainsKey("error")) |
1321 | { | 1331 | { |
1322 | data = response["error"]; | 1332 | data = response["error"]; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index d221d68..9f58175 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
322 | // a copy of the local asset. | 322 | // a copy of the local asset. |
323 | m_Cache.Cache(asset); | 323 | m_Cache.Cache(asset); |
324 | 324 | ||
325 | if (asset.Temporary || asset.Local) | 325 | if (asset.Local) |
326 | { | 326 | { |
327 | if (m_Cache != null) | 327 | if (m_Cache != null) |
328 | m_Cache.Cache(asset); | 328 | m_Cache.Cache(asset); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 480cd69..52b1039 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -258,7 +258,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
258 | if (m_Cache != null) | 258 | if (m_Cache != null) |
259 | m_Cache.Cache(asset); | 259 | m_Cache.Cache(asset); |
260 | 260 | ||
261 | if (asset.Temporary || asset.Local) | 261 | if (asset.Local) |
262 | { | 262 | { |
263 | // m_log.DebugFormat( | 263 | // m_log.DebugFormat( |
264 | // "[LOCAL ASSET SERVICE CONNECTOR]: Returning asset {0} {1} without querying database since status Temporary = {2}, Local = {3}", | 264 | // "[LOCAL ASSET SERVICE CONNECTOR]: Returning asset {0} {1} without querying database since status Temporary = {2}, Local = {3}", |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs index 1982473..7073433 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs | |||
@@ -93,7 +93,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests | |||
93 | LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); | 93 | LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); |
94 | lasc.Initialise(config); | 94 | lasc.Initialise(config); |
95 | 95 | ||
96 | // If it is local, it should not be stored | ||
96 | AssetBase a1 = AssetHelpers.CreateNotecardAsset(); | 97 | AssetBase a1 = AssetHelpers.CreateNotecardAsset(); |
98 | a1.Local = true; | ||
97 | a1.Temporary = true; | 99 | a1.Temporary = true; |
98 | 100 | ||
99 | lasc.Store(a1); | 101 | lasc.Store(a1); |
@@ -102,6 +104,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests | |||
102 | Assert.That(lasc.GetData(a1.ID), Is.Null); | 104 | Assert.That(lasc.GetData(a1.ID), Is.Null); |
103 | Assert.That(lasc.GetMetadata(a1.ID), Is.Null); | 105 | Assert.That(lasc.GetMetadata(a1.ID), Is.Null); |
104 | 106 | ||
107 | // If it is remote, it should be stored | ||
108 | // AssetBase a2 = AssetHelpers.CreateNotecardAsset(); | ||
109 | // a2.Local = false; | ||
110 | // a2.Temporary = true; | ||
111 | |||
112 | // lasc.Store(a2); | ||
113 | |||
114 | // AssetBase retreivedA2 = lasc.Get(a2.ID); | ||
115 | // Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); | ||
116 | // Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); | ||
117 | // Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); | ||
118 | |||
119 | // AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); | ||
120 | // Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); | ||
121 | |||
122 | // byte[] retrievedA2Data = lasc.GetData(a2.ID); | ||
123 | // Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); | ||
124 | |||
105 | // TODO: Add cache and check that this does receive a copy of the asset | 125 | // TODO: Add cache and check that this does receive a copy of the asset |
106 | } | 126 | } |
107 | 127 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index cca887a..a4c5e08 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -148,7 +148,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
148 | // The asset state is first 'Unknown' then 'Waiting' then either 'Failed' or 'Fetched'. | 148 | // The asset state is first 'Unknown' then 'Waiting' then either 'Failed' or 'Fetched'. |
149 | public enum PrimAssetCondition | 149 | public enum PrimAssetCondition |
150 | { | 150 | { |
151 | Unknown, Waiting, Failed, Fetched | 151 | Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched |
152 | } | 152 | } |
153 | public PrimAssetCondition PrimAssetState { get; set; } | 153 | public PrimAssetCondition PrimAssetState { get; set; } |
154 | 154 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 423c389..dec6b6f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -249,7 +249,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
249 | TerrainManager.CreateInitialGroundPlaneAndTerrain(); | 249 | TerrainManager.CreateInitialGroundPlaneAndTerrain(); |
250 | 250 | ||
251 | // Put some informational messages into the log file. | 251 | // Put some informational messages into the log file. |
252 | m_log.WarnFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); | 252 | m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); |
253 | 253 | ||
254 | InTaintTime = false; | 254 | InTaintTime = false; |
255 | m_initialized = true; | 255 | m_initialized = true; |
@@ -374,7 +374,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
374 | } | 374 | } |
375 | else | 375 | else |
376 | { | 376 | { |
377 | m_log.WarnFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); | 377 | m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); |
378 | } | 378 | } |
379 | 379 | ||
380 | return ret; | 380 | return ret; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 326fc9e..a780526 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -167,7 +167,7 @@ public abstract class BSShape | |||
167 | // Prevent trying to keep fetching the mesh by declaring failure. | 167 | // Prevent trying to keep fetching the mesh by declaring failure. |
168 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) | 168 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) |
169 | { | 169 | { |
170 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; | 170 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; |
171 | physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", | 171 | physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", |
172 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); | 172 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); |
173 | physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}", | 173 | physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}", |
@@ -177,7 +177,8 @@ public abstract class BSShape | |||
177 | { | 177 | { |
178 | // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset | 178 | // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset |
179 | if (prim.BaseShape.SculptEntry | 179 | if (prim.BaseShape.SculptEntry |
180 | && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed | 180 | && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedAssetFetch |
181 | && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedMeshing | ||
181 | && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting | 182 | && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting |
182 | && prim.BaseShape.SculptTexture != OMV.UUID.Zero | 183 | && prim.BaseShape.SculptTexture != OMV.UUID.Zero |
183 | ) | 184 | ) |
@@ -219,7 +220,7 @@ public abstract class BSShape | |||
219 | } | 220 | } |
220 | if (!assetFound) | 221 | if (!assetFound) |
221 | { | 222 | { |
222 | yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; | 223 | yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; |
223 | } | 224 | } |
224 | physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}", | 225 | physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}", |
225 | yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); | 226 | yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); |
@@ -227,7 +228,7 @@ public abstract class BSShape | |||
227 | } | 228 | } |
228 | else | 229 | else |
229 | { | 230 | { |
230 | xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; | 231 | xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; |
231 | physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", | 232 | physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", |
232 | LogHeader, physicsScene.Name); | 233 | LogHeader, physicsScene.Name); |
233 | } | 234 | } |
@@ -235,13 +236,20 @@ public abstract class BSShape | |||
235 | } | 236 | } |
236 | else | 237 | else |
237 | { | 238 | { |
238 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) | 239 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) |
239 | { | 240 | { |
240 | physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", | 241 | physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", |
241 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); | 242 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); |
242 | physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}", | 243 | physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}", |
243 | prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); | 244 | prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); |
244 | } | 245 | } |
246 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing) | ||
247 | { | ||
248 | physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}", | ||
249 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); | ||
250 | physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}", | ||
251 | prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); | ||
252 | } | ||
245 | } | 253 | } |
246 | } | 254 | } |
247 | 255 | ||
@@ -374,7 +382,9 @@ public class BSShapeMesh : BSShape | |||
374 | 382 | ||
375 | // Check to see if mesh was created (might require an asset). | 383 | // Check to see if mesh was created (might require an asset). |
376 | newShape = VerifyMeshCreated(physicsScene, newShape, prim); | 384 | newShape = VerifyMeshCreated(physicsScene, newShape, prim); |
377 | if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) | 385 | if (!newShape.isNativeShape |
386 | || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing | ||
387 | || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) | ||
378 | { | 388 | { |
379 | // If a mesh was what was created, remember the built shape for later sharing. | 389 | // If a mesh was what was created, remember the built shape for later sharing. |
380 | // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh. | 390 | // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh. |
@@ -519,7 +529,7 @@ public class BSShapeMesh : BSShape | |||
519 | else | 529 | else |
520 | { | 530 | { |
521 | // Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh. | 531 | // Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh. |
522 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; | 532 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; |
523 | physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", | 533 | physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", |
524 | LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name); | 534 | LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name); |
525 | physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey); | 535 | physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey); |
@@ -561,7 +571,9 @@ public class BSShapeHull : BSShape | |||
561 | 571 | ||
562 | // Check to see if hull was created (might require an asset). | 572 | // Check to see if hull was created (might require an asset). |
563 | newShape = VerifyMeshCreated(physicsScene, newShape, prim); | 573 | newShape = VerifyMeshCreated(physicsScene, newShape, prim); |
564 | if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) | 574 | if (!newShape.isNativeShape |
575 | || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing | ||
576 | || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) | ||
565 | { | 577 | { |
566 | // If a mesh was what was created, remember the built shape for later sharing. | 578 | // If a mesh was what was created, remember the built shape for later sharing. |
567 | Hulls.Add(newHullKey, retHull); | 579 | Hulls.Add(newHullKey, retHull); |
@@ -1081,10 +1093,13 @@ public class BSShapeGImpact : BSShape | |||
1081 | // Check to see if mesh was created (might require an asset). | 1093 | // Check to see if mesh was created (might require an asset). |
1082 | newShape = VerifyMeshCreated(physicsScene, newShape, prim); | 1094 | newShape = VerifyMeshCreated(physicsScene, newShape, prim); |
1083 | newShape.shapeKey = newMeshKey; | 1095 | newShape.shapeKey = newMeshKey; |
1084 | if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) | 1096 | if (!newShape.isNativeShape |
1097 | || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing | ||
1098 | || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) | ||
1085 | { | 1099 | { |
1086 | // If a mesh was what was created, remember the built shape for later sharing. | 1100 | // If a mesh was what was created, remember the built shape for later sharing. |
1087 | // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh. | 1101 | // Also note that if meshing failed we put it in the mesh list as there is nothing |
1102 | // else to do about the mesh. | ||
1088 | GImpacts.Add(newMeshKey, retGImpact); | 1103 | GImpacts.Add(newMeshKey, retGImpact); |
1089 | } | 1104 | } |
1090 | 1105 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index df1da63..1e01526 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -2,11 +2,6 @@ CURRENT PROBLEMS TO FIX AND/OR LOOK AT | |||
2 | ================================================= | 2 | ================================================= |
3 | Script changing rotation of child prim while vehicle moving (eg turning wheel) causes | 3 | Script changing rotation of child prim while vehicle moving (eg turning wheel) causes |
4 | the wheel to appear to jump back. Looks like sending position from previous update. | 4 | the wheel to appear to jump back. Looks like sending position from previous update. |
5 | Vehicle ride, get up, ride again. Second time vehicle does not act correctly. | ||
6 | Have to rez new vehicle and delete the old to fix situation. | ||
7 | Hitting RESET on Nebadon's vehicle while riding causes vehicle to get into odd | ||
8 | position state where it will not settle onto ground properly, etc | ||
9 | Two of Nebadon vehicles in a sim max the CPU. This is new. | ||
10 | Enable vehicle border crossings (at least as poorly as ODE) | 5 | Enable vehicle border crossings (at least as poorly as ODE) |
11 | Terrain skirts | 6 | Terrain skirts |
12 | Avatar created in previous region and not new region when crossing border | 7 | Avatar created in previous region and not new region when crossing border |
@@ -23,24 +18,17 @@ vehicle angular banking | |||
23 | Center-of-gravity | 18 | Center-of-gravity |
24 | Vehicle angular deflection | 19 | Vehicle angular deflection |
25 | Preferred orientation angular correction fix | 20 | Preferred orientation angular correction fix |
26 | when should angular and linear motor targets be zeroed? when selected? | ||
27 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. | ||
28 | Teravus llMoveToTarget script debug | 21 | Teravus llMoveToTarget script debug |
29 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force | 22 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force |
30 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) | 23 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) |
31 | limitMotorUp calibration (more down?) | 24 | limitMotorUp calibration (more down?) |
32 | llRotLookAt | 25 | llRotLookAt |
33 | llLookAt | 26 | llLookAt |
34 | Avatars walking up stairs (HALF DONE) | 27 | Convert to avatar mesh capsule. Include rotation of capsule. |
35 | Avatar movement | ||
36 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) | ||
37 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) (DONE) | ||
38 | avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) | ||
39 | Vehicle script tuning/debugging | 28 | Vehicle script tuning/debugging |
40 | Avanti speed script | 29 | Avanti speed script |
41 | Weapon shooter script | 30 | Weapon shooter script |
42 | Move material definitions (friction, ...) into simulator. | 31 | Move material definitions (friction, ...) into simulator. |
43 | Add material densities to the material types. | ||
44 | One sided meshes? Should terrain be built into a closed shape? | 32 | One sided meshes? Should terrain be built into a closed shape? |
45 | When meshes get partially wedged into the terrain, they cannot push themselves out. | 33 | When meshes get partially wedged into the terrain, they cannot push themselves out. |
46 | It is possible that Bullet processes collisions whether entering or leaving a mesh. | 34 | It is possible that Bullet processes collisions whether entering or leaving a mesh. |
@@ -53,12 +41,8 @@ LINEAR_MOTOR_DIRECTION values should be clamped to reasonable numbers. | |||
53 | Same for other velocity settings. | 41 | Same for other velocity settings. |
54 | UBit improvements to remove rubber-banding of avatars sitting on vehicle child prims: | 42 | UBit improvements to remove rubber-banding of avatars sitting on vehicle child prims: |
55 | https://github.com/UbitUmarov/Ubit-opensim | 43 | https://github.com/UbitUmarov/Ubit-opensim |
56 | Border crossing with linked vehicle causes crash | ||
57 | 20121129.1411: editting/moving phys object across region boundries causes crash | ||
58 | getPos-> btRigidBody::upcast -> getBodyType -> BOOM | ||
59 | Vehicles (Move smoothly) | 44 | Vehicles (Move smoothly) |
60 | Some vehicles should not be able to turn if no speed or off ground. | 45 | Some vehicles should not be able to turn if no speed or off ground. |
61 | What to do if vehicle and prim buoyancy differ? | ||
62 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. | 46 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. |
63 | Neb car jiggling left and right | 47 | Neb car jiggling left and right |
64 | Happens on terrain and any other mesh object. Flat cubes are much smoother. | 48 | Happens on terrain and any other mesh object. Flat cubes are much smoother. |
@@ -68,8 +52,6 @@ For limitMotorUp, use raycast down to find if vehicle is in the air. | |||
68 | Verify llGetVel() is returning a smooth and good value for vehicle movement. | 52 | Verify llGetVel() is returning a smooth and good value for vehicle movement. |
69 | llGetVel() should return the root's velocity if requested in a child prim. | 53 | llGetVel() should return the root's velocity if requested in a child prim. |
70 | Implement function efficiency for lineaar and angular motion. | 54 | Implement function efficiency for lineaar and angular motion. |
71 | After getting off a vehicle, the root prim is phantom (can be walked through) | ||
72 | Need to force a position update for the root prim after compound shape destruction | ||
73 | Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint) | 55 | Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint) |
74 | Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties(). | 56 | Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties(). |
75 | A kludge that isn't fixing the real problem of Bullet adding extra motion. | 57 | A kludge that isn't fixing the real problem of Bullet adding extra motion. |
@@ -78,11 +60,10 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl | |||
78 | creates over-correction and over-shoot and wabbling. | 60 | creates over-correction and over-shoot and wabbling. |
79 | Vehicle attributes are not restored when a vehicle is rezzed on region creation | 61 | Vehicle attributes are not restored when a vehicle is rezzed on region creation |
80 | Create vehicle, setup vehicle properties, restart region, vehicle is not reinitialized. | 62 | Create vehicle, setup vehicle properties, restart region, vehicle is not reinitialized. |
63 | What to do if vehicle and prim buoyancy differ? | ||
81 | 64 | ||
82 | GENERAL TODO LIST: | 65 | GENERAL TODO LIST: |
83 | ================================================= | 66 | ================================================= |
84 | Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects. | ||
85 | Regular triangle meshes don't do physical collisions. | ||
86 | Resitution of a prim works on another prim but not on terrain. | 67 | Resitution of a prim works on another prim but not on terrain. |
87 | The dropped prim doesn't bounce properly on the terrain. | 68 | The dropped prim doesn't bounce properly on the terrain. |
88 | Add a sanity check for PIDTarget location. | 69 | Add a sanity check for PIDTarget location. |
@@ -359,4 +340,25 @@ Lock axis (DONE 20130401) | |||
359 | Terrain detail: double terrain mesh detail (DONE) | 340 | Terrain detail: double terrain mesh detail (DONE) |
360 | Use the HACD convex hull routine in Bullet rather than the C# version. | 341 | Use the HACD convex hull routine in Bullet rather than the C# version. |
361 | Speed up hullifying large meshes. (DONE) | 342 | Speed up hullifying large meshes. (DONE) |
343 | Vehicle ride, get up, ride again. Second time vehicle does not act correctly. | ||
344 | Have to rez new vehicle and delete the old to fix situation. | ||
345 | (DONE 20130520: normalize rotations) | ||
346 | Hitting RESET on Nebadon's vehicle while riding causes vehicle to get into odd | ||
347 | position state where it will not settle onto ground properly, etc | ||
348 | (DONE 20130520: normalize rotations) | ||
349 | Two of Nebadon vehicles in a sim max the CPU. This is new. | ||
350 | (DONE 20130520: two problems: if asset failed to mesh, constantly refetched | ||
351 | asset; vehicle was sending too many messages to all linkset members) | ||
352 | Add material densities to the material types. (WILL NOT BE DONE: not how it is done) | ||
353 | Avatars walking up stairs (DONE) | ||
354 | Avatar movement | ||
355 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) | ||
356 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) (DONE) | ||
357 | avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) | ||
358 | After getting off a vehicle, the root prim is phantom (can be walked through) | ||
359 | Need to force a position update for the root prim after compound shape destruction | ||
360 | (DONE) | ||
361 | Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects. | ||
362 | Regular triangle meshes don't do physical collisions. | ||
363 | (DONE: discovered GImpact is VERY CPU intensive) | ||
362 | 364 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7c375e6..f5d5bc6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5109,6 +5109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5109 | 5109 | ||
5110 | s = Math.Cos(angle * 0.5); | 5110 | s = Math.Cos(angle * 0.5); |
5111 | t = Math.Sin(angle * 0.5); // temp value to avoid 2 more sin() calcs | 5111 | t = Math.Sin(angle * 0.5); // temp value to avoid 2 more sin() calcs |
5112 | axis = LSL_Vector.Norm(axis); | ||
5112 | x = axis.x * t; | 5113 | x = axis.x * t; |
5113 | y = axis.y * t; | 5114 | y = axis.y * t; |
5114 | z = axis.z * t; | 5115 | z = axis.z * t; |
@@ -5149,7 +5150,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5149 | y = rot.y / s; | 5150 | y = rot.y / s; |
5150 | z = rot.z / s; | 5151 | z = rot.z / s; |
5151 | } | 5152 | } |
5152 | 5153 | if ((double.IsNaN(x)) || double.IsInfinity(x)) x = 0; | |
5154 | if ((double.IsNaN(y)) || double.IsInfinity(y)) y = 0; | ||
5155 | if ((double.IsNaN(z)) || double.IsInfinity(z)) z = 0; | ||
5153 | return new LSL_Vector(x,y,z); | 5156 | return new LSL_Vector(x,y,z); |
5154 | } | 5157 | } |
5155 | 5158 | ||
@@ -5171,7 +5174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5171 | } | 5174 | } |
5172 | 5175 | ||
5173 | double angle = 2 * Math.Acos(rot.s); | 5176 | double angle = 2 * Math.Acos(rot.s); |
5174 | 5177 | if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0; | |
5175 | return angle; | 5178 | return angle; |
5176 | } | 5179 | } |
5177 | 5180 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 3e69ab9..c685afb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -371,6 +371,31 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
371 | 371 | ||
372 | #endregion | 372 | #endregion |
373 | 373 | ||
374 | #region Methods | ||
375 | public Quaternion Normalize() | ||
376 | { | ||
377 | double length = Math.Sqrt(x * x + y * y + z * z + s * s); | ||
378 | if (length < float.Epsilon) | ||
379 | { | ||
380 | x = 1; | ||
381 | y = 0; | ||
382 | z = 0; | ||
383 | s = 0; | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | |||
388 | double invLength = 1.0 / length; | ||
389 | x *= invLength; | ||
390 | y *= invLength; | ||
391 | z *= invLength; | ||
392 | s *= invLength; | ||
393 | } | ||
394 | |||
395 | return this; | ||
396 | } | ||
397 | #endregion | ||
398 | |||
374 | #region Overriders | 399 | #region Overriders |
375 | 400 | ||
376 | public override int GetHashCode() | 401 | public override int GetHashCode() |