aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Communications
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/CAPSService.cs6
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs207
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs24
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs26
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs37
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactions.cs199
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs37
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs21
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolder.cs41
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs82
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs21
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCache.cs72
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs136
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDArray.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs5
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs7
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs12
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs32
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs5
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs6
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs19
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTest.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDType.cs10
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs20
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs6
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs3
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs6
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs19
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs594
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs53
-rw-r--r--OpenSim/Framework/Communications/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs37
-rw-r--r--OpenSim/Framework/Communications/RestClient/RestClient.cs64
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs49
40 files changed, 832 insertions, 1079 deletions
diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs
index b60ef02..40f4006 100644
--- a/OpenSim/Framework/Communications/CAPSService.cs
+++ b/OpenSim/Framework/Communications/CAPSService.cs
@@ -37,17 +37,17 @@ namespace OpenSim.Framework.Communications
37 public CAPSService(BaseHttpServer httpServer) 37 public CAPSService(BaseHttpServer httpServer)
38 { 38 {
39 m_server = httpServer; 39 m_server = httpServer;
40 this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); 40 AddCapsSeedHandler("/CapsSeed/", CapsRequest);
41 } 41 }
42 42
43 private void AddCapsSeedHandler(string path, RestMethod restMethod) 43 private void AddCapsSeedHandler(string path, RestMethod restMethod)
44 { 44 {
45 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); 45 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod));
46 } 46 }
47 47
48 public string CapsRequest(string request, string path, string param) 48 public string CapsRequest(string request, string path, string param)
49 { 49 {
50 System.Console.WriteLine("new caps request " + request +" from path "+ path); 50 System.Console.WriteLine("new caps request " + request + " from path " + path);
51 return ""; 51 return "";
52 } 52 }
53 } 53 }
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 39e2887..ca2fc35 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -29,12 +29,9 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection;
33using System.Threading; 32using System.Threading;
34using libsecondlife; 33using libsecondlife;
35using libsecondlife.Packets; 34using libsecondlife.Packets;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework;
38using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
39 36
40namespace OpenSim.Framework.Communications.Cache 37namespace OpenSim.Framework.Communications.Cache
@@ -51,18 +48,22 @@ namespace OpenSim.Framework.Communications.Cache
51 public Dictionary<LLUUID, AssetInfo> Assets; 48 public Dictionary<LLUUID, AssetInfo> Assets;
52 public Dictionary<LLUUID, TextureImage> Textures; 49 public Dictionary<LLUUID, TextureImage> Textures;
53 50
54 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers 51 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
55 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent 52 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
56 53
57 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server 54 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>();
58 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server 55 //Assets requested from the asset server
56
57 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>();
58 //Textures requested from the asset server
59 59
60 public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>(); 60 public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>();
61 private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>(); 61 private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>();
62 62
63 private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>(); 63 private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>();
64 64
65 private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent = new Dictionary<LLUUID, Dictionary<LLUUID, int>>(); 65 private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent =
66 new Dictionary<LLUUID, Dictionary<LLUUID, int>>();
66 67
67 public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>(); 68 public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>();
68 69
@@ -76,19 +77,18 @@ namespace OpenSim.Framework.Communications.Cache
76 /// </summary> 77 /// </summary>
77 public AssetCache(IAssetServer assetServer) 78 public AssetCache(IAssetServer assetServer)
78 { 79 {
79 OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSTORAGE","Creating Asset cache"); 80 MainLog.Instance.Verbose("ASSETSTORAGE", "Creating Asset cache");
80 _assetServer = assetServer; 81 _assetServer = assetServer;
81 _assetServer.SetReceiver(this); 82 _assetServer.SetReceiver(this);
82 Assets = new Dictionary<LLUUID, AssetInfo>(); 83 Assets = new Dictionary<LLUUID, AssetInfo>();
83 Textures = new Dictionary<LLUUID, TextureImage>(); 84 Textures = new Dictionary<LLUUID, TextureImage>();
84 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); 85 _assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
85 this._assetCacheThread.IsBackground = true; 86 _assetCacheThread.IsBackground = true;
86 this._assetCacheThread.Start(); 87 _assetCacheThread.Start();
87
88 this.TextureSenderThread = new Thread(new ThreadStart(this.ProcessTextureSenders));
89 this.TextureSenderThread.IsBackground = true;
90 this.TextureSenderThread.Start();
91 88
89 TextureSenderThread = new Thread(new ThreadStart(ProcessTextureSenders));
90 TextureSenderThread.IsBackground = true;
91 TextureSenderThread.Start();
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
@@ -100,8 +100,8 @@ namespace OpenSim.Framework.Communications.Cache
100 { 100 {
101 try 101 try
102 { 102 {
103 this.ProcessAssetQueue(); 103 ProcessAssetQueue();
104 this.ProcessTextureQueue(); 104 ProcessTextureQueue();
105 Thread.Sleep(500); 105 Thread.Sleep(500);
106 } 106 }
107 catch (Exception e) 107 catch (Exception e)
@@ -115,13 +115,13 @@ namespace OpenSim.Framework.Communications.Cache
115 public AssetBase GetAsset(LLUUID assetID) 115 public AssetBase GetAsset(LLUUID assetID)
116 { 116 {
117 AssetBase asset = null; 117 AssetBase asset = null;
118 if (this.Textures.ContainsKey(assetID)) 118 if (Textures.ContainsKey(assetID))
119 { 119 {
120 asset = this.Textures[assetID]; 120 asset = Textures[assetID];
121 } 121 }
122 else if (this.Assets.ContainsKey(assetID)) 122 else if (Assets.ContainsKey(assetID))
123 { 123 {
124 asset = this.Assets[assetID]; 124 asset = Assets[assetID];
125 } 125 }
126 return asset; 126 return asset;
127 } 127 }
@@ -129,13 +129,13 @@ namespace OpenSim.Framework.Communications.Cache
129 public void GetAsset(LLUUID assetID, AssetRequestCallback callback) 129 public void GetAsset(LLUUID assetID, AssetRequestCallback callback)
130 { 130 {
131 AssetBase asset = null; 131 AssetBase asset = null;
132 if (this.Textures.ContainsKey(assetID)) 132 if (Textures.ContainsKey(assetID))
133 { 133 {
134 asset = this.Textures[assetID]; 134 asset = Textures[assetID];
135 } 135 }
136 else if (this.Assets.ContainsKey(assetID)) 136 else if (Assets.ContainsKey(assetID))
137 { 137 {
138 asset = this.Assets[assetID]; 138 asset = Assets[assetID];
139 } 139 }
140 140
141 if (asset != null) 141 if (asset != null)
@@ -145,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache
145 else 145 else
146 { 146 {
147 NewAssetRequest req = new NewAssetRequest(assetID, callback); 147 NewAssetRequest req = new NewAssetRequest(assetID, callback);
148 if (this.RequestLists.ContainsKey(assetID)) 148 if (RequestLists.ContainsKey(assetID))
149 { 149 {
150 lock (RequestLists) 150 lock (RequestLists)
151 { 151 {
@@ -161,7 +161,7 @@ namespace OpenSim.Framework.Communications.Cache
161 RequestLists.Add(assetID, reqList); 161 RequestLists.Add(assetID, reqList);
162 } 162 }
163 } 163 }
164 this._assetServer.FetchAsset(assetID, false); 164 _assetServer.FetchAsset(assetID, false);
165 } 165 }
166 } 166 }
167 167
@@ -171,22 +171,23 @@ namespace OpenSim.Framework.Communications.Cache
171 AssetBase asset = GetAsset(assetID); 171 AssetBase asset = GetAsset(assetID);
172 if (asset == null) 172 if (asset == null)
173 { 173 {
174 this._assetServer.FetchAsset(assetID, isTexture); 174 _assetServer.FetchAsset(assetID, isTexture);
175 } 175 }
176 return asset; 176 return asset;
177 } 177 }
178 178
179 public void AddAsset(AssetBase asset) 179 public void AddAsset(AssetBase asset)
180 { 180 {
181 //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); 181 //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
182 if (asset.Type == 0) 182 if (asset.Type == 0)
183 { 183 {
184 //Console.WriteLine("which is a texture"); 184 //Console.WriteLine("which is a texture");
185 if (!Textures.ContainsKey(asset.FullID)) 185 if (!Textures.ContainsKey(asset.FullID))
186 { //texture 186 {
187 //texture
187 TextureImage textur = new TextureImage(asset); 188 TextureImage textur = new TextureImage(asset);
188 Textures.Add(textur.FullID, textur); 189 Textures.Add(textur.FullID, textur);
189 if(!asset.Temporary) 190 if (!asset.Temporary)
190 _assetServer.StoreAndCommitAsset(asset); 191 _assetServer.StoreAndCommitAsset(asset);
191 } 192 }
192 else 193 else
@@ -219,49 +220,47 @@ namespace OpenSim.Framework.Communications.Cache
219 /// </summary> 220 /// </summary>
220 private void ProcessTextureQueue() 221 private void ProcessTextureQueue()
221 { 222 {
222 if (this.TextureRequests.Count == 0) 223 if (TextureRequests.Count == 0)
223 { 224 {
224 //no requests waiting 225 //no requests waiting
225 return; 226 return;
226 } 227 }
227 int num; 228 int num;
228 num = this.TextureRequests.Count; 229 num = TextureRequests.Count;
229 230
230 AssetRequest req; 231 AssetRequest req;
231 for (int i = 0; i < num; i++) 232 for (int i = 0; i < num; i++)
232 { 233 {
233 req = (AssetRequest)this.TextureRequests[i]; 234 req = (AssetRequest) TextureRequests[i];
234 if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) 235 if (!SendingTextures.ContainsKey(req.ImageInfo.FullID))
235 { 236 {
236 //Console.WriteLine("new texture to send"); 237 //Console.WriteLine("new texture to send");
237 TextureSender sender = new TextureSender(req); 238 TextureSender sender = new TextureSender(req);
238 //sender.OnComplete += this.TextureSent; 239 //sender.OnComplete += this.TextureSent;
239 this.SendingTextures.Add(req.ImageInfo.FullID, sender); 240 SendingTextures.Add(req.ImageInfo.FullID, sender);
240 this.QueueTextures.Enqueue(sender); 241 QueueTextures.Enqueue(sender);
241 } 242 }
242
243 } 243 }
244 244
245 this.TextureRequests.Clear(); 245 TextureRequests.Clear();
246 } 246 }
247 247
248 public void ProcessTextureSenders() 248 public void ProcessTextureSenders()
249 { 249 {
250 while (true) 250 while (true)
251 { 251 {
252 TextureSender sender = this.QueueTextures.Dequeue(); 252 TextureSender sender = QueueTextures.Dequeue();
253 253
254 bool finished = sender.SendTexture(); 254 bool finished = sender.SendTexture();
255 if (finished) 255 if (finished)
256 { 256 {
257 this.TextureSent(sender); 257 TextureSent(sender);
258 } 258 }
259 else 259 else
260 { 260 {
261 // Console.WriteLine("readding texture"); 261 // Console.WriteLine("readding texture");
262 this.QueueTextures.Enqueue(sender); 262 QueueTextures.Enqueue(sender);
263 } 263 }
264
265 } 264 }
266 } 265 }
267 266
@@ -271,16 +270,16 @@ namespace OpenSim.Framework.Communications.Cache
271 /// <param name="sender"></param> 270 /// <param name="sender"></param>
272 public void TextureSent(TextureSender sender) 271 public void TextureSent(TextureSender sender)
273 { 272 {
274 if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) 273 if (SendingTextures.ContainsKey(sender.request.ImageInfo.FullID))
275 { 274 {
276 this.SendingTextures.Remove(sender.request.ImageInfo.FullID); 275 SendingTextures.Remove(sender.request.ImageInfo.FullID);
277 // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID); 276 // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID);
278 } 277 }
279 } 278 }
280 279
281 public void AssetReceived(AssetBase asset, bool IsTexture) 280 public void AssetReceived(AssetBase asset, bool IsTexture)
282 { 281 {
283 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server 282 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
284 { 283 {
285 //check if it is a texture or not 284 //check if it is a texture or not
286 //then add to the correct cache list 285 //then add to the correct cache list
@@ -292,48 +291,48 @@ namespace OpenSim.Framework.Communications.Cache
292 //Console.WriteLine("asset recieved from asset server"); 291 //Console.WriteLine("asset recieved from asset server");
293 292
294 TextureImage image = new TextureImage(asset); 293 TextureImage image = new TextureImage(asset);
295 if (!this.Textures.ContainsKey(image.FullID)) 294 if (!Textures.ContainsKey(image.FullID))
296 { 295 {
297 this.Textures.Add(image.FullID, image); 296 Textures.Add(image.FullID, image);
298 if (this.RequestedTextures.ContainsKey(image.FullID)) 297 if (RequestedTextures.ContainsKey(image.FullID))
299 { 298 {
300 AssetRequest req = this.RequestedTextures[image.FullID]; 299 AssetRequest req = RequestedTextures[image.FullID];
301 req.ImageInfo = image; 300 req.ImageInfo = image;
302 if (image.Data.LongLength > 600) 301 if (image.Data.LongLength > 600)
303 { 302 {
304 //over 600 bytes so split up file 303 //over 600 bytes so split up file
305 req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000; 304 req.NumPackets = 1 + (int) (image.Data.Length - 600)/1000;
306 } 305 }
307 else 306 else
308 { 307 {
309 req.NumPackets = 1; 308 req.NumPackets = 1;
310 } 309 }
311 this.RequestedTextures.Remove(image.FullID); 310 RequestedTextures.Remove(image.FullID);
312 this.TextureRequests.Add(req); 311 TextureRequests.Add(req);
313 } 312 }
314 } 313 }
315 } 314 }
316 else 315 else
317 { 316 {
318 AssetInfo assetInf = new AssetInfo(asset); 317 AssetInfo assetInf = new AssetInfo(asset);
319 if (!this.Assets.ContainsKey(assetInf.FullID)) 318 if (!Assets.ContainsKey(assetInf.FullID))
320 { 319 {
321 this.Assets.Add(assetInf.FullID, assetInf); 320 Assets.Add(assetInf.FullID, assetInf);
322 if (this.RequestedAssets.ContainsKey(assetInf.FullID)) 321 if (RequestedAssets.ContainsKey(assetInf.FullID))
323 { 322 {
324 AssetRequest req = this.RequestedAssets[assetInf.FullID]; 323 AssetRequest req = RequestedAssets[assetInf.FullID];
325 req.AssetInf = assetInf; 324 req.AssetInf = assetInf;
326 if (assetInf.Data.LongLength > 600) 325 if (assetInf.Data.LongLength > 600)
327 { 326 {
328 //over 600 bytes so split up file 327 //over 600 bytes so split up file
329 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; 328 req.NumPackets = 1 + (int) (assetInf.Data.Length - 600 + 999)/1000;
330 } 329 }
331 else 330 else
332 { 331 {
333 req.NumPackets = 1; 332 req.NumPackets = 1;
334 } 333 }
335 this.RequestedAssets.Remove(assetInf.FullID); 334 RequestedAssets.Remove(assetInf.FullID);
336 this.AssetRequests.Add(req); 335 AssetRequests.Add(req);
337 } 336 }
338 } 337 }
339 } 338 }
@@ -345,7 +344,7 @@ namespace OpenSim.Framework.Communications.Cache
345 { 344 {
346 req.Callback(asset.FullID, asset); 345 req.Callback(asset.FullID, asset);
347 } 346 }
348 347
349 lock (RequestLists) 348 lock (RequestLists)
350 { 349 {
351 RequestLists.Remove(asset.FullID); 350 RequestLists.Remove(asset.FullID);
@@ -373,6 +372,7 @@ namespace OpenSim.Framework.Communications.Cache
373 } 372 }
374 373
375 #region Assets 374 #region Assets
375
376 /// <summary> 376 /// <summary>
377 /// 377 ///
378 /// </summary> 378 /// </summary>
@@ -396,11 +396,11 @@ namespace OpenSim.Framework.Communications.Cache
396 } 396 }
397 //check to see if asset is in local cache, if not we need to request it from asset server. 397 //check to see if asset is in local cache, if not we need to request it from asset server.
398 //Console.WriteLine("asset request " + requestID); 398 //Console.WriteLine("asset request " + requestID);
399 if (!this.Assets.ContainsKey(requestID)) 399 if (!Assets.ContainsKey(requestID))
400 { 400 {
401 //not found asset 401 //not found asset
402 // so request from asset server 402 // so request from asset server
403 if (!this.RequestedAssets.ContainsKey(requestID)) 403 if (!RequestedAssets.ContainsKey(requestID))
404 { 404 {
405 AssetRequest request = new AssetRequest(); 405 AssetRequest request = new AssetRequest();
406 request.RequestUser = userInfo; 406 request.RequestUser = userInfo;
@@ -408,13 +408,13 @@ namespace OpenSim.Framework.Communications.Cache
408 request.TransferRequestID = transferRequest.TransferInfo.TransferID; 408 request.TransferRequestID = transferRequest.TransferInfo.TransferID;
409 request.AssetRequestSource = source; 409 request.AssetRequestSource = source;
410 request.Params = transferRequest.TransferInfo.Params; 410 request.Params = transferRequest.TransferInfo.Params;
411 this.RequestedAssets.Add(requestID, request); 411 RequestedAssets.Add(requestID, request);
412 this._assetServer.FetchAsset(requestID, false); 412 _assetServer.FetchAsset(requestID, false);
413 } 413 }
414 return; 414 return;
415 } 415 }
416 //it is in our cache 416 //it is in our cache
417 AssetInfo asset = this.Assets[requestID]; 417 AssetInfo asset = Assets[requestID];
418 418
419 //work out how many packets it should be sent in 419 //work out how many packets it should be sent in
420 // and add to the AssetRequests list 420 // and add to the AssetRequests list
@@ -429,14 +429,14 @@ namespace OpenSim.Framework.Communications.Cache
429 if (asset.Data.LongLength > 600) 429 if (asset.Data.LongLength > 600)
430 { 430 {
431 //over 600 bytes so split up file 431 //over 600 bytes so split up file
432 req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; 432 req.NumPackets = 1 + (int) (asset.Data.Length - 600 + 999)/1000;
433 } 433 }
434 else 434 else
435 { 435 {
436 req.NumPackets = 1; 436 req.NumPackets = 1;
437 } 437 }
438 438
439 this.AssetRequests.Add(req); 439 AssetRequests.Add(req);
440 } 440 }
441 441
442 /// <summary> 442 /// <summary>
@@ -444,17 +444,17 @@ namespace OpenSim.Framework.Communications.Cache
444 /// </summary> 444 /// </summary>
445 private void ProcessAssetQueue() 445 private void ProcessAssetQueue()
446 { 446 {
447 if (this.AssetRequests.Count == 0) 447 if (AssetRequests.Count == 0)
448 { 448 {
449 //no requests waiting 449 //no requests waiting
450 return; 450 return;
451 } 451 }
452 int num; 452 int num;
453 453
454 if (this.AssetRequests.Count < 5) 454 if (AssetRequests.Count < 5)
455 { 455 {
456 //lower than 5 so do all of them 456 //lower than 5 so do all of them
457 num = this.AssetRequests.Count; 457 num = AssetRequests.Count;
458 } 458 }
459 else 459 else
460 { 460 {
@@ -463,7 +463,7 @@ namespace OpenSim.Framework.Communications.Cache
463 AssetRequest req; 463 AssetRequest req;
464 for (int i = 0; i < num; i++) 464 for (int i = 0; i < num; i++)
465 { 465 {
466 req = (AssetRequest)this.AssetRequests[i]; 466 req = (AssetRequest) AssetRequests[i];
467 //Console.WriteLine("sending asset " + req.RequestAssetID); 467 //Console.WriteLine("sending asset " + req.RequestAssetID);
468 TransferInfoPacket Transfer = new TransferInfoPacket(); 468 TransferInfoPacket Transfer = new TransferInfoPacket();
469 Transfer.TransferInfo.ChannelType = 2; 469 Transfer.TransferInfo.ChannelType = 2;
@@ -473,7 +473,7 @@ namespace OpenSim.Framework.Communications.Cache
473 { 473 {
474 Transfer.TransferInfo.Params = new byte[20]; 474 Transfer.TransferInfo.Params = new byte[20];
475 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 475 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
476 int assType = (int)req.AssetInf.Type; 476 int assType = (int) req.AssetInf.Type;
477 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); 477 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
478 } 478 }
479 else if (req.AssetRequestSource == 3) 479 else if (req.AssetRequestSource == 3)
@@ -483,7 +483,7 @@ namespace OpenSim.Framework.Communications.Cache
483 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 483 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
484 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); 484 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
485 } 485 }
486 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; 486 Transfer.TransferInfo.Size = (int) req.AssetInf.Data.Length;
487 Transfer.TransferInfo.TransferID = req.TransferRequestID; 487 Transfer.TransferInfo.TransferID = req.TransferRequestID;
488 req.RequestUser.OutPacket(Transfer); 488 req.RequestUser.OutPacket(Transfer);
489 489
@@ -533,19 +533,19 @@ namespace OpenSim.Framework.Communications.Cache
533 req.RequestUser.OutPacket(TransferPacket); 533 req.RequestUser.OutPacket(TransferPacket);
534 } 534 }
535 } 535 }
536
537 } 536 }
538 537
539 //remove requests that have been completed 538 //remove requests that have been completed
540 for (int i = 0; i < num; i++) 539 for (int i = 0; i < num; i++)
541 { 540 {
542 this.AssetRequests.RemoveAt(0); 541 AssetRequests.RemoveAt(0);
543 } 542 }
544
545 } 543 }
544
546 #endregion 545 #endregion
547 546
548 #region Textures 547 #region Textures
548
549 /// <summary> 549 /// <summary>
550 /// 550 ///
551 /// </summary> 551 /// </summary>
@@ -553,21 +553,21 @@ namespace OpenSim.Framework.Communications.Cache
553 /// <param name="imageID"></param> 553 /// <param name="imageID"></param>
554 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard) 554 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard)
555 { 555 {
556 // System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber); 556 // System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber);
557 //check to see if texture is in local cache, if not request from asset server 557 //check to see if texture is in local cache, if not request from asset server
558 if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) 558 if (!AvatarRecievedTextures.ContainsKey(userInfo.AgentId))
559 { 559 {
560 this.AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>()); 560 AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>());
561 } 561 }
562 /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID)) 562 /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID))
563 { 563 {
564 //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them"); 564 //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them");
565 return; 565 return;
566 }*/ 566 }*/
567 567
568 if (!this.Textures.ContainsKey(imageID)) 568 if (!Textures.ContainsKey(imageID))
569 { 569 {
570 if (!this.RequestedTextures.ContainsKey(imageID)) 570 if (!RequestedTextures.ContainsKey(imageID))
571 { 571 {
572 //not is cache so request from asset server 572 //not is cache so request from asset server
573 AssetRequest request = new AssetRequest(); 573 AssetRequest request = new AssetRequest();
@@ -575,14 +575,14 @@ namespace OpenSim.Framework.Communications.Cache
575 request.RequestAssetID = imageID; 575 request.RequestAssetID = imageID;
576 request.IsTextureRequest = true; 576 request.IsTextureRequest = true;
577 request.DiscardLevel = discard; 577 request.DiscardLevel = discard;
578 this.RequestedTextures.Add(imageID, request); 578 RequestedTextures.Add(imageID, request);
579 this._assetServer.FetchAsset(imageID, true); 579 _assetServer.FetchAsset(imageID, true);
580 } 580 }
581 return; 581 return;
582 } 582 }
583 583
584 // System.Console.WriteLine("texture already in cache"); 584 // System.Console.WriteLine("texture already in cache");
585 TextureImage imag = this.Textures[imageID]; 585 TextureImage imag = Textures[imageID];
586 AssetRequest req = new AssetRequest(); 586 AssetRequest req = new AssetRequest();
587 req.RequestUser = userInfo; 587 req.RequestUser = userInfo;
588 req.RequestAssetID = imageID; 588 req.RequestAssetID = imageID;
@@ -594,7 +594,7 @@ namespace OpenSim.Framework.Communications.Cache
594 { 594 {
595 //Console.WriteLine("{0}", imag.Data.LongLength); 595 //Console.WriteLine("{0}", imag.Data.LongLength);
596 //over 600 bytes so split up file 596 //over 600 bytes so split up file
597 req.NumPackets = 2 + (int)(imag.Data.Length - 601) / 1000; 597 req.NumPackets = 2 + (int) (imag.Data.Length - 601)/1000;
598 //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets"); 598 //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets");
599 } 599 }
600 else 600 else
@@ -603,12 +603,11 @@ namespace OpenSim.Framework.Communications.Cache
603 } 603 }
604 if (packetNumber != 0) 604 if (packetNumber != 0)
605 { 605 {
606 req.PacketCounter = (int)packetNumber; 606 req.PacketCounter = (int) packetNumber;
607 } 607 }
608 this.TextureRequests.Add(req); 608 TextureRequests.Add(req);
609 } 609 }
610 610
611
612 #endregion 611 #endregion
613 612
614 public class AssetRequest 613 public class AssetRequest
@@ -630,7 +629,6 @@ namespace OpenSim.Framework.Communications.Cache
630 629
631 public AssetRequest() 630 public AssetRequest()
632 { 631 {
633
634 } 632 }
635 } 633 }
636 634
@@ -638,7 +636,6 @@ namespace OpenSim.Framework.Communications.Cache
638 { 636 {
639 public AssetInfo() 637 public AssetInfo()
640 { 638 {
641
642 } 639 }
643 640
644 public AssetInfo(AssetBase aBase) 641 public AssetInfo(AssetBase aBase)
@@ -656,7 +653,6 @@ namespace OpenSim.Framework.Communications.Cache
656 { 653 {
657 public TextureImage() 654 public TextureImage()
658 { 655 {
659
660 } 656 }
661 657
662 public TextureImage(AssetBase aBase) 658 public TextureImage(AssetBase aBase)
@@ -678,7 +674,6 @@ namespace OpenSim.Framework.Communications.Cache
678 public TextureSender(AssetRequest req) 674 public TextureSender(AssetRequest req)
679 { 675 {
680 request = req; 676 request = req;
681
682 } 677 }
683 678
684 public bool SendTexture() 679 public bool SendTexture()
@@ -686,7 +681,8 @@ namespace OpenSim.Framework.Communications.Cache
686 SendPacket(); 681 SendPacket();
687 counter++; 682 counter++;
688 683
689 if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) | (request.DiscardLevel == -1)) 684 if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) |
685 (request.DiscardLevel == -1))
690 { 686 {
691 return true; 687 return true;
692 } 688 }
@@ -707,7 +703,7 @@ namespace OpenSim.Framework.Communications.Cache
707 im.Header.Reliable = false; 703 im.Header.Reliable = false;
708 im.ImageID.Packets = 1; 704 im.ImageID.Packets = 1;
709 im.ImageID.ID = req.ImageInfo.FullID; 705 im.ImageID.ID = req.ImageInfo.FullID;
710 im.ImageID.Size = (uint)req.ImageInfo.Data.Length; 706 im.ImageID.Size = (uint) req.ImageInfo.Data.Length;
711 im.ImageData.Data = req.ImageInfo.Data; 707 im.ImageData.Data = req.ImageInfo.Data;
712 im.ImageID.Codec = 2; 708 im.ImageID.Codec = 2;
713 req.RequestUser.OutPacket(im); 709 req.RequestUser.OutPacket(im);
@@ -721,9 +717,9 @@ namespace OpenSim.Framework.Communications.Cache
721 //more than one packet so split file up 717 //more than one packet so split file up
722 ImageDataPacket im = new ImageDataPacket(); 718 ImageDataPacket im = new ImageDataPacket();
723 im.Header.Reliable = false; 719 im.Header.Reliable = false;
724 im.ImageID.Packets = (ushort)(req.NumPackets); 720 im.ImageID.Packets = (ushort) (req.NumPackets);
725 im.ImageID.ID = req.ImageInfo.FullID; 721 im.ImageID.ID = req.ImageInfo.FullID;
726 im.ImageID.Size = (uint)req.ImageInfo.Data.Length; 722 im.ImageID.Size = (uint) req.ImageInfo.Data.Length;
727 im.ImageData.Data = new byte[600]; 723 im.ImageData.Data = new byte[600];
728 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); 724 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
729 im.ImageID.Codec = 2; 725 im.ImageID.Codec = 2;
@@ -742,19 +738,18 @@ namespace OpenSim.Framework.Communications.Cache
742 //more than one packet so split file up 738 //more than one packet so split file up
743 ImagePacketPacket im = new ImagePacketPacket(); 739 ImagePacketPacket im = new ImagePacketPacket();
744 im.Header.Reliable = false; 740 im.Header.Reliable = false;
745 im.ImageID.Packet = (ushort)(req.PacketCounter); 741 im.ImageID.Packet = (ushort) (req.PacketCounter);
746 im.ImageID.ID = req.ImageInfo.FullID; 742 im.ImageID.ID = req.ImageInfo.FullID;
747 int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter - 1)); 743 int size = req.ImageInfo.Data.Length - 600 - (1000*(req.PacketCounter - 1));
748 if (size > 1000) size = 1000; 744 if (size > 1000) size = 1000;
749 //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); 745 //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size);
750 im.ImageData.Data = new byte[size]; 746 im.ImageData.Data = new byte[size];
751 Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter - 1)), im.ImageData.Data, 0, size); 747 Array.Copy(req.ImageInfo.Data, 600 + (1000*(req.PacketCounter - 1)), im.ImageData.Data, 0, size);
752 req.RequestUser.OutPacket(im); 748 req.RequestUser.OutPacket(im);
753 req.PacketCounter++; 749 req.PacketCounter++;
754 //req.ImageInfo.last_used = time; 750 //req.ImageInfo.last_used = time;
755 //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID); 751 //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID);
756 } 752 }
757
758 } 753 }
759 754
760 private void SaveAssetToFile(string filename, byte[] data) 755 private void SaveAssetToFile(string filename, byte[] data)
@@ -789,7 +784,5 @@ namespace OpenSim.Framework.Communications.Cache
789 AssetID = assetID; 784 AssetID = assetID;
790 Callback = callback; 785 Callback = callback;
791 } 786 }
792
793
794 } 787 }
795} 788} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs
index c927571..fa421c7 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs
@@ -25,18 +25,11 @@
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;
29using System.Collections.Generic;
30using System.IO; 28using System.IO;
31using System.Threading;
32using Db4objects.Db4o; 29using Db4objects.Db4o;
33using Db4objects.Db4o.Query; 30using Db4objects.Db4o.Query;
34using libsecondlife; 31using libsecondlife;
35using Nini.Config;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework;
40 33
41namespace OpenSim.Framework.Communications.Cache 34namespace OpenSim.Framework.Communications.Cache
42{ 35{
@@ -50,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache
50 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); 43 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
51 44
52 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); 45 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
53 MainLog.Instance.Verbose("ASSETS","Db4 Asset database creation"); 46 MainLog.Instance.Verbose("ASSETS", "Db4 Asset database creation");
54 47
55 if (!yapfile) 48 if (!yapfile)
56 { 49 {
@@ -68,29 +61,29 @@ namespace OpenSim.Framework.Communications.Cache
68 db.Commit(); 61 db.Commit();
69 } 62 }
70 63
71 override public void Close() 64 public override void Close()
72 { 65 {
73 base.Close(); 66 base.Close();
74 67
75 if (db != null) 68 if (db != null)
76 { 69 {
77 MainLog.Instance.Verbose("ASSETSERVER","Closing local asset server database"); 70 MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database");
78 db.Close(); 71 db.Close();
79 } 72 }
80 } 73 }
81 74
82 override protected void RunRequests() 75 protected override void RunRequests()
83 { 76 {
84 while (true) 77 while (true)
85 { 78 {
86 byte[] idata = null; 79 byte[] idata = null;
87 bool found = false; 80 bool found = false;
88 AssetStorage foundAsset = null; 81 AssetStorage foundAsset = null;
89 ARequest req = this._assetRequests.Dequeue(); 82 ARequest req = _assetRequests.Dequeue();
90 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); 83 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
91 if (result.Count > 0) 84 if (result.Count > 0)
92 { 85 {
93 foundAsset = (AssetStorage)result.Next(); 86 foundAsset = (AssetStorage) result.Next();
94 found = true; 87 found = true;
95 } 88 }
96 89
@@ -110,12 +103,10 @@ namespace OpenSim.Framework.Communications.Cache
110 //asset.FullID = ; 103 //asset.FullID = ;
111 _receiver.AssetNotFound(req.AssetID); 104 _receiver.AssetNotFound(req.AssetID);
112 } 105 }
113
114 } 106 }
115
116 } 107 }
117 108
118 override protected void StoreAsset(AssetBase asset) 109 protected override void StoreAsset(AssetBase asset)
119 { 110 {
120 AssetStorage store = new AssetStorage(); 111 AssetStorage store = new AssetStorage();
121 store.Data = asset.Data; 112 store.Data = asset.Data;
@@ -148,6 +139,7 @@ namespace OpenSim.Framework.Communications.Cache
148 { 139 {
149 _findID = find; 140 _findID = find;
150 } 141 }
142
151 public bool Match(AssetStorage asset) 143 public bool Match(AssetStorage asset)
152 { 144 {
153 return (asset.UUID == _findID); 145 return (asset.UUID == _findID);
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index 0771a20..7109910 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -5,8 +5,6 @@ using System.Threading;
5using libsecondlife; 5using libsecondlife;
6using Nini.Config; 6using Nini.Config;
7using OpenSim.Framework.Console; 7using OpenSim.Framework.Console;
8using OpenSim.Framework.Interfaces;
9using OpenSim.Framework;
10 8
11namespace OpenSim.Framework.Communications.Cache 9namespace OpenSim.Framework.Communications.Cache
12{ 10{
@@ -36,13 +34,12 @@ namespace OpenSim.Framework.Communications.Cache
36 34
37 public AssetServerBase() 35 public AssetServerBase()
38 { 36 {
37 MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system");
38 _assetRequests = new BlockingQueue<ARequest>();
39 39
40 OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSERVER","Starting asset storage system"); 40 _localAssetServerThread = new Thread(RunRequests);
41 this._assetRequests = new BlockingQueue<ARequest>(); 41 _localAssetServerThread.IsBackground = true;
42 42 _localAssetServerThread.Start();
43 this._localAssetServerThread = new Thread(RunRequests);
44 this._localAssetServerThread.IsBackground = true;
45 this._localAssetServerThread.Start();
46 } 43 }
47 44
48 public void LoadAsset(AssetBase info, bool image, string filename) 45 public void LoadAsset(AssetBase info, bool image, string filename)
@@ -57,7 +54,7 @@ namespace OpenSim.Framework.Communications.Cache
57 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 54 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
58 byte[] idata = new byte[numBytes]; 55 byte[] idata = new byte[numBytes];
59 BinaryReader br = new BinaryReader(fStream); 56 BinaryReader br = new BinaryReader(fStream);
60 idata = br.ReadBytes((int)numBytes); 57 idata = br.ReadBytes((int) numBytes);
61 br.Close(); 58 br.Close();
62 fStream.Close(); 59 fStream.Close();
63 info.Data = idata; 60 info.Data = idata;
@@ -66,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache
66 63
67 public void SetReceiver(IAssetReceiver receiver) 64 public void SetReceiver(IAssetReceiver receiver)
68 { 65 {
69 this._receiver = receiver; 66 _receiver = receiver;
70 } 67 }
71 68
72 public void FetchAsset(LLUUID assetID, bool isTexture) 69 public void FetchAsset(LLUUID assetID, bool isTexture)
@@ -74,7 +71,7 @@ namespace OpenSim.Framework.Communications.Cache
74 ARequest req = new ARequest(); 71 ARequest req = new ARequest();
75 req.AssetID = assetID; 72 req.AssetID = assetID;
76 req.IsTexture = isTexture; 73 req.IsTexture = isTexture;
77 this._assetRequests.Enqueue(req); 74 _assetRequests.Enqueue(req);
78 } 75 }
79 76
80 public void UpdateAsset(AssetBase asset) 77 public void UpdateAsset(AssetBase asset)
@@ -102,7 +99,6 @@ namespace OpenSim.Framework.Communications.Cache
102 99
103 public void SetServerInfo(string ServerUrl, string ServerKey) 100 public void SetServerInfo(string ServerUrl, string ServerKey)
104 { 101 {
105
106 } 102 }
107 103
108 public virtual List<AssetBase> GetDefaultAssets() 104 public virtual List<AssetBase> GetDefaultAssets()
@@ -175,8 +171,8 @@ namespace OpenSim.Framework.Communications.Cache
175 // System.Console.WriteLine("loading asset into database"); 171 // System.Console.WriteLine("loading asset into database");
176 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); 172 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated());
177 string name = source.Configs[i].GetString("name", ""); 173 string name = source.Configs[i].GetString("name", "");
178 sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); 174 sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
179 sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); 175 sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
180 string fileName = source.Configs[i].GetString("fileName", ""); 176 string fileName = source.Configs[i].GetString("fileName", "");
181 177
182 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); 178 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false);
@@ -189,4 +185,4 @@ namespace OpenSim.Framework.Communications.Cache
189 assets.ForEach(action); 185 assets.ForEach(action);
190 } 186 }
191 } 187 }
192} 188} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs
index d622e02..55b255a 100644
--- a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs
@@ -25,15 +25,8 @@
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;
29using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife; 29using libsecondlife;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework;
36using OpenSim.Framework.Data;
37 30
38namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Framework.Communications.Cache
39{ 32{
@@ -41,7 +34,10 @@ namespace OpenSim.Framework.Communications.Cache
41 { 34 {
42 // Fields 35 // Fields
43 public CommunicationsManager CommsManager; 36 public CommunicationsManager CommsManager;
44 public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = new Dictionary<LLUUID, AgentAssetTransactions>(); 37
38 public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
39 new Dictionary<LLUUID, AgentAssetTransactions>();
40
45 private bool m_dumpAssetsToFile; 41 private bool m_dumpAssetsToFile;
46 42
47 public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) 43 public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
@@ -53,10 +49,10 @@ namespace OpenSim.Framework.Communications.Cache
53 // Methods 49 // Methods
54 public AgentAssetTransactions AddUser(LLUUID userID) 50 public AgentAssetTransactions AddUser(LLUUID userID)
55 { 51 {
56 if (!this.AgentTransactions.ContainsKey(userID)) 52 if (!AgentTransactions.ContainsKey(userID))
57 { 53 {
58 AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); 54 AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
59 this.AgentTransactions.Add(userID, transactions); 55 AgentTransactions.Add(userID, transactions);
60 return transactions; 56 return transactions;
61 } 57 }
62 return null; 58 return null;
@@ -64,27 +60,30 @@ namespace OpenSim.Framework.Communications.Cache
64 60
65 public AgentAssetTransactions GetUserTransActions(LLUUID userID) 61 public AgentAssetTransactions GetUserTransActions(LLUUID userID)
66 { 62 {
67 if (this.AgentTransactions.ContainsKey(userID)) 63 if (AgentTransactions.ContainsKey(userID))
68 { 64 {
69 return this.AgentTransactions[userID]; 65 return AgentTransactions[userID];
70 } 66 }
71 return null; 67 return null;
72 } 68 }
73 69
74 public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 70 public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
71 uint callbackID, string description, string name, sbyte invType,
72 sbyte type, byte wearableType, uint nextOwnerMask)
75 { 73 {
76 AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); 74 AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
77 if (transactions != null) 75 if (transactions != null)
78 { 76 {
79 transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 77 transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description,
78 name, invType, type, wearableType, nextOwnerMask);
80 } 79 }
81
82 } 80 }
83 81
84 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) 82 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
83 byte[] data, bool storeLocal)
85 { 84 {
86 // Console.WriteLine("asset upload of " + assetID); 85 // Console.WriteLine("asset upload of " + assetID);
87 AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); 86 AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
88 if (transactions != null) 87 if (transactions != null)
89 { 88 {
90 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 89 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
@@ -97,7 +96,7 @@ namespace OpenSim.Framework.Communications.Cache
97 96
98 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) 97 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
99 { 98 {
100 AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); 99 AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
101 if (transactions != null) 100 if (transactions != null)
102 { 101 {
103 transactions.HandleXfer(xferID, packetID, data); 102 transactions.HandleXfer(xferID, packetID, data);
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
index e78f4f7..6b08fc9 100644
--- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
@@ -26,17 +26,12 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32using System.IO; 30using System.IO;
33using libsecondlife; 31using libsecondlife;
34using libsecondlife.Packets; 32using libsecondlife.Packets;
35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework;
38using OpenSim.Region.Capabilities;
39using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
34using OpenSim.Region.Capabilities;
40 35
41namespace OpenSim.Framework.Communications.Cache 36namespace OpenSim.Framework.Communications.Cache
42{ 37{
@@ -53,7 +48,7 @@ namespace OpenSim.Framework.Communications.Cache
53 // Methods 48 // Methods
54 public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) 49 public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile)
55 { 50 {
56 this.UserID = agentID; 51 UserID = agentID;
57 Manager = manager; 52 Manager = manager;
58 m_dumpAssetsToFile = dumpAssetsToFile; 53 m_dumpAssetsToFile = dumpAssetsToFile;
59 } 54 }
@@ -61,24 +56,24 @@ namespace OpenSim.Framework.Communications.Cache
61 public AssetCapsUploader RequestCapsUploader() 56 public AssetCapsUploader RequestCapsUploader()
62 { 57 {
63 AssetCapsUploader uploader = new AssetCapsUploader(); 58 AssetCapsUploader uploader = new AssetCapsUploader();
64 this.CapsUploaders.Add(uploader); 59 CapsUploaders.Add(uploader);
65 return uploader; 60 return uploader;
66 } 61 }
67 62
68 public NoteCardCapsUpdate RequestNoteCardUpdater() 63 public NoteCardCapsUpdate RequestNoteCardUpdater()
69 { 64 {
70 NoteCardCapsUpdate update = new NoteCardCapsUpdate(); 65 NoteCardCapsUpdate update = new NoteCardCapsUpdate();
71 this.NotecardUpdaters.Add(update); 66 NotecardUpdaters.Add(update);
72 return update; 67 return update;
73 } 68 }
74 69
75 public AssetXferUploader RequestXferUploader(LLUUID transactionID) 70 public AssetXferUploader RequestXferUploader(LLUUID transactionID)
76 { 71 {
77 if (!this.XferUploaders.ContainsKey(transactionID)) 72 if (!XferUploaders.ContainsKey(transactionID))
78 { 73 {
79 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); 74 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
80 75
81 this.XferUploaders.Add(transactionID, uploader); 76 XferUploaders.Add(transactionID, uploader);
82 return uploader; 77 return uploader;
83 } 78 }
84 return null; 79 return null;
@@ -86,7 +81,7 @@ namespace OpenSim.Framework.Communications.Cache
86 81
87 public void HandleXfer(ulong xferID, uint packetID, byte[] data) 82 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
88 { 83 {
89 foreach (AssetXferUploader uploader in this.XferUploaders.Values) 84 foreach (AssetXferUploader uploader in XferUploaders.Values)
90 { 85 {
91 if (uploader.XferID == xferID) 86 if (uploader.XferID == xferID)
92 { 87 {
@@ -96,17 +91,21 @@ namespace OpenSim.Framework.Communications.Cache
96 } 91 }
97 } 92 }
98 93
99 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 94 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
95 uint callbackID, string description, string name, sbyte invType,
96 sbyte type, byte wearableType, uint nextOwnerMask)
100 { 97 {
101 if (this.XferUploaders.ContainsKey(transactionID)) 98 if (XferUploaders.ContainsKey(transactionID))
102 { 99 {
103 this.XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 100 XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
101 callbackID, description, name, invType, type,
102 wearableType, nextOwnerMask);
104 } 103 }
105 } 104 }
106 105
107 public AssetBase GetTransactionAsset(LLUUID transactionID) 106 public AssetBase GetTransactionAsset(LLUUID transactionID)
108 { 107 {
109 if (this.XferUploaders.ContainsKey(transactionID)) 108 if (XferUploaders.ContainsKey(transactionID))
110 { 109 {
111 return XferUploaders[transactionID].GetAssetData(); 110 return XferUploaders[transactionID].GetAssetData();
112 } 111 }
@@ -130,15 +129,16 @@ namespace OpenSim.Framework.Communications.Cache
130 public event UpLoadedAsset OnUpLoad; 129 public event UpLoadedAsset OnUpLoad;
131 130
132 // Methods 131 // Methods
133 public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile) 132 public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem,
133 LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile)
134 { 134 {
135 this.m_assetName = assetName; 135 m_assetName = assetName;
136 this.m_assetDescription = assetDescription; 136 m_assetDescription = assetDescription;
137 this.m_folderID = folderID; 137 m_folderID = folderID;
138 this.newAssetID = assetID; 138 newAssetID = assetID;
139 this.inventoryItemID = inventoryItem; 139 inventoryItemID = inventoryItem;
140 this.uploaderPath = path; 140 uploaderPath = path;
141 this.httpListener = httpServer; 141 httpListener = httpServer;
142 m_dumpImageToFile = dumpImageToFile; 142 m_dumpImageToFile = dumpImageToFile;
143 } 143 }
144 144
@@ -156,18 +156,18 @@ namespace OpenSim.Framework.Communications.Cache
156 LLUUID inventoryItemID = this.inventoryItemID; 156 LLUUID inventoryItemID = this.inventoryItemID;
157 string text = ""; 157 string text = "";
158 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); 158 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
159 complete.new_asset = this.newAssetID.ToStringHyphenated(); 159 complete.new_asset = newAssetID.ToStringHyphenated();
160 complete.new_inventory_item = inventoryItemID; 160 complete.new_inventory_item = inventoryItemID;
161 complete.state = "complete"; 161 complete.state = "complete";
162 text = LLSDHelpers.SerialiseLLSDReply(complete); 162 text = LLSDHelpers.SerialiseLLSDReply(complete);
163 this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); 163 httpListener.RemoveStreamHandler("POST", uploaderPath);
164 if (this.m_dumpImageToFile) 164 if (m_dumpImageToFile)
165 { 165 {
166 this.SaveImageToFile(this.m_assetName + ".jp2", data); 166 SaveImageToFile(m_assetName + ".jp2", data);
167 } 167 }
168 if (this.OnUpLoad != null) 168 if (OnUpLoad != null)
169 { 169 {
170 this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , ""); 170 OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", "");
171 } 171 }
172 return text; 172 return text;
173 } 173 }
@@ -196,90 +196,91 @@ namespace OpenSim.Framework.Communications.Cache
196 196
197 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) 197 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
198 { 198 {
199 this.m_userTransactions = transactions; 199 m_userTransactions = transactions;
200 m_dumpAssetToFile = dumpAssetToFile; 200 m_dumpAssetToFile = dumpAssetToFile;
201 } 201 }
202 202
203 // Methods 203 // Methods
204 public void HandleXferPacket(ulong xferID, uint packetID, byte[] data) 204 public void HandleXferPacket(ulong xferID, uint packetID, byte[] data)
205 { 205 {
206 if (this.XferID == xferID) 206 if (XferID == xferID)
207 { 207 {
208 if (this.Asset.Data.Length > 1) 208 if (Asset.Data.Length > 1)
209 { 209 {
210 byte[] destinationArray = new byte[this.Asset.Data.Length + data.Length]; 210 byte[] destinationArray = new byte[Asset.Data.Length + data.Length];
211 Array.Copy(this.Asset.Data, 0, destinationArray, 0, this.Asset.Data.Length); 211 Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length);
212 Array.Copy(data, 0, destinationArray, this.Asset.Data.Length, data.Length); 212 Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length);
213 this.Asset.Data = destinationArray; 213 Asset.Data = destinationArray;
214 } 214 }
215 else 215 else
216 { 216 {
217 byte[] buffer2 = new byte[data.Length - 4]; 217 byte[] buffer2 = new byte[data.Length - 4];
218 Array.Copy(data, 4, buffer2, 0, data.Length - 4); 218 Array.Copy(data, 4, buffer2, 0, data.Length - 4);
219 this.Asset.Data = buffer2; 219 Asset.Data = buffer2;
220 } 220 }
221 ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket(); 221 ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket();
222 newPack.XferID.ID = xferID; 222 newPack.XferID.ID = xferID;
223 newPack.XferID.Packet = packetID; 223 newPack.XferID.Packet = packetID;
224 this.ourClient.OutPacket(newPack); 224 ourClient.OutPacket(newPack);
225 if ((packetID & 0x80000000) != 0) 225 if ((packetID & 0x80000000) != 0)
226 { 226 {
227 this.SendCompleteMessage(); 227 SendCompleteMessage();
228 } 228 }
229 } 229 }
230 } 230 }
231 231
232 public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) 232 public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data,
233 bool storeLocal)
233 { 234 {
234 this.ourClient = remoteClient; 235 ourClient = remoteClient;
235 this.Asset = new AssetBase(); 236 Asset = new AssetBase();
236 this.Asset.FullID = assetID; 237 Asset.FullID = assetID;
237 this.Asset.InvType = type; 238 Asset.InvType = type;
238 this.Asset.Type = type; 239 Asset.Type = type;
239 this.Asset.Data = data; 240 Asset.Data = data;
240 this.Asset.Name = "blank"; 241 Asset.Name = "blank";
241 this.Asset.Description = "empty"; 242 Asset.Description = "empty";
242 this.TransactionID = transaction; 243 TransactionID = transaction;
243 this.m_storeLocal = storeLocal; 244 m_storeLocal = storeLocal;
244 if (this.Asset.Data.Length > 2) 245 if (Asset.Data.Length > 2)
245 { 246 {
246 this.SendCompleteMessage(); 247 SendCompleteMessage();
247 } 248 }
248 else 249 else
249 { 250 {
250 this.ReqestStartXfer(); 251 ReqestStartXfer();
251 } 252 }
252 } 253 }
253 254
254 protected void ReqestStartXfer() 255 protected void ReqestStartXfer()
255 { 256 {
256 this.UploadComplete = false; 257 UploadComplete = false;
257 this.XferID = Util.GetNextXferID(); 258 XferID = Util.GetNextXferID();
258 RequestXferPacket newPack = new RequestXferPacket(); 259 RequestXferPacket newPack = new RequestXferPacket();
259 newPack.XferID.ID = this.XferID; 260 newPack.XferID.ID = XferID;
260 newPack.XferID.VFileType = this.Asset.Type; 261 newPack.XferID.VFileType = Asset.Type;
261 newPack.XferID.VFileID = this.Asset.FullID; 262 newPack.XferID.VFileID = Asset.FullID;
262 newPack.XferID.FilePath = 0; 263 newPack.XferID.FilePath = 0;
263 newPack.XferID.Filename = new byte[0]; 264 newPack.XferID.Filename = new byte[0];
264 this.ourClient.OutPacket(newPack); 265 ourClient.OutPacket(newPack);
265 } 266 }
266 267
267 protected void SendCompleteMessage() 268 protected void SendCompleteMessage()
268 { 269 {
269 this.UploadComplete = true; 270 UploadComplete = true;
270 AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); 271 AssetUploadCompletePacket newPack = new AssetUploadCompletePacket();
271 newPack.AssetBlock.Type = this.Asset.Type; 272 newPack.AssetBlock.Type = Asset.Type;
272 newPack.AssetBlock.Success = true; 273 newPack.AssetBlock.Success = true;
273 newPack.AssetBlock.UUID = this.Asset.FullID; 274 newPack.AssetBlock.UUID = Asset.FullID;
274 this.ourClient.OutPacket(newPack); 275 ourClient.OutPacket(newPack);
275 this.m_finished = true; 276 m_finished = true;
276 if (m_createItem) 277 if (m_createItem)
277 { 278 {
278 DoCreateItem(); 279 DoCreateItem();
279 } 280 }
280 else if (m_storeLocal) 281 else if (m_storeLocal)
281 { 282 {
282 this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); 283 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
283 } 284 }
284 285
285 // Console.WriteLine("upload complete "+ this.TransactionID); 286 // Console.WriteLine("upload complete "+ this.TransactionID);
@@ -287,8 +288,10 @@ namespace OpenSim.Framework.Communications.Cache
287 if (m_dumpAssetToFile) 288 if (m_dumpAssetToFile)
288 { 289 {
289 DateTime now = DateTime.Now; 290 DateTime now = DateTime.Now;
290 string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type ); 291 string filename =
291 SaveAssetToFile(filename, this.Asset.Data); 292 String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}", now.Year, now.Month, now.Day,
293 now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type);
294 SaveAssetToFile(filename, Asset.Data);
292 } 295 }
293 } 296 }
294 297
@@ -301,20 +304,22 @@ namespace OpenSim.Framework.Communications.Cache
301 fs.Close(); 304 fs.Close();
302 } 305 }
303 306
304 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 307 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
308 uint callbackID, string description, string name, sbyte invType,
309 sbyte type, byte wearableType, uint nextOwnerMask)
305 { 310 {
306 if (this.TransactionID == transactionID) 311 if (TransactionID == transactionID)
307 { 312 {
308 this.InventFolder = folderID; 313 InventFolder = folderID;
309 this.m_name = name; 314 m_name = name;
310 this.m_description = description; 315 m_description = description;
311 this.type = type; 316 this.type = type;
312 this.invType = invType; 317 this.invType = invType;
313 this.nextPerm = nextOwnerMask; 318 nextPerm = nextOwnerMask;
314 this.Asset.Name = name; 319 Asset.Name = name;
315 this.Asset.Description = description; 320 Asset.Description = description;
316 this.Asset.Type = type; 321 Asset.Type = type;
317 this.Asset.InvType = invType; 322 Asset.InvType = invType;
318 m_createItem = true; 323 m_createItem = true;
319 if (m_finished) 324 if (m_finished)
320 { 325 {
@@ -326,22 +331,23 @@ namespace OpenSim.Framework.Communications.Cache
326 private void DoCreateItem() 331 private void DoCreateItem()
327 { 332 {
328 //really need to fix this call, if lbsa71 saw this he would die. 333 //really need to fix this call, if lbsa71 saw this he would die.
329 this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); 334 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
330 CachedUserInfo userInfo = m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); 335 CachedUserInfo userInfo =
336 m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId);
331 if (userInfo != null) 337 if (userInfo != null)
332 { 338 {
333 InventoryItemBase item = new InventoryItemBase(); 339 InventoryItemBase item = new InventoryItemBase();
334 item.avatarID = this.ourClient.AgentId; 340 item.avatarID = ourClient.AgentId;
335 item.creatorsID = ourClient.AgentId; 341 item.creatorsID = ourClient.AgentId;
336 item.inventoryID = LLUUID.Random(); 342 item.inventoryID = LLUUID.Random();
337 item.assetID = Asset.FullID; 343 item.assetID = Asset.FullID;
338 item.inventoryDescription = this.m_description; 344 item.inventoryDescription = m_description;
339 item.inventoryName = m_name; 345 item.inventoryName = m_name;
340 item.assetType = type; 346 item.assetType = type;
341 item.invType = this.invType; 347 item.invType = invType;
342 item.parentFolderID = this.InventFolder; 348 item.parentFolderID = InventFolder;
343 item.inventoryCurrentPermissions = 2147483647; 349 item.inventoryCurrentPermissions = 2147483647;
344 item.inventoryNextPermissions = this.nextPerm; 350 item.inventoryNextPermissions = nextPerm;
345 351
346 userInfo.AddItem(ourClient.AgentId, item); 352 userInfo.AddItem(ourClient.AgentId, item);
347 ourClient.SendInventoryItemUpdate(item); 353 ourClient.SendInventoryItemUpdate(item);
@@ -350,14 +356,13 @@ namespace OpenSim.Framework.Communications.Cache
350 356
351 public void UpdateInventoryItem(LLUUID itemID) 357 public void UpdateInventoryItem(LLUUID itemID)
352 { 358 {
353
354 } 359 }
355 360
356 public AssetBase GetAssetData() 361 public AssetBase GetAssetData()
357 { 362 {
358 if (m_finished) 363 if (m_finished)
359 { 364 {
360 return this.Asset; 365 return Asset;
361 } 366 }
362 return null; 367 return null;
363 } 368 }
@@ -379,10 +384,10 @@ namespace OpenSim.Framework.Communications.Cache
379 // Methods 384 // Methods
380 public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer) 385 public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer)
381 { 386 {
382 this.inventoryItemID = inventoryItem; 387 inventoryItemID = inventoryItem;
383 this.uploaderPath = path; 388 uploaderPath = path;
384 this.httpListener = httpServer; 389 httpListener = httpServer;
385 this.newAssetID = LLUUID.Random(); 390 newAssetID = LLUUID.Random();
386 } 391 }
387 392
388 private void SaveImageToFile(string filename, byte[] data) 393 private void SaveImageToFile(string filename, byte[] data)
@@ -399,18 +404,18 @@ namespace OpenSim.Framework.Communications.Cache
399 LLUUID inventoryItemID = this.inventoryItemID; 404 LLUUID inventoryItemID = this.inventoryItemID;
400 string text = ""; 405 string text = "";
401 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); 406 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
402 complete.new_asset = this.newAssetID.ToStringHyphenated(); 407 complete.new_asset = newAssetID.ToStringHyphenated();
403 complete.new_inventory_item = inventoryItemID; 408 complete.new_inventory_item = inventoryItemID;
404 complete.state = "complete"; 409 complete.state = "complete";
405 text = LLSDHelpers.SerialiseLLSDReply(complete); 410 text = LLSDHelpers.SerialiseLLSDReply(complete);
406 this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); 411 httpListener.RemoveStreamHandler("POST", uploaderPath);
407 if (this.SaveImages) 412 if (SaveImages)
408 { 413 {
409 this.SaveImageToFile(this.m_assetName + "notecard.txt", data); 414 SaveImageToFile(m_assetName + "notecard.txt", data);
410 } 415 }
411 if (this.OnUpLoad != null) 416 if (OnUpLoad != null)
412 { 417 {
413 this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , "" ); 418 OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", "");
414 } 419 }
415 return text; 420 return text;
416 } 421 }
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 2d639d6..8fbc3fd 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework;
30 29
31namespace OpenSim.Framework.Communications.Cache 30namespace OpenSim.Framework.Communications.Cache
32{ 31{
@@ -45,22 +44,22 @@ namespace OpenSim.Framework.Communications.Cache
45 // Methods 44 // Methods
46 public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) 45 public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo)
47 { 46 {
48 if (userID == this.UserProfile.UUID) 47 if (userID == UserProfile.UUID)
49 { 48 {
50 if (this.RootFolder == null) 49 if (RootFolder == null)
51 { 50 {
52 if (folderInfo.parentID == LLUUID.Zero) 51 if (folderInfo.parentID == LLUUID.Zero)
53 { 52 {
54 this.RootFolder = folderInfo; 53 RootFolder = folderInfo;
55 } 54 }
56 } 55 }
57 else if (this.RootFolder.folderID == folderInfo.parentID) 56 else if (RootFolder.folderID == folderInfo.parentID)
58 { 57 {
59 this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); 58 RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
60 } 59 }
61 else 60 else
62 { 61 {
63 InventoryFolderImpl folder = this.RootFolder.HasSubFolder(folderInfo.parentID); 62 InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.parentID);
64 if (folder != null) 63 if (folder != null)
65 { 64 {
66 folder.SubFolders.Add(folderInfo.folderID, folderInfo); 65 folder.SubFolders.Add(folderInfo.folderID, folderInfo);
@@ -71,18 +70,18 @@ namespace OpenSim.Framework.Communications.Cache
71 70
72 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) 71 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
73 { 72 {
74 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 73 if ((userID == UserProfile.UUID) && (RootFolder != null))
75 { 74 {
76 if (itemInfo.parentFolderID == this.RootFolder.folderID) 75 if (itemInfo.parentFolderID == RootFolder.folderID)
77 { 76 {
78 this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); 77 RootFolder.Items.Add(itemInfo.inventoryID, itemInfo);
79 } 78 }
80 else 79 else
81 { 80 {
82 InventoryFolderImpl folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); 81 InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID);
83 if (folder != null) 82 if (folder != null)
84 { 83 {
85 folder.Items.Add(itemInfo.inventoryID, itemInfo); 84 folder.Items.Add(itemInfo.inventoryID, itemInfo);
86 } 85 }
87 } 86 }
88 } 87 }
@@ -90,30 +89,30 @@ namespace OpenSim.Framework.Communications.Cache
90 89
91 public void AddItem(LLUUID userID, InventoryItemBase itemInfo) 90 public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
92 { 91 {
93 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 92 if ((userID == UserProfile.UUID) && (RootFolder != null))
94 { 93 {
95 this.ItemReceive(userID, itemInfo); 94 ItemReceive(userID, itemInfo);
96 this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 95 m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
97 } 96 }
98 } 97 }
99 98
100 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) 99 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
101 { 100 {
102 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 101 if ((userID == UserProfile.UUID) && (RootFolder != null))
103 { 102 {
104 this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 103 m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
105 } 104 }
106 } 105 }
107 106
108 public bool DeleteItem(LLUUID userID, InventoryItemBase item) 107 public bool DeleteItem(LLUUID userID, InventoryItemBase item)
109 { 108 {
110 bool result = false; 109 bool result = false;
111 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 110 if ((userID == UserProfile.UUID) && (RootFolder != null))
112 { 111 {
113 result = RootFolder.DeleteItem(item.inventoryID); 112 result = RootFolder.DeleteItem(item.inventoryID);
114 if (result) 113 if (result)
115 { 114 {
116 this.m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); 115 m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item);
117 } 116 }
118 } 117 }
119 return result; 118 return result;
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index 4904293..74a1ef4 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -25,19 +25,13 @@
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*/
28
28using System; 29using System;
30using System.Collections.Generic;
29using System.IO; 31using System.IO;
30using System.Threading;
31using System.Reflection;
32using System.Xml.Serialization; 32using System.Xml.Serialization;
33
34using libsecondlife; 33using libsecondlife;
35
36using Nini.Config;
37using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41 35
42namespace OpenSim.Framework.Communications.Cache 36namespace OpenSim.Framework.Communications.Cache
43{ 37{
@@ -63,7 +57,6 @@ namespace OpenSim.Framework.Communications.Cache
63 Stream s = null; 57 Stream s = null;
64 try 58 try
65 { 59 {
66
67 MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString()); 60 MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString());
68 61
69 RestClient rc = new RestClient(_assetServerUrl); 62 RestClient rc = new RestClient(_assetServerUrl);
@@ -77,8 +70,8 @@ namespace OpenSim.Framework.Communications.Cache
77 70
78 if (s.Length > 0) 71 if (s.Length > 0)
79 { 72 {
80 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 73 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
81 AssetBase asset = (AssetBase)xs.Deserialize(s); 74 AssetBase asset = (AssetBase) xs.Deserialize(s);
82 75
83 _receiver.AssetReceived(asset, isTexture); 76 _receiver.AssetReceived(asset, isTexture);
84 } 77 }
@@ -106,7 +99,7 @@ namespace OpenSim.Framework.Communications.Cache
106 { 99 {
107 MemoryStream s = new MemoryStream(); 100 MemoryStream s = new MemoryStream();
108 101
109 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 102 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
110 xs.Serialize(s, asset); 103 xs.Serialize(s, asset);
111 RestClient rc = new RestClient(_assetServerUrl); 104 RestClient rc = new RestClient(_assetServerUrl);
112 rc.AddResourcePath("assets"); 105 rc.AddResourcePath("assets");
@@ -129,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache
129 throw new Exception("The method or operation is not implemented."); 122 throw new Exception("The method or operation is not implemented.");
130 } 123 }
131 124
132 public System.Collections.Generic.List<AssetBase> GetDefaultAssets() 125 public List<AssetBase> GetDefaultAssets()
133 { 126 {
134 throw new Exception("The method or operation is not implemented."); 127 throw new Exception("The method or operation is not implemented.");
135 } 128 }
@@ -156,4 +149,4 @@ namespace OpenSim.Framework.Communications.Cache
156 149
157 #endregion 150 #endregion
158 } 151 }
159} 152} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
index 0905af8..3495e55 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -25,14 +25,8 @@
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;
29using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife; 29using libsecondlife;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework;
36 30
37namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Framework.Communications.Cache
38{ 32{
@@ -44,17 +38,16 @@ namespace OpenSim.Framework.Communications.Cache
44 38
45 public InventoryFolderImpl(InventoryFolderBase folderbase) 39 public InventoryFolderImpl(InventoryFolderBase folderbase)
46 { 40 {
47 this.agentID = folderbase.agentID; 41 agentID = folderbase.agentID;
48 this.folderID = folderbase.folderID; 42 folderID = folderbase.folderID;
49 this.name = folderbase.name; 43 name = folderbase.name;
50 this.parentID = folderbase.parentID; 44 parentID = folderbase.parentID;
51 this.type = folderbase.type; 45 type = folderbase.type;
52 this.version = folderbase.version; 46 version = folderbase.version;
53 } 47 }
54 48
55 public InventoryFolderImpl() 49 public InventoryFolderImpl()
56 { 50 {
57
58 } 51 }
59 52
60 // Methods 53 // Methods
@@ -65,19 +58,19 @@ namespace OpenSim.Framework.Communications.Cache
65 subFold.folderID = folderID; 58 subFold.folderID = folderID;
66 subFold.type = (short) type; 59 subFold.type = (short) type;
67 subFold.parentID = this.folderID; 60 subFold.parentID = this.folderID;
68 subFold.agentID = this.agentID; 61 subFold.agentID = agentID;
69 this.SubFolders.Add(subFold.folderID, subFold); 62 SubFolders.Add(subFold.folderID, subFold);
70 return subFold; 63 return subFold;
71 } 64 }
72 65
73 public InventoryItemBase HasItem(LLUUID itemID) 66 public InventoryItemBase HasItem(LLUUID itemID)
74 { 67 {
75 InventoryItemBase base2 = null; 68 InventoryItemBase base2 = null;
76 if (this.Items.ContainsKey(itemID)) 69 if (Items.ContainsKey(itemID))
77 { 70 {
78 return this.Items[itemID]; 71 return Items[itemID];
79 } 72 }
80 foreach (InventoryFolderImpl folder in this.SubFolders.Values) 73 foreach (InventoryFolderImpl folder in SubFolders.Values)
81 { 74 {
82 base2 = folder.HasItem(itemID); 75 base2 = folder.HasItem(itemID);
83 if (base2 != null) 76 if (base2 != null)
@@ -91,12 +84,12 @@ namespace OpenSim.Framework.Communications.Cache
91 public bool DeleteItem(LLUUID itemID) 84 public bool DeleteItem(LLUUID itemID)
92 { 85 {
93 bool found = false; 86 bool found = false;
94 if (this.Items.ContainsKey(itemID)) 87 if (Items.ContainsKey(itemID))
95 { 88 {
96 Items.Remove(itemID); 89 Items.Remove(itemID);
97 return true; 90 return true;
98 } 91 }
99 foreach (InventoryFolderImpl folder in this.SubFolders.Values) 92 foreach (InventoryFolderImpl folder in SubFolders.Values)
100 { 93 {
101 found = folder.DeleteItem(itemID); 94 found = folder.DeleteItem(itemID);
102 if (found == true) 95 if (found == true)
@@ -111,13 +104,13 @@ namespace OpenSim.Framework.Communications.Cache
111 public InventoryFolderImpl HasSubFolder(LLUUID folderID) 104 public InventoryFolderImpl HasSubFolder(LLUUID folderID)
112 { 105 {
113 InventoryFolderImpl returnFolder = null; 106 InventoryFolderImpl returnFolder = null;
114 if (this.SubFolders.ContainsKey(folderID)) 107 if (SubFolders.ContainsKey(folderID))
115 { 108 {
116 returnFolder = this.SubFolders[folderID]; 109 returnFolder = SubFolders[folderID];
117 } 110 }
118 else 111 else
119 { 112 {
120 foreach (InventoryFolderImpl folder in this.SubFolders.Values) 113 foreach (InventoryFolderImpl folder in SubFolders.Values)
121 { 114 {
122 returnFolder = folder.HasSubFolder(folderID); 115 returnFolder = folder.HasSubFolder(folderID);
123 if (returnFolder != null) 116 if (returnFolder != null)
@@ -132,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache
132 public List<InventoryItemBase> RequestListOfItems() 125 public List<InventoryItemBase> RequestListOfItems()
133 { 126 {
134 List<InventoryItemBase> itemList = new List<InventoryItemBase>(); 127 List<InventoryItemBase> itemList = new List<InventoryItemBase>();
135 foreach (InventoryItemBase item in this.Items.Values) 128 foreach (InventoryItemBase item in Items.Values)
136 { 129 {
137 itemList.Add(item); 130 itemList.Add(item);
138 } 131 }
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
index 60f9b6b..765c42e 100644
--- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
@@ -26,12 +26,8 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.IO; 29using System.IO;
31using System.Collections.Generic;
32using System.Text;
33using libsecondlife; 30using libsecondlife;
34using OpenSim.Framework;
35using Nini.Config; 31using Nini.Config;
36 32
37namespace OpenSim.Framework.Communications.Cache 33namespace OpenSim.Framework.Communications.Cache
@@ -40,43 +36,42 @@ namespace OpenSim.Framework.Communications.Cache
40 /// Basically a hack to give us a Inventory library while we don't have a inventory server 36 /// Basically a hack to give us a Inventory library while we don't have a inventory server
41 /// once the server is fully implemented then should read the data from that 37 /// once the server is fully implemented then should read the data from that
42 /// </summary> 38 /// </summary>
43 public class LibraryRootFolder : Cache.InventoryFolderImpl 39 public class LibraryRootFolder : InventoryFolderImpl
44 { 40 {
45 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 41 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
46 private Cache.InventoryFolderImpl m_textureFolder; 42 private InventoryFolderImpl m_textureFolder;
47 43
48 public LibraryRootFolder() 44 public LibraryRootFolder()
49 { 45 {
50 this.agentID = libOwner; 46 agentID = libOwner;
51 this.folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); 47 folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
52 this.name = "OpenSim Library"; 48 name = "OpenSim Library";
53 this.parentID = LLUUID.Zero; 49 parentID = LLUUID.Zero;
54 this.type = (short)-1; 50 type = (short) -1;
55 this.version = (ushort)1; 51 version = (ushort) 1;
56 52
57 Cache.InventoryFolderImpl folderInfo = new InventoryFolderImpl(); 53 InventoryFolderImpl folderInfo = new InventoryFolderImpl();
58 folderInfo.agentID = libOwner; 54 folderInfo.agentID = libOwner;
59 folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); 55 folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001");
60 folderInfo.name = "Texture Library"; 56 folderInfo.name = "Texture Library";
61 folderInfo.parentID = this.folderID; 57 folderInfo.parentID = folderID;
62 folderInfo.type = -1; 58 folderInfo.type = -1;
63 folderInfo.version = 1; 59 folderInfo.version = 1;
64 this.SubFolders.Add(folderInfo.folderID, folderInfo); 60 SubFolders.Add(folderInfo.folderID, folderInfo);
65 this.m_textureFolder = folderInfo; 61 m_textureFolder = folderInfo;
66 62
67 this.CreateLibraryItems(); 63 CreateLibraryItems();
68 64
69 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); 65 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml");
70 if (File.Exists(filePath)) 66 if (File.Exists(filePath))
71 { 67 {
72 XmlConfigSource source = new XmlConfigSource(filePath); 68 XmlConfigSource source = new XmlConfigSource(filePath);
73 this.ReadItemsFromFile(source); 69 ReadItemsFromFile(source);
74 } 70 }
75 } 71 }
76 72
77 private void CreateLibraryItems() 73 private void CreateLibraryItems()
78 { 74 {
79
80 InventoryItemBase item = new InventoryItemBase(); 75 InventoryItemBase item = new InventoryItemBase();
81 item.avatarID = libOwner; 76 item.avatarID = libOwner;
82 item.creatorsID = libOwner; 77 item.creatorsID = libOwner;
@@ -90,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache
90 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 85 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
91 item.inventoryCurrentPermissions = 0x7FFFFFFF; 86 item.inventoryCurrentPermissions = 0x7FFFFFFF;
92 item.inventoryNextPermissions = 0x7FFFFFFF; 87 item.inventoryNextPermissions = 0x7FFFFFFF;
93 this.m_textureFolder.Items.Add(item.inventoryID, item); 88 m_textureFolder.Items.Add(item.inventoryID, item);
94 89
95 item = new InventoryItemBase(); 90 item = new InventoryItemBase();
96 item.avatarID = libOwner; 91 item.avatarID = libOwner;
@@ -105,7 +100,7 @@ namespace OpenSim.Framework.Communications.Cache
105 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 100 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
106 item.inventoryCurrentPermissions = 0x7FFFFFFF; 101 item.inventoryCurrentPermissions = 0x7FFFFFFF;
107 item.inventoryNextPermissions = 0x7FFFFFFF; 102 item.inventoryNextPermissions = 0x7FFFFFFF;
108 this.m_textureFolder.Items.Add(item.inventoryID, item); 103 m_textureFolder.Items.Add(item.inventoryID, item);
109 104
110 item = new InventoryItemBase(); 105 item = new InventoryItemBase();
111 item.avatarID = libOwner; 106 item.avatarID = libOwner;
@@ -120,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache
120 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 115 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
121 item.inventoryCurrentPermissions = 0x7FFFFFFF; 116 item.inventoryCurrentPermissions = 0x7FFFFFFF;
122 item.inventoryNextPermissions = 0x7FFFFFFF; 117 item.inventoryNextPermissions = 0x7FFFFFFF;
123 this.m_textureFolder.Items.Add(item.inventoryID, item); 118 m_textureFolder.Items.Add(item.inventoryID, item);
124 119
125 item = new InventoryItemBase(); 120 item = new InventoryItemBase();
126 item.avatarID = libOwner; 121 item.avatarID = libOwner;
@@ -135,7 +130,7 @@ namespace OpenSim.Framework.Communications.Cache
135 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 130 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
136 item.inventoryCurrentPermissions = 0x7FFFFFFF; 131 item.inventoryCurrentPermissions = 0x7FFFFFFF;
137 item.inventoryNextPermissions = 0x7FFFFFFF; 132 item.inventoryNextPermissions = 0x7FFFFFFF;
138 this.m_textureFolder.Items.Add(item.inventoryID, item); 133 m_textureFolder.Items.Add(item.inventoryID, item);
139 134
140 item = new InventoryItemBase(); 135 item = new InventoryItemBase();
141 item.avatarID = libOwner; 136 item.avatarID = libOwner;
@@ -150,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache
150 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 145 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
151 item.inventoryCurrentPermissions = 0x7FFFFFFF; 146 item.inventoryCurrentPermissions = 0x7FFFFFFF;
152 item.inventoryNextPermissions = 0x7FFFFFFF; 147 item.inventoryNextPermissions = 0x7FFFFFFF;
153 this.m_textureFolder.Items.Add(item.inventoryID, item); 148 m_textureFolder.Items.Add(item.inventoryID, item);
154 149
155 item = new InventoryItemBase(); 150 item = new InventoryItemBase();
156 item.avatarID = libOwner; 151 item.avatarID = libOwner;
@@ -161,10 +156,10 @@ namespace OpenSim.Framework.Communications.Cache
161 item.inventoryName = "Default Shape"; 156 item.inventoryName = "Default Shape";
162 item.assetType = 13; 157 item.assetType = 13;
163 item.invType = 18; 158 item.invType = 18;
164 item.parentFolderID = this.folderID; 159 item.parentFolderID = folderID;
165 item.inventoryCurrentPermissions = 0; 160 item.inventoryCurrentPermissions = 0;
166 item.inventoryNextPermissions = 0; 161 item.inventoryNextPermissions = 0;
167 this.Items.Add(item.inventoryID, item); 162 Items.Add(item.inventoryID, item);
168 163
169 item = new InventoryItemBase(); 164 item = new InventoryItemBase();
170 item.avatarID = libOwner; 165 item.avatarID = libOwner;
@@ -175,10 +170,10 @@ namespace OpenSim.Framework.Communications.Cache
175 item.inventoryName = "Default Skin"; 170 item.inventoryName = "Default Skin";
176 item.assetType = 13; 171 item.assetType = 13;
177 item.invType = 18; 172 item.invType = 18;
178 item.parentFolderID = this.folderID; 173 item.parentFolderID = folderID;
179 item.inventoryCurrentPermissions = 0; 174 item.inventoryCurrentPermissions = 0;
180 item.inventoryNextPermissions = 0; 175 item.inventoryNextPermissions = 0;
181 this.Items.Add(item.inventoryID, item); 176 Items.Add(item.inventoryID, item);
182 177
183 item = new InventoryItemBase(); 178 item = new InventoryItemBase();
184 item.avatarID = libOwner; 179 item.avatarID = libOwner;
@@ -189,10 +184,10 @@ namespace OpenSim.Framework.Communications.Cache
189 item.inventoryName = "Default Shirt"; 184 item.inventoryName = "Default Shirt";
190 item.assetType = 5; 185 item.assetType = 5;
191 item.invType = 18; 186 item.invType = 18;
192 item.parentFolderID = this.folderID; 187 item.parentFolderID = folderID;
193 item.inventoryCurrentPermissions = 0; 188 item.inventoryCurrentPermissions = 0;
194 item.inventoryNextPermissions = 0; 189 item.inventoryNextPermissions = 0;
195 this.Items.Add(item.inventoryID, item); 190 Items.Add(item.inventoryID, item);
196 191
197 item = new InventoryItemBase(); 192 item = new InventoryItemBase();
198 item.avatarID = libOwner; 193 item.avatarID = libOwner;
@@ -203,11 +198,10 @@ namespace OpenSim.Framework.Communications.Cache
203 item.inventoryName = "Default Pants"; 198 item.inventoryName = "Default Pants";
204 item.assetType = 5; 199 item.assetType = 5;
205 item.invType = 18; 200 item.invType = 18;
206 item.parentFolderID = this.folderID; 201 item.parentFolderID = folderID;
207 item.inventoryCurrentPermissions = 0; 202 item.inventoryCurrentPermissions = 0;
208 item.inventoryNextPermissions = 0; 203 item.inventoryNextPermissions = 0;
209 this.Items.Add(item.inventoryID, item); 204 Items.Add(item.inventoryID, item);
210
211 } 205 }
212 206
213 private void ReadItemsFromFile(IConfigSource source) 207 private void ReadItemsFromFile(IConfigSource source)
@@ -217,28 +211,28 @@ namespace OpenSim.Framework.Communications.Cache
217 InventoryItemBase item = new InventoryItemBase(); 211 InventoryItemBase item = new InventoryItemBase();
218 item.avatarID = libOwner; 212 item.avatarID = libOwner;
219 item.creatorsID = libOwner; 213 item.creatorsID = libOwner;
220 item.inventoryID = new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated())); 214 item.inventoryID =
215 new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated()));
221 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); 216 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
222 item.inventoryDescription = source.Configs[i].GetString("description", ""); 217 item.inventoryDescription = source.Configs[i].GetString("description", "");
223 item.inventoryName = source.Configs[i].GetString("name", ""); 218 item.inventoryName = source.Configs[i].GetString("name", "");
224 item.assetType = source.Configs[i].GetInt("assetType", 0); 219 item.assetType = source.Configs[i].GetInt("assetType", 0);
225 item.invType = source.Configs[i].GetInt("inventoryType", 0); 220 item.invType = source.Configs[i].GetInt("inventoryType", 0);
226 item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); 221 item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF);
227 item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); 222 item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF);
228 item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); 223 item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF);
229 item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); 224 item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF);
230 if (item.assetType == 0) 225 if (item.assetType == 0)
231 { 226 {
232 item.parentFolderID = this.m_textureFolder.folderID; 227 item.parentFolderID = m_textureFolder.folderID;
233 this.m_textureFolder.Items.Add(item.inventoryID, item); 228 m_textureFolder.Items.Add(item.inventoryID, item);
234 } 229 }
235 else 230 else
236 { 231 {
237 item.parentFolderID = this.folderID; 232 item.parentFolderID = folderID;
238 this.Items.Add(item.inventoryID, item); 233 Items.Add(item.inventoryID, item);
239 } 234 }
240 } 235 }
241 } 236 }
242
243 } 237 }
244} \ No newline at end of file 238} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index 0953e19..b4f29db 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -26,14 +26,8 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using System.Threading;
31using System.Reflection; 29using System.Reflection;
32using libsecondlife;
33using Nini.Config;
34using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework;
37 31
38namespace OpenSim.Framework.Communications.Cache 32namespace OpenSim.Framework.Communications.Cache
39{ 33{
@@ -62,11 +56,14 @@ namespace OpenSim.Framework.Communications.Cache
62 56
63 if (typeInterface != null) 57 if (typeInterface != null)
64 { 58 {
65 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 59 IAssetProvider plug =
60 (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
66 m_assetProviderPlugin = plug; 61 m_assetProviderPlugin = plug;
67 m_assetProviderPlugin.Initialise(); 62 m_assetProviderPlugin.Initialise();
68 63
69 MainLog.Instance.Verbose("AssetStorage","Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); 64 MainLog.Instance.Verbose("AssetStorage",
65 "Added " + m_assetProviderPlugin.Name + " " +
66 m_assetProviderPlugin.Version);
70 } 67 }
71 68
72 typeInterface = null; 69 typeInterface = null;
@@ -84,13 +81,13 @@ namespace OpenSim.Framework.Communications.Cache
84 m_assetProviderPlugin.CommitAssets(); 81 m_assetProviderPlugin.CommitAssets();
85 } 82 }
86 83
87 override protected void RunRequests() 84 protected override void RunRequests()
88 { 85 {
89 while (true) 86 while (true)
90 { 87 {
91 ARequest req = this._assetRequests.Dequeue(); 88 ARequest req = _assetRequests.Dequeue();
92 89
93 //MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID); 90 //MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID);
94 91
95 AssetBase asset = null; 92 AssetBase asset = null;
96 lock (syncLock) 93 lock (syncLock)
@@ -105,9 +102,7 @@ namespace OpenSim.Framework.Communications.Cache
105 { 102 {
106 _receiver.AssetNotFound(req.AssetID); 103 _receiver.AssetNotFound(req.AssetID);
107 } 104 }
108
109 } 105 }
110
111 } 106 }
112 107
113 protected override void StoreAsset(AssetBase asset) 108 protected override void StoreAsset(AssetBase asset)
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
index 8105556..fe943b0 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
@@ -25,16 +25,8 @@
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;
29using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife; 29using libsecondlife;
34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework;
37
38 30
39namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Framework.Communications.Cache
40{ 32{
@@ -49,7 +41,7 @@ namespace OpenSim.Framework.Communications.Cache
49 // Methods 41 // Methods
50 public UserProfileCache(CommunicationsManager parent) 42 public UserProfileCache(CommunicationsManager parent)
51 { 43 {
52 this.m_parent = parent; 44 m_parent = parent;
53 } 45 }
54 46
55 /// <summary> 47 /// <summary>
@@ -62,14 +54,14 @@ namespace OpenSim.Framework.Communications.Cache
62 // Potential fix - Multithreading issue. 54 // Potential fix - Multithreading issue.
63 lock (UserProfiles) 55 lock (UserProfiles)
64 { 56 {
65 if (!this.UserProfiles.ContainsKey(userID)) 57 if (!UserProfiles.ContainsKey(userID))
66 { 58 {
67 CachedUserInfo userInfo = new CachedUserInfo(this.m_parent); 59 CachedUserInfo userInfo = new CachedUserInfo(m_parent);
68 userInfo.UserProfile = this.RequestUserProfileForUser(userID); 60 userInfo.UserProfile = RequestUserProfileForUser(userID);
69 if (userInfo.UserProfile != null) 61 if (userInfo.UserProfile != null)
70 { 62 {
71 this.RequestInventoryForUser(userID, userInfo); 63 RequestInventoryForUser(userID, userInfo);
72 this.UserProfiles.Add(userID, userInfo); 64 UserProfiles.Add(userID, userInfo);
73 } 65 }
74 else 66 else
75 { 67 {
@@ -91,26 +83,28 @@ namespace OpenSim.Framework.Communications.Cache
91 83
92 public CachedUserInfo GetUserDetails(LLUUID userID) 84 public CachedUserInfo GetUserDetails(LLUUID userID)
93 { 85 {
94 if (this.UserProfiles.ContainsKey(userID)) 86 if (UserProfiles.ContainsKey(userID))
95 { 87 {
96 return this.UserProfiles[userID]; 88 return UserProfiles[userID];
97 } 89 }
98 return null; 90 return null;
99 } 91 }
100 92
101 public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) 93 public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
94 string folderName, LLUUID parentID)
102 { 95 {
103 if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 96 if (UserProfiles.ContainsKey(remoteClient.AgentId))
104 { 97 {
105 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 98 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
106 { 99 {
107 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 100 CachedUserInfo info = UserProfiles[remoteClient.AgentId];
108 if (info.RootFolder.folderID == parentID) 101 if (info.RootFolder.folderID == parentID)
109 { 102 {
110 InventoryFolderImpl createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); 103 InventoryFolderImpl createdFolder =
104 info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
111 if (createdFolder != null) 105 if (createdFolder != null)
112 { 106 {
113 this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); 107 m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
114 } 108 }
115 } 109 }
116 else 110 else
@@ -125,27 +119,30 @@ namespace OpenSim.Framework.Communications.Cache
125 } 119 }
126 } 120 }
127 121
128 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) 122 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
123 bool fetchFolders, bool fetchItems, int sortOrder)
129 { 124 {
130 InventoryFolderImpl fold = null; 125 InventoryFolderImpl fold = null;
131 if (folderID == libraryRoot.folderID ) 126 if (folderID == libraryRoot.folderID)
132 { 127 {
133 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); 128 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID,
129 libraryRoot.RequestListOfItems());
134 } 130 }
135 else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) 131 else if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
136 { 132 {
137 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); 133 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems());
138 } 134 }
139 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 135 else if (UserProfiles.ContainsKey(remoteClient.AgentId))
140 { 136 {
141 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 137 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
142 { 138 {
143 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 139 CachedUserInfo info = UserProfiles[remoteClient.AgentId];
144 if (info.RootFolder.folderID == folderID) 140 if (info.RootFolder.folderID == folderID)
145 { 141 {
146 if (fetchItems) 142 if (fetchItems)
147 { 143 {
148 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, info.RootFolder.RequestListOfItems()); 144 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
145 info.RootFolder.RequestListOfItems());
149 } 146 }
150 } 147 }
151 else 148 else
@@ -153,7 +150,8 @@ namespace OpenSim.Framework.Communications.Cache
153 InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID); 150 InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID);
154 if ((folder != null) && fetchItems) 151 if ((folder != null) && fetchItems)
155 { 152 {
156 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems()); 153 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
154 folder.RequestListOfItems());
157 } 155 }
158 } 156 }
159 } 157 }
@@ -166,11 +164,11 @@ namespace OpenSim.Framework.Communications.Cache
166 { 164 {
167 //Console.WriteLine("request info for library item"); 165 //Console.WriteLine("request info for library item");
168 } 166 }
169 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 167 else if (UserProfiles.ContainsKey(remoteClient.AgentId))
170 { 168 {
171 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 169 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
172 { 170 {
173 InventoryItemBase item = this.UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID); 171 InventoryItemBase item = UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID);
174 if (item != null) 172 if (item != null)
175 { 173 {
176 remoteClient.SendInventoryItemDetails(ownerID, item); 174 remoteClient.SendInventoryItemDetails(ownerID, item);
@@ -185,7 +183,7 @@ namespace OpenSim.Framework.Communications.Cache
185 /// <param name="userID"></param> 183 /// <param name="userID"></param>
186 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) 184 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
187 { 185 {
188 this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 186 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
189 } 187 }
190 188
191 /// <summary> 189 /// <summary>
@@ -194,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache
194 /// <param name="userID"></param> 192 /// <param name="userID"></param>
195 private UserProfileData RequestUserProfileForUser(LLUUID userID) 193 private UserProfileData RequestUserProfileForUser(LLUUID userID)
196 { 194 {
197 return this.m_parent.UserService.GetUserProfile(userID); 195 return m_parent.UserService.GetUserProfile(userID);
198 } 196 }
199 197
200 /// <summary> 198 /// <summary>
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index a114b64..23dfcc6 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -28,18 +28,23 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.IO; 31using System.IO;
33using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console;
35using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
36using OpenSim.Framework;
37 37
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
40 public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType); 40 public delegate void UpLoadedAsset(
41 string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data,
42 string inventoryType, string assetType);
43
41 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); 44 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data);
45
42 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); 46 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
47
43 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); 48 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
44 49
45 public class Caps 50 public class Caps
@@ -62,7 +67,8 @@ namespace OpenSim.Region.Capabilities
62 public ItemUpdatedCallback ItemUpdatedCall = null; 67 public ItemUpdatedCallback ItemUpdatedCall = null;
63 private bool m_dumpAssetsToFile; 68 private bool m_dumpAssetsToFile;
64 69
65 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) 70 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath,
71 LLUUID agent, bool dumpAssetsToFile)
66 { 72 {
67 assetCache = assetCach; 73 assetCache = assetCach;
68 m_capsObjectPath = capsPath; 74 m_capsObjectPath = capsPath;
@@ -78,12 +84,17 @@ namespace OpenSim.Region.Capabilities
78 /// </summary> 84 /// </summary>
79 public void RegisterHandlers() 85 public void RegisterHandlers()
80 { 86 {
81 OpenSim.Framework.Console.MainLog.Instance.Verbose("CAPS","Registering CAPS handlers"); 87 MainLog.Instance.Verbose("CAPS", "Registering CAPS handlers");
82 string capsBase = "/CAPS/" + m_capsObjectPath; 88 string capsBase = "/CAPS/" + m_capsObjectPath;
83 try 89 try
84 { 90 {
85 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer)); 91 httpListener.AddStreamHandler(
86 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); 92 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
93 GetMapLayer));
94 httpListener.AddStreamHandler(
95 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
96 capsBase + m_newInventory,
97 NewAgentInventoryRequest));
87 98
88 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); 99 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
89 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); 100 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture);
@@ -103,7 +114,7 @@ namespace OpenSim.Region.Capabilities
103 string capsBase = "/CAPS/" + m_capsObjectPath; 114 string capsBase = "/CAPS/" + m_capsObjectPath;
104 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); 115 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
105 } 116 }
106 117
107 /// <summary> 118 /// <summary>
108 /// 119 ///
109 /// </summary> 120 /// </summary>
@@ -113,8 +124,8 @@ namespace OpenSim.Region.Capabilities
113 /// <returns></returns> 124 /// <returns></returns>
114 public string CapsRequest(string request, string path, string param) 125 public string CapsRequest(string request, string path, string param)
115 { 126 {
116 // Console.WriteLine("caps request " + request); 127 // Console.WriteLine("caps request " + request);
117 string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); 128 string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities());
118 return result; 129 return result;
119 } 130 }
120 131
@@ -125,9 +136,10 @@ namespace OpenSim.Region.Capabilities
125 protected LLSDCapsDetails GetCapabilities() 136 protected LLSDCapsDetails GetCapabilities()
126 { 137 {
127 LLSDCapsDetails caps = new LLSDCapsDetails(); 138 LLSDCapsDetails caps = new LLSDCapsDetails();
128 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; 139 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" +
140 m_capsObjectPath;
129 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 141 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
130 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; 142 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
131 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 143 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
132 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; 144 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
133 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; 145 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;
@@ -142,7 +154,7 @@ namespace OpenSim.Region.Capabilities
142 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) 154 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
143 { 155 {
144 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 156 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
145 mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); 157 mapResponse.LayerData.Array.Add(GetLLSDMapLayerResponse());
146 return mapResponse; 158 return mapResponse;
147 } 159 }
148 160
@@ -174,6 +186,7 @@ namespace OpenSim.Region.Capabilities
174 } 186 }
175 187
176 #region EventQueue (Currently not enabled) 188 #region EventQueue (Currently not enabled)
189
177 /// <summary> 190 /// <summary>
178 /// 191 ///
179 /// </summary> 192 /// </summary>
@@ -184,10 +197,10 @@ namespace OpenSim.Region.Capabilities
184 public string ProcessEventQueue(string request, string path, string param) 197 public string ProcessEventQueue(string request, string path, string param)
185 { 198 {
186 string res = ""; 199 string res = "";
187 200
188 if (this.CapsEventQueue.Count > 0) 201 if (CapsEventQueue.Count > 0)
189 { 202 {
190 lock (this.CapsEventQueue) 203 lock (CapsEventQueue)
191 { 204 {
192 string item = CapsEventQueue.Dequeue(); 205 string item = CapsEventQueue.Dequeue();
193 res = item; 206 res = item;
@@ -195,7 +208,7 @@ namespace OpenSim.Region.Capabilities
195 } 208 }
196 else 209 else
197 { 210 {
198 res = this.CreateEmptyEventResponse(); 211 res = CreateEmptyEventResponse();
199 } 212 }
200 return res; 213 return res;
201 } 214 }
@@ -214,8 +227,8 @@ namespace OpenSim.Region.Capabilities
214 eventItem.events.Array.Add(new LLSDEmpty()); 227 eventItem.events.Array.Add(new LLSDEmpty());
215 string res = LLSDHelpers.SerialiseLLSDReply(eventItem); 228 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
216 eventQueueCount++; 229 eventQueueCount++;
217 230
218 this.CapsEventQueue.Enqueue(res); 231 CapsEventQueue.Enqueue(res);
219 return res; 232 return res;
220 } 233 }
221 234
@@ -232,6 +245,7 @@ namespace OpenSim.Region.Capabilities
232 eventQueueCount++; 245 eventQueueCount++;
233 return res; 246 return res;
234 } 247 }
248
235 #endregion 249 #endregion
236 250
237 /// <summary> 251 /// <summary>
@@ -243,24 +257,27 @@ namespace OpenSim.Region.Capabilities
243 /// <returns></returns> 257 /// <returns></returns>
244 public string NoteCardAgentInventory(string request, string path, string param) 258 public string NoteCardAgentInventory(string request, string path, string param)
245 { 259 {
246 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); 260 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
247 LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); 261 LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
248 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 262 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
249 263
250 string capsBase = "/CAPS/" + m_capsObjectPath; 264 string capsBase = "/CAPS/" + m_capsObjectPath;
251 LLUUID newInvItem = llsdRequest.item_id; 265 LLUUID newInvItem = llsdRequest.item_id;
252 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 266 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
253 267
254 ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile ); 268 ItemUpdater uploader =
255 uploader.OnUpLoad += this.ItemUpdated; 269 new ItemUpdater(newInvItem, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
270 uploader.OnUpLoad += ItemUpdated;
256 271
257 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 272 httpListener.AddStreamHandler(
258 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 273 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
274 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
275 uploaderPath;
259 276
260 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 277 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
261 uploadResponse.uploader = uploaderURL; 278 uploadResponse.uploader = uploaderURL;
262 uploadResponse.state = "upload"; 279 uploadResponse.state = "upload";
263 280
264 return LLSDHelpers.SerialiseLLSDReply(uploadResponse); 281 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
265 } 282 }
266 283
@@ -272,7 +289,7 @@ namespace OpenSim.Region.Capabilities
272 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) 289 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
273 { 290 {
274 //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); 291 //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
275 292
276 string assetName = llsdRequest.name; 293 string assetName = llsdRequest.name;
277 string assetDes = llsdRequest.description; 294 string assetDes = llsdRequest.description;
278 string capsBase = "/CAPS/" + m_capsObjectPath; 295 string capsBase = "/CAPS/" + m_capsObjectPath;
@@ -281,14 +298,18 @@ namespace OpenSim.Region.Capabilities
281 LLUUID parentFolder = llsdRequest.folder_id; 298 LLUUID parentFolder = llsdRequest.folder_id;
282 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 299 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
283 300
284 AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile); 301 AssetUploader uploader =
285 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 302 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
286 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 303 llsdRequest.asset_type, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
304 httpListener.AddStreamHandler(
305 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
306 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
307 uploaderPath;
287 308
288 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 309 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
289 uploadResponse.uploader = uploaderURL; 310 uploadResponse.uploader = uploaderURL;
290 uploadResponse.state = "upload"; 311 uploadResponse.state = "upload";
291 uploader.OnUpLoad += this.UploadCompleteHandler; 312 uploader.OnUpLoad += UploadCompleteHandler;
292 return uploadResponse; 313 return uploadResponse;
293 } 314 }
294 315
@@ -298,7 +319,9 @@ namespace OpenSim.Region.Capabilities
298 /// <param name="assetID"></param> 319 /// <param name="assetID"></param>
299 /// <param name="inventoryItem"></param> 320 /// <param name="inventoryItem"></param>
300 /// <param name="data"></param> 321 /// <param name="data"></param>
301 public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType) 322 public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID,
323 LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType,
324 string assetType)
302 { 325 {
303 sbyte assType = 0; 326 sbyte assType = 0;
304 sbyte inType = 0; 327 sbyte inType = 0;
@@ -319,14 +342,14 @@ namespace OpenSim.Region.Capabilities
319 asset.FullID = assetID; 342 asset.FullID = assetID;
320 asset.Type = assType; 343 asset.Type = assType;
321 asset.InvType = inType; 344 asset.InvType = inType;
322 asset.Name = assetName; 345 asset.Name = assetName;
323 asset.Data = data; 346 asset.Data = data;
324 this.assetCache.AddAsset(asset); 347 assetCache.AddAsset(asset);
325 348
326 InventoryItemBase item = new InventoryItemBase(); 349 InventoryItemBase item = new InventoryItemBase();
327 item.avatarID = agentID; 350 item.avatarID = agentID;
328 item.creatorsID = agentID; 351 item.creatorsID = agentID;
329 item.inventoryID = inventoryItem; 352 item.inventoryID = inventoryItem;
330 item.assetID = asset.FullID; 353 item.assetID = asset.FullID;
331 item.inventoryDescription = assetDescription; 354 item.inventoryDescription = assetDescription;
332 item.inventoryName = assetName; 355 item.inventoryName = assetName;
@@ -340,14 +363,13 @@ namespace OpenSim.Region.Capabilities
340 { 363 {
341 AddNewInventoryItem(agentID, item); 364 AddNewInventoryItem(agentID, item);
342 } 365 }
343
344 } 366 }
345 367
346 public LLUUID ItemUpdated(LLUUID itemID, byte[] data) 368 public LLUUID ItemUpdated(LLUUID itemID, byte[] data)
347 { 369 {
348 if (ItemUpdatedCall != null) 370 if (ItemUpdatedCall != null)
349 { 371 {
350 return ItemUpdatedCall(this.agentID, itemID, data); 372 return ItemUpdatedCall(agentID, itemID, data);
351 } 373 }
352 return LLUUID.Zero; 374 return LLUUID.Zero;
353 } 375 }
@@ -359,7 +381,7 @@ namespace OpenSim.Region.Capabilities
359 private string uploaderPath = ""; 381 private string uploaderPath = "";
360 private LLUUID newAssetID; 382 private LLUUID newAssetID;
361 private LLUUID inventoryItemID; 383 private LLUUID inventoryItemID;
362 private LLUUID parentFolder; 384 private LLUUID parentFolder;
363 private BaseHttpServer httpListener; 385 private BaseHttpServer httpListener;
364 private bool m_dumpAssetsToFile; 386 private bool m_dumpAssetsToFile;
365 private string m_assetName = ""; 387 private string m_assetName = "";
@@ -368,7 +390,9 @@ namespace OpenSim.Region.Capabilities
368 private string m_invType = ""; 390 private string m_invType = "";
369 private string m_assetType = ""; 391 private string m_assetType = "";
370 392
371 public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer, bool dumpAssetsToFile) 393 public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem,
394 LLUUID parentFolderID, string invType, string assetType, string path,
395 BaseHttpServer httpServer, bool dumpAssetsToFile)
372 { 396 {
373 m_assetName = assetName; 397 m_assetName = assetName;
374 m_assetDes = description; 398 m_assetDes = description;
@@ -391,7 +415,7 @@ namespace OpenSim.Region.Capabilities
391 /// <returns></returns> 415 /// <returns></returns>
392 public string uploaderCaps(byte[] data, string path, string param) 416 public string uploaderCaps(byte[] data, string path, string param)
393 { 417 {
394 LLUUID inv = this.inventoryItemID; 418 LLUUID inv = inventoryItemID;
395 string res = ""; 419 string res = "";
396 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 420 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
397 uploadComplete.new_asset = newAssetID.ToStringHyphenated(); 421 uploadComplete.new_asset = newAssetID.ToStringHyphenated();
@@ -399,29 +423,29 @@ namespace OpenSim.Region.Capabilities
399 uploadComplete.state = "complete"; 423 uploadComplete.state = "complete";
400 424
401 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); 425 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
402 426
403 httpListener.RemoveStreamHandler("POST", uploaderPath); 427 httpListener.RemoveStreamHandler("POST", uploaderPath);
404 428
405 if (this.m_dumpAssetsToFile) 429 if (m_dumpAssetsToFile)
406 { 430 {
407 this.SaveAssetToFile(m_assetName + ".jp2", data); 431 SaveAssetToFile(m_assetName + ".jp2", data);
408 } 432 }
409 433
410 if (OnUpLoad != null) 434 if (OnUpLoad != null)
411 { 435 {
412 OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); 436 OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType);
413 } 437 }
414 438
415 return res; 439 return res;
416 } 440 }
417 441
418 private void SaveAssetToFile(string filename, byte[] data) 442 private void SaveAssetToFile(string filename, byte[] data)
419 { 443 {
420 FileStream fs = File.Create(filename); 444 FileStream fs = File.Create(filename);
421 BinaryWriter bw = new BinaryWriter(fs); 445 BinaryWriter bw = new BinaryWriter(fs);
422 bw.Write(data); 446 bw.Write(data);
423 bw.Close(); 447 bw.Close();
424 fs.Close(); 448 fs.Close();
425 } 449 }
426 } 450 }
427 451
@@ -434,7 +458,7 @@ namespace OpenSim.Region.Capabilities
434 private BaseHttpServer httpListener; 458 private BaseHttpServer httpListener;
435 private bool m_dumpAssetToFile; 459 private bool m_dumpAssetToFile;
436 460
437 public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) 461 public ItemUpdater(LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile)
438 { 462 {
439 m_dumpAssetToFile = dumpAssetToFile; 463 m_dumpAssetToFile = dumpAssetToFile;
440 464
@@ -452,7 +476,7 @@ namespace OpenSim.Region.Capabilities
452 /// <returns></returns> 476 /// <returns></returns>
453 public string uploaderCaps(byte[] data, string path, string param) 477 public string uploaderCaps(byte[] data, string path, string param)
454 { 478 {
455 LLUUID inv = this.inventoryItemID; 479 LLUUID inv = inventoryItemID;
456 string res = ""; 480 string res = "";
457 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 481 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
458 LLUUID assetID = LLUUID.Zero; 482 LLUUID assetID = LLUUID.Zero;
@@ -461,7 +485,7 @@ namespace OpenSim.Region.Capabilities
461 { 485 {
462 assetID = OnUpLoad(inv, data); 486 assetID = OnUpLoad(inv, data);
463 } 487 }
464 488
465 uploadComplete.new_asset = assetID.ToStringHyphenated(); 489 uploadComplete.new_asset = assetID.ToStringHyphenated();
466 uploadComplete.new_inventory_item = inv; 490 uploadComplete.new_inventory_item = inv;
467 uploadComplete.state = "complete"; 491 uploadComplete.state = "complete";
@@ -470,9 +494,9 @@ namespace OpenSim.Region.Capabilities
470 494
471 httpListener.RemoveStreamHandler("POST", uploaderPath); 495 httpListener.RemoveStreamHandler("POST", uploaderPath);
472 496
473 if (this.m_dumpAssetToFile) 497 if (m_dumpAssetToFile)
474 { 498 {
475 this.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); 499 SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data);
476 } 500 }
477 501
478 return res; 502 return res;
@@ -488,6 +512,4 @@ namespace OpenSim.Region.Capabilities
488 } 512 }
489 } 513 }
490 } 514 }
491} 515} \ No newline at end of file
492
493
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
index 2af5a4a..2ed7750 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
@@ -36,7 +36,6 @@ namespace OpenSim.Region.Capabilities
36 36
37 public LLSDArray() 37 public LLSDArray()
38 { 38 {
39
40 } 39 }
41 } 40 }
42} 41} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
index e65e741..d054386 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
@@ -39,7 +39,6 @@ namespace OpenSim.Region.Capabilities
39 39
40 public LLSDAssetUploadComplete() 40 public LLSDAssetUploadComplete()
41 { 41 {
42
43 } 42 }
44 } 43 }
45} 44} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs
index 3a2fe20..7fed27a 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs
@@ -26,9 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 29using libsecondlife;
33 30
34namespace OpenSim.Region.Capabilities 31namespace OpenSim.Region.Capabilities
@@ -46,4 +43,4 @@ namespace OpenSim.Region.Capabilities
46 { 43 {
47 } 44 }
48 } 45 }
49} 46} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs
index c7a9ee6..3ad618d 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.Capabilities 29namespace OpenSim.Region.Capabilities
34{ 30{
35 [LLSDMap] 31 [LLSDMap]
@@ -40,7 +36,6 @@ namespace OpenSim.Region.Capabilities
40 36
41 public LLSDAssetUploadResponse() 37 public LLSDAssetUploadResponse()
42 { 38 {
43
44 } 39 }
45 } 40 }
46} 41} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
index d1894d4..06afac4 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDCapEvent() 36 public LLSDCapEvent()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
index 3184792..35caa15 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
@@ -34,18 +34,14 @@ namespace OpenSim.Region.Capabilities
34 public string MapLayer = ""; 34 public string MapLayer = "";
35 public string NewFileAgentInventory = ""; 35 public string NewFileAgentInventory = "";
36 //public string EventQueueGet = ""; 36 //public string EventQueueGet = "";
37 // public string RequestTextureDownload = ""; 37 // public string RequestTextureDownload = "";
38 // public string ChatSessionRequest = ""; 38 // public string ChatSessionRequest = "";
39 public string UpdateNotecardAgentInventory = ""; 39 public string UpdateNotecardAgentInventory = "";
40 public string UpdateScriptAgentInventory = ""; 40 public string UpdateScriptAgentInventory = "";
41 // public string ParcelVoiceInfoRequest = ""; 41 // public string ParcelVoiceInfoRequest = "";
42 42
43 public LLSDCapsDetails() 43 public LLSDCapsDetails()
44 { 44 {
45
46 } 45 }
47 } 46 }
48} 47} \ No newline at end of file
49
50
51
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
index 0169d3c..69c525c 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
@@ -32,7 +32,6 @@ namespace OpenSim.Region.Capabilities
32 { 32 {
33 public LLSDEmpty() 33 public LLSDEmpty()
34 { 34 {
35
36 } 35 }
37 } 36 }
38} 37} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
index 8a2215f..8252a63 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Capabilities
51 public static void SerializeLLSDType(XmlTextWriter writer, object obj) 51 public static void SerializeLLSDType(XmlTextWriter writer, object obj)
52 { 52 {
53 Type myType = obj.GetType(); 53 Type myType = obj.GetType();
54 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 54 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
55 if (llsdattributes.Length > 0) 55 if (llsdattributes.Length > 0)
56 { 56 {
57 switch (llsdattributes[0].ObjectType) 57 switch (llsdattributes[0].ObjectType)
@@ -62,7 +62,8 @@ namespace OpenSim.Region.Capabilities
62 for (int i = 0; i < fields.Length; i++) 62 for (int i = 0; i < fields.Length; i++)
63 { 63 {
64 object fieldValue = fields[i].GetValue(obj); 64 object fieldValue = fields[i].GetValue(obj);
65 LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); 65 LLSDType[] fieldAttributes =
66 (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false);
66 if (fieldAttributes.Length > 0) 67 if (fieldAttributes.Length > 0)
67 { 68 {
68 writer.WriteStartElement(String.Empty, "key", String.Empty); 69 writer.WriteStartElement(String.Empty, "key", String.Empty);
@@ -83,7 +84,7 @@ namespace OpenSim.Region.Capabilities
83 case "ARRAY": 84 case "ARRAY":
84 // LLSDArray arrayObject = obj as LLSDArray; 85 // LLSDArray arrayObject = obj as LLSDArray;
85 // ArrayList a = arrayObject.Array; 86 // ArrayList a = arrayObject.Array;
86 ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); 87 ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj);
87 if (a != null) 88 if (a != null)
88 { 89 {
89 writer.WriteStartElement(String.Empty, "array", String.Empty); 90 writer.WriteStartElement(String.Empty, "array", String.Empty);
@@ -105,7 +106,7 @@ namespace OpenSim.Region.Capabilities
105 public static object DeserialiseLLSDMap(Hashtable llsd, object obj) 106 public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
106 { 107 {
107 Type myType = obj.GetType(); 108 Type myType = obj.GetType();
108 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 109 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
109 if (llsdattributes.Length > 0) 110 if (llsdattributes.Length > 0)
110 { 111 {
111 switch (llsdattributes[0].ObjectType) 112 switch (llsdattributes[0].ObjectType)
@@ -114,7 +115,7 @@ namespace OpenSim.Region.Capabilities
114 IDictionaryEnumerator enumerator = llsd.GetEnumerator(); 115 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
115 while (enumerator.MoveNext()) 116 while (enumerator.MoveNext())
116 { 117 {
117 FieldInfo field = myType.GetField((string)enumerator.Key); 118 FieldInfo field = myType.GetField((string) enumerator.Key);
118 if (field != null) 119 if (field != null)
119 { 120 {
120 if (enumerator.Value is Hashtable) 121 if (enumerator.Value is Hashtable)
@@ -142,23 +143,4 @@ namespace OpenSim.Region.Capabilities
142 return obj; 143 return obj;
143 } 144 }
144 } 145 }
145 146} \ No newline at end of file
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164}
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
index 57fc9e8..3842058 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
@@ -26,9 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 29using libsecondlife;
33 30
34namespace OpenSim.Region.Capabilities 31namespace OpenSim.Region.Capabilities
@@ -42,4 +39,4 @@ namespace OpenSim.Region.Capabilities
42 { 39 {
43 } 40 }
44 } 41 }
45} 42} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
index 6d17bff..683e479 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
@@ -40,7 +40,6 @@ namespace OpenSim.Region.Capabilities
40 40
41 public LLSDMapLayer() 41 public LLSDMapLayer()
42 { 42 {
43
44 } 43 }
45 } 44 }
46} 45} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
index 7900290..1945a6c 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDMapLayerResponse() 36 public LLSDMapLayerResponse()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs
index 5fa08c9..935f81d 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDMapRequest() 36 public LLSDMapRequest()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs
index 67253ee..6bd47e1 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs
@@ -26,11 +26,7 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.Capabilities 29namespace OpenSim.Region.Capabilities
34{ 30{
35 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); 31 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
36} 32} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
index 894b276..08e9563 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
@@ -26,13 +26,11 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework.Servers;
33using System.IO;
34using System.Collections; 29using System.Collections;
30using System.IO;
31using System.Text;
35using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Servers;
36 34
37namespace OpenSim.Region.Capabilities 35namespace OpenSim.Region.Capabilities
38{ 36{
@@ -42,11 +40,11 @@ namespace OpenSim.Region.Capabilities
42 private LLSDMethod<TRequest, TResponse> m_method; 40 private LLSDMethod<TRequest, TResponse> m_method;
43 41
44 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) 42 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
45 : base(httpMethod, path ) 43 : base(httpMethod, path)
46 { 44 {
47 m_method = method; 45 m_method = method;
48 } 46 }
49 47
50 public override byte[] Handle(string path, Stream request) 48 public override byte[] Handle(string path, Stream request)
51 { 49 {
52 //Encoding encoding = Encoding.UTF8; 50 //Encoding encoding = Encoding.UTF8;
@@ -55,16 +53,15 @@ namespace OpenSim.Region.Capabilities
55 //string requestBody = streamReader.ReadToEnd(); 53 //string requestBody = streamReader.ReadToEnd();
56 //streamReader.Close(); 54 //streamReader.Close();
57 55
58 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); 56 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
59 TRequest llsdRequest = new TRequest(); 57 TRequest llsdRequest = new TRequest();
60 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 58 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
61 59
62 TResponse response = m_method(llsdRequest); 60 TResponse response = m_method(llsdRequest);
63 61
64 Encoding encoding = new UTF8Encoding(false); 62 Encoding encoding = new UTF8Encoding(false);
65
66 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
67 63
64 return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
68 } 65 }
69 } 66 }
70} 67} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
index f70fa11..c2a6054 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDTest() 36 public LLSDTest()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
index 6af7f39..a90ae03 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
@@ -37,23 +37,19 @@ namespace OpenSim.Region.Capabilities
37 public LLSDType(string type) 37 public LLSDType(string type)
38 { 38 {
39 myType = type; 39 myType = type;
40
41 } 40 }
42 41
43 public string ObjectType 42 public string ObjectType
44 { 43 {
45 get 44 get { return myType; }
46 {
47 return myType;
48 }
49 } 45 }
50 } 46 }
51 47
52 [AttributeUsage(AttributeTargets.Class)] 48 [AttributeUsage(AttributeTargets.Class)]
53 public class LLSDMap : LLSDType 49 public class LLSDMap : LLSDType
54 { 50 {
55 public LLSDMap() : base( "MAP" ) 51 public LLSDMap() : base("MAP")
56 { 52 {
57 } 53 }
58 } 54 }
59} 55} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index d8d198b..77c7261 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -28,69 +28,77 @@
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Communications.Cache; 30using OpenSim.Framework.Communications.Cache;
31using OpenSim.Framework.Console;
31using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
35 34
36namespace OpenSim.Framework.Communications 35namespace OpenSim.Framework.Communications
37{ 36{
38 public class CommunicationsManager 37 public class CommunicationsManager
39 { 38 {
40 protected IUserService m_userService; 39 protected IUserService m_userService;
40
41 public IUserService UserService 41 public IUserService UserService
42 { 42 {
43 get { return m_userService; } 43 get { return m_userService; }
44 } 44 }
45 45
46 protected IGridServices m_gridService; 46 protected IGridServices m_gridService;
47
47 public IGridServices GridService 48 public IGridServices GridService
48 { 49 {
49 get { return m_gridService; } 50 get { return m_gridService; }
50 } 51 }
51 52
52 protected IInventoryServices m_inventoryService; 53 protected IInventoryServices m_inventoryService;
54
53 public IInventoryServices InventoryService 55 public IInventoryServices InventoryService
54 { 56 {
55 get { return m_inventoryService; } 57 get { return m_inventoryService; }
56 } 58 }
57 59
58 protected IInterRegionCommunications m_interRegion; 60 protected IInterRegionCommunications m_interRegion;
61
59 public IInterRegionCommunications InterRegion 62 public IInterRegionCommunications InterRegion
60 { 63 {
61 get { return m_interRegion; } 64 get { return m_interRegion; }
62 } 65 }
63 66
64 protected UserProfileCache m_userProfileCache; 67 protected UserProfileCache m_userProfileCache;
68
65 public UserProfileCache UserProfileCache 69 public UserProfileCache UserProfileCache
66 { 70 {
67 get { return m_userProfileCache; } 71 get { return m_userProfileCache; }
68 } 72 }
69 73
70 protected AssetTransactionManager m_transactionsManager; 74 protected AssetTransactionManager m_transactionsManager;
75
71 public AssetTransactionManager TransactionsManager 76 public AssetTransactionManager TransactionsManager
72 { 77 {
73 get { return m_transactionsManager; } 78 get { return m_transactionsManager; }
74 } 79 }
75 80
76 protected AssetCache m_assetCache; 81 protected AssetCache m_assetCache;
82
77 public AssetCache AssetCache 83 public AssetCache AssetCache
78 { 84 {
79 get { return m_assetCache; } 85 get { return m_assetCache; }
80 } 86 }
81 87
82 protected NetworkServersInfo m_networkServersInfo; 88 protected NetworkServersInfo m_networkServersInfo;
89
83 public NetworkServersInfo NetworkServersInfo 90 public NetworkServersInfo NetworkServersInfo
84 { 91 {
85 get { return m_networkServersInfo; } 92 get { return m_networkServersInfo; }
86 } 93 }
87 94
88 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool dumpAssetsToFile) 95 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
96 bool dumpAssetsToFile)
89 { 97 {
90 m_networkServersInfo = serversInfo; 98 m_networkServersInfo = serversInfo;
91 m_assetCache = assetCache; 99 m_assetCache = assetCache;
92 m_userProfileCache = new UserProfileCache(this); 100 m_userProfileCache = new UserProfileCache(this);
93 m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile ); 101 m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
94 } 102 }
95 103
96 public void doCreate(string[] cmmdParams) 104 public void doCreate(string[] cmmdParams)
@@ -106,7 +114,6 @@ namespace OpenSim.Framework.Communications
106 114
107 if (cmmdParams.Length < 2) 115 if (cmmdParams.Length < 2)
108 { 116 {
109
110 firstName = MainLog.Instance.CmdPrompt("First name", "Default"); 117 firstName = MainLog.Instance.CmdPrompt("First name", "Default");
111 lastName = MainLog.Instance.CmdPrompt("Last name", "User"); 118 lastName = MainLog.Instance.CmdPrompt("Last name", "User");
112 password = MainLog.Instance.PasswdPrompt("Password"); 119 password = MainLog.Instance.PasswdPrompt("Password");
@@ -120,7 +127,6 @@ namespace OpenSim.Framework.Communications
120 password = cmmdParams[3]; 127 password = cmmdParams[3];
121 regX = Convert.ToUInt32(cmmdParams[4]); 128 regX = Convert.ToUInt32(cmmdParams[4]);
122 regY = Convert.ToUInt32(cmmdParams[5]); 129 regY = Convert.ToUInt32(cmmdParams[5]);
123
124 } 130 }
125 131
126 AddUser(firstName, lastName, password, regX, regY); 132 AddUser(firstName, lastName, password, regX, regY);
@@ -140,7 +146,7 @@ namespace OpenSim.Framework.Communications
140 } 146 }
141 else 147 else
142 { 148 {
143 this.m_inventoryService.CreateNewUserInventory(userProf.UUID); 149 m_inventoryService.CreateNewUserInventory(userProf.UUID);
144 System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); 150 System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
145 return userProf.UUID; 151 return userProf.UUID;
146 } 152 }
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index ccbb729..ce6205f 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -27,10 +27,6 @@
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net;
31using libsecondlife;
32
33using OpenSim.Framework;
34 30
35namespace OpenSim.Framework.Communications 31namespace OpenSim.Framework.Communications
36{ 32{
@@ -41,4 +37,4 @@ namespace OpenSim.Framework.Communications
41 RegionInfo RequestNeighbourInfo(ulong regionHandle); 37 RegionInfo RequestNeighbourInfo(ulong regionHandle);
42 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); 38 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
43 } 39 }
44} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index 244747d..d4fb54b 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework;
30 29
31namespace OpenSim.Framework.Communications 30namespace OpenSim.Framework.Communications
32{ 31{
@@ -36,4 +35,4 @@ namespace OpenSim.Framework.Communications
36 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); 35 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
37 bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId); 36 bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId);
38 } 37 }
39} 38} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index e7758c4..fc301c2 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -26,16 +26,14 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 30using libsecondlife;
33using OpenSim.Framework.Communications.Cache; 31using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework;
35 32
36namespace OpenSim.Framework.Communications 33namespace OpenSim.Framework.Communications
37{ 34{
38 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo); 35 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo);
36
39 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); 37 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
40 38
41 public interface IInventoryServices 39 public interface IInventoryServices
@@ -53,4 +51,4 @@ namespace OpenSim.Framework.Communications
53 /// <returns></returns> 51 /// <returns></returns>
54 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID); 52 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID);
55 } 53 }
56} 54} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 05183be..effe132 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -30,10 +30,8 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Communications;
34using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
36using OpenSim.Framework;
37 35
38namespace OpenSim.Framework.Communications 36namespace OpenSim.Framework.Communications
39{ 37{
@@ -67,10 +65,10 @@ namespace OpenSim.Framework.Communications
67 if (typeInterface != null) 65 if (typeInterface != null)
68 { 66 {
69 IInventoryData plug = 67 IInventoryData plug =
70 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
71 plug.Initialise(); 69 plug.Initialise();
72 this.m_plugins.Add(plug.getName(), plug); 70 m_plugins.Add(plug.getName(), plug);
73 MainLog.Instance.Verbose("INVENTORY","Added IInventoryData Interface"); 71 MainLog.Instance.Verbose("INVENTORY", "Added IInventoryData Interface");
74 } 72 }
75 } 73 }
76 } 74 }
@@ -168,7 +166,7 @@ namespace OpenSim.Framework.Communications
168 { 166 {
169 foreach (InventoryFolderBase folder in inventory.Folders.Values) 167 foreach (InventoryFolderBase folder in inventory.Folders.Values)
170 { 168 {
171 this.AddFolder(folder); 169 AddFolder(folder);
172 } 170 }
173 } 171 }
174 172
@@ -176,7 +174,7 @@ namespace OpenSim.Framework.Communications
176 { 174 {
177 UsersInventory inven = new UsersInventory(); 175 UsersInventory inven = new UsersInventory();
178 inven.CreateNewInventorySet(user); 176 inven.CreateNewInventorySet(user);
179 this.AddNewInventorySet(inven); 177 AddNewInventorySet(inven);
180 } 178 }
181 179
182 public class UsersInventory 180 public class UsersInventory
@@ -186,7 +184,6 @@ namespace OpenSim.Framework.Communications
186 184
187 public UsersInventory() 185 public UsersInventory()
188 { 186 {
189
190 } 187 }
191 188
192 public virtual void CreateNewInventorySet(LLUUID user) 189 public virtual void CreateNewInventorySet(LLUUID user)
@@ -231,9 +228,11 @@ namespace OpenSim.Framework.Communications
231 } 228 }
232 } 229 }
233 230
234 public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); 231 public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
232 InventoryItemInfo itemCallBack);
233
235 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder); 234 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder);
236 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 235 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
237 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 236 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
238 } 237 }
239} 238} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index 38bc016..4d1c35a 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -34,12 +34,10 @@ using OpenSim.Framework.Console;
34 34
35namespace OpenSim.Framework.UserManagement 35namespace OpenSim.Framework.UserManagement
36{ 36{
37
38 /// <summary> 37 /// <summary>
39 /// A temp class to handle login response. 38 /// A temp class to handle login response.
40 /// Should make use of UserProfileManager where possible. 39 /// Should make use of UserProfileManager where possible.
41 /// </summary> 40 /// </summary>
42
43 public class LoginResponse 41 public class LoginResponse
44 { 42 {
45 private Hashtable loginFlagsHash; 43 private Hashtable loginFlagsHash;
@@ -103,211 +101,222 @@ namespace OpenSim.Framework.UserManagement
103 101
104 public LoginResponse() 102 public LoginResponse()
105 { 103 {
106 this.loginFlags = new ArrayList(); 104 loginFlags = new ArrayList();
107 this.globalTextures = new ArrayList(); 105 globalTextures = new ArrayList();
108 this.eventCategories = new ArrayList(); 106 eventCategories = new ArrayList();
109 this.uiConfig = new ArrayList(); 107 uiConfig = new ArrayList();
110 this.classifiedCategories = new ArrayList(); 108 classifiedCategories = new ArrayList();
111 109
112 this.loginError = new Hashtable(); 110 loginError = new Hashtable();
113 this.uiConfigHash = new Hashtable(); 111 uiConfigHash = new Hashtable();
114 112
115 this.defaultXmlRpcResponse = new XmlRpcResponse(); 113 defaultXmlRpcResponse = new XmlRpcResponse();
116 this.userProfile = new UserInfo(); 114 userProfile = new UserInfo();
117 this.inventoryRoot = new ArrayList(); 115 inventoryRoot = new ArrayList();
118 this.initialOutfit = new ArrayList(); 116 initialOutfit = new ArrayList();
119 this.agentInventory = new ArrayList(); 117 agentInventory = new ArrayList();
120 this.inventoryLibrary = new ArrayList(); 118 inventoryLibrary = new ArrayList();
121 this.inventoryLibraryOwner = new ArrayList(); 119 inventoryLibraryOwner = new ArrayList();
122 120
123 this.xmlRpcResponse = new XmlRpcResponse(); 121 xmlRpcResponse = new XmlRpcResponse();
124 this.defaultXmlRpcResponse = new XmlRpcResponse(); 122 defaultXmlRpcResponse = new XmlRpcResponse();
125 123
126 this.SetDefaultValues(); 124 SetDefaultValues();
127 } // LoginServer 125 } // LoginServer
128 126
129 public void SetDefaultValues() 127 public void SetDefaultValues()
130 { 128 {
131 this.DST = "N"; 129 DST = "N";
132 this.StipendSinceLogin = "N"; 130 StipendSinceLogin = "N";
133 this.Gendered = "Y"; 131 Gendered = "Y";
134 this.EverLoggedIn = "Y"; 132 EverLoggedIn = "Y";
135 this.login = "false"; 133 login = "false";
136 this.firstname = "Test"; 134 firstname = "Test";
137 this.lastname = "User"; 135 lastname = "User";
138 this.agentAccess = "M"; 136 agentAccess = "M";
139 this.startLocation = "last"; 137 startLocation = "last";
140 this.allowFirstLife = "Y"; 138 allowFirstLife = "Y";
141 139
142 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; 140 SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
143 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 141 CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
144 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 142 MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
145 143
146 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; 144 ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
147 this.ErrorReason = "key"; 145 ErrorReason = "key";
148 this.welcomeMessage = "Welcome to OpenSim!"; 146 welcomeMessage = "Welcome to OpenSim!";
149 this.seedCapability = ""; 147 seedCapability = "";
150 this.home = "{'region_handle':[r" + (1000 * 256).ToString() + ",r" + (1000 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}"; 148 home = "{'region_handle':[r" + (1000*256).ToString() + ",r" + (1000*256).ToString() + "], 'position':[r" +
151 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; 149 userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" +
152 this.RegionX = (uint)255232; 150 userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" +
153 this.RegionY = (uint)254976; 151 userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}";
154 152 lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
155 // Classifieds; 153 RegionX = (uint) 255232;
156 this.AddClassifiedCategory((Int32)1, "Shopping"); 154 RegionY = (uint) 254976;
157 this.AddClassifiedCategory((Int32)2, "Land Rental"); 155
158 this.AddClassifiedCategory((Int32)3, "Property Rental"); 156 // Classifieds;
159 this.AddClassifiedCategory((Int32)4, "Special Attraction"); 157 AddClassifiedCategory((Int32) 1, "Shopping");
160 this.AddClassifiedCategory((Int32)5, "New Products"); 158 AddClassifiedCategory((Int32) 2, "Land Rental");
161 this.AddClassifiedCategory((Int32)6, "Employment"); 159 AddClassifiedCategory((Int32) 3, "Property Rental");
162 this.AddClassifiedCategory((Int32)7, "Wanted"); 160 AddClassifiedCategory((Int32) 4, "Special Attraction");
163 this.AddClassifiedCategory((Int32)8, "Service"); 161 AddClassifiedCategory((Int32) 5, "New Products");
164 this.AddClassifiedCategory((Int32)9, "Personal"); 162 AddClassifiedCategory((Int32) 6, "Employment");
165 163 AddClassifiedCategory((Int32) 7, "Wanted");
166 164 AddClassifiedCategory((Int32) 8, "Service");
167 this.SessionID = LLUUID.Random(); 165 AddClassifiedCategory((Int32) 9, "Personal");
168 this.SecureSessionID = LLUUID.Random(); 166
169 this.AgentID = LLUUID.Random(); 167
170 168 SessionID = LLUUID.Random();
171 Hashtable InitialOutfitHash = new Hashtable(); 169 SecureSessionID = LLUUID.Random();
172 InitialOutfitHash["folder_name"] = "Nightclub Female"; 170 AgentID = LLUUID.Random();
173 InitialOutfitHash["gender"] = "female"; 171
174 this.initialOutfit.Add(InitialOutfitHash); 172 Hashtable InitialOutfitHash = new Hashtable();
175 173 InitialOutfitHash["folder_name"] = "Nightclub Female";
176 174 InitialOutfitHash["gender"] = "female";
175 initialOutfit.Add(InitialOutfitHash);
177 } // SetDefaultValues 176 } // SetDefaultValues
178 177
179 #region Login Failure Methods 178 #region Login Failure Methods
179
180 public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) 180 public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
181 { 181 {
182 // Overwrite any default values; 182 // Overwrite any default values;
183 this.xmlRpcResponse = new XmlRpcResponse(); 183 xmlRpcResponse = new XmlRpcResponse();
184 184
185 // Ensure Login Failed message/reason; 185 // Ensure Login Failed message/reason;
186 this.ErrorMessage = message; 186 ErrorMessage = message;
187 this.ErrorReason = reason; 187 ErrorReason = reason;
188 188
189 this.loginError["reason"] = this.ErrorReason; 189 loginError["reason"] = ErrorReason;
190 this.loginError["message"] = this.ErrorMessage; 190 loginError["message"] = ErrorMessage;
191 this.loginError["login"] = login; 191 loginError["login"] = login;
192 this.xmlRpcResponse.Value = this.loginError; 192 xmlRpcResponse.Value = loginError;
193 return (this.xmlRpcResponse); 193 return (xmlRpcResponse);
194 } // GenerateResponse 194 } // GenerateResponse
195 195
196 public XmlRpcResponse CreateFailedResponse() 196 public XmlRpcResponse CreateFailedResponse()
197 { 197 {
198 return (this.CreateLoginFailedResponse()); 198 return (CreateLoginFailedResponse());
199 } // CreateErrorConnectingToGridResponse() 199 } // CreateErrorConnectingToGridResponse()
200 200
201 public XmlRpcResponse CreateLoginFailedResponse() 201 public XmlRpcResponse CreateLoginFailedResponse()
202 { 202 {
203 return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false")); 203 return
204 (GenerateFailureResponse("key",
205 "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
206 "false"));
204 } // LoginFailedResponse 207 } // LoginFailedResponse
205 208
206 public XmlRpcResponse CreateAlreadyLoggedInResponse() 209 public XmlRpcResponse CreateAlreadyLoggedInResponse()
207 { 210 {
208 return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false")); 211 return
212 (GenerateFailureResponse("presence",
213 "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner",
214 "false"));
209 } // CreateAlreadyLoggedInResponse() 215 } // CreateAlreadyLoggedInResponse()
210 216
211 public XmlRpcResponse CreateDeadRegionResponse() 217 public XmlRpcResponse CreateDeadRegionResponse()
212 { 218 {
213 return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false")); 219 return
220 (GenerateFailureResponse("key",
221 "The region you are attempting to log into is not responding. Please select another region and try again.",
222 "false"));
214 } 223 }
215 224
216 public XmlRpcResponse CreateGridErrorResponse() 225 public XmlRpcResponse CreateGridErrorResponse()
217 { 226 {
218 return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false")); 227 return
228 (GenerateFailureResponse("key",
229 "Error connecting to grid. Could not percieve credentials from login XML.",
230 "false"));
219 } 231 }
220 232
221 #endregion 233 #endregion
222 234
223 public XmlRpcResponse ToXmlRpcResponse() 235 public XmlRpcResponse ToXmlRpcResponse()
224 { 236 {
225 try 237 try
226 { 238 {
227
228 Hashtable responseData = new Hashtable(); 239 Hashtable responseData = new Hashtable();
229 240
230 this.loginFlagsHash = new Hashtable(); 241 loginFlagsHash = new Hashtable();
231 this.loginFlagsHash["daylight_savings"] = this.DST; 242 loginFlagsHash["daylight_savings"] = DST;
232 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; 243 loginFlagsHash["stipend_since_login"] = StipendSinceLogin;
233 this.loginFlagsHash["gendered"] = this.Gendered; 244 loginFlagsHash["gendered"] = Gendered;
234 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; 245 loginFlagsHash["ever_logged_in"] = EverLoggedIn;
235 this.loginFlags.Add(this.loginFlagsHash); 246 loginFlags.Add(loginFlagsHash);
236 247
237 responseData["first_name"] = this.Firstname; 248 responseData["first_name"] = Firstname;
238 responseData["last_name"] = this.Lastname; 249 responseData["last_name"] = Lastname;
239 responseData["agent_access"] = this.agentAccess; 250 responseData["agent_access"] = agentAccess;
240 251
241 this.globalTexturesHash = new Hashtable(); 252 globalTexturesHash = new Hashtable();
242 this.globalTexturesHash["sun_texture_id"] = this.SunTexture; 253 globalTexturesHash["sun_texture_id"] = SunTexture;
243 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; 254 globalTexturesHash["cloud_texture_id"] = CloudTexture;
244 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; 255 globalTexturesHash["moon_texture_id"] = MoonTexture;
245 this.globalTextures.Add(this.globalTexturesHash); 256 globalTextures.Add(globalTexturesHash);
246 // this.eventCategories.Add(this.eventCategoriesHash); 257 // this.eventCategories.Add(this.eventCategoriesHash);
247 258
248 this.AddToUIConfig("allow_first_life", this.allowFirstLife); 259 AddToUIConfig("allow_first_life", allowFirstLife);
249 this.uiConfig.Add(this.uiConfigHash); 260 uiConfig.Add(uiConfigHash);
250 261
251 responseData["sim_port"] =(Int32) this.SimPort; 262 responseData["sim_port"] = (Int32) SimPort;
252 responseData["sim_ip"] = this.SimAddress; 263 responseData["sim_ip"] = SimAddress;
253 264
254 responseData["agent_id"] = this.AgentID.ToStringHyphenated(); 265 responseData["agent_id"] = AgentID.ToStringHyphenated();
255 responseData["session_id"] = this.SessionID.ToStringHyphenated(); 266 responseData["session_id"] = SessionID.ToStringHyphenated();
256 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); 267 responseData["secure_session_id"] = SecureSessionID.ToStringHyphenated();
257 responseData["circuit_code"] = this.CircuitCode; 268 responseData["circuit_code"] = CircuitCode;
258 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 269 responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
259 responseData["login-flags"] = this.loginFlags; 270 responseData["login-flags"] = loginFlags;
260 responseData["global-textures"] = this.globalTextures; 271 responseData["global-textures"] = globalTextures;
261 responseData["seed_capability"] = this.seedCapability; 272 responseData["seed_capability"] = seedCapability;
262 273
263 responseData["event_categories"] = this.eventCategories; 274 responseData["event_categories"] = eventCategories;
264 responseData["event_notifications"] = new ArrayList(); // todo 275 responseData["event_notifications"] = new ArrayList(); // todo
265 responseData["classified_categories"] = this.classifiedCategories; 276 responseData["classified_categories"] = classifiedCategories;
266 responseData["ui-config"] = this.uiConfig; 277 responseData["ui-config"] = uiConfig;
267 278
268 responseData["inventory-skeleton"] = this.agentInventory; 279 responseData["inventory-skeleton"] = agentInventory;
269 responseData["inventory-skel-lib"] = this.inventoryLibrary; 280 responseData["inventory-skel-lib"] = inventoryLibrary;
270 responseData["inventory-root"] = this.inventoryRoot; 281 responseData["inventory-root"] = inventoryRoot;
271 responseData["gestures"] = new ArrayList(); // todo 282 responseData["gestures"] = new ArrayList(); // todo
272 responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; 283 responseData["inventory-lib-owner"] = inventoryLibraryOwner;
273 responseData["initial-outfit"] = this.initialOutfit; 284 responseData["initial-outfit"] = initialOutfit;
274 responseData["start_location"] = this.startLocation; 285 responseData["start_location"] = startLocation;
275 responseData["seed_capability"] = this.seedCapability; 286 responseData["seed_capability"] = seedCapability;
276 responseData["home"] = this.home; 287 responseData["home"] = home;
277 responseData["look_at"] = this.lookAt; 288 responseData["look_at"] = lookAt;
278 responseData["message"] = this.welcomeMessage; 289 responseData["message"] = welcomeMessage;
279 responseData["region_x"] = (Int32)this.RegionX * 256; 290 responseData["region_x"] = (Int32) RegionX*256;
280 responseData["region_y"] = (Int32)this.RegionY * 256; 291 responseData["region_y"] = (Int32) RegionY*256;
281 292
282 //responseData["inventory-lib-root"] = new ArrayList(); // todo 293 //responseData["inventory-lib-root"] = new ArrayList(); // todo
283 //responseData["buddy-list"] = new ArrayList(); // todo 294 //responseData["buddy-list"] = new ArrayList(); // todo
284 295
285 responseData["login"] = "true"; 296 responseData["login"] = "true";
286 this.xmlRpcResponse.Value = responseData; 297 xmlRpcResponse.Value = responseData;
287 298
288 return (this.xmlRpcResponse); 299 return (xmlRpcResponse);
289 } 300 }
290 catch (Exception e) 301 catch (Exception e)
291 { 302 {
292 MainLog.Instance.Warn( 303 MainLog.Instance.Warn(
293 "CLIENT", 304 "CLIENT",
294 "LoginResponse: Error creating XML-RPC Response: " + e.Message 305 "LoginResponse: Error creating XML-RPC Response: " + e.Message
295 ); 306 );
296 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); 307 return (GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
297
298 } 308 }
299
300 } // ToXmlRpcResponse 309 } // ToXmlRpcResponse
301 310
302 public void SetEventCategories(string category, string value) 311 public void SetEventCategories(string category, string value)
303 { 312 {
304 // this.eventCategoriesHash[category] = value; 313 // this.eventCategoriesHash[category] = value;
305 //TODO 314 //TODO
306 } // SetEventCategories 315 } // SetEventCategories
307 316
308 public void AddToUIConfig(string itemName, string item) 317 public void AddToUIConfig(string itemName, string item)
309 { 318 {
310 this.uiConfigHash[itemName] = item; 319 uiConfigHash[itemName] = item;
311 } // SetUIConfig 320 } // SetUIConfig
312 321
313 public void AddClassifiedCategory(Int32 ID, string categoryName) 322 public void AddClassifiedCategory(Int32 ID, string categoryName)
@@ -315,372 +324,193 @@ namespace OpenSim.Framework.UserManagement
315 Hashtable hash = new Hashtable(); 324 Hashtable hash = new Hashtable();
316 hash["category_name"] = categoryName; 325 hash["category_name"] = categoryName;
317 hash["category_id"] = ID; 326 hash["category_id"] = ID;
318 this.classifiedCategories.Add(hash); 327 classifiedCategories.Add(hash);
319 // this.classifiedCategoriesHash.Clear(); 328 // this.classifiedCategoriesHash.Clear();
320 } // SetClassifiedCategory 329 } // SetClassifiedCategory
321 330
322 #region Properties 331 #region Properties
332
323 public string Login 333 public string Login
324 { 334 {
325 get 335 get { return login; }
326 { 336 set { login = value; }
327 return this.login;
328 }
329 set
330 {
331 this.login = value;
332 }
333 } // Login 337 } // Login
334 338
335 public string DST 339 public string DST
336 { 340 {
337 get 341 get { return dst; }
338 { 342 set { dst = value; }
339 return this.dst;
340 }
341 set
342 {
343 this.dst = value;
344 }
345 } // DST 343 } // DST
346 344
347 public string StipendSinceLogin 345 public string StipendSinceLogin
348 { 346 {
349 get 347 get { return stipendSinceLogin; }
350 { 348 set { stipendSinceLogin = value; }
351 return this.stipendSinceLogin;
352 }
353 set
354 {
355 this.stipendSinceLogin = value;
356 }
357 } // StipendSinceLogin 349 } // StipendSinceLogin
358 350
359 public string Gendered 351 public string Gendered
360 { 352 {
361 get 353 get { return gendered; }
362 { 354 set { gendered = value; }
363 return this.gendered;
364 }
365 set
366 {
367 this.gendered = value;
368 }
369 } // Gendered 355 } // Gendered
370 356
371 public string EverLoggedIn 357 public string EverLoggedIn
372 { 358 {
373 get 359 get { return everLoggedIn; }
374 { 360 set { everLoggedIn = value; }
375 return this.everLoggedIn;
376 }
377 set
378 {
379 this.everLoggedIn = value;
380 }
381 } // EverLoggedIn 361 } // EverLoggedIn
382 362
383 public int SimPort 363 public int SimPort
384 { 364 {
385 get 365 get { return simPort; }
386 { 366 set { simPort = value; }
387 return this.simPort;
388 }
389 set
390 {
391 this.simPort = value;
392 }
393 } // SimPort 367 } // SimPort
394 368
395 public string SimAddress 369 public string SimAddress
396 { 370 {
397 get 371 get { return simAddress; }
398 { 372 set { simAddress = value; }
399 return this.simAddress;
400 }
401 set
402 {
403 this.simAddress = value;
404 }
405 } // SimAddress 373 } // SimAddress
406 374
407 public LLUUID AgentID 375 public LLUUID AgentID
408 { 376 {
409 get 377 get { return agentID; }
410 { 378 set { agentID = value; }
411 return this.agentID;
412 }
413 set
414 {
415 this.agentID = value;
416 }
417 } // AgentID 379 } // AgentID
418 380
419 public LLUUID SessionID 381 public LLUUID SessionID
420 { 382 {
421 get 383 get { return sessionID; }
422 { 384 set { sessionID = value; }
423 return this.sessionID;
424 }
425 set
426 {
427 this.sessionID = value;
428 }
429 } // SessionID 385 } // SessionID
430 386
431 public LLUUID SecureSessionID 387 public LLUUID SecureSessionID
432 { 388 {
433 get 389 get { return secureSessionID; }
434 { 390 set { secureSessionID = value; }
435 return this.secureSessionID;
436 }
437 set
438 {
439 this.secureSessionID = value;
440 }
441 } // SecureSessionID 391 } // SecureSessionID
442 392
443 public Int32 CircuitCode 393 public Int32 CircuitCode
444 { 394 {
445 get 395 get { return circuitCode; }
446 { 396 set { circuitCode = value; }
447 return this.circuitCode;
448 }
449 set
450 {
451 this.circuitCode = value;
452 }
453 } // CircuitCode 397 } // CircuitCode
454 398
455 public uint RegionX 399 public uint RegionX
456 { 400 {
457 get 401 get { return regionX; }
458 { 402 set { regionX = value; }
459 return this.regionX;
460 }
461 set
462 {
463 this.regionX = value;
464 }
465 } // RegionX 403 } // RegionX
466 404
467 public uint RegionY 405 public uint RegionY
468 { 406 {
469 get 407 get { return regionY; }
470 { 408 set { regionY = value; }
471 return this.regionY;
472 }
473 set
474 {
475 this.regionY = value;
476 }
477 } // RegionY 409 } // RegionY
478 410
479 public string SunTexture 411 public string SunTexture
480 { 412 {
481 get 413 get { return sunTexture; }
482 { 414 set { sunTexture = value; }
483 return this.sunTexture;
484 }
485 set
486 {
487 this.sunTexture = value;
488 }
489 } // SunTexture 415 } // SunTexture
490 416
491 public string CloudTexture 417 public string CloudTexture
492 { 418 {
493 get 419 get { return cloudTexture; }
494 { 420 set { cloudTexture = value; }
495 return this.cloudTexture;
496 }
497 set
498 {
499 this.cloudTexture = value;
500 }
501 } // CloudTexture 421 } // CloudTexture
502 422
503 public string MoonTexture 423 public string MoonTexture
504 { 424 {
505 get 425 get { return moonTexture; }
506 { 426 set { moonTexture = value; }
507 return this.moonTexture;
508 }
509 set
510 {
511 this.moonTexture = value;
512 }
513 } // MoonTexture 427 } // MoonTexture
514 428
515 public string Firstname 429 public string Firstname
516 { 430 {
517 get 431 get { return firstname; }
518 { 432 set { firstname = value; }
519 return this.firstname;
520 }
521 set
522 {
523 this.firstname = value;
524 }
525 } // Firstname 433 } // Firstname
526 434
527 public string Lastname 435 public string Lastname
528 { 436 {
529 get 437 get { return lastname; }
530 { 438 set { lastname = value; }
531 return this.lastname;
532 }
533 set
534 {
535 this.lastname = value;
536 }
537 } // Lastname 439 } // Lastname
538 440
539 public string AgentAccess 441 public string AgentAccess
540 { 442 {
541 get 443 get { return agentAccess; }
542 { 444 set { agentAccess = value; }
543 return this.agentAccess;
544 }
545 set
546 {
547 this.agentAccess = value;
548 }
549 } 445 }
550 446
551 public string StartLocation 447 public string StartLocation
552 { 448 {
553 get 449 get { return startLocation; }
554 { 450 set { startLocation = value; }
555 return this.startLocation;
556 }
557 set
558 {
559 this.startLocation = value;
560 }
561 } // StartLocation 451 } // StartLocation
562 452
563 public string LookAt 453 public string LookAt
564 { 454 {
565 get 455 get { return lookAt; }
566 { 456 set { lookAt = value; }
567 return this.lookAt;
568 }
569 set
570 {
571 this.lookAt = value;
572 }
573 } 457 }
574 458
575 public string SeedCapability 459 public string SeedCapability
576 { 460 {
577 get 461 get { return seedCapability; }
578 { 462 set { seedCapability = value; }
579 return this.seedCapability;
580 }
581 set
582 {
583 this.seedCapability = value;
584 }
585 } // SeedCapability 463 } // SeedCapability
586 464
587 public string ErrorReason 465 public string ErrorReason
588 { 466 {
589 get 467 get { return errorReason; }
590 { 468 set { errorReason = value; }
591 return this.errorReason;
592 }
593 set
594 {
595 this.errorReason = value;
596 }
597 } // ErrorReason 469 } // ErrorReason
598 470
599 public string ErrorMessage 471 public string ErrorMessage
600 { 472 {
601 get 473 get { return errorMessage; }
602 { 474 set { errorMessage = value; }
603 return this.errorMessage;
604 }
605 set
606 {
607 this.errorMessage = value;
608 }
609 } // ErrorMessage 475 } // ErrorMessage
610 476
611 public ArrayList InventoryRoot 477 public ArrayList InventoryRoot
612 { 478 {
613 get 479 get { return inventoryRoot; }
614 { 480 set { inventoryRoot = value; }
615 return this.inventoryRoot;
616 }
617 set
618 {
619 this.inventoryRoot = value;
620 }
621 } 481 }
622 482
623 public ArrayList InventorySkeleton 483 public ArrayList InventorySkeleton
624 { 484 {
625 get 485 get { return agentInventory; }
626 { 486 set { agentInventory = value; }
627 return this.agentInventory;
628 }
629 set
630 {
631 this.agentInventory = value;
632 }
633 } 487 }
634 488
635 public ArrayList InventoryLibrary 489 public ArrayList InventoryLibrary
636 { 490 {
637 get 491 get { return inventoryLibrary; }
638 { 492 set { inventoryLibrary = value; }
639 return this.inventoryLibrary;
640 }
641 set
642 {
643 this.inventoryLibrary = value;
644 }
645 } 493 }
646 494
647 public ArrayList InventoryLibraryOwner 495 public ArrayList InventoryLibraryOwner
648 { 496 {
649 get 497 get { return inventoryLibraryOwner; }
650 { 498 set { inventoryLibraryOwner = value; }
651 return this.inventoryLibraryOwner;
652 }
653 set
654 {
655 this.inventoryLibraryOwner = value;
656 }
657 } 499 }
658 500
659 public string Home 501 public string Home
660 { 502 {
661 get 503 get { return home; }
662 { 504 set { home = value; }
663 return this.home;
664 }
665 set
666 {
667 this.home = value;
668 }
669 } 505 }
670 506
671 public string Message 507 public string Message
672 { 508 {
673 get 509 get { return welcomeMessage; }
674 { 510 set { welcomeMessage = value; }
675 return this.welcomeMessage;
676 }
677 set
678 {
679 this.welcomeMessage = value;
680 }
681 } 511 }
682 #endregion
683 512
513 #endregion
684 514
685 public class UserInfo 515 public class UserInfo
686 { 516 {
@@ -691,6 +521,4 @@ namespace OpenSim.Framework.UserManagement
691 public LLVector3 homelookat; 521 public LLVector3 homelookat;
692 } 522 }
693 } 523 }
694} 524} \ No newline at end of file
695
696
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 66b91e1..497cc5d 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -28,16 +28,10 @@
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic;
32using System.Reflection;
33using System.Security.Cryptography;
34using libsecondlife; 31using libsecondlife;
35using Nwc.XmlRpc; 32using Nwc.XmlRpc;
36using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
37 34
38using OpenSim.Framework;
39using InventoryFolder = OpenSim.Framework.InventoryFolder;
40
41namespace OpenSim.Framework.UserManagement 35namespace OpenSim.Framework.UserManagement
42{ 36{
43 public class LoginService 37 public class LoginService
@@ -61,12 +55,12 @@ namespace OpenSim.Framework.UserManagement
61 /// <returns>The response to send</returns> 55 /// <returns>The response to send</returns>
62 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 56 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
63 { 57 {
64 58 MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
65 MainLog.Instance.Verbose("LOGIN","Attempting login now...");
66 XmlRpcResponse response = new XmlRpcResponse(); 59 XmlRpcResponse response = new XmlRpcResponse();
67 Hashtable requestData = (Hashtable)request.Params[0]; 60 Hashtable requestData = (Hashtable) request.Params[0];
68 61
69 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); 62 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") &&
63 requestData.Contains("passwd"));
70 bool GoodLogin = false; 64 bool GoodLogin = false;
71 65
72 UserProfileData userProfile; 66 UserProfileData userProfile;
@@ -74,9 +68,9 @@ namespace OpenSim.Framework.UserManagement
74 68
75 if (GoodXML) 69 if (GoodXML)
76 { 70 {
77 string firstname = (string)requestData["first"]; 71 string firstname = (string) requestData["first"];
78 string lastname = (string)requestData["last"]; 72 string lastname = (string) requestData["last"];
79 string passwd = (string)requestData["passwd"]; 73 string passwd = (string) requestData["passwd"];
80 74
81 userProfile = GetTheUser(firstname, lastname); 75 userProfile = GetTheUser(firstname, lastname);
82 if (userProfile == null) 76 if (userProfile == null)
@@ -110,7 +104,7 @@ namespace OpenSim.Framework.UserManagement
110 LLUUID agentID = userProfile.UUID; 104 LLUUID agentID = userProfile.UUID;
111 105
112 // Inventory Library Section 106 // Inventory Library Section
113 InventoryData inventData = this.CreateInventoryData(agentID); 107 InventoryData inventData = CreateInventoryData(agentID);
114 ArrayList AgentInventoryArray = inventData.InventoryArray; 108 ArrayList AgentInventoryArray = inventData.InventoryArray;
115 109
116 Hashtable InventoryRootHash = new Hashtable(); 110 Hashtable InventoryRootHash = new Hashtable();
@@ -120,7 +114,7 @@ namespace OpenSim.Framework.UserManagement
120 userProfile.rootInventoryFolderID = inventData.RootFolderID; 114 userProfile.rootInventoryFolderID = inventData.RootFolderID;
121 115
122 // Circuit Code 116 // Circuit Code
123 uint circode = (uint)(Util.RandomClass.Next()); 117 uint circode = (uint) (Util.RandomClass.Next());
124 118
125 logResponse.Lastname = userProfile.surname; 119 logResponse.Lastname = userProfile.surname;
126 logResponse.Firstname = userProfile.username; 120 logResponse.Firstname = userProfile.username;
@@ -129,20 +123,20 @@ namespace OpenSim.Framework.UserManagement
129 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); 123 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
130 logResponse.InventoryRoot = InventoryRoot; 124 logResponse.InventoryRoot = InventoryRoot;
131 logResponse.InventorySkeleton = AgentInventoryArray; 125 logResponse.InventorySkeleton = AgentInventoryArray;
132 logResponse.InventoryLibrary = this.GetInventoryLibrary(); 126 logResponse.InventoryLibrary = GetInventoryLibrary();
133 logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); 127 logResponse.InventoryLibraryOwner = GetLibraryOwner();
134 logResponse.CircuitCode = (Int32)circode; 128 logResponse.CircuitCode = (Int32) circode;
135 //logResponse.RegionX = 0; //overwritten 129 //logResponse.RegionX = 0; //overwritten
136 //logResponse.RegionY = 0; //overwritten 130 //logResponse.RegionY = 0; //overwritten
137 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten 131 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
138 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; 132 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
139 //logResponse.SimAddress = "127.0.0.1"; //overwritten 133 //logResponse.SimAddress = "127.0.0.1"; //overwritten
140 //logResponse.SimPort = 0; //overwritten 134 //logResponse.SimPort = 0; //overwritten
141 logResponse.Message = this.GetMessage(); 135 logResponse.Message = GetMessage();
142 136
143 try 137 try
144 { 138 {
145 this.CustomiseResponse(logResponse, userProfile); 139 CustomiseResponse(logResponse, userProfile);
146 } 140 }
147 catch (Exception e) 141 catch (Exception e)
148 { 142 {
@@ -152,7 +146,6 @@ namespace OpenSim.Framework.UserManagement
152 } 146 }
153 CommitAgent(ref userProfile); 147 CommitAgent(ref userProfile);
154 return logResponse.ToXmlRpcResponse(); 148 return logResponse.ToXmlRpcResponse();
155
156 } 149 }
157 150
158 catch (Exception E) 151 catch (Exception E)
@@ -162,7 +155,6 @@ namespace OpenSim.Framework.UserManagement
162 //} 155 //}
163 } 156 }
164 return response; 157 return response;
165
166 } 158 }
167 159
168 /// <summary> 160 /// <summary>
@@ -174,7 +166,7 @@ namespace OpenSim.Framework.UserManagement
174 { 166 {
175 } 167 }
176 168
177 /// <summary> 169 /// <summary>
178 /// Saves a target agent to the database 170 /// Saves a target agent to the database
179 /// </summary> 171 /// </summary>
180 /// <param name="profile">The users profile</param> 172 /// <param name="profile">The users profile</param>
@@ -194,8 +186,7 @@ namespace OpenSim.Framework.UserManagement
194 /// <returns>Authenticated?</returns> 186 /// <returns>Authenticated?</returns>
195 public virtual bool AuthenticateUser(UserProfileData profile, string password) 187 public virtual bool AuthenticateUser(UserProfileData profile, string password)
196 { 188 {
197 189 MainLog.Instance.Verbose("LOGIN", "Authenticating " + profile.username + " " + profile.surname);
198 MainLog.Instance.Verbose("LOGIN","Authenticating " + profile.username + " " + profile.surname);
199 190
200 password = password.Remove(0, 3); //remove $1$ 191 password = password.Remove(0, 3); //remove $1$
201 192
@@ -211,7 +202,7 @@ namespace OpenSim.Framework.UserManagement
211 /// <param name="request"></param> 202 /// <param name="request"></param>
212 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 203 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
213 { 204 {
214 this.m_userManager.CreateAgent(profile, request); 205 m_userManager.CreateAgent(profile, request);
215 } 206 }
216 207
217 /// <summary> 208 /// <summary>
@@ -222,7 +213,7 @@ namespace OpenSim.Framework.UserManagement
222 /// <returns></returns> 213 /// <returns></returns>
223 public virtual UserProfileData GetTheUser(string firstname, string lastname) 214 public virtual UserProfileData GetTheUser(string firstname, string lastname)
224 { 215 {
225 return this.m_userManager.GetUserProfile(firstname, lastname); 216 return m_userManager.GetUserProfile(firstname, lastname);
226 } 217 }
227 218
228 /// <summary> 219 /// <summary>
@@ -286,8 +277,8 @@ namespace OpenSim.Framework.UserManagement
286 TempHash = new Hashtable(); 277 TempHash = new Hashtable();
287 TempHash["name"] = InvFolder.FolderName; 278 TempHash["name"] = InvFolder.FolderName;
288 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 279 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
289 TempHash["version"] = (Int32)InvFolder.Version; 280 TempHash["version"] = (Int32) InvFolder.Version;
290 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 281 TempHash["type_default"] = (Int32) InvFolder.DefaultType;
291 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 282 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
292 AgentInventoryArray.Add(TempHash); 283 AgentInventoryArray.Add(TempHash);
293 } 284 }
@@ -307,4 +298,4 @@ namespace OpenSim.Framework.UserManagement
307 } 298 }
308 } 299 }
309 } 300 }
310} 301} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
index 43fce84..a812ac9 100644
--- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
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*
@@ -27,25 +27,29 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// General Information about an assembly is controlled through the following 31// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 33// associated with an assembly.
33[assembly: AssemblyTitle("OpenGrid.Framework.Communications")] 34
34[assembly: AssemblyDescription("")] 35[assembly : AssemblyTitle("OpenGrid.Framework.Communications")]
35[assembly: AssemblyConfiguration("")] 36[assembly : AssemblyDescription("")]
36[assembly: AssemblyCompany("")] 37[assembly : AssemblyConfiguration("")]
37[assembly: AssemblyProduct("OpenGrid.Framework.Communications")] 38[assembly : AssemblyCompany("")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 39[assembly : AssemblyProduct("OpenGrid.Framework.Communications")]
39[assembly: AssemblyTrademark("")] 40[assembly : AssemblyCopyright("Copyright © 2007")]
40[assembly: AssemblyCulture("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
41 43
42// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 47
48[assembly : ComVisible(false)]
46 49
47// The following GUID is for the ID of the typelib if this project is exposed to COM 50// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")] 51
52[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
49 53
50// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
51// 55//
@@ -56,5 +60,6 @@ using System.Runtime.InteropServices;
56// 60//
57// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
58// by using the '*' as shown below: 62// by using the '*' as shown below:
59[assembly: AssemblyVersion("1.0.0.0")] 63
60[assembly: AssemblyFileVersion("1.0.0.0")] 64[assembly : AssemblyVersion("1.0.0.0")]
65[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs b/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs
index c821fa4..72d8f65 100644
--- a/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs
+++ b/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs
@@ -1,13 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading; 2using System.Threading;
5 3
6namespace OpenSim.Framework.Communications 4namespace OpenSim.Framework.Communications
7{ 5{
8 internal class SimpleAsyncResult : IAsyncResult 6 internal class SimpleAsyncResult : IAsyncResult
9 { 7 {
10
11 private readonly AsyncCallback m_callback; 8 private readonly AsyncCallback m_callback;
12 9
13 /// <summary> 10 /// <summary>
@@ -36,7 +33,6 @@ namespace OpenSim.Framework.Communications
36 m_completedSynchronously = 1; 33 m_completedSynchronously = 1;
37 } 34 }
38 35
39
40 #region IAsyncResult Members 36 #region IAsyncResult Members
41 37
42 public object AsyncState 38 public object AsyncState
@@ -45,7 +41,6 @@ namespace OpenSim.Framework.Communications
45 } 41 }
46 42
47 43
48
49 public WaitHandle AsyncWaitHandle 44 public WaitHandle AsyncWaitHandle
50 { 45 {
51 get 46 get
@@ -82,19 +77,18 @@ namespace OpenSim.Framework.Communications
82 get { return Thread.VolatileRead(ref m_completed) == 1; } 77 get { return Thread.VolatileRead(ref m_completed) == 1; }
83 } 78 }
84 79
85
86 #endregion 80 #endregion
87 81
88
89 #region class Methods 82 #region class Methods
83
90 internal void SetAsCompleted(bool completedSynchronously) 84 internal void SetAsCompleted(bool completedSynchronously)
91 { 85 {
92 m_completed = 1; 86 m_completed = 1;
93 if(completedSynchronously) 87 if (completedSynchronously)
94 m_completedSynchronously = 1; 88 m_completedSynchronously = 1;
95 else 89 else
96 m_completedSynchronously = 0; 90 m_completedSynchronously = 0;
97 91
98 SignalCompletion(); 92 SignalCompletion();
99 } 93 }
100 94
@@ -112,9 +106,9 @@ namespace OpenSim.Framework.Communications
112 106
113 private void SignalCompletion() 107 private void SignalCompletion()
114 { 108 {
115 if(m_waitHandle != null) m_waitHandle.Set(); 109 if (m_waitHandle != null) m_waitHandle.Set();
116 110
117 if(m_callback != null) m_callback(this); 111 if (m_callback != null) m_callback(this);
118 } 112 }
119 113
120 public void EndInvoke() 114 public void EndInvoke()
@@ -125,14 +119,14 @@ namespace OpenSim.Framework.Communications
125 // If the operation isn't done, wait for it 119 // If the operation isn't done, wait for it
126 AsyncWaitHandle.WaitOne(); 120 AsyncWaitHandle.WaitOne();
127 AsyncWaitHandle.Close(); 121 AsyncWaitHandle.Close();
128 m_waitHandle = null; // Allow early GC 122 m_waitHandle = null; // Allow early GC
129 } 123 }
130 124
131 // Operation is done: if an exception occured, throw it 125 // Operation is done: if an exception occured, throw it
132 if (m_exception != null) throw m_exception; 126 if (m_exception != null) throw m_exception;
133 } 127 }
134 128
135 #endregion 129 #endregion
136 } 130 }
137 131
138 internal class AsyncResult<T> : SimpleAsyncResult 132 internal class AsyncResult<T> : SimpleAsyncResult
@@ -140,10 +134,12 @@ namespace OpenSim.Framework.Communications
140 private T m_result = default(T); 134 private T m_result = default(T);
141 135
142 public AsyncResult(AsyncCallback asyncCallback, Object state) : 136 public AsyncResult(AsyncCallback asyncCallback, Object state) :
143 base(asyncCallback, state) { } 137 base(asyncCallback, state)
138 {
139 }
144 140
145 141
146 public void SetAsCompleted(T result, bool completedSynchronously) 142 public void SetAsCompleted(T result, bool completedSynchronously)
147 { 143 {
148 // Save the asynchronous operation's result 144 // Save the asynchronous operation's result
149 m_result = result; 145 m_result = result;
@@ -153,11 +149,10 @@ namespace OpenSim.Framework.Communications
153 base.SetAsCompleted(completedSynchronously); 149 base.SetAsCompleted(completedSynchronously);
154 } 150 }
155 151
156 new public T EndInvoke() 152 public new T EndInvoke()
157 { 153 {
158 base.EndInvoke(); 154 base.EndInvoke();
159 return m_result; 155 return m_result;
160 } 156 }
161
162 } 157 }
163} 158} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs
index 392669f..ac3a287 100644
--- a/OpenSim/Framework/Communications/RestClient/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs
@@ -1,12 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic;
2using System.IO; 3using System.IO;
3using System.Net; 4using System.Net;
4using System.Web;
5using System.Text; 5using System.Text;
6using System.Collections.Generic;
7using System.Threading; 6using System.Threading;
8 7using System.Web;
9using OpenSim.Framework.Console;
10 8
11namespace OpenSim.Framework.Communications 9namespace OpenSim.Framework.Communications
12{ 10{
@@ -29,9 +27,10 @@ namespace OpenSim.Framework.Communications
29 /// </remarks> 27 /// </remarks>
30 public class RestClient 28 public class RestClient
31 { 29 {
30 private string realuri;
32 31
33 string realuri;
34 #region member variables 32 #region member variables
33
35 /// <summary> 34 /// <summary>
36 /// The base Uri of the web-service e.g. http://www.google.com 35 /// The base Uri of the web-service e.g. http://www.google.com
37 /// </summary> 36 /// </summary>
@@ -60,7 +59,7 @@ namespace OpenSim.Framework.Communications
60 /// <summary> 59 /// <summary>
61 /// MemoryStream representing the resultiong resource 60 /// MemoryStream representing the resultiong resource
62 /// </summary> 61 /// </summary>
63 Stream _resource; 62 private Stream _resource;
64 63
65 /// <summary> 64 /// <summary>
66 /// WebRequest object, held as a member variable 65 /// WebRequest object, held as a member variable
@@ -80,12 +79,12 @@ namespace OpenSim.Framework.Communications
80 /// <summary> 79 /// <summary>
81 /// Default time out period 80 /// Default time out period
82 /// </summary> 81 /// </summary>
83 const int DefaultTimeout = 10 * 1000; // 10 seconds timeout 82 private const int DefaultTimeout = 10*1000; // 10 seconds timeout
84 83
85 /// <summary> 84 /// <summary>
86 /// Default Buffer size of a block requested from the web-server 85 /// Default Buffer size of a block requested from the web-server
87 /// </summary> 86 /// </summary>
88 const int BufferSize = 4096; // Read blocks of 4 KB. 87 private const int BufferSize = 4096; // Read blocks of 4 KB.
89 88
90 89
91 /// <summary> 90 /// <summary>
@@ -97,6 +96,7 @@ namespace OpenSim.Framework.Communications
97 #endregion member variables 96 #endregion member variables
98 97
99 #region constructors 98 #region constructors
99
100 /// <summary> 100 /// <summary>
101 /// Instantiate a new RestClient 101 /// Instantiate a new RestClient
102 /// </summary> 102 /// </summary>
@@ -111,7 +111,8 @@ namespace OpenSim.Framework.Communications
111 _lock = new object(); 111 _lock = new object();
112 } 112 }
113 113
114 object _lock; 114 private object _lock;
115
115 #endregion constructors 116 #endregion constructors
116 117
117 /// <summary> 118 /// <summary>
@@ -120,8 +121,8 @@ namespace OpenSim.Framework.Communications
120 /// <param name="element">path entry</param> 121 /// <param name="element">path entry</param>
121 public void AddResourcePath(string element) 122 public void AddResourcePath(string element)
122 { 123 {
123 if(isSlashed(element)) 124 if (isSlashed(element))
124 _pathElements.Add(element.Substring(0, element.Length-1)); 125 _pathElements.Add(element.Substring(0, element.Length - 1));
125 else 126 else
126 _pathElements.Add(element); 127 _pathElements.Add(element);
127 } 128 }
@@ -178,7 +179,7 @@ namespace OpenSim.Framework.Communications
178 /// Build a Uri based on the intial Url, path elements and parameters 179 /// Build a Uri based on the intial Url, path elements and parameters
179 /// </summary> 180 /// </summary>
180 /// <returns>fully constructed Uri</returns> 181 /// <returns>fully constructed Uri</returns>
181 Uri buildUri() 182 private Uri buildUri()
182 { 183 {
183 StringBuilder sb = new StringBuilder(); 184 StringBuilder sb = new StringBuilder();
184 sb.Append(_url); 185 sb.Append(_url);
@@ -196,7 +197,8 @@ namespace OpenSim.Framework.Communications
196 { 197 {
197 sb.Append("?"); 198 sb.Append("?");
198 firstElement = false; 199 firstElement = false;
199 } else 200 }
201 else
200 sb.Append("&"); 202 sb.Append("&");
201 203
202 sb.Append(kv.Key); 204 sb.Append(kv.Key);
@@ -209,7 +211,9 @@ namespace OpenSim.Framework.Communications
209 realuri = sb.ToString(); 211 realuri = sb.ToString();
210 return new Uri(sb.ToString()); 212 return new Uri(sb.ToString());
211 } 213 }
214
212 #region Async communications with server 215 #region Async communications with server
216
213 /// <summary> 217 /// <summary>
214 /// Async method, invoked when a block of data has been received from the service 218 /// Async method, invoked when a block of data has been received from the service
215 /// </summary> 219 /// </summary>
@@ -218,13 +222,14 @@ namespace OpenSim.Framework.Communications
218 { 222 {
219 try 223 try
220 { 224 {
221 Stream s = (Stream)ar.AsyncState; 225 Stream s = (Stream) ar.AsyncState;
222 int read = s.EndRead(ar); 226 int read = s.EndRead(ar);
223 227
224 if (read > 0) 228 if (read > 0)
225 { 229 {
226 _resource.Write(_readbuf, 0, read); 230 _resource.Write(_readbuf, 0, read);
227 IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); 231 IAsyncResult asynchronousResult =
232 s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
228 233
229 // TODO! Implement timeout, without killing the server 234 // TODO! Implement timeout, without killing the server
230 //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); 235 //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
@@ -251,12 +256,13 @@ namespace OpenSim.Framework.Communications
251 try 256 try
252 { 257 {
253 // grab response 258 // grab response
254 WebRequest wr = (WebRequest)ar.AsyncState; 259 WebRequest wr = (WebRequest) ar.AsyncState;
255 _response = (HttpWebResponse)wr.EndGetResponse(ar); 260 _response = (HttpWebResponse) wr.EndGetResponse(ar);
256 261
257 // get response stream, and setup async reading 262 // get response stream, and setup async reading
258 Stream s = _response.GetResponseStream(); 263 Stream s = _response.GetResponseStream();
259 IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); 264 IAsyncResult asynchronousResult =
265 s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
260 266
261 // TODO! Implement timeout, without killing the server 267 // TODO! Implement timeout, without killing the server
262 // wait until completed, or we timed out 268 // wait until completed, or we timed out
@@ -281,6 +287,7 @@ namespace OpenSim.Framework.Communications
281 } 287 }
282 } 288 }
283 } 289 }
290
284 #endregion Async communications with server 291 #endregion Async communications with server
285 292
286 /// <summary> 293 /// <summary>
@@ -290,17 +297,17 @@ namespace OpenSim.Framework.Communications
290 { 297 {
291 lock (_lock) 298 lock (_lock)
292 { 299 {
293 _request = (HttpWebRequest)WebRequest.Create(buildUri()); 300 _request = (HttpWebRequest) WebRequest.Create(buildUri());
294 _request.KeepAlive = false; 301 _request.KeepAlive = false;
295 _request.ContentType = "application/xml"; 302 _request.ContentType = "application/xml";
296 _request.Timeout = 200000; 303 _request.Timeout = 200000;
297 _asyncException = null; 304 _asyncException = null;
298 305
299// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 306// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
300 _response = (HttpWebResponse)_request.GetResponse(); 307 _response = (HttpWebResponse) _request.GetResponse();
301 Stream src = _response.GetResponseStream(); 308 Stream src = _response.GetResponseStream();
302 int length = src.Read(_readbuf, 0, BufferSize); 309 int length = src.Read(_readbuf, 0, BufferSize);
303 while(length > 0) 310 while (length > 0)
304 { 311 {
305 _resource.Write(_readbuf, 0, length); 312 _resource.Write(_readbuf, 0, length);
306 length = src.Read(_readbuf, 0, BufferSize); 313 length = src.Read(_readbuf, 0, BufferSize);
@@ -329,7 +336,7 @@ namespace OpenSim.Framework.Communications
329 336
330 public Stream Request(Stream src) 337 public Stream Request(Stream src)
331 { 338 {
332 _request = (HttpWebRequest)WebRequest.Create(buildUri()); 339 _request = (HttpWebRequest) WebRequest.Create(buildUri());
333 _request.KeepAlive = false; 340 _request.KeepAlive = false;
334 _request.ContentType = "application/xml"; 341 _request.ContentType = "application/xml";
335 _request.Timeout = 900000; 342 _request.Timeout = 900000;
@@ -340,13 +347,13 @@ namespace OpenSim.Framework.Communications
340 src.Seek(0, SeekOrigin.Begin); 347 src.Seek(0, SeekOrigin.Begin);
341 Stream dst = _request.GetRequestStream(); 348 Stream dst = _request.GetRequestStream();
342 byte[] buf = new byte[1024]; 349 byte[] buf = new byte[1024];
343 int length = src.Read(buf,0, 1024); 350 int length = src.Read(buf, 0, 1024);
344 while (length > 0) 351 while (length > 0)
345 { 352 {
346 dst.Write(buf, 0, length); 353 dst.Write(buf, 0, length);
347 length = src.Read(buf, 0, 1024); 354 length = src.Read(buf, 0, 1024);
348 } 355 }
349 _response = (HttpWebResponse)_request.GetResponse(); 356 _response = (HttpWebResponse) _request.GetResponse();
350 357
351// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 358// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
352 359
@@ -357,8 +364,8 @@ namespace OpenSim.Framework.Communications
357 return null; 364 return null;
358 } 365 }
359 366
360
361 #region Async Invocation 367 #region Async Invocation
368
362 public IAsyncResult BeginRequest(AsyncCallback callback, object state) 369 public IAsyncResult BeginRequest(AsyncCallback callback, object state)
363 { 370 {
364 /// <summary> 371 /// <summary>
@@ -371,7 +378,7 @@ namespace OpenSim.Framework.Communications
371 378
372 public Stream EndRequest(IAsyncResult asyncResult) 379 public Stream EndRequest(IAsyncResult asyncResult)
373 { 380 {
374 AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; 381 AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
375 382
376 // Wait for operation to complete, then return result or 383 // Wait for operation to complete, then return result or
377 // throw exception 384 // throw exception
@@ -381,7 +388,7 @@ namespace OpenSim.Framework.Communications
381 private void RequestHelper(Object asyncResult) 388 private void RequestHelper(Object asyncResult)
382 { 389 {
383 // We know that it's really an AsyncResult<DateTime> object 390 // We know that it's really an AsyncResult<DateTime> object
384 AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; 391 AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
385 try 392 try
386 { 393 {
387 // Perform the operation; if sucessful set the result 394 // Perform the operation; if sucessful set the result
@@ -394,6 +401,7 @@ namespace OpenSim.Framework.Communications
394 ar.HandleException(e, false); 401 ar.HandleException(e, false);
395 } 402 }
396 } 403 }
404
397 #endregion Async Invocation 405 #endregion Async Invocation
398 } 406 }
399} 407} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 006c8ee..cdc3baf 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -33,18 +33,15 @@ using System.Reflection;
33using System.Security.Cryptography; 33using System.Security.Cryptography;
34using libsecondlife; 34using libsecondlife;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework;
37using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
38using OpenSim.Framework.Data;
39using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
40 38
41
42namespace OpenSim.Framework.UserManagement 39namespace OpenSim.Framework.UserManagement
43{ 40{
44 public abstract class UserManagerBase : IUserService 41 public abstract class UserManagerBase : IUserService
45 { 42 {
46 public UserConfig _config; 43 public UserConfig _config;
47 Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); 44 private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
48 45
49 /// <summary> 46 /// <summary>
50 /// Adds a new user server plugin - user servers will be requested in the order they were loaded. 47 /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
@@ -78,11 +75,12 @@ namespace OpenSim.Framework.UserManagement
78 public void AddPlugin(IUserData plug) 75 public void AddPlugin(IUserData plug)
79 { 76 {
80 plug.Initialise(); 77 plug.Initialise();
81 this._plugins.Add(plug.getName(), plug); 78 _plugins.Add(plug.getName(), plug);
82 MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); 79 MainLog.Instance.Verbose("Userstorage: Added IUserData Interface");
83 } 80 }
84 81
85 #region Get UserProfile 82 #region Get UserProfile
83
86 /// <summary> 84 /// <summary>
87 /// Loads a user profile from a database by UUID 85 /// Loads a user profile from a database by UUID
88 /// </summary> 86 /// </summary>
@@ -100,7 +98,7 @@ namespace OpenSim.Framework.UserManagement
100 } 98 }
101 catch (Exception e) 99 catch (Exception e)
102 { 100 {
103 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 101 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
104 } 102 }
105 } 103 }
106 104
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.UserManagement
126 catch (Exception e) 124 catch (Exception e)
127 { 125 {
128 System.Console.WriteLine("EEK!"); 126 System.Console.WriteLine("EEK!");
129 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 127 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
130 } 128 }
131 } 129 }
132 130
@@ -145,7 +143,7 @@ namespace OpenSim.Framework.UserManagement
145 { 143 {
146 try 144 try
147 { 145 {
148 UserProfileData profile = plugin.Value.GetUserByName(fname,lname); 146 UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
149 147
150 profile.currentAgent = getUserAgent(profile.UUID); 148 profile.currentAgent = getUserAgent(profile.UUID);
151 149
@@ -153,7 +151,7 @@ namespace OpenSim.Framework.UserManagement
153 } 151 }
154 catch (Exception e) 152 catch (Exception e)
155 { 153 {
156 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 154 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
157 } 155 }
158 } 156 }
159 157
@@ -170,20 +168,24 @@ namespace OpenSim.Framework.UserManagement
170 { 168 {
171 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 169 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
172 { 170 {
173 try { 171 try
172 {
174 plugin.Value.UpdateUserProfile(data); 173 plugin.Value.UpdateUserProfile(data);
175 return true; 174 return true;
176 } catch (Exception e) { 175 }
177 MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); 176 catch (Exception e)
177 {
178 MainLog.Instance.Verbose("Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
178 } 179 }
179 } 180 }
180 181
181 return false; 182 return false;
182 } 183 }
183 184
184 #endregion 185 #endregion
185 186
186 #region Get UserAgent 187 #region Get UserAgent
188
187 /// <summary> 189 /// <summary>
188 /// Loads a user agent by uuid (not called directly) 190 /// Loads a user agent by uuid (not called directly)
189 /// </summary> 191 /// </summary>
@@ -199,7 +201,7 @@ namespace OpenSim.Framework.UserManagement
199 } 201 }
200 catch (Exception e) 202 catch (Exception e)
201 { 203 {
202 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 204 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
203 } 205 }
204 } 206 }
205 207
@@ -221,7 +223,7 @@ namespace OpenSim.Framework.UserManagement
221 } 223 }
222 catch (Exception e) 224 catch (Exception e)
223 { 225 {
224 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 226 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
225 } 227 }
226 } 228 }
227 229
@@ -249,11 +251,11 @@ namespace OpenSim.Framework.UserManagement
249 { 251 {
250 try 252 try
251 { 253 {
252 return plugin.Value.GetAgentByName(fname,lname); 254 return plugin.Value.GetAgentByName(fname, lname);
253 } 255 }
254 catch (Exception e) 256 catch (Exception e)
255 { 257 {
256 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 258 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
257 } 259 }
258 } 260 }
259 261
@@ -263,6 +265,7 @@ namespace OpenSim.Framework.UserManagement
263 #endregion 265 #endregion
264 266
265 #region CreateAgent 267 #region CreateAgent
268
266 /// <summary> 269 /// <summary>
267 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB 270 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
268 /// </summary> 271 /// </summary>
@@ -270,7 +273,7 @@ namespace OpenSim.Framework.UserManagement
270 /// <param name="request">The users loginrequest</param> 273 /// <param name="request">The users loginrequest</param>
271 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 274 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
272 { 275 {
273 Hashtable requestData = (Hashtable)request.Params[0]; 276 Hashtable requestData = (Hashtable) request.Params[0];
274 277
275 UserAgentData agent = new UserAgentData(); 278 UserAgentData agent = new UserAgentData();
276 279
@@ -297,7 +300,7 @@ namespace OpenSim.Framework.UserManagement
297 // If user specified additional start, use that 300 // If user specified additional start, use that
298 if (requestData.ContainsKey("start")) 301 if (requestData.ContainsKey("start"))
299 { 302 {
300 string startLoc = ((string)requestData["start"]).Trim(); 303 string startLoc = ((string) requestData["start"]).Trim();
301 if (!(startLoc == "last" || startLoc == "home")) 304 if (!(startLoc == "last" || startLoc == "home"))
302 { 305 {
303 // Format: uri:Ahern&162&213&34 306 // Format: uri:Ahern&162&213&34
@@ -312,7 +315,6 @@ namespace OpenSim.Framework.UserManagement
312 } 315 }
313 catch (Exception) 316 catch (Exception)
314 { 317 {
315
316 } 318 }
317 } 319 }
318 } 320 }
@@ -323,7 +325,7 @@ namespace OpenSim.Framework.UserManagement
323 325
324 // Current location 326 // Current location
325 agent.regionID = new LLUUID(); // Fill in later 327 agent.regionID = new LLUUID(); // Fill in later
326 agent.currentRegion = new LLUUID(); // Fill in later 328 agent.currentRegion = new LLUUID(); // Fill in later
327 329
328 profile.currentAgent = agent; 330 profile.currentAgent = agent;
329 } 331 }
@@ -364,7 +366,6 @@ namespace OpenSim.Framework.UserManagement
364 try 366 try
365 { 367 {
366 plugin.Value.AddNewUserProfile(user); 368 plugin.Value.AddNewUserProfile(user);
367
368 } 369 }
369 catch (Exception e) 370 catch (Exception e)
370 { 371 {
@@ -376,4 +377,4 @@ namespace OpenSim.Framework.UserManagement
376 public abstract UserProfileData SetupMasterUser(string firstName, string lastName); 377 public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
377 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); 378 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
378 } 379 }
379} 380} \ No newline at end of file