aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs786
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs34
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs34
-rw-r--r--OpenSim/Framework/General/Interfaces/IAssetProvider.cs34
-rw-r--r--OpenSim/Framework/UserManager/CAPSService.cs76
-rw-r--r--OpenSim/Framework/UserManager/LoginService.cs580
6 files changed, 772 insertions, 772 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs
index 8c63b30..e5329ec 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs
@@ -1,393 +1,393 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Threading; 30using System.Threading;
31using Db4objects.Db4o; 31using Db4objects.Db4o;
32using Db4objects.Db4o.Query; 32using Db4objects.Db4o.Query;
33using libsecondlife; 33using libsecondlife;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types; 37using OpenSim.Framework.Types;
38using OpenSim.Framework.Utilities; 38using OpenSim.Framework.Utilities;
39 39
40namespace OpenSim.Framework.Communications.Caches 40namespace OpenSim.Framework.Communications.Caches
41{ 41{
42 42
43 public class LocalAssetServer : IAssetServer 43 public class LocalAssetServer : IAssetServer
44 { 44 {
45 private IAssetReceiver _receiver; 45 private IAssetReceiver _receiver;
46 private BlockingQueue<ARequest> _assetRequests; 46 private BlockingQueue<ARequest> _assetRequests;
47 private IObjectContainer db; 47 private IObjectContainer db;
48 private Thread _localAssetServerThread; 48 private Thread _localAssetServerThread;
49 49
50 public LocalAssetServer() 50 public LocalAssetServer()
51 { 51 {
52 System.Console.WriteLine("Starting Db4o asset storage system"); 52 System.Console.WriteLine("Starting Db4o asset storage system");
53 bool yapfile; 53 bool yapfile;
54 this._assetRequests = new BlockingQueue<ARequest>(); 54 this._assetRequests = new BlockingQueue<ARequest>();
55 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); 55 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
56 56
57 MainLog.Instance.Verbose("Local Asset Server class created"); 57 MainLog.Instance.Verbose("Local Asset Server class created");
58 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); 58 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
59 MainLog.Instance.Verbose("Db4 Asset database creation"); 59 MainLog.Instance.Verbose("Db4 Asset database creation");
60 60
61 if (!yapfile) 61 if (!yapfile)
62 { 62 {
63 this.SetUpAssetDatabase(); 63 this.SetUpAssetDatabase();
64 } 64 }
65 65
66 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); 66 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
67 this._localAssetServerThread.IsBackground = true; 67 this._localAssetServerThread.IsBackground = true;
68 this._localAssetServerThread.Start(); 68 this._localAssetServerThread.Start();
69 69
70 } 70 }
71 71
72 public void SetReceiver(IAssetReceiver receiver) 72 public void SetReceiver(IAssetReceiver receiver)
73 { 73 {
74 this._receiver = receiver; 74 this._receiver = receiver;
75 } 75 }
76 76
77 public void FetchAsset(LLUUID assetID, bool isTexture) 77 public void FetchAsset(LLUUID assetID, bool isTexture)
78 { 78 {
79 ARequest req = new ARequest(); 79 ARequest req = new ARequest();
80 req.AssetID = assetID; 80 req.AssetID = assetID;
81 req.IsTexture = isTexture; 81 req.IsTexture = isTexture;
82 this._assetRequests.Enqueue(req); 82 this._assetRequests.Enqueue(req);
83 } 83 }
84 84
85 public void UpdateAsset(AssetBase asset) 85 public void UpdateAsset(AssetBase asset)
86 { 86 {
87 87
88 } 88 }
89 89
90 public void CreateAsset(AssetBase asset) 90 public void CreateAsset(AssetBase asset)
91 { 91 {
92 AssetStorage store = new AssetStorage(); 92 AssetStorage store = new AssetStorage();
93 store.Data = asset.Data; 93 store.Data = asset.Data;
94 store.Name = asset.Name; 94 store.Name = asset.Name;
95 store.UUID = asset.FullID; 95 store.UUID = asset.FullID;
96 db.Set(store); 96 db.Set(store);
97 db.Commit(); 97 db.Commit();
98 } 98 }
99 99
100 public void SetServerInfo(string ServerUrl, string ServerKey) 100 public void SetServerInfo(string ServerUrl, string ServerKey)
101 { 101 {
102 102
103 } 103 }
104 public void Close() 104 public void Close()
105 { 105 {
106 if (db != null) 106 if (db != null)
107 { 107 {
108 MainLog.Instance.Verbose("Closing local asset server database"); 108 MainLog.Instance.Verbose("Closing local asset server database");
109 db.Close(); 109 db.Close();
110 } 110 }
111 } 111 }
112 112
113 private void RunRequests() 113 private void RunRequests()
114 { 114 {
115 while (true) 115 while (true)
116 { 116 {
117 byte[] idata = null; 117 byte[] idata = null;
118 bool found = false; 118 bool found = false;
119 AssetStorage foundAsset = null; 119 AssetStorage foundAsset = null;
120 ARequest req = this._assetRequests.Dequeue(); 120 ARequest req = this._assetRequests.Dequeue();
121 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); 121 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
122 if (result.Count > 0) 122 if (result.Count > 0)
123 { 123 {
124 foundAsset = (AssetStorage)result.Next(); 124 foundAsset = (AssetStorage)result.Next();
125 found = true; 125 found = true;
126 } 126 }
127 127
128 AssetBase asset = new AssetBase(); 128 AssetBase asset = new AssetBase();
129 if (found) 129 if (found)
130 { 130 {
131 asset.FullID = foundAsset.UUID; 131 asset.FullID = foundAsset.UUID;
132 asset.Type = foundAsset.Type; 132 asset.Type = foundAsset.Type;
133 asset.InvType = foundAsset.Type; 133 asset.InvType = foundAsset.Type;
134 asset.Name = foundAsset.Name; 134 asset.Name = foundAsset.Name;
135 idata = foundAsset.Data; 135 idata = foundAsset.Data;
136 asset.Data = idata; 136 asset.Data = idata;
137 _receiver.AssetReceived(asset, req.IsTexture); 137 _receiver.AssetReceived(asset, req.IsTexture);
138 } 138 }
139 else 139 else
140 { 140 {
141 //asset.FullID = ; 141 //asset.FullID = ;
142 _receiver.AssetNotFound(req.AssetID); 142 _receiver.AssetNotFound(req.AssetID);
143 } 143 }
144 144
145 } 145 }
146 146
147 } 147 }
148 148
149 private void SetUpAssetDatabase() 149 private void SetUpAssetDatabase()
150 { 150 {
151 MainLog.Instance.Verbose("Setting up asset database"); 151 MainLog.Instance.Verbose("Setting up asset database");
152 152
153 AssetBase Image = new AssetBase(); 153 AssetBase Image = new AssetBase();
154 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); 154 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
155 Image.Name = "Bricks"; 155 Image.Name = "Bricks";
156 this.LoadAsset(Image, true, "bricks.jp2"); 156 this.LoadAsset(Image, true, "bricks.jp2");
157 AssetStorage store = new AssetStorage(); 157 AssetStorage store = new AssetStorage();
158 store.Data = Image.Data; 158 store.Data = Image.Data;
159 store.Name = Image.Name; 159 store.Name = Image.Name;
160 store.UUID = Image.FullID; 160 store.UUID = Image.FullID;
161 db.Set(store); 161 db.Set(store);
162 db.Commit(); 162 db.Commit();
163 163
164 Image = new AssetBase(); 164 Image = new AssetBase();
165 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); 165 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
166 Image.Name = "Plywood"; 166 Image.Name = "Plywood";
167 this.LoadAsset(Image, true, "plywood.jp2"); 167 this.LoadAsset(Image, true, "plywood.jp2");
168 store = new AssetStorage(); 168 store = new AssetStorage();
169 store.Data = Image.Data; 169 store.Data = Image.Data;
170 store.Name = Image.Name; 170 store.Name = Image.Name;
171 store.UUID = Image.FullID; 171 store.UUID = Image.FullID;
172 db.Set(store); 172 db.Set(store);
173 db.Commit(); 173 db.Commit();
174 174
175 Image = new AssetBase(); 175 Image = new AssetBase();
176 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); 176 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
177 Image.Name = "Rocks"; 177 Image.Name = "Rocks";
178 this.LoadAsset(Image, true, "rocks.jp2"); 178 this.LoadAsset(Image, true, "rocks.jp2");
179 store = new AssetStorage(); 179 store = new AssetStorage();
180 store.Data = Image.Data; 180 store.Data = Image.Data;
181 store.Name = Image.Name; 181 store.Name = Image.Name;
182 store.UUID = Image.FullID; 182 store.UUID = Image.FullID;
183 db.Set(store); 183 db.Set(store);
184 db.Commit(); 184 db.Commit();
185 185
186 Image = new AssetBase(); 186 Image = new AssetBase();
187 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); 187 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
188 Image.Name = "Granite"; 188 Image.Name = "Granite";
189 this.LoadAsset(Image, true, "granite.jp2"); 189 this.LoadAsset(Image, true, "granite.jp2");
190 store = new AssetStorage(); 190 store = new AssetStorage();
191 store.Data = Image.Data; 191 store.Data = Image.Data;
192 store.Name = Image.Name; 192 store.Name = Image.Name;
193 store.UUID = Image.FullID; 193 store.UUID = Image.FullID;
194 db.Set(store); 194 db.Set(store);
195 db.Commit(); 195 db.Commit();
196 196
197 Image = new AssetBase(); 197 Image = new AssetBase();
198 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); 198 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
199 Image.Name = "Hardwood"; 199 Image.Name = "Hardwood";
200 this.LoadAsset(Image, true, "hardwood.jp2"); 200 this.LoadAsset(Image, true, "hardwood.jp2");
201 store = new AssetStorage(); 201 store = new AssetStorage();
202 store.Data = Image.Data; 202 store.Data = Image.Data;
203 store.Name = Image.Name; 203 store.Name = Image.Name;
204 store.UUID = Image.FullID; 204 store.UUID = Image.FullID;
205 db.Set(store); 205 db.Set(store);
206 db.Commit(); 206 db.Commit();
207 207
208 Image = new AssetBase(); 208 Image = new AssetBase();
209 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); 209 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
210 Image.Name = "Prim Base Texture"; 210 Image.Name = "Prim Base Texture";
211 this.LoadAsset(Image, true, "plywood.jp2"); 211 this.LoadAsset(Image, true, "plywood.jp2");
212 store = new AssetStorage(); 212 store = new AssetStorage();
213 store.Data = Image.Data; 213 store.Data = Image.Data;
214 store.Name = Image.Name; 214 store.Name = Image.Name;
215 store.UUID = Image.FullID; 215 store.UUID = Image.FullID;
216 db.Set(store); 216 db.Set(store);
217 db.Commit(); 217 db.Commit();
218 218
219 Image = new AssetBase(); 219 Image = new AssetBase();
220 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); 220 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
221 Image.Name = "Map Base Texture"; 221 Image.Name = "Map Base Texture";
222 this.LoadAsset(Image, true, "map_base.jp2"); 222 this.LoadAsset(Image, true, "map_base.jp2");
223 store = new AssetStorage(); 223 store = new AssetStorage();
224 store.Data = Image.Data; 224 store.Data = Image.Data;
225 store.Name = Image.Name; 225 store.Name = Image.Name;
226 store.UUID = Image.FullID; 226 store.UUID = Image.FullID;
227 db.Set(store); 227 db.Set(store);
228 db.Commit(); 228 db.Commit();
229 229
230 Image = new AssetBase(); 230 Image = new AssetBase();
231 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); 231 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
232 Image.Name = "Map Texture"; 232 Image.Name = "Map Texture";
233 this.LoadAsset(Image, true, "map1.jp2"); 233 this.LoadAsset(Image, true, "map1.jp2");
234 store = new AssetStorage(); 234 store = new AssetStorage();
235 store.Data = Image.Data; 235 store.Data = Image.Data;
236 store.Name = Image.Name; 236 store.Name = Image.Name;
237 store.UUID = Image.FullID; 237 store.UUID = Image.FullID;
238 db.Set(store); 238 db.Set(store);
239 db.Commit(); 239 db.Commit();
240 240
241 Image = new AssetBase(); 241 Image = new AssetBase();
242 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); 242 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010");
243 Image.Name = "Female Body Texture"; 243 Image.Name = "Female Body Texture";
244 this.LoadAsset(Image, true, "femalebody.jp2"); 244 this.LoadAsset(Image, true, "femalebody.jp2");
245 store = new AssetStorage(); 245 store = new AssetStorage();
246 store.Data = Image.Data; 246 store.Data = Image.Data;
247 store.Name = Image.Name; 247 store.Name = Image.Name;
248 store.UUID = Image.FullID; 248 store.UUID = Image.FullID;
249 db.Set(store); 249 db.Set(store);
250 db.Commit(); 250 db.Commit();
251 251
252 Image = new AssetBase(); 252 Image = new AssetBase();
253 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); 253 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011");
254 Image.Name = "Female Bottom Texture"; 254 Image.Name = "Female Bottom Texture";
255 this.LoadAsset(Image, true, "femalebottom.jp2"); 255 this.LoadAsset(Image, true, "femalebottom.jp2");
256 store = new AssetStorage(); 256 store = new AssetStorage();
257 store.Data = Image.Data; 257 store.Data = Image.Data;
258 store.Name = Image.Name; 258 store.Name = Image.Name;
259 store.UUID = Image.FullID; 259 store.UUID = Image.FullID;
260 db.Set(store); 260 db.Set(store);
261 db.Commit(); 261 db.Commit();
262 262
263 Image = new AssetBase(); 263 Image = new AssetBase();
264 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); 264 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012");
265 Image.Name = "Female Face Texture"; 265 Image.Name = "Female Face Texture";
266 this.LoadAsset(Image, true, "femaleface.jp2"); 266 this.LoadAsset(Image, true, "femaleface.jp2");
267 store = new AssetStorage(); 267 store = new AssetStorage();
268 store.Data = Image.Data; 268 store.Data = Image.Data;
269 store.Name = Image.Name; 269 store.Name = Image.Name;
270 store.UUID = Image.FullID; 270 store.UUID = Image.FullID;
271 db.Set(store); 271 db.Set(store);
272 db.Commit(); 272 db.Commit();
273 273
274 Image = new AssetBase(); 274 Image = new AssetBase();
275 Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); 275 Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb");
276 Image.Name = "Skin"; 276 Image.Name = "Skin";
277 Image.Type = 13; 277 Image.Type = 13;
278 Image.InvType = 13; 278 Image.InvType = 13;
279 this.LoadAsset(Image, false, "base_skin.dat"); 279 this.LoadAsset(Image, false, "base_skin.dat");
280 store = new AssetStorage(); 280 store = new AssetStorage();
281 store.Data = Image.Data; 281 store.Data = Image.Data;
282 store.Name = Image.Name; 282 store.Name = Image.Name;
283 store.UUID = Image.FullID; 283 store.UUID = Image.FullID;
284 db.Set(store); 284 db.Set(store);
285 db.Commit(); 285 db.Commit();
286 286
287 287
288 Image = new AssetBase(); 288 Image = new AssetBase();
289 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 289 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
290 Image.Name = "Shape"; 290 Image.Name = "Shape";
291 Image.Type = 13; 291 Image.Type = 13;
292 Image.InvType = 13; 292 Image.InvType = 13;
293 this.LoadAsset(Image, false, "base_shape.dat"); 293 this.LoadAsset(Image, false, "base_shape.dat");
294 store = new AssetStorage(); 294 store = new AssetStorage();
295 store.Data = Image.Data; 295 store.Data = Image.Data;
296 store.Name = Image.Name; 296 store.Name = Image.Name;
297 store.UUID = Image.FullID; 297 store.UUID = Image.FullID;
298 db.Set(store); 298 db.Set(store);
299 db.Commit(); 299 db.Commit();
300 300
301 Image = new AssetBase(); 301 Image = new AssetBase();
302 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); 302 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110");
303 Image.Name = "Shirt"; 303 Image.Name = "Shirt";
304 Image.Type = 5; 304 Image.Type = 5;
305 Image.InvType = 18; 305 Image.InvType = 18;
306 this.LoadAsset(Image, false, "newshirt.dat"); 306 this.LoadAsset(Image, false, "newshirt.dat");
307 store = new AssetStorage(); 307 store = new AssetStorage();
308 store.Data = Image.Data; 308 store.Data = Image.Data;
309 store.Name = Image.Name; 309 store.Name = Image.Name;
310 store.UUID = Image.FullID; 310 store.UUID = Image.FullID;
311 db.Set(store); 311 db.Set(store);
312 db.Commit(); 312 db.Commit();
313 313
314 Image = new AssetBase(); 314 Image = new AssetBase();
315 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); 315 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120");
316 Image.Name = "Shirt"; 316 Image.Name = "Shirt";
317 Image.Type = 5; 317 Image.Type = 5;
318 Image.InvType = 18; 318 Image.InvType = 18;
319 this.LoadAsset(Image, false, "newpants.dat"); 319 this.LoadAsset(Image, false, "newpants.dat");
320 store = new AssetStorage(); 320 store = new AssetStorage();
321 store.Data = Image.Data; 321 store.Data = Image.Data;
322 store.Name = Image.Name; 322 store.Name = Image.Name;
323 store.UUID = Image.FullID; 323 store.UUID = Image.FullID;
324 db.Set(store); 324 db.Set(store);
325 db.Commit(); 325 db.Commit();
326 326
327 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); 327 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
328 if (File.Exists(filePath)) 328 if (File.Exists(filePath))
329 { 329 {
330 XmlConfigSource source = new XmlConfigSource(filePath); 330 XmlConfigSource source = new XmlConfigSource(filePath);
331 ReadAssetDetails(source); 331 ReadAssetDetails(source);
332 } 332 }
333 } 333 }
334 334
335 protected void ReadAssetDetails(IConfigSource source) 335 protected void ReadAssetDetails(IConfigSource source)
336 { 336 {
337 AssetBase newAsset = null; 337 AssetBase newAsset = null;
338 for (int i = 0; i < source.Configs.Count; i++) 338 for (int i = 0; i < source.Configs.Count; i++)
339 { 339 {
340 newAsset = new AssetBase(); 340 newAsset = new AssetBase();
341 newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); 341 newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
342 newAsset.Name = source.Configs[i].GetString("name", ""); 342 newAsset.Name = source.Configs[i].GetString("name", "");
343 newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0); 343 newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0);
344 newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); 344 newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0);
345 string fileName = source.Configs[i].GetString("fileName", ""); 345 string fileName = source.Configs[i].GetString("fileName", "");
346 if (fileName != "") 346 if (fileName != "")
347 { 347 {
348 this.LoadAsset(newAsset, false, fileName); 348 this.LoadAsset(newAsset, false, fileName);
349 AssetStorage store = new AssetStorage(); 349 AssetStorage store = new AssetStorage();
350 store.Data = newAsset.Data; 350 store.Data = newAsset.Data;
351 store.Name = newAsset.Name; 351 store.Name = newAsset.Name;
352 store.UUID = newAsset.FullID; 352 store.UUID = newAsset.FullID;
353 db.Set(store); 353 db.Set(store);
354 db.Commit(); 354 db.Commit();
355 } 355 }
356 } 356 }
357 } 357 }
358 358
359 private void LoadAsset(AssetBase info, bool image, string filename) 359 private void LoadAsset(AssetBase info, bool image, string filename)
360 { 360 {
361 //should request Asset from storage manager 361 //should request Asset from storage manager
362 //but for now read from file 362 //but for now read from file
363 363
364 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; 364 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
365 string fileName = Path.Combine(dataPath, filename); 365 string fileName = Path.Combine(dataPath, filename);
366 FileInfo fInfo = new FileInfo(fileName); 366 FileInfo fInfo = new FileInfo(fileName);
367 long numBytes = fInfo.Length; 367 long numBytes = fInfo.Length;
368 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 368 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
369 byte[] idata = new byte[numBytes]; 369 byte[] idata = new byte[numBytes];
370 BinaryReader br = new BinaryReader(fStream); 370 BinaryReader br = new BinaryReader(fStream);
371 idata = br.ReadBytes((int)numBytes); 371 idata = br.ReadBytes((int)numBytes);
372 br.Close(); 372 br.Close();
373 fStream.Close(); 373 fStream.Close();
374 info.Data = idata; 374 info.Data = idata;
375 //info.loaded=true; 375 //info.loaded=true;
376 } 376 }
377 } 377 }
378 public class AssetUUIDQuery : Predicate 378 public class AssetUUIDQuery : Predicate
379 { 379 {
380 private LLUUID _findID; 380 private LLUUID _findID;
381 381
382 public AssetUUIDQuery(LLUUID find) 382 public AssetUUIDQuery(LLUUID find)
383 { 383 {
384 _findID = find; 384 _findID = find;
385 } 385 }
386 public bool Match(AssetStorage asset) 386 public bool Match(AssetStorage asset)
387 { 387 {
388 return (asset.UUID == _findID); 388 return (asset.UUID == _findID);
389 } 389 }
390 } 390 }
391 391
392} 392}
393 393
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index a965ee0..a64d195 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Communications.Caches
44 private IAssetReceiver _receiver; 44 private IAssetReceiver _receiver;
45 private BlockingQueue<ARequest> _assetRequests; 45 private BlockingQueue<ARequest> _assetRequests;
46 private Thread _localAssetServerThread; 46 private Thread _localAssetServerThread;
47 protected IAssetProvider m_plugin; 47 protected IAssetProvider m_plugin;
48 private object syncLock = new object(); 48 private object syncLock = new object();
49 49
50 50
@@ -102,20 +102,20 @@ namespace OpenSim.Framework.Communications.Caches
102 } 102 }
103 103
104 public void UpdateAsset(AssetBase asset) 104 public void UpdateAsset(AssetBase asset)
105 { 105 {
106 lock (syncLock) 106 lock (syncLock)
107 { 107 {
108 m_plugin.UpdateAsset(asset); 108 m_plugin.UpdateAsset(asset);
109 m_plugin.CommitAssets(); 109 m_plugin.CommitAssets();
110 } 110 }
111 } 111 }
112 112
113 public void CreateAsset(AssetBase asset) 113 public void CreateAsset(AssetBase asset)
114 { 114 {
115 lock (syncLock) 115 lock (syncLock)
116 { 116 {
117 m_plugin.CreateAsset(asset); 117 m_plugin.CreateAsset(asset);
118 m_plugin.CommitAssets(); 118 m_plugin.CommitAssets();
119 } 119 }
120 } 120 }
121 121
@@ -135,12 +135,12 @@ namespace OpenSim.Framework.Communications.Caches
135 { 135 {
136 ARequest req = this._assetRequests.Dequeue(); 136 ARequest req = this._assetRequests.Dequeue();
137 137
138 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); 138 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
139 139
140 AssetBase asset = null; 140 AssetBase asset = null;
141 lock (syncLock) 141 lock (syncLock)
142 { 142 {
143 asset = m_plugin.FetchAsset(req.AssetID); 143 asset = m_plugin.FetchAsset(req.AssetID);
144 } 144 }
145 if (asset != null) 145 if (asset != null)
146 { 146 {
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
index d47bb07..19220ac 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
@@ -1,17 +1,17 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife; 4using libsecondlife;
5 5
6namespace OpenSim.Region.Capabilities 6namespace OpenSim.Region.Capabilities
7{ 7{
8 [LLSDMap] 8 [LLSDMap]
9 public class LLSDItemUpdate 9 public class LLSDItemUpdate
10 { 10 {
11 public LLUUID item_id; 11 public LLUUID item_id;
12 12
13 public LLSDItemUpdate() 13 public LLSDItemUpdate()
14 { 14 {
15 } 15 }
16 } 16 }
17} 17}
diff --git a/OpenSim/Framework/General/Interfaces/IAssetProvider.cs b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs
index a2ef826..daf9d6d 100644
--- a/OpenSim/Framework/General/Interfaces/IAssetProvider.cs
+++ b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs
@@ -1,18 +1,18 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
5using libsecondlife; 5using libsecondlife;
6 6
7namespace OpenSim.Framework.Interfaces 7namespace OpenSim.Framework.Interfaces
8{ 8{
9 public interface IAssetProvider 9 public interface IAssetProvider
10 { 10 {
11 void Initialise(string dbfile, string dbname); 11 void Initialise(string dbfile, string dbname);
12 AssetBase FetchAsset(LLUUID uuid); 12 AssetBase FetchAsset(LLUUID uuid);
13 void CreateAsset(AssetBase asset); 13 void CreateAsset(AssetBase asset);
14 void UpdateAsset(AssetBase asset); 14 void UpdateAsset(AssetBase asset);
15 bool ExistsAsset(LLUUID uuid); 15 bool ExistsAsset(LLUUID uuid);
16 void CommitAssets(); // force a sync to the database 16 void CommitAssets(); // force a sync to the database
17 } 17 }
18} \ No newline at end of file 18} \ No newline at end of file
diff --git a/OpenSim/Framework/UserManager/CAPSService.cs b/OpenSim/Framework/UserManager/CAPSService.cs
index 39af140..a8eac26 100644
--- a/OpenSim/Framework/UserManager/CAPSService.cs
+++ b/OpenSim/Framework/UserManager/CAPSService.cs
@@ -1,38 +1,38 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Reflection; 4using System.Reflection;
5using System.Security.Cryptography; 5using System.Security.Cryptography;
6using libsecondlife; 6using libsecondlife;
7using Nwc.XmlRpc; 7using Nwc.XmlRpc;
8using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Inventory; 11using OpenSim.Framework.Inventory;
12using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
13using OpenSim.Framework.Servers; 13using OpenSim.Framework.Servers;
14 14
15namespace OpenSim.Framework.UserManagement 15namespace OpenSim.Framework.UserManagement
16{ 16{
17 public class CAPSService 17 public class CAPSService
18 { 18 {
19 private BaseHttpServer m_server; 19 private BaseHttpServer m_server;
20 20
21 public CAPSService(BaseHttpServer httpServer) 21 public CAPSService(BaseHttpServer httpServer)
22 { 22 {
23 m_server = httpServer; 23 m_server = httpServer;
24 this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); 24 this.AddCapsSeedHandler("/CapsSeed/", CapsRequest);
25 } 25 }
26 26
27 private void AddCapsSeedHandler(string path, RestMethod restMethod) 27 private void AddCapsSeedHandler(string path, RestMethod restMethod)
28 { 28 {
29 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); 29 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod));
30 } 30 }
31 31
32 public string CapsRequest(string request, string path, string param) 32 public string CapsRequest(string request, string path, string param)
33 { 33 {
34 System.Console.WriteLine("new caps request " + request +" from path "+ path); 34 System.Console.WriteLine("new caps request " + request +" from path "+ path);
35 return ""; 35 return "";
36 } 36 }
37 } 37 }
38} 38}
diff --git a/OpenSim/Framework/UserManager/LoginService.cs b/OpenSim/Framework/UserManager/LoginService.cs
index 0af341e..32f5565 100644
--- a/OpenSim/Framework/UserManager/LoginService.cs
+++ b/OpenSim/Framework/UserManager/LoginService.cs
@@ -1,290 +1,290 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Reflection; 4using System.Reflection;
5using System.Security.Cryptography; 5using System.Security.Cryptography;
6using libsecondlife; 6using libsecondlife;
7using Nwc.XmlRpc; 7using Nwc.XmlRpc;
8using OpenSim.Framework.Console; 8using OpenSim.Framework.Console;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Inventory; 11using OpenSim.Framework.Inventory;
12using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
13 13
14using OpenSim.Framework.Configuration; 14using OpenSim.Framework.Configuration;
15using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; 15using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
16 16
17namespace OpenSim.Framework.UserManagement 17namespace OpenSim.Framework.UserManagement
18{ 18{
19 public class LoginService 19 public class LoginService
20 { 20 {
21 protected string m_welcomeMessage = "Welcome to OpenSim"; 21 protected string m_welcomeMessage = "Welcome to OpenSim";
22 protected UserManagerBase m_userManager = null; 22 protected UserManagerBase m_userManager = null;
23 23
24 public LoginService(UserManagerBase userManager, string welcomeMess) 24 public LoginService(UserManagerBase userManager, string welcomeMess)
25 { 25 {
26 m_userManager = userManager; 26 m_userManager = userManager;
27 if (welcomeMess != "") 27 if (welcomeMess != "")
28 { 28 {
29 m_welcomeMessage = welcomeMess; 29 m_welcomeMessage = welcomeMess;
30 } 30 }
31 } 31 }
32 32
33 /// <summary> 33 /// <summary>
34 /// Main user login function 34 /// Main user login function
35 /// </summary> 35 /// </summary>
36 /// <param name="request">The XMLRPC request</param> 36 /// <param name="request">The XMLRPC request</param>
37 /// <returns>The response to send</returns> 37 /// <returns>The response to send</returns>
38 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 38 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
39 { 39 {
40 40
41 System.Console.WriteLine("Attempting login now..."); 41 System.Console.WriteLine("Attempting login now...");
42 XmlRpcResponse response = new XmlRpcResponse(); 42 XmlRpcResponse response = new XmlRpcResponse();
43 Hashtable requestData = (Hashtable)request.Params[0]; 43 Hashtable requestData = (Hashtable)request.Params[0];
44 44
45 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); 45 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
46 bool GoodLogin = false; 46 bool GoodLogin = false;
47 string firstname = ""; 47 string firstname = "";
48 string lastname = ""; 48 string lastname = "";
49 string passwd = ""; 49 string passwd = "";
50 50
51 UserProfileData userProfile; 51 UserProfileData userProfile;
52 LoginResponse logResponse = new LoginResponse(); 52 LoginResponse logResponse = new LoginResponse();
53 53
54 if (GoodXML) 54 if (GoodXML)
55 { 55 {
56 firstname = (string)requestData["first"]; 56 firstname = (string)requestData["first"];
57 lastname = (string)requestData["last"]; 57 lastname = (string)requestData["last"];
58 passwd = (string)requestData["passwd"]; 58 passwd = (string)requestData["passwd"];
59 59
60 userProfile = GetTheUser(firstname, lastname); 60 userProfile = GetTheUser(firstname, lastname);
61 if (userProfile == null) 61 if (userProfile == null)
62 return logResponse.CreateLoginFailedResponse(); 62 return logResponse.CreateLoginFailedResponse();
63 63
64 GoodLogin = AuthenticateUser(userProfile, passwd); 64 GoodLogin = AuthenticateUser(userProfile, passwd);
65 } 65 }
66 else 66 else
67 { 67 {
68 return logResponse.CreateGridErrorResponse(); 68 return logResponse.CreateGridErrorResponse();
69 } 69 }
70 70
71 if (!GoodLogin) 71 if (!GoodLogin)
72 { 72 {
73 return logResponse.CreateLoginFailedResponse(); 73 return logResponse.CreateLoginFailedResponse();
74 } 74 }
75 else 75 else
76 { 76 {
77 // If we already have a session... 77 // If we already have a session...
78 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) 78 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
79 { 79 {
80 // Reject the login 80 // Reject the login
81 return logResponse.CreateAlreadyLoggedInResponse(); 81 return logResponse.CreateAlreadyLoggedInResponse();
82 } 82 }
83 // Otherwise... 83 // Otherwise...
84 // Create a new agent session 84 // Create a new agent session
85 CreateAgent(userProfile, request); 85 CreateAgent(userProfile, request);
86 86
87 try 87 try
88 { 88 {
89 LLUUID agentID = userProfile.UUID; 89 LLUUID agentID = userProfile.UUID;
90 90
91 // Inventory Library Section 91 // Inventory Library Section
92 InventoryData inventData = this.CreateInventoryData(agentID); 92 InventoryData inventData = this.CreateInventoryData(agentID);
93 ArrayList AgentInventoryArray = inventData.InventoryArray; 93 ArrayList AgentInventoryArray = inventData.InventoryArray;
94 94
95 Hashtable InventoryRootHash = new Hashtable(); 95 Hashtable InventoryRootHash = new Hashtable();
96 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); 96 InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
97 ArrayList InventoryRoot = new ArrayList(); 97 ArrayList InventoryRoot = new ArrayList();
98 InventoryRoot.Add(InventoryRootHash); 98 InventoryRoot.Add(InventoryRootHash);
99 userProfile.rootInventoryFolderID = inventData.RootFolderID; 99 userProfile.rootInventoryFolderID = inventData.RootFolderID;
100 100
101 // Circuit Code 101 // Circuit Code
102 uint circode = (uint)(Util.RandomClass.Next()); 102 uint circode = (uint)(Util.RandomClass.Next());
103 103
104 logResponse.Lastname = userProfile.surname; 104 logResponse.Lastname = userProfile.surname;
105 logResponse.Firstname = userProfile.username; 105 logResponse.Firstname = userProfile.username;
106 logResponse.AgentID = agentID.ToStringHyphenated(); 106 logResponse.AgentID = agentID.ToStringHyphenated();
107 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); 107 logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
108 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); 108 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
109 logResponse.InventoryRoot = InventoryRoot; 109 logResponse.InventoryRoot = InventoryRoot;
110 logResponse.InventorySkeleton = AgentInventoryArray; 110 logResponse.InventorySkeleton = AgentInventoryArray;
111 logResponse.InventoryLibrary = this.GetInventoryLibrary(); 111 logResponse.InventoryLibrary = this.GetInventoryLibrary();
112 logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); 112 logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
113 logResponse.CircuitCode = (Int32)circode; 113 logResponse.CircuitCode = (Int32)circode;
114 //logResponse.RegionX = 0; //overwritten 114 //logResponse.RegionX = 0; //overwritten
115 //logResponse.RegionY = 0; //overwritten 115 //logResponse.RegionY = 0; //overwritten
116 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten 116 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
117 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; 117 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
118 //logResponse.SimAddress = "127.0.0.1"; //overwritten 118 //logResponse.SimAddress = "127.0.0.1"; //overwritten
119 //logResponse.SimPort = 0; //overwritten 119 //logResponse.SimPort = 0; //overwritten
120 logResponse.Message = this.GetMessage(); 120 logResponse.Message = this.GetMessage();
121 121
122 try 122 try
123 { 123 {
124 this.CustomiseResponse(logResponse, userProfile); 124 this.CustomiseResponse(logResponse, userProfile);
125 } 125 }
126 catch (Exception e) 126 catch (Exception e)
127 { 127 {
128 System.Console.WriteLine(e.ToString()); 128 System.Console.WriteLine(e.ToString());
129 return logResponse.CreateDeadRegionResponse(); 129 return logResponse.CreateDeadRegionResponse();
130 //return logResponse.ToXmlRpcResponse(); 130 //return logResponse.ToXmlRpcResponse();
131 } 131 }
132 CommitAgent(ref userProfile); 132 CommitAgent(ref userProfile);
133 return logResponse.ToXmlRpcResponse(); 133 return logResponse.ToXmlRpcResponse();
134 134
135 } 135 }
136 136
137 catch (Exception E) 137 catch (Exception E)
138 { 138 {
139 System.Console.WriteLine(E.ToString()); 139 System.Console.WriteLine(E.ToString());
140 } 140 }
141 //} 141 //}
142 } 142 }
143 return response; 143 return response;
144 144
145 } 145 }
146 146
147 /// <summary> 147 /// <summary>
148 /// Customises the login response and fills in missing values. 148 /// Customises the login response and fills in missing values.
149 /// </summary> 149 /// </summary>
150 /// <param name="response">The existing response</param> 150 /// <param name="response">The existing response</param>
151 /// <param name="theUser">The user profile</param> 151 /// <param name="theUser">The user profile</param>
152 public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) 152 public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser)
153 { 153 {
154 } 154 }
155 155
156 /// <summary> 156 /// <summary>
157 /// Saves a target agent to the database 157 /// Saves a target agent to the database
158 /// </summary> 158 /// </summary>
159 /// <param name="profile">The users profile</param> 159 /// <param name="profile">The users profile</param>
160 /// <returns>Successful?</returns> 160 /// <returns>Successful?</returns>
161 public bool CommitAgent(ref UserProfileData profile) 161 public bool CommitAgent(ref UserProfileData profile)
162 { 162 {
163 // Saves the agent to database 163 // Saves the agent to database
164 return true; 164 return true;
165 } 165 }
166 166
167 167
168 /// <summary> 168 /// <summary>
169 /// Checks a user against it's password hash 169 /// Checks a user against it's password hash
170 /// </summary> 170 /// </summary>
171 /// <param name="profile">The users profile</param> 171 /// <param name="profile">The users profile</param>
172 /// <param name="password">The supplied password</param> 172 /// <param name="password">The supplied password</param>
173 /// <returns>Authenticated?</returns> 173 /// <returns>Authenticated?</returns>
174 public virtual bool AuthenticateUser(UserProfileData profile, string password) 174 public virtual bool AuthenticateUser(UserProfileData profile, string password)
175 { 175 {
176 176
177 MainLog.Instance.Verbose( 177 MainLog.Instance.Verbose(
178 "Authenticating " + profile.username + " " + profile.surname); 178 "Authenticating " + profile.username + " " + profile.surname);
179 179
180 password = password.Remove(0, 3); //remove $1$ 180 password = password.Remove(0, 3); //remove $1$
181 181
182 string s = Util.Md5Hash(password + ":" + profile.passwordSalt); 182 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
183 183
184 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); 184 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
188 /// 188 ///
189 /// </summary> 189 /// </summary>
190 /// <param name="profile"></param> 190 /// <param name="profile"></param>
191 /// <param name="request"></param> 191 /// <param name="request"></param>
192 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 192 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
193 { 193 {
194 this.m_userManager.CreateAgent(profile, request); 194 this.m_userManager.CreateAgent(profile, request);
195 } 195 }
196 196
197 /// <summary> 197 /// <summary>
198 /// 198 ///
199 /// </summary> 199 /// </summary>
200 /// <param name="firstname"></param> 200 /// <param name="firstname"></param>
201 /// <param name="lastname"></param> 201 /// <param name="lastname"></param>
202 /// <returns></returns> 202 /// <returns></returns>
203 public virtual UserProfileData GetTheUser(string firstname, string lastname) 203 public virtual UserProfileData GetTheUser(string firstname, string lastname)
204 { 204 {
205 return this.m_userManager.getUserProfile(firstname, lastname); 205 return this.m_userManager.getUserProfile(firstname, lastname);
206 } 206 }
207 207
208 /// <summary> 208 /// <summary>
209 /// 209 ///
210 /// </summary> 210 /// </summary>
211 /// <returns></returns> 211 /// <returns></returns>
212 public virtual string GetMessage() 212 public virtual string GetMessage()
213 { 213 {
214 return m_welcomeMessage; 214 return m_welcomeMessage;
215 } 215 }
216 216
217 /// <summary> 217 /// <summary>
218 /// 218 ///
219 /// </summary> 219 /// </summary>
220 /// <returns></returns> 220 /// <returns></returns>
221 protected virtual ArrayList GetInventoryLibrary() 221 protected virtual ArrayList GetInventoryLibrary()
222 { 222 {
223 //return new ArrayList(); 223 //return new ArrayList();
224 Hashtable TempHash = new Hashtable(); 224 Hashtable TempHash = new Hashtable();
225 TempHash["name"] = "OpenSim Library"; 225 TempHash["name"] = "OpenSim Library";
226 TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); 226 TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated();
227 TempHash["version"] = 1; 227 TempHash["version"] = 1;
228 TempHash["type_default"] = -1; 228 TempHash["type_default"] = -1;
229 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; 229 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
230 ArrayList temp = new ArrayList(); 230 ArrayList temp = new ArrayList();
231 temp.Add(TempHash); 231 temp.Add(TempHash);
232 232
233 TempHash = new Hashtable(); 233 TempHash = new Hashtable();
234 TempHash["name"] = "Texture Library"; 234 TempHash["name"] = "Texture Library";
235 TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; 235 TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000";
236 TempHash["version"] = 1; 236 TempHash["version"] = 1;
237 TempHash["type_default"] = -1; 237 TempHash["type_default"] = -1;
238 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; 238 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
239 temp.Add(TempHash); 239 temp.Add(TempHash);
240 return temp; 240 return temp;
241 } 241 }
242 242
243 /// <summary> 243 /// <summary>
244 /// 244 ///
245 /// </summary> 245 /// </summary>
246 /// <returns></returns> 246 /// <returns></returns>
247 protected virtual ArrayList GetLibraryOwner() 247 protected virtual ArrayList GetLibraryOwner()
248 { 248 {
249 //for now create random inventory library owner 249 //for now create random inventory library owner
250 Hashtable TempHash = new Hashtable(); 250 Hashtable TempHash = new Hashtable();
251 TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; 251 TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000";
252 ArrayList inventoryLibOwner = new ArrayList(); 252 ArrayList inventoryLibOwner = new ArrayList();
253 inventoryLibOwner.Add(TempHash); 253 inventoryLibOwner.Add(TempHash);
254 return inventoryLibOwner; 254 return inventoryLibOwner;
255 } 255 }
256 256
257 protected virtual InventoryData CreateInventoryData(LLUUID userID) 257 protected virtual InventoryData CreateInventoryData(LLUUID userID)
258 { 258 {
259 AgentInventory userInventory = new AgentInventory(); 259 AgentInventory userInventory = new AgentInventory();
260 userInventory.CreateRootFolder(userID, false); 260 userInventory.CreateRootFolder(userID, false);
261 261
262 ArrayList AgentInventoryArray = new ArrayList(); 262 ArrayList AgentInventoryArray = new ArrayList();
263 Hashtable TempHash; 263 Hashtable TempHash;
264 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) 264 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
265 { 265 {
266 TempHash = new Hashtable(); 266 TempHash = new Hashtable();
267 TempHash["name"] = InvFolder.FolderName; 267 TempHash["name"] = InvFolder.FolderName;
268 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 268 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
269 TempHash["version"] = (Int32)InvFolder.Version; 269 TempHash["version"] = (Int32)InvFolder.Version;
270 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 270 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
271 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 271 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
272 AgentInventoryArray.Add(TempHash); 272 AgentInventoryArray.Add(TempHash);
273 } 273 }
274 274
275 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); 275 return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
276 } 276 }
277 277
278 public class InventoryData 278 public class InventoryData
279 { 279 {
280 public ArrayList InventoryArray = null; 280 public ArrayList InventoryArray = null;
281 public LLUUID RootFolderID = LLUUID.Zero; 281 public LLUUID RootFolderID = LLUUID.Zero;
282 282
283 public InventoryData(ArrayList invList, LLUUID rootID) 283 public InventoryData(ArrayList invList, LLUUID rootID)
284 { 284 {
285 InventoryArray = invList; 285 InventoryArray = invList;
286 RootFolderID = rootID; 286 RootFolderID = rootID;
287 } 287 }
288 } 288 }
289 } 289 }
290} 290}